You are on page 1of 46

Development Environment

eGovFrame Training Book

eGovFrame Center 2013

Preparation for Labs

Copy eGovFrame-2.5_EN.zip from USB to C:\ Copy other 2 directories from USB to Desktop (or any directory)

Extract eGovFrame-2.5_EN.zip to C:\ (eGovFarame-2.5_EN.zip already has


eGovFrame-2.5_EN subdirectory)

Add C:\eGovFrame-2.5_EN\bin\jdk1.5.0_22\bin to system PATH environment

Page l

Table of contents

1. Overview

2. Development Tool
3. Deploy(Maven) 4. CI(Configuration Integration) Server

Page l

Development Environment

Overview

Development Environment provides a set of tools on implementation(coding, debugging), test, deployment and configuration which are needed to develop an application based on the eGovFrame Runtime Environment

Implementation Tools

Editor, Debugger and Templates Development Procedures

Test Tools

Testing, Test Reporting and Coverage Analysis

Configuration Management Tools

Configuration and Change Management

Distribution Tools

Build / Build Automation (Maven)

Page l

Development Environment
4 service groups, 13 services compose the development environment. Support various tools that are required for a programming based on eGovFrame

Overview

Development Tool
Implementation Tool Debug Code Generation Test Tool Test Reporting Deployment Tool Build Conf. & Change Mgt. Tool Configuration Mgt. Change Management

Editor
Methodology & Template

Code Inspection
Batch

Unit Test
Batch Test

Deployment

Page l

Development Environment
4 service groups, 13 services compose the development environment. Various open sources are also provided for a programming based on eGovFrame development environment

Overview

Development Tool
Implementation Tool Debug Code Generation Test Tool Test Reporting Deployment Tool Build Conf. & Change Mgt. Tool Configuration Mgt. Change Management

Editor
Methodology & Template

Code Inspection
Batch

Unit Test
Batch Test

Deployment

Page l

General programming process


Adopt eclipse IDE*), and provide programming support tools through the entire programming lifecycle, which is from coding to deployment

Overview

Developer PC

Development Server

Coding
Code editing Testing Debugging Inspection

Build
Compile Packaging

Success?

Yes Commit

Configuration management

Checkout

Build
Compile Packaging

No

Operation Server

WAS restart

Deploy

IDE*) : Integrated Development Environment


Page l

Development Tool
1. Overview 2. eGovFrame IDE 11. Batch Configuration 12. eGovFrame Template Project

3. UML
4. ERD 5. DBIO 6. Code Generation 7. eGovFrame Java Project 8. Common Component 9. Batch Job 10. Batch Job Launcher

13.Code Inspection
14. Server Connection Management 15. Test

Page l

Development Tool

Development tool consist of UML, ERD, DBIO Editor, eGovFrame Template project and so on

Debug Batch Configuration

New Batch Job Launcher New Batch Job New Batch Template Project
Customize Development Tool Common Component Eclipse platform (JEE package)

eGovFrame Development Tool

Template Project DBIO Editor WebFlow Editor Source Code Editor ERD Editor UML Editor

Overview

Page l

eGovFrame IDE

Development Tool

Development tool provides integrated menu, perspective, view and editor characterized for eGovFrame for developers' convenience
eGovFrame Integrated Menu for quick access

eGovFrame Perspective

Provide various editors such as DBIO, UML, ERD , etc

Provide Package Explorer, DataSource Explorer, etc.

Provide Outline View, etc.

Provide DBIO Search, Query Result, etc.

Page l

10

eGovFrame IDE eGovFrame Menu(1/2)

Development Tool

Integrated menu, eGovFrame, only activated in eGovFrame perspective provides quick access to eGovFrame related plug-ins

Start - New Batch Template Project : Generate eGovFrame Batch Project - New Core Project : Generate eGovFrame Core Project - New Web Project : Generate eGovFrame Web Project - New Template Project : Generate eGovFrame Template Project - New DeviceAPI Template Project : Generate eGovFrame Mobile DeviceAPI Project - New Mobile Project : Generate eGovFrame Mobile Web Project - New Mobile Template Project : Generate eGovFrame Mobile Template Project Analysis - New Usecase Diagram : Generates Usecase Diagram Design - New ER Diagram : Generates ER Diagram - New Class Diagram : Generates Class Diagram

Page l

11

eGovFrame IDE eGovFrame Menu(1/2)

