Test Driven Development

Slides:



Advertisements
Similar presentations
Apache Maven: J2EE Front to Back Jesse McConnell -
Advertisements

Introduction to Maven 2.0 An open source build tool for Enterprise Java projects Mahen Goonewardene.
OpusCollege and Spring-DM. OSGi based web applications – three strategies OSGi container embedded in another container: OSGi Bridge Server (OBS)  e.g.
Developing in CAS. Why? As distributed you edit CAS 3 with Eclipse and build with Maven 2 – Best Practice for Release Engineering – Difficult edit-debug.
Introduction to Maven Michael Youngstrom. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to the Java Stack.
Developing CAS in Eclipse
Maven: Build and project management in the 21th century.
6/2/2015Page 1 SOA Development and Deployment B. Ramamurthy.
Current Topics in Programming Languages Lecture 15_1 George Koutsogiannakis SUMMER
Hello Vaadin! CS 3130 Summer 2015.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
Open source administration software for education research administration Lin-Long Shyu System Analyst Kuali Coeus Technical Team Indiana University
Open source administration software for education 2012 User Conference April 22-24, 2012 – Atlanta, Georgia “Together Toward Tomorrow” Chris Denne, Colorado.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
Introduction to the JBoss Presented by: Hao Shi. Agenda Application Servers What is JBoss JBoss features Architecture of JBoss Installation and running.
Maven and Stack Starter Michael Youngstrom. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack.
OSGi.
Maven & Bamboo CONTINUOUS INTEGRATION. QA in a large organization In a large organization that manages over 100 applications and over 20 developers, implementing.
MAVEN-BLUEMARTINI Yannick Robin. What is maven-bluemartini?  maven-bluemartini is Maven archetypes for Blue Martini projects  Open source project on.
Kuali Rice at Indiana University Rice Setup Options July 29-30, 2008 Eric Westfall.
© 2005 by IBM; made available under the EPL v1.0 | March 1, 2005 Tim deBoer Gorkem Ercan Extend WTP Server Tools for your.
Presentation 8: SOAP in a distributed object framework, Application Servers & AXIS SOAP.
Play with Cloud Foundry An Open PaaS Shi, Tao May 11, 2012.
Entity Java Beans Jorg Janke Open Source ERP & CRM.
Tomcat Spencer Uresk. Notes This is a training NOT a presentation Please ask questions This is being recorded
Guidelines for Homework 6. Getting Started Homework 6 requires that you complete Homework 5. –All of HW5 must run on the GridFarm. –HW6 may run elsewhere.
Introduction to J2EE Architecture Portions by Kunal Mehta.
|Tecnologie Web L-A Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat
Web Applications - Basics. Introduction to Web Web features Clent/Server HyperText Transfer Protocol HyperText Markup Language URL addresses Web server.
Juggling Java EE with Enterprise Apache Maven Jesse McConnell -
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Introduction to Web Dimitar Nenchev Ivan Nakov
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
1 Apache TomEE // JavaEE Web Profile on Tomcat Jonathan #TomEE.
Katari Globant 2008 (update to 2010). Katari  Katari is a framework to use as a starting point to develop new web applications.  Incorporates architecture,
Maven for building Java applications By Nalin De Zoysa
Build Systems Presentation December 14, 2015 Noon-1pm Kathy Lee Simunich Bldg. 203/ D120 Brought to you by: Argonne Java.
Presentation Title Subtitle DSpace UI Prototype 7 Spring, Angular.js, and the DSpace REST API.
Software Deployment & Release 26/03/2015 1EN-ICE.
Maven. Introduction Using Maven (I) – Installing the Maven plugin for Eclipse – Creating a Maven Project – Building the Project Understanding the POM.
From Venus to Mars Developer land Real world Maven Alfresco SDK is fun! -Pamp-to-war Alfresco AMP Archetype Share AMP Archetype.
CS520 Web Programming Introduction to Maven Chengyu Sun California State University, Los Angeles.
Apache Geronimo Open Source J2EE Application Server Getting up to speed with Apache Geronimo - Copyright 2005 Tom McQueeney 1 Getting up to speed with.
The Maven Alfresco SDK™ At the end of a journey, there is always a new beginning…
Platform & Maven2 David Šimonek. Certified Engineer Course Agenda What is Maven? Why Maven? NB IDE & Maven NB Platform & Maven.
CS3220 Web and Internet Programming RESTful Web Service
Open-O Integration Project Introduction
Maven 04 March
JRA2: Acceptance Testing senarious
CS520 Web Programming Introduction to Maven
Build Automation with Gradle
Plan What is Maven ? Links : mvn command line tool
Bhavana Sudharshan Jaydeep Patel
Understanding SOAP and REST calls The types of web service requests
Google Web Toolkit Tutorial
Writing simple Java Web Services using Eclipse
Overall Architecture and Component Model
prepared by hasan.we4tech.com
Project management and comprehension tool
Chengyu Sun California State University, Los Angeles
Skill Based Assessment
Maven IIB9 Plug-in Version 9.0
J2EE Application Development
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
Devops Jenkins as CI/CD tool Created By: Amrit Choudhary
Maven IIB9 Plug-in Version 9.0
Introduction to Web Services
Developing and testing enterprise Java applications
CS4961 Software Design Laboratory Understand Aquila Backend
Presentation transcript:

