The document summarizes the development environment lab workbook for eGovFrame. It describes the composition of the lab environment including installed software and directory information. It also outlines the configuration of plug-ins in Eclipse and servers. The document then explains three labs - creating and running a sample project to learn the tools, creating a Hello World test case using JUnit, and generating CRUD code automatically from a database table template to learn code generation.
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
Page l 2 2
3. Composition of the Lab environment Development Environment
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 6 & 7
- apache-tomcat-7.0.23
- apache-maven-2.2.1 • Maven (MAVEN_HOME)
• Eclipse JEE Helios SR2 (3.6.2)
- eclipse
• Include implementation tools plug-ins
maven/repository • Maven Local Repository
workspace • Eclipse project workspace
Page l 3 3
4. Configuration Development Environment
Check plug-in configuration through Window Preference menu in Eclipse.
Check basic encoding (UTF-8) – General > Workspace
Page l 4 4
5. Configuration Development Environment
Check plug-in configuration through Window Preference menu in Eclipse.
Check Maven(m2eclipse) configuration– Maven > User Settings
Page l 5 5
6. Configuration Development Environment
Check plug-in configuration through Window Preference menu in Eclipse.
Check installed JRE – Java > Installed JREs
Page l 6 6
7. Configuration Development Environment
Check plug-in configuration through Window Preference menu in Eclipse.
Check Apache Tomcat Server configuration – Server > Runtime Environments
C:/eGovFrame-2.0/bin/apache-tomcat-6.0.35
Page l 7 7
8. 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
Page l 8 8
9. [[LAB1] Generate Sample Project Development Environment
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
Page l 9 9
10. [LAB1] Generate Sample Project Development Environment
[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
2.5 Automatic input
Module Version
Group Id egovlab
Artifact Id lab101 Automatic input
Version 1.0.0 Automatic input
Example Code Generation
Page l
10
10
11. [LAB1] Generate Sample Project Development Environment
[Step 1-3] Select the project and run „Maven > Update Project Configuration‟. It reflects the Maven
configuration.
Reflect Maven
configuration setting
Page l
11
11
12. [[LAB1] Generate Sample Project Development Environment
[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
Page l
12
12
13. [LAB1] Generate Sample Project Development Environment
[Step 1-5] Run HSQL DB for project execution.
Input and run „runHsqlDB.cmd‟ command which is under „DATABASE/db‟ directory in the project.
2
3
1
Page l
13
13
14. [LAB1] Generate Sample Project Development Environment
[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/)
Page l
14
14
15. [LAB2] Hello World Test Development Environment
As creating TestCase based on Maven project, learn test tool functions
[Step 2-1] Check LAB2 Maven basic project structure, create HelloWorldServiceTest with a Spring Test
function
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")
[ Maven based Project public void setHelloWorld(HelloWorldService hello) {
this.helloworld = hello;
Structure] }
@Test
public void SayHello() {
assertEquals( "Hello egov framework!!!", helloworld.sayHello() );
}
}
[ Hello World TestCase]
Page l
15
15
16. [LAB2] Hello World Test Development Environment
[Step 2-2] Run TestCase
- Run test: : Select HelloWorldServiceTest class -> Run As -> JUnit Test
[Step 2-3] Check a test result
Page l
16
16
17. [LAB3] Code Generation Development Environment
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.
Page l
17
17
18. [LAB3] Code Generation Development Environment
[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.
Page l
18
18
19. [LAB3] Code Generation Development Environment
[Step 3-5] . Input directory information for automatically generation source code, and then click “Finish”
button.
Kildong, Hong
2012.10.10
Page l
19
19
20. [LAB3] Code Generation Development Environment
[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.
Page l
20
20
21. [LAB3] Code Generation Development Environment
[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.
Page l
21
21