01.development environment training book_en.pdf

Upload: banana567

Post on 03-Jun-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    1/46

    eGovFrame Center

    2013

    eGovFrame Training Book

    Development Environment

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    2/46

    2

    Page l 2

    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

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    3/46

    Table of contents

    Page l 3

    1. Overview

    2. Development Tool

    3. Deploy(Maven)

    4. CI(Configuration Integration) Server

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    4/46

    Page l 4

    Overview

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

    Implementation

    Tools

    Configuration

    Management Tools

    Test Tools

    Distribution

    Tools

    Configuration and

    Change Management

    Editor, Debugger and Templates

    Development Procedures

    Build / Build Automation

    (Maven)

    Testing, Test Reporting and

    Coverage Analysis

    Development Environment

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    5/46Page l 5

    Overview

    Development Tool

    Implementation Tool

    Debug

    Editor

    Methodology &

    Template

    Test Tool

    Test Reporting

    Unit Test

    Deployment Tool

    Build

    Deployment

    Conf. & Change Mgt.

    ToolConfiguration Mgt.

    Change

    Management

    Code Generation

    Code Inspection

    Batch Batch Test

    Development Environment

    4 service groups, 13 services compose the development environment.

    Support various tools that are required for a programming based on eGovFrame

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    6/46Page l 6

    Implementation Tool

    Debug

    Editor

    Methodology &

    Template

    Test Tool

    Test Reporting

    Unit Test

    Deployment Tool

    Build

    Deployment

    Conf. & Change Mgt.

    ToolConfiguration Mgt.

    Change

    Management

    Code Generation

    Code Inspection

    Batch Batch Test

    Development Tool

    OverviewDevelopment Environment

    4 service groups, 13 services compose the development environment.

    Various open sources are also provided for a programming based on eGovFrame

    development environment

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    7/46Page l 7

    Coding Build

    CompilePackaging

    Build

    DeployWAS restart

    Success?Yes

    No

    CompilePackaging

    Developer PC Development Server

    Operation Server

    Configuration

    managementCode editingTestingDebuggingInspection

    Commit Checkout

    IDE*): Integrated Development Environment

    OverviewGeneral programming process

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

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    8/46

    Development Tool

    Page l 8

    1. Overview

    2. eGovFrame IDE

    3. UML

    4. ERD

    5. DBIO

    6. Code Generation

    7. eGovFrame Java Project

    8. Common Component

    9. Batch Job

    10.Batch Job Launcher

    11.Batch Configuration

    12.eGovFrame Template Project

    13.Code Inspection

    14.Server Connection Management

    15.Test

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    9/46

    Page l 9

    eGovFrame Development Tool

    Eclipse platform

    (JEE package)

    UMLEditor

    ERDEditor

    SourceCodeEditor

    DBIOEditor

    Debug

    WebFlowEditor

    TemplatePro

    ject

    CommonCom

    ponent

    CustomizeDe

    velopment

    Tool

    NewBatchTe

    mplate

    Project

    NewBatchJob

    NewBatchJobLauncher

    BatchConfigu

    ration

    Development ToolOverview

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

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    10/46

    Page l 10

    eGovFrame Integrated Menu for quick access eGovFrame Perspective

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

    Provide DBIO Search, Query Result, etc.

    ProvideOutline View,etc.Provide Package

    Explorer,DataSourceExplorer, etc.

    Development TooleGovFrame IDE

    Development tool provides integrated menu, perspective, view and editor characterized foreGovFrame for developers' convenience

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    11/46

    Page l 11

    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

    Development TooleGovFrame IDE eGovFrame Menu(1/2)

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

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    12/46

    Page l 12

    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

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

    Development TooleGovFrame IDE eGovFrame Menu(1/2)

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    13/46

    Page l 13

    UseCase Diagram

    Class Diagram

    Limitations

    Support diagrams based on UML 1.4

    Not support UML 2.0

    UseCaseDiagram

    ClassDiagram

    UML

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

    Development Tool

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    14/46

    Page l 14

    ERD

    DDL

    Support Reverse Engineering

    Export table specifications to HTML format

    Limitations

    Not compatible with ERWIN modeling tool

    ERD

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

    Development Tool

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    15/46

    Page l 15

    SQL Map Editor

    - Supports editing SQL Map File

    SQL Map Config Editor

    - Supports editing SQL Map Config File

    ComponentTree

    In/Out Section

    Query Section

    Test Section

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

    DBIO

    DBIO Editor for programming DBIO by iBatis SQL Map API is provided

    Development Tool

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    16/46

    Page l 16

    Model Based Code Generator

    Code Generator

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

    Development Tool

    G F J P j t

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    17/46

    Page l 17

    Project appropriate to developingweb application based oneGovFrame is generated

    2 ways to access the wizard

    eGovFrame Core Project

    - General JAVA Project

    eGovFrame Web Project

    - Web-based JAVA Project

    eGovFrame Java Project

    general or web-based JAVA project is generated automatically

    Development Tool

    C C t S C d O l (1/3)

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    18/46

    Page l 18

    Select components needed

    Select how to createtablez

    Common Component Source Code Only(1/3)

    install 219 kinds of common components in the wizard

    Development Tool

    Common Component So ce Code Table(2/3)

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    19/46

    Page l 19

    Create tables

    Run Connection Test

    Process for creating tables

    Select Database

    Run Connection Test. Create Table button will beactivated if succeeded.

    Create tables by click Create Table

    Check if tables are created normally : 4 Status are

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

    'Failed)

    Select DB

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

    install 219 kinds of common components in the wizard

    Common Component Configuration(3/3) D l t T l

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    20/46

    Page l 20

    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

    Common Component Configuration(3/3) Development Tool

    install 219 kinds of common components in the wizard

    Batch Job D l t T l

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    21/46

    Page l 21

    Generate Job Info

    Generate Batch Step Info

    Select Reader/Writer Info

    Generate Batch Job File

    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

    Batch Job

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

    Development Tool

    Batch Job Launcher Development Tool

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    22/46

    Page l 22

    Create Batch Job Execution Info

    Generate batch job execution file

    Create DataSource Info

    Process for batch job execution

    Create Job Execution info

    Create DataSource info

    Generate Batch Job execution file

    Batch Job Launcher

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

    Development Tool

    Batch Configuration Development Tool

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    23/46

    Page l 23

    Job Parameter

    - Add parameters for batch configuration

    Job Reader/Writer

    - Add input data for batch execution

    - Add output data for batch execution

    Listener

    - Add Listeners to catch events at pre or post ofJob, Step or Chunk

    Select Reader/Writer

    Create Reader/Writer

    Input Reader/Writer Info

    Batch Configuration

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

    Listener intuitionally

    Development Tool

    eGovFrame Template Project(1/2) Development Tool

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    24/46

    Page l 24

    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.

    eGovFrame Template Project(1/2)

    eGovFrame Template Project provides templates by types of the business

    Development Tool

    eGovFrame Template Project - Batch(2/2) Development Tool

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    25/46

    Page l 25

    Select input resource type of batch template

    Select running type of batchtemplate

    Input template project info

    Generate runnable batch templateproject

    Process to generate batch template project

    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

    eGovFrame Template Project Batch(2/2)

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

    Development Tool

    Code Inspection Development Tool

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    26/46

    Page l 26

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

    Code Inspection

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

    Development Tool

    Implementation ToolServer Connection Management

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    27/46

    Page l 27

    Implementation ToolServer Connection Management

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

    Nexus Repository

    SVN Repositories View

    Create Nexus Repository info by click New button Apply Nexus Repository info to your project

    Test Overview Development Tool

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    28/46

    Page l 28

    Test Tool

    Target Module

    Test Report

    TestReporting

    TestAutomation

    Test Class

    Implementation Tool

    RunWrite

    OOService

    OODao

    OOServiceTest

    MockDao

    DBDB

    DaoTest

    Test

    Coverage

    Automation

    Reporting

    Writing TestCase Running Test

    Analyze

    Unit TestFramework

    MockFramework

    DB TestFramework

    Test tool supports writing TestCase by Unit Test, Mock and DB Test Framework, TestAutomation, Test Coverage and Test Reporting

    Development Tool

    Test Process Development Tool

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    29/46

    Page l 29

    writeTestCases

    runTestCases

    analyzeTest Coverage

    run automaticallyTestCases

    reportTest results

    p

    Test How to write TestCase(1/2) Development Tool

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    30/46

    Page l 30

    component

    Test Class using test framework(e.g. JUnit)

    Test fixture

    Setup of test data

    Test method (e.g. testOOO)

    Internal method

    Target ResultInput

    Success

    Fail

    1:

    2:

    3:

    4:

    5:

    6:

    7:

    8:

    9:

    10:

    11:

    12:

    13:

    14:

    15:

    16:17:

    18:

    19:

    20:

    21:

    22:

    23:

    24:

    25:

    26:

    27:

    28:

    29:

    30:

    31:

    32:

    33:

    34:

    publicclassUserAdminTest {

    /* Class under test */

    privateUserAdmin userAdmin;

    /* A simple test user */

    privateUser user; // Test Data (Fixture)

    /* An administrator role */ //

    privateRole adminRole; //

    /**

    *Initializesthetestfixture.

    */

    @Before

    publicvoidsetUp() throwsException {

    userAdmin= newUserAdmin();user= newUser("John", "Doe"); // Test Data Setup

    adminRole= newRole("Administrator"); //

    }

    /**

    *Testformethodwith...

    */

    @Test

    publicvoidtestAddUser() {

    user.setAge(18); // Extra Test Setup

    userAdmin.addUser("jdoe", user, adminRole); // Use

    Test Data

    User result = userAdmin.getUser("jdoe");

    assertEquals("John", result.getFirstName());

    assertEquals("Doe", result.getLastName());

    }

    }

    ( )

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

    p

    Test How to Run TestCase(2/2) Development Tool

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    31/46

    Page l 31

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

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    32/46

    Deploy - Maven

    Page l 32

    1. Architecture

    2. Directory Structure

    3. POM.XML

    4. Build Lifecycle

    5. Plug-in6. Repository

    7. Nexus

    DeployArchitecture

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    33/46

    Page l 33

    Maven Architecture

    POM.XML Repositories(local and

    remote)

    Project Object

    Model

    Dependency

    ManagementModel

    Project life cycle and phases

    Plug-ins

    Sourcefiles Reporting Resources Compile Packagedlibraries

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

    DeployDirectory Structure

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    34/46

    Page l 34

    Maven Standard Directory StructureDirectory/File Description

    /pom.xml

    The core of a project's configuration inMaven. It is a single configuration file thatcontains the majority of informationrequired to build a project. (Ex:dependency)

    /src/main/javaLocate Java Source file. Compiled totarget/classes directory

    /src/main/resources

    Resources for deploying, namely XML,properties, etc. Copied to target/classes

    /src/main/webappWeb application related files (/WEB-INF/web.xml, webapp/index.jsp, css, etc)

    /src/test/javaTest case Java sources. Compiled totarget/test-classes

    /src/test/resources

    Resources for testing. Copied totarget/test-classes

    /target Build outputs are located

    Providing a standard directory structure

    DeployPOM.XML

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    35/46

    Page l 35

    Build Settings

    Properties

    Build

    Packaging

    Reporting

    Project Information

    Name

    URL

    Description

    ArtifactGroup Id

    Version

    Artifact Id

    Inception Year

    Dependencies

    Dependencies

    Repositories

    Repositories

    egovframework.dev.comegovframework-dev-com1.0war

    junit

    junit4.4test

    org.apache.maven.pluginsmaven-compiler-plugin1.5

    Artifact Info.

    DependencyManagement

    Plug-inSetting

    POM.XML

    The POM contains all necessary information about a project, as well as configurations ofplug-ins to be used during the build process. groupId:artifactId:version are all requiredfields and act much like an address and timestamp in a repository, acting like a coordinatesystem for Maven projects

    DeployBuild Lifecycle

    http://maven.apache.org/POM/4.0.0http://maven.apache.org/POM/4.0.0
  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    36/46

    Page l 36

    Build Lifecycle Maven2 Build Lifecycle Phase

    Maven command ex) $mvn install

    Validate

    Compile

    Test

    Package

    Verify

    Install

    deploy

    P

    O

    M

    archetype

    compiler

    surefire

    jar

    install

    Lifecycle Phases Plugins

    mvn compile

    mvn install

    mvntest

    Phase Description

    Validatevalidate the project is correct and all necessary

    information is available

    Compile compile the source code of the project

    Testtest the compiled source code using a suitable unit

    testing framework

    Packagetake the compiled code and package it in itsdistributable format, such as a JAR

    Verifyrun any checks to verify the package is valid andmeets quality criteria

    Installinstall the package into the local repository, for useas a dependency in other projects locally

    Deploy

    copies the final package to the remote repository for

    sharing with other developers and projects

    Maven 2.0 is based around the central concept of a build lifecycle. What this means is thatthe process for building and distributing a particular artifact (project) is clearly defined

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    37/46

    DeployRepository

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    38/46

    Page l 38

    Intranet Internet

    Public MavenRepository

    Computer 1

    Computer 2

    Computer 3

    Utilizing Maven Repository ManagerMaven Repository Composition Diagram

    Public MavenRepository

    Computer 1

    Computer 2

    Computer 3

    Intranet Internet

    Maven Repository(Nexus)

    Using libraries that declared in the pom.xml of the project as dependency and the librariescome from the repository. If it exits in local repository, use it, if not, download from theremote repository to local and use

    DeployNexus

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    39/46

    Page l 39

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

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    40/46

    CI(Configuration Integration) Server

    Page l 40

    1. Overview2. Subversion

    3. Hudson Build

    4. Hudson Dashboard

    Overview CI Server

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    41/46

    Page l 41

    Source CodeBuild

    FeedbackMechanism

    Unit Tests

    Test CoverageAnalysis

    BuildSuccess

    DevelopmentServer

    CI ServerVersion ControlServer(SVN)

    Build Failed

    Code Inspection

    Developer

    Developer

    Deploy

    CodeCommit

    CodeCommit

    Watch &

    Polling

    Notice

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

    Subversion CI Server

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    42/46

    Page l 42

    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 Source Management Tool Deploy Tool

    Repository

    Developer

    CMO

    Check in/outDeploy

    Backup

    Configuration

    ManagementPL

    Subversion is a version control system that keeps track of changes made to files andfolders (directories), facilitating data recovery and providing a history of the changes thathave been made over time

    Hudson Build CI Server

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    43/46

    Page l 43

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

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

    Hudson Dashboard CI Server

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    44/46

    Page l 44

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

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    45/46

  • 8/12/2019 01.Development Environment Training Book_EN.pdf

    46/46

    46Page l 46