Difference between revisions of "J2EE Smoke Test (WTP 3.0)"

From Eclipsepedia

Jump to: navigation, search
(Create an EJB 3.0 project)
m (Setup)
 
(27 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
=== Setup ===
 
=== Setup ===
 
* Install a J2EE 1.4-compatible server, such as JOnAS, JBoss or WebSphere
 
* Install a J2EE 1.4-compatible server, such as JOnAS, JBoss or WebSphere
* Add the server in Window -> Preferences... -> Server -> Installed Runtimes
+
* Add the server in Window -> Preferences -> Server -> Runtime Environments
 +
* Define the server in the Servers view, using the above created runtime environment
 
* Install the XDoclet support (1.2.1, 1.2.2 or 1.2.3)
 
* Install the XDoclet support (1.2.1, 1.2.2 or 1.2.3)
* Add the XDoclet support in Window -> Preferences... -> XDoclet
+
* Add the XDoclet support in Window -> Preferences -> XDoclet
 
* Expand the XDoclet node and configure the ejbdoclet and webdoclet support for your installed server(s).
 
* Expand the XDoclet node and configure the ejbdoclet and webdoclet support for your installed server(s).
  
Line 16: Line 17:
 
** enter "test" for Java package
 
** enter "test" for Java package
 
** specify a name
 
** specify a name
** select the "Generate an annotated servlet class file" checkbox
+
** select the "Generate a XDoclet annotated class" checkbox
 
** give "test" for servlet's name (second page)
 
** give "test" for servlet's name (second page)
 
** leave only the "doGet" checkbox checked (third page - inherited abstract methods)
 
** leave only the "doGet" checkbox checked (third page - inherited abstract methods)
Line 29: Line 30:
 
==== Create an EAR 1.4 project ====
 
==== Create an EAR 1.4 project ====
 
* Target it at the installed J2EE server
 
* Target it at the installed J2EE server
* Select the Web 2.4 project as J2EE module (third page)
+
* Select the Web 2.4 project as J2EE module (second page)
  
 
==== Create an EJB 2.1 project ====
 
==== Create an EJB 2.1 project ====
Line 42: Line 43:
  
 
==== Verify the Web project ====
 
==== Verify the Web project ====
 +
* verify that the servlet class exists in the project file structure
 
* verify there is a node for the deployment descriptor
 
* verify there is a node for the deployment descriptor
* the deployment descriptor node should specify version 2.4
+
** the deployment descriptor node should specify version 2.4
 
* verify that the servlet class is listed under the "Servlets" node
 
* verify that the servlet class is listed under the "Servlets" node
 
* verify that the "/test ->" url mapping is listed under the "Servlet Mappings" node
 
* verify that the "/test ->" url mapping is listed under the "Servlet Mappings" node
  
 
==== Verify the EJB project ====
 
==== Verify the EJB project ====
 +
* verify that an EJB client project is created together with the EJB project
 +
* verify that there is an ejb-client-jar tag in the ejb-jar.xml deployment descriptor
 +
* verify that session bean classes exist in the project file structure
 +
** EJB interfaces should be in the EJB client project instead in the EJB project
 
* verify there is a node for the deployment descriptor
 
* verify there is a node for the deployment descriptor
 
* the deployment descriptor node should specify version 2.1
 
* the deployment descriptor node should specify version 2.1
Line 55: Line 61:
 
==== Verify the EAR project ====
 
==== Verify the EAR project ====
 
* verify there is a node for the deployment descriptor
 
* verify there is a node for the deployment descriptor
* the deployment descriptor node should specify version 1.4
+
** the deployment descriptor node should specify version 1.4
 
* expand the deployment descriptor node
 
* expand the deployment descriptor node
 
** verify there are "Modules" and "Utility JARs" nodes
 
** verify there are "Modules" and "Utility JARs" nodes
Line 86: Line 92:
 
=== Setup ===
 
=== Setup ===
 
* Install a Java EE 5-compatible server, such as Glassfish or JBoss
 
* Install a Java EE 5-compatible server, such as Glassfish or JBoss
* Add the server in Window -> Preferences... -> Server -> Installed Runtimes
+
* Add the server in Window -> Preferences -> Server -> Runtime Environments
  
 
=== Create resources ===
 
=== Create resources ===
Line 107: Line 113:
 
==== Create an EAR 5 project ====
 
==== Create an EAR 5 project ====
 
* Target it at the installed Java EE server
 
* Target it at the installed Java EE server
* Select the Web 2.5 project as J2EE module (third page)
+
* Select the Web 2.5 project as J2EE module (second page)
  
 
==== Create an EJB 3.0 project ====
 
==== Create an EJB 3.0 project ====
Line 115: Line 121:
 
** enter "test" for Java package
 
** enter "test" for Java package
 
** enter "TestBean" for Class name
 
** enter "TestBean" for Class name
** leave the "Create Business Interface > Local" checked
+
** leave "Create Business Interface > Local" checked
  
 
=== Verify Project Explorer content ===
 
=== Verify Project Explorer content ===
  
 
==== Verify the Web project ====
 
==== Verify the Web project ====
* verify there is no node for the deployment descriptor
+
* verify that the servlet class exists in the project file structure
 
* verify there is a web.xml file under the WEB-INF folder
 
* verify there is a web.xml file under the WEB-INF folder
* verify that the servlet and its mapping are described in the web.xml
+
* verify there is a node for the deployment descriptor
 +
** the deployment descriptor node should specify version 2.5
 +
* verify that the servlet class is listed under the "Servlets" node
 +
* verify that the "/test ->" url mapping is listed under the "Servlet Mappings" node
  
 
==== Verify the EJB project ====
 
==== Verify the EJB project ====
* verify there is no node for the deployment descriptor
+
* verify that an EJB client project is created together with the EJB project
* verify there is no ejb-jar.xml file under the META-INF directory
+
* verify that session bean classes exist in the project file structure
 +
** EJB interfaces should be generated in the EJB client project instead of in the EJB project
 +
* verify there is an ejb-jar.xml file under the /ejbModule/META-INF directory
 +
** there should be an ejb-client-jar tag pointing to the EJB client project
 +
* verify there is a node for the deployment descriptor
 +
** the deployment descriptor node should specify version 3.0
 +
* verify that the there is a node for the bean under the "Session Beans" node
 +
** verify that under this node all bean classes and interfaces are listed
  
 
==== Verify the EAR project ====
 
==== Verify the EAR project ====
* verify there is no node for the deployment descriptor
+
* verify there is no application.xml file under the /EarContent/META-INF directory
* verify there is no application.xml file under the META-INF directory
+
** verify that /META-INF directory is not generated under /EarContent
* verify that the Web and EJB modules are listed and checked in the J2EE Module Dependencies property page
+
* verify there is a node for the deployment descriptor
 +
** the deployment descriptor node should specify version 5.0
 +
* expand the deployment descriptor node
 +
** verify there are "Bundled Libraries" and "Modules" nodes
 +
* expand the Bundled Libraries node
 +
** verify there is reference to the EJB Client JAR
 +
* expand the Modules node
 +
** verify there are references to the Web and EJB modules
  
 
=== Export the projects ===
 
=== Export the projects ===
Line 139: Line 162:
  
 
==== Export the EJB project ====
 
==== Export the EJB project ====
* verify that all of the classes are included in the EJB JAR
+
* verify that all of the classes and the deployment descriptor XML are included in the EJB JAR
* verify there is no deployment descriptor XML
+
  
 
==== Export the EAR project ====
 
==== Export the EAR project ====
Line 148: Line 170:
 
=== Deploy and Run the application ===
 
=== Deploy and Run the application ===
 
* Run the test servlet
 
* Run the test servlet
** Right click on the servlet class and choose Run As -> Run on Server
+
** Right click on the servlet node in the deployment descriptor tree and choose Run As -> Run on Server
 
** Select the targeted Java EE server
 
** Select the targeted Java EE server
 
** The internal browser should request the test servlet and show the result page
 
** The internal browser should request the test servlet and show the result page

Latest revision as of 12:54, 1 July 2010

Contents

[edit] J2EE 1.4

[edit] Setup

  • Install a J2EE 1.4-compatible server, such as JOnAS, JBoss or WebSphere
  • Add the server in Window -> Preferences -> Server -> Runtime Environments
  • Define the server in the Servers view, using the above created runtime environment
  • Install the XDoclet support (1.2.1, 1.2.2 or 1.2.3)
  • Add the XDoclet support in Window -> Preferences -> XDoclet
  • Expand the XDoclet node and configure the ejbdoclet and webdoclet support for your installed server(s).

[edit] Create resources

[edit] Create a Web 2.4 project

  • Target it at the installed J2EE server
  • Choose "Dynamic Web Project with XDoclet" from Configurations
  • Create a servlet inside the project
    • enter "test" for Java package
    • specify a name
    • select the "Generate a XDoclet annotated class" checkbox
    • give "test" for servlet's name (second page)
    • leave only the "doGet" checkbox checked (third page - inherited abstract methods)
    • add the following code in the doGet() method of the servlet class
response.getOutputStream().println("This is a test servlet. ");
  • Create a JSP inside the project
    • file name: index.jsp
    • add the following text inside the <body> tag
This is the Smoke Test.
  • Ensure the project builds and is targeted to the server correctly

[edit] Create an EAR 1.4 project

  • Target it at the installed J2EE server
  • Select the Web 2.4 project as J2EE module (second page)

[edit] Create an EJB 2.1 project

  • Target it at the installed J2EE server
  • Choose "EJB Project with XDoclet" from Configurations
  • Choose "Add project to an EAR" and choose the previously created EAR project
  • Create a new XDoclet Enterprise JavaBean
    • choose Session Bean as a type
    • enter "test" for Java package

[edit] Verify Project Explorer content

[edit] Verify the Web project

  • verify that the servlet class exists in the project file structure
  • verify there is a node for the deployment descriptor
    • the deployment descriptor node should specify version 2.4
  • verify that the servlet class is listed under the "Servlets" node
  • verify that the "/test ->" url mapping is listed under the "Servlet Mappings" node

[edit] Verify the EJB project

  • verify that an EJB client project is created together with the EJB project
  • verify that there is an ejb-client-jar tag in the ejb-jar.xml deployment descriptor
  • verify that session bean classes exist in the project file structure
    • EJB interfaces should be in the EJB client project instead in the EJB project
  • verify there is a node for the deployment descriptor
  • the deployment descriptor node should specify version 2.1
  • verify that the there is a node for the bean under the "Session Beans" node
    • verify that under this node all bean classes and interfaces are listed

[edit] Verify the EAR project

  • verify there is a node for the deployment descriptor
    • the deployment descriptor node should specify version 1.4
  • expand the deployment descriptor node
    • verify there are "Modules" and "Utility JARs" nodes
  • expand the Modules node
    • verify there are references to the Web and EJB modules

[edit] Export the projects

[edit] Export the Web project

  • verify that the deployment descriptor XML, Servlet classes, JSP files and libraries are included in the WAR

[edit] Export the EJB project

  • verify that all of the classes and the deployment descriptor XML are included in the EJB JAR

[edit] Export the EAR project

  • verify that deployment descriptor XML and the WARs and EJB JARs of the referenced J2EE modules are included

[edit] Deploy and Run the application

  • Run the test servlet
    • Right click on the servlet node in the deployment descriptor tree and choose Run As -> Run on Server
    • Select the targeted J2EE server
    • The internal browser should request the test servlet and show the result page
  • Run the index.jsp
    • Right click on the index.jsp and choose Run As -> Run on Server
    • Select the targeted J2EE server
    • The internal browser should request the index.jsp and show the result page

[edit] Java EE 5

[edit] Setup

  • Install a Java EE 5-compatible server, such as Glassfish or JBoss
  • Add the server in Window -> Preferences -> Server -> Runtime Environments

[edit] Create resources

[edit] Create a Web 2.5 project

  • Target it at the installed Java EE server
  • Create a servlet inside the project
    • enter "test" for Java package
    • specify a name
    • give "test" for servlet's name (second page)
    • leave only the "doGet" checkbox checked (third page - inherited abstract methods)
    • add the following code in the doGet() method of the servlet class
response.getOutputStream().println("This is a test servlet. ");
  • Create a JSP inside the project
    • file name: index.jsp
    • add the following text inside the <body> tag
This is the Smoke Test.
  • Ensure the project builds and is targeted to the server correctly

[edit] Create an EAR 5 project

  • Target it at the installed Java EE server
  • Select the Web 2.5 project as J2EE module (second page)

[edit] Create an EJB 3.0 project

  • Target it at the installed Java EE server
  • Choose "Add project to an EAR" and choose the previously created EAR 5 project
  • Create a new Session Bean
    • enter "test" for Java package
    • enter "TestBean" for Class name
    • leave "Create Business Interface > Local" checked

[edit] Verify Project Explorer content

[edit] Verify the Web project

  • verify that the servlet class exists in the project file structure
  • verify there is a web.xml file under the WEB-INF folder
  • verify there is a node for the deployment descriptor
    • the deployment descriptor node should specify version 2.5
  • verify that the servlet class is listed under the "Servlets" node
  • verify that the "/test ->" url mapping is listed under the "Servlet Mappings" node

[edit] Verify the EJB project

  • verify that an EJB client project is created together with the EJB project
  • verify that session bean classes exist in the project file structure
    • EJB interfaces should be generated in the EJB client project instead of in the EJB project
  • verify there is an ejb-jar.xml file under the /ejbModule/META-INF directory
    • there should be an ejb-client-jar tag pointing to the EJB client project
  • verify there is a node for the deployment descriptor
    • the deployment descriptor node should specify version 3.0
  • verify that the there is a node for the bean under the "Session Beans" node
    • verify that under this node all bean classes and interfaces are listed

[edit] Verify the EAR project

  • verify there is no application.xml file under the /EarContent/META-INF directory
    • verify that /META-INF directory is not generated under /EarContent
  • verify there is a node for the deployment descriptor
    • the deployment descriptor node should specify version 5.0
  • expand the deployment descriptor node
    • verify there are "Bundled Libraries" and "Modules" nodes
  • expand the Bundled Libraries node
    • verify there is reference to the EJB Client JAR
  • expand the Modules node
    • verify there are references to the Web and EJB modules

[edit] Export the projects

[edit] Export the Web project

  • verify that the deployment descriptor XML, Servlet classes, JSP files and libraries are included in the WAR

[edit] Export the EJB project

  • verify that all of the classes and the deployment descriptor XML are included in the EJB JAR

[edit] Export the EAR project

  • verify that the WARs and EJB JARs of the referenced J2EE modules are included
  • verify there is no deployment descriptor XML

[edit] Deploy and Run the application

  • Run the test servlet
    • Right click on the servlet node in the deployment descriptor tree and choose Run As -> Run on Server
    • Select the targeted Java EE server
    • The internal browser should request the test servlet and show the result page
  • Run the index.jsp
    • Right click on the index.jsp and choose Run As -> Run on Server
    • Select the targeted Java EE server
    • The internal browser should request the index.jsp and show the result page

[edit] See also

Click here to view smoke test scenarios for WTP 1.5.
Click here to view smoke test scenarios for WTP 2.0.
Click here to view smoke test scenarios for WTP 3.0.
Click here to view WTP smoke test results.
Back to Web Tools Wiki Home