Development Tool

Integrated menu, eGovFrame, only activated in eGovFrame perspective provides quick access to eGovFrame related plug-ins

Implementation - New Batch Job : Create Batch Job - New Batch Job Launcher : Create Batch Job Launcher - XMI Based CodeGen : Generate source code from model (UML XMI) - Add eGovFrame Common Component : Install Common Component - New SQL Map Config : Create SQL Map Config file - New SQL Map : Create SQL Map file - Show DBIO Search View - Add DeviceAPI Template : Generate Mobile DeviceAPI Template - Add Mobile Common Component : Install Common Component for Mobile - Mobile Web Verification : Check Mobile Web Standard Verification Test - Batch Job Test : Test batch by JUnit Configuration - Customize Development Tool : Selectively install the required functionality - Server Connection Management Show SVN Repositories View Nexus : Manage Nexus repository information
12

Page l

UML

Development Tool

AmaterasUML as an open source of UML editor supports to make UseCase Diagram and Class Diagram

UseCase Diagram Class Diagram Limitations Support diagrams based on UML 1.4 Not support UML 2.0

UseCase Diagram

Class Diagram

Page l

13

ERD

Development Tool

AmaterasERD as an open source of ERD editor supports Logical and Physical model

ERD DDL Support Reverse Engineering

Export table specifications to HTML format


Limitations Not compatible with ERWIN modeling tool

Page l

14

DBIO
DBIO Editor for programming DBIO by iBatis SQL Map API is provided
SQL Map Config Editor - Supports editing SQL Map Config File

Development Tool

SQL Map Editor - Supports editing SQL Map File

In/Out Section

Query Section Component Tree Test Section

* Basically, SQL Map File and SQL Map Config File are required to iBatis SQL Map API
Page l

15

Code Generator

Development Tool

Generate source code based on pre-defined templates or models defined in Class Diagram

Model Based Code Generator

Page l

16

eGovFrame Java Project


general or web-based JAVA project is generated automatically
eGovFrame Core Project - General JAVA Project eGovFrame Web Project

Development Tool

- Web-based JAVA Project

Project appropriate to developing web application based on eGovFrame is generated 2 ways to access the wizard

Page l

17

Common Component Source Code Only(1/3)


install 219 kinds of common components in the wizard

Development Tool

Select components needed

Select how to create tablez

Page l

18

Common Component Source Code w. Table(2/3) Development Tool


install 219 kinds of common components in the wizard

Select DB

Process for creating tables Select Database


Run Connection Test

Run Connection Test. Create Table button will be activated if succeeded. Create tables by click Create Table Check if tables are created normally : 4 Status are
Create tables

provided to check('Prepared', Success', 'Already Exist', 'Failed)

Page l

19

Common Component Configuration(3/3)


install 219 kinds of common components in the wizard

Development Tool

Select or Change OS Type Limited to Windows or Linux Main Page Input initial page address to be shown right after running the application IP for G4C Check IP for G4C Select or change Database

What you have done here can be checked in the file globals.properties
Page l

20

Batch Job

Development Tool

Batch Job wizard to generate batch job file by configuring job and step, flow control and partitioning

Generate Job Info

Generate Batch Step Info Select Reader/Writer Info

Process for creating Batch Job Select Batch Job info Select Batch Step info

Select Reader/Writer info


Generate Batch Job File by click Finish button

Generate Batch Job File

Page l

21

Batch Job Launcher

Development Tool

Generate batch job execution info include Job Launcher, Job Operator and DB info

Create Batch Job Execution Info

Process for batch job execution


Create DataSource Info

Create Job Execution info Create DataSource info

Generate Batch Job execution file

Generate batch job execution file

Page l

22

Batch Configuration

Development Tool

Preference for batch is provided to create or select Job Parameter, Job Reader/Writer and Listener intuitionally
Create Reader/Writer

Job Parameter

- Add parameters for batch configuration


Job Reader/Writer
Select Reader/Writer

- Add input data for batch execution - Add output data for batch execution

Input Reader/Writer Info

Listener - Add Listeners to catch events at pre or post of Job, Step or Chunk

Page l

23

eGovFrame Template Project(1/2)

Development Tool

eGovFrame Template Project provides templates by types of the business

Simple Homepage - Main Page, User Management, Notice Management,

Board Management, etc.


