TS 61 EJB Support

EJB Support Test Specification

Author: Radim Roska
Estimated time: 4 hours
Default IZ component(s): j2ee/ejb* j2ee/persistence
Version: 1.0
Last update: 2008/05/13
Comments: Test Specification for EJB support in NetBeans IDE.


Contents


Test suite: Create EJB project

Purpose: Test creating of project
Setup: GlassFish application server(or another j2ee 5 compliant app server) must be registered in IDE.

  1. Create j2ee 1.4 EJB project
    1. file - new project - enterprise - EJB Module, next
    2. specify Java EE Version to J2EE 1.4, finish
    • EXPECTED RESULT: New empty EJB project is created. Check Configuration files node in Projects View for deployment descriptors ejb-jar.xml and sun-ejb-jar.xml. In project properties (right click on project in Projects view and click on properties) there is Source/Binary Format set to JDK 1.4
  1. Create Java EE 5 EJB project
    1. file - new project - enterprise - EJB Module, next
    2. specify Java EE Version to Java EE 5, finish
    • EXPECTED RESULT: New empty EJB project is created. In project properties there is Source/Binary Format set to JDK 5.


Test suite: Message-Driven Bean

  1. Create Message-Driven Bean
    1. File - New File - Enterprise - Message-Driven Bean. Next.
    2. Specify package
    3. Create Project Destination (Add button, specify destination name and type, Ok).
    4. Finish.
    • EXPECTED RESULT: Bean is created and opened in editor.
      For j2ee 1.4 project check information about message driven bean in ejb-jar.xml. This means: open ejb-jar.xml, go to the Enterprise Beans section and go throught Message Driven bean informations - check Name, transaction type is Container, destination type corresponds to message destination you have created before. In XML view you can see another informations like message-destination-link which is message destination name.
      For java ee 5 project ensure correct annotations are generated in created file.



Test suite: Entity Class

  1. Create Entity classes
    1. j2ee 1.4 project
      1. File - New File - Enterprise - Entity Bean. Next.
      2. Specify package name.
      3. Specify Persistence type : Container/Bean and Local/Remote Interface.
      4. Try to create Entity Class. Error message is displayed in wizard.
    2. java ee 5 project
      1. File - New File - Persistence - Entity Class. Next.
      2. Specify package name.
      3. If project does not contain Persistence Unit, click on Create Persistence Unit. Specify e.g. some sample data source.
    • EXPECTED RESULT: Entity Bean for 1.4 project is created, check ejb-jar.xml for information about this bean. Again go to the Enterprise Beans section and look for created Entity bean - check name and persistence type in general subsection. In subsection Enterprise Bean Implementation and Interfaces there are Bean Class and interfaces of this particular bean.
      Entity class for ee 5 project is created. persistence.xml is in Configuration Files
  1. Create Entity classes from Database
    1. In java EE 5 project open New File dialog
    2. Select Persistence - Entity Classes from database, Next.
    3. Specify some data source. For example jdbc/sample.
    4. Select some of available tables - lets say Customer. This will select Discount_code as well because its related table.
    5. Uncheck Include Related Tables. Next.
    6. Class names table is correct. Ensure Generate Named Query Annotations is checked. Finish.
    • EXPECTED RESULT: Entity class is created. It contains correct set of fields according to the CUSTOMER table. There is NamedQueries annotation with set of queries.
  1. Create CMP Entity Beans from Database
    1. In j2ee 1.4 project open New File dialog
    2. File - New File - Enterprise - CMP Entity Beans from Database
    3. Specify some data source. For example jdbc/sample.
    4. Select some of available tables - lets say Customer. This will select Discount_code as well because its related table.Next.
    5. Class names table is correct. Ensure Generate Finder Methods for CMP Fields and Add CMP and CMR fields to the Local interfaces. Finish.
    • {{{1}}}


Test suite: Session Bean

Setup: Created EJB Project

  1. Create Session Bean
    1. File - new file - Enterprise - Session Bean. Next.
    2. Specify package name.
    3. Set Stateless/Statefull Session Type
    4. Check Remote/Local interface
    5. Finish.
    6. Follow this steps for both projects j2ee 1.4 and java ee 5.
    • {{result|EXPECTED RESULT: Session bean is created.
      For j2ee 1.4 check that for every bean 3/5 files are created - SessionBean class and 2 interfaces for each local/remote interface. Also check deployment descriptor - ejb-jar.xml. In Enterprise Beans find NewSessionSB and check stateless/statefull state, transaction type bean/container.
      For java ee 5 check that session bean is annotated with correct annotation (@Stateless/@Stateful). Remote/Local interface is created.
  1. Create Session Bean For Entity Classes
    1. Just for Java EE 5 project.
    2. File - new file - Persistence - Session Bean For Entity Classes. Next.
    3. Select some of Available Entity Classes. Next.
    4. Specify package name.
    5. Check Remote/Local interface
    6. Finish.
    • EXPECTED RESULT: CustomerFacade Session bean and Remote/Local interface are created.
      Class contain basic methods for table/entity manipulation.



Test suite: Final test

Purpose: Ensure its correctly assambled

  1. Undeploy and deploy projects
    1. In project view undeploy and deploy both ejb projects
    • EXPECTED RESULT: Application servers have to start up (if not running) and in output window there must be no error. After successfull deployment check in Services view Application server node and look for EJB project node.



Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo