02.egovFrame Development Environment workshop I

Preview:

DESCRIPTION

eGovFrame - Framework for e-government Development Environment - Practice

Citation preview

1Page l 1

eGovFrame Lab WorkbookDevelopment Environment

eGovFrame Center

2012

2Page l 2

Development Environment

1. Development Environment Setup

Composition of the Lab environment

Configuration of the Lab environment

2. Development Environment Practice

[LAB1] Create and run Sample Project

[LAB2] Hello World Test

[LAB3] Code Generation

3Page l 3

The lab consists of the following environments

Install

- Unzip eGovFrame-2.0zip under C:\ drive

Installed Software

- JDK5.0 (1.5.0_22) & JDK6.0 (1.6.0_29)

- Eclipse JEE Helios SR2

- Apache Tomcat 6.0.35 & 7.0.23

- Maven 2.2.1/Maven 3.0.3

Directory Information

Directory Description

bin • Executable file directory

- jdk1.5.0 / jdk1.6.0 • JDK5.0(1.5.0_22), JDK6.0(1.6.0_29)

- apache-tomcat-6.0.35

- apache-tomcat-7.0.23• Apache Tomcat 6 & 7

- apache-maven-2.2.1 • Maven (MAVEN_HOME)

- eclipse• Eclipse JEE Helios SR2 (3.6.2)

• Include implementation tools plug-ins

maven/repository • Maven Local Repository

workspace • Eclipse project workspace

Composition of the Lab environment Development Environment

4Page l 4

Configuration

Check plug-in configuration through Window Preference menu in Eclipse.

Check basic encoding (UTF-8) – General > Workspace

Development Environment

5Page l 5

Check Maven(m2eclipse) configuration– Maven > User Settings

Development Environment

Check plug-in configuration through Window Preference menu in Eclipse.

Configuration

6Page l 6

Check installed JRE – Java > Installed JREs

Check plug-in configuration through Window Preference menu in Eclipse.

Development EnvironmentConfiguration

7Page l 7

Check Apache Tomcat Server configuration – Server > Runtime Environments

Development Environment

Check plug-in configuration through Window Preference menu in Eclipse.

Configuration

C:/eGovFrame-2.0/bin/apache-tomcat-6.0.35

8Page l 8

1. Development Environment Setup

Composition of the Lab environment

Configuration of the Lab environment

2. Development Environment Practice

[LAB1] Create and run Sample Project

[LAB2] Hello World Test

[LAB3] Code Generation

Development Environment

9Page l 9

[[LAB1] Generate Sample Project

Learn the functionality of the tools as creating and running the sample project, based on the eGovFrame

implementation tools.

[Step 1-1] Select eGovFramework>start>New Web Project menu in Eclipse

Select eGovFramework

Web Project

Development Environment

10Page l 10

[Step 1-2] Input below data to project creation wizard in Eclipse and click „Next‟ button.

Check „Generate Example‟ element, then click „Finish‟ button. Create a project.

Element Input Data Remarks

Project name lab101

Target Runtime Apache Tomcat 6.0

Dynamic Web Module Version

2.5 Automatic input

Group Id egovlab

Artifact Id lab101 Automatic input

Version 1.0.0 Automatic input

Example Code Generation

[LAB1] Generate Sample Project Development Environment

11Page l 11

[Step 1-3] Select the project and run „Maven > Update Project Configuration‟. It reflects the Maven

configuration.

Reflect Maven

configuration setting

[LAB1] Generate Sample Project Development Environment

12Page l 12

[Step 1-4] Run each phase in Maven lifecycle as running the project build. Select and run „Run As >

Maven package‟ menu. Then check the build description on the console and build output which is war file

under the „target‟ directory.

Reflect Maven configuration

Generate war file

[[LAB1] Generate Sample Project Development Environment

13Page l 13

[Step 1-5] Run HSQL DB for project execution.

Input and run „runHsqlDB.cmd‟ command which is under „DATABASE/db‟ directory in the project.

[LAB1] Generate Sample Project Development Environment

1

2

3

14Page l 14

[Step 1-6] Select a project and run „Run As > Run on Server‟ menu. Run a project.

Check features of the executed project. (Sample application URL : http://localhost:8080/lab101/)

[LAB1] Generate Sample Project Development Environment

15Page l 15

[LAB2] Hello World Test

As creating TestCasebased on Maven project, learn test tool functions

[Step 2-1] Check LAB2 Maven basic project structure, create HelloWorldServiceTest with a Spring Test

function

[ Maven based Project

Structure]

package egovframework.guide.helloworld;

import static org.junit.Assert.assertEquals;

import javax.annotation.Resource;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.test.context.ContextConfiguration;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)

@ContextConfiguration(locations={"/context-helloworld.xml"})

public class HelloWorldServiceTest {

private HelloWorldService helloworld;

@Resource(name="helloworld")

public void setHelloWorld(HelloWorldService hello) {

this.helloworld = hello;

}

@Test

public void SayHello() {

assertEquals( "Hello egov framework!!!", helloworld.sayHello() );

}

}

[ Hello World TestCase]

Development Environment

16Page l 16

[LAB2] Hello World Test

[Step 2-2] Run TestCase

- Run test: : Select HelloWorldServiceTest class -> Run As -> JUnit Test

[Step 2-3] Check a test result

Development Environment

17Page l 17

[LAB3] Code Generation

As creating CRUD project based on Template, learn a Code Generation function.

[Step 3-1] Open lab103 project, connect to SampleDB HSQLDB in the Data Source Explorer.

[Step 3-2] As using “Show View” function from main menu, run eGovFramework > eGocFrame

Templates View.

Development Environment

18Page l 18

[LAB3] Code Generation

[Step 3-3] Select lab103 project, double click “eGovFrame Templates > CRUD > CRUD Program“ in the

eGovFrame Template view.

[Step 3-4] Select PUBLIC > SAMPLE table and click “NEXT” button.

Development Environment

19Page l 19

[LAB3] Code Generation

[Step 3-5] . Input directory information for automatically generation source code, and then click “Finish”

button.

Development Environment

Kildong, Hong

2012.10.10

20Page l 20

[LAB3] Code Generation

[Step 3-6] Open sql-map-config.xml file from egovframework.sqlmap.rte package in the

src/main/resource, add created Sample_SQL.xml file.

Development Environment

21Page l 21

[LAB3] Code Generation

[Step 3-7] Run the created project. Click lab103 > Run As > Run on Server

[Step 3-8] Check created project functions on the web browser.

Development Environment

Recommended