Portal Site - Portal Notice Management, Portal Initial Screen Management, Portal Notice Management, Portal FAQ

Management
Enterprise Business - Main Page, Authorization Management, Menu Management, etc.

Page l

24

eGovFrame Template Project - Batch(2/2)

Development Tool

eGovFrame Batch Template Project provides 6 kinds of batch templates by types of input resource and executing batch

Select input resource type of batch template

Process to generate batch template project


Select running type of batch template

Select input resource type of batch template(File or DB)

Select running type of batch


template(Scheduler, CommandLine or Web) Input template project info Generate runnable batch template project

by click Finish button


Input template project info Generate runnable batch template project

Page l

25

Code Inspection

Development Tool

PMD as an open source of source code analyzer finds unused variables, empty catch blocks, unnecessary object creation, and so forth

* After checking code with PMD, the result will be shown in PMD Perspective

Page l

26

Server Connection Management

Implementation Tool

SVN Repositories View and Nexus Repository Management can be directly reached by eGovFrame Menu
SVN Repositories View

Nexus Repository

Create Nexus Repository info by click New button

Apply Nexus Repository info to your project


Page l

27

Test Overview

Development Tool

Test tool supports writing TestCase by Unit Test, Mock and DB Test Framework, Test Automation, Test Coverage and Test Reporting
Test Tool Writing TestCase Write Test Class OOServiceTest Target Module OOService Unit Test Framework Analyze Test Coverage Run Running Test

Implementation Tool

MockDao
<<Dataset>>

Mock Framework
Automation DB Test Framework Test Automation Reporting Test Reporting Test Report

OODao

DaoTest

DB

DB

Page l

28

Test Process

Development Tool

write TestCases

run TestCases

analyze Test Coverage

run automatically TestCases

report Test results

Page l

29

Test How to write TestCase(1/2)

Development Tool

As a Unit Test Framework for Java Programming, JUnit supports writing Unit Test code and running Automated Test 1: public class UserAdminTest {
component Test Class using test framework(e.g. JUnit) Test fixture Setup of test data Test method (e.g. testOOO)
2: 3: /* Class under test */ 4: private UserAdmin userAdmin; 5: 6: /* A simple test user */ 7: private User user; // Test Data (Fixture) 8: /* An administrator role */ // 9: private Role adminRole; // 10: 11: /** 12: * Initializes the test fixture. 13: */ 14: @Before 15: public void setUp() throws Exception { 16: userAdmin = new UserAdmin(); 17: user = new User("John", "Doe"); // Test Data Setup 18: adminRole = new Role("Administrator"); // 19: } 20: 21: /** 22: * Test for method with ... 23: */ 24: @Test 25: public void testAddUser() { 26: user.setAge(18); // Extra Test Setup 27: userAdmin.addUser("jdoe", user, adminRole); // Use 28: Test Data 29: 30: User result = userAdmin.getUser("jdoe"); 31: assertEquals("John", result.getFirstName()); 32: assertEquals("Doe", result.getLastName()); 33: } 34: }
Page l

Internal method

Success Input Target Result Fail

30

Test How to Run TestCase(2/2)

Development Tool

As a Unit Test Framework for Java Programming, JUnit supports writing Unit Test code and running Automated Test

Page l

31

Deploy - Maven
1. Architecture 2. Directory Structure

3. POM.XML
4. Build Lifecycle 5. Plug-in 6. Repository 7. Nexus

Page l

32

Architecture

Deploy

Maven was originally started as an attempt to simplify the build process and provides a standard way to build projects. It includes a clear definition of what the project consisted of(POM), dependency management(library control), project life cycle management, etc Maven Architecture

POM.XML

Project Object Model

Dependency Management Model

Repositories (local and remote)

Project life cycle and phases Plug-ins

Source files

Reporting Resources

Compile

Packaged libraries

Page l

33

Directory Structure
Providing a standard directory structure
Maven Standard Directory Structure

Deploy

Directory/File

Description
The core of a project's configuration in Maven. It is a single configuration file that contains the majority of information required to build a project. (Ex: dependency)

/pom.xml

/src/main/java

Locate Java Source file. Compiled to target/classes directory

/src/main/resourc Resources for deploying, namely XML, properties, etc. Copied to target/classes es /src/main/webapp INF/web.xml, webapp/index.jsp, css, etc) /src/test/java
Test case Java sources. Compiled to target/test-classes Web application related files (/WEB-

/src/test/resource Resources for testing. Copied to target/test-classes s

/target

Build outputs are located


Page l

34

POM.XML

Deploy

The POM contains all necessary information about a project, as well as configurations of plug-ins to be used during the build process. groupId:artifactId:version are all required fields and act much like an address and timestamp in a repository, acting like a coordinate system for Maven projects
POM.XML
Project Information Name URL Artifact Description
<project xmlns=http://maven.apache.org/POM/4.0.0 ....> <groupId>egovframework.dev.com</groupId> <artifactId>egovframework-dev-com</artifactId> <version>1.0</version> <packaging>war</packaging> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.4</version> <scope>test</scope> </dependency> </dependencies> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> </configuration> </plugin> </plugins> </project>

Artifact Info.

Inception Year

Group Id
Version Dependencies Dependencies Build Settings

Artifact Id

Dependency Management

Repositories Repositories

Plug-in Setting

Properties
Build

Packaging
Reporting

Page l

35

Build Lifecycle

Deploy

Maven 2.0 is based around the central concept of a build lifecycle. What this means is that the process for building and distributing a particular artifact (project) is clearly defined
Build Lifecycle
Phase Validate Description validate the project is correct and all necessary information is available test the compiled source code using a suitable unit testing framework take the compiled code and package it in its distributable format, such as a JAR run any checks to verify the package is valid and meets quality criteria install the package into the local repository, for use as a dependency in other projects locally

Maven2 Build Lifecycle Phase


Validate archetype Compile mvn compile Test mvn test Package Verify mvn install Install P O M compiler

Compile compile the source code of the project


Test Package Verify Install

surefire

jar

copies the final package to the remote repository for Deploy sharing with other developers and projects

deploy
Lifecycle Phases

install Plugins

Maven command ex) $mvn install