Test Driven Development TDD with Maven, Spring Framework, CXF and JUnit When times get tough, the tough get going…

Summary This presentation will cover a single Maven web module, using the Spring framework to create a CXF based webservice, and testing a remote client with JUnit to verify the CXF contract.

This presentation will cover the following topics Maven 2 CXF Spring Framework Spring Remoting Cargo Tomcat JUnit Some of the tools you will need to create your world-wide presence.

Takeaway Attendees will take away a new insight as to how to create setup a Maven web module, how to add Spring, Cargo and CXF capabilities and how to use these technologies to perform unit testing with a test driven development lifecycle.

About the Author Mick Knutson This should begin the presentation.

About Mick Knutson President of BASE Logic, Inc (http://www.baselogic.com) Blog (http://www.baselogic.com/blog) Won ‘Best in Show’ for GoGrid.com @ Linux World 2008 Manage Multiple Enterprise Deployments @ FedEx with >4MIL message transactions per hour.

Setting up a single module Maven project. Setting Up Maven Setting up a single module Maven project. This should begin the presentation.

Maven Quick Start Download Apache Maven (http://maven.apache.org) Unpack Maven to C:/maven Install Sun JDK to c:/jdks/java (NOT C:/Program Files/java) Create workspace for new project (c:/code/ucc2009) Create blank Webapp archetype (template) mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp Open CMD prompt to c:/code/ucc2009

Convention Over Configuration Java source Directory ./src/main/java/** Resources Directory ./src/main/resources/** Webapp Directory ./src/main/webapp/** Testing Source ./src/test/java/** Testing Resources ./src/test/resources/**

Maven Quick start Single Maven Module directory layout

Project Object Model (pom.xml) Project Build Descriptor Group Id Artifact Id Artifact Type (jar, war, ear, pom) Version Dependency Management Plugin Management Build Properties

Adding Spring dependencies In your pom.xml, add the following Spring dependencies Note <property>: <spring.version>2.5.6</spring.version>

Spring Framework Spring does many things, but when you strip it down to its base parts, Spring is a lightweight dependency injection and aspect-oriented container and framework.

Adding Spring Context ./src/main/webapp/WEB-INF/applicationContext.xml

Adding Spring Context ./src/main/webapp/WEB-INF/applicationContext-services.xml

Adding CXF dependencies In your pom.xml, add the following CXF dependencies Note <property>: <cxf.version>2.2.3</cxf.version>

Adding CXF Context Server entries Create applicationContext-services.xml

Adding web.xml entries Adding Spring and CXF entries

Adding JUnit Test Case Create new Test Case Instantiate Test Spring Context Get Client Proxy Bean Execute Proxy Methods on Bean Assert outcome.

Adding JUnit Test Create ./src/test/java/**/MessageWebServiceTest Talk about the Unit test, and how Spring starts the IoC container.

Create Service for Test Case Create Service to match our test

Create Service for Test Case Create Service Interface Annotate the Interface as @WebService Create Service Implementation Class Annotate the Class as @WebService defining the Service Interface as the endpointInterface.

Adding Service Interface Create src/main/java/**/MessageService Talk about the Unit test, and how Spring starts the IoC container.

Adding Service Implementation Create src/main/java/**/MessageServiceImpl Talk about the Unit test, and how Spring starts the IoC container.

Adding Spring Test Context Create applicationContext-test.xml

Adding test.properties Create src/test/resources/test.properties

Cargo Tomcat Plugin for Maven Compile and Package War Start embedded Tomcat container before running Tests Deploy war to Tomcat container Run Test Cases Assert Test Outcome Stop embedded Tomcat container after tests complete.

Cargo Tomcat Plugin We want to start Tomcat with the Cargo plugin and deploy our webapp before running unit tests

Running Standalone Cargo Plugin By running run-cargo-tomcat.bat, we can deploy our war, and verify our service endpoint in a browser manually Run-cargo-tomcat.bat executes: mvn -Dcargo.wait=true cargo:start -e

CXF Generated WSDL

Tying it all together Compile and Package war Start Cargo Tomcat Deploy war to Tomcat Run Tests Assert Results Stop Cargo Tomcat

Start Cargo, and Run Test Executing mvn clean verify

Test Success Successful Test result

Next Steps Debug-As JUnit Tests in Eclipse Remote Debugging with Eclipse Use Easy Mock to stub Spring services Integrate Coburtura to measure Test Code Coverage

Any questions of comments? This is the end of the presentation…

Thank you for your time and attention… The End… Thank you for your time and attention… This is the end of the presentation…

Mick Knutson BASE Logic, Inc. Enterprise Architecture, Design, Mentoring & Agile Consulting Phone. (866) BLiNC-411: (254-6241-1) Fax. (415) 685-4233 Website: http://www.baselogic.com Website: http://www.baselogic.com/blog Linked IN: http://www.linkedin.com/in/mickknutson

References Source Code (http://baselogic.com/code/ucc2009/webapp.zip) Slide Deck PPT (http://baselogic.com/code/ucc2009/ucc.ppt) Apache Maven (http://maven.apache.org) Springframework (http://www.springsource.com) CXF (http://cxf.apache.org) Cargo Plugin (http://cargo.codehaus.org/Maven2+plugin) SOAP UI (http://soapui.org)