Page l

36

Plug-in
m2eclipse plug-in to use Maven in eGovFrame IDE

Deploy

m2eclipse Maven Build

Maven install

Click Maven install to initiate build lifecycle phase. It packages and installs the project into the local repository

Page l

37

Repository

Deploy

Using libraries that declared in the pom.xml of the project as dependency and the libraries come from the repository. If it exits in local repository, use it, if not, download from the remote repository to local and use
Maven Repository Composition Diagram
Intranet Internet

Utilizing Maven Repository Manager


Intranet Internet

Computer 1

Computer 1

Computer 2 Public Maven Repository

Computer 2 Maven Repository (Nexus)

Public Maven Repository

Computer 3

Computer 3

Page l

38

Nexus

Deploy

Nexus manages software artifacts required for development, deployment, and provisioning. Also it simplifies the maintenance of internal repositories and access to external repositories

Page l

39

CI(Configuration Integration) Server


1. Overview 2. Subversion

3. Hudson Build
4. Hudson Dashboard

Page l

40

Overview

CI Server

Continuous integration (CI) is the practice, in software engineering, of merging all developer workspaces with a shared mainline several times a day

Notice
Feedback Mechanism Build Failed Source Code Build Watch & Polling Version Control Server (SVN) CI Server Deploy Build Success Test Coverage Analysis Code Inspection Unit Tests

Code Commit Developer

Code Commit Developer

Development Server

Page l

41

Subversion

CI Server

Subversion is a version control system that keeps track of changes made to files and folders (directories), facilitating data recovery and providing a history of the changes that have been made over time
Features Change management for source as well as data Versioning is done for folders as well as for individual files File and folder properties are recorded over time, thereby creating a detailed history

Project Team
Developer

Source Management Tool


Check in/out
Configuration Management

Deploy Tool
Deploy

PL
CMO

Backup

Repository

Page l

42

Hudson Build

CI Server

Hudson as an open source CI server provides automatic build with a script and offers a feedback mechanism about build results to developers

Main Screen : Display a list of projects, build status and build success or failure

Page l

43

Hudson Dashboard
Providing a dashboard function to show build, test results, etc

CI Server

Page l

44

Reference

Eclipse Home http://www.eclipse.org/ Apache Maven http://maven.apache.org/ Subversion Project Home Page http://subversion.tigris.org/ Continuous Integration (Martin Fowler) http://martinfowler.com/articles/continuousIntegration.html#AutomateDeployment Hudson Home https://hudson.dev.java.net/

Page l

45

Page l

46 46