jst j2ee
test plan: EJB Module validation
WTP LogoWTP Home
Intoduction
 

Validation on J2EE modules can be manual or automatic. To run it manually you need to select the J2EE module, right click and select Run Validation on the pop up menu. The automatic validation is triggered during a full build or an incremental build if auto build preference is turned on there is delta i.e a change in one of the resources in the modules. The validators that are registered to run on a J2EE module can be seen on the validation properties page.

Steps
 

    The EJB Validator validates J2EE 1.2, 1.3 and 1.4 specification artifacts and other artifacts that are related to the workbench for EJB modules or an EJB Jar(jar) archives. For each of the validated scenario if an error condition is found the validator puts out a Error, Warning or Informational message in the problems view based on the severity of the error condition. Here are the list of artifacts and how to validate these artifacts.

  1. Test EJB 1.1 Validation
    Download the following jar ValidationEJBTestBeans_updated.jar. Navigate via the browse button and select this jar from disk. Keep the default Project Name, select your Target runtime, and click finish.
    Increase the maximum number of validation messages to 200 on ValidationEJBTestBeans project or in the Validation Preferences. Then "Run Validation".
    Click on the Description title in the Tasks view to alphabetically sort the validation errors.
    Verify that at least all of the following errors are in the Tasks view. Multiple occurrances of some errors are expected.
    Clicking on one validation error at a time will take you to the offending lines of java. Comments in the code will tell you how to correct the errors. Make the corrections, save the file, and verify that the validation error is removed. (NOTE: Beacuse many validation errors can result due to a single implanted error, many java files will contain errors without nearby comments to tell you how to fix them. When you encounter these commentless errors, move onto the next error and eventually fixing the commented errors will clean up all of the commentless errors.)
    If you want to highlight all of the comments that explain how to fix the defects, add a new Java Task. (Window > Preferences > Java > Task Tags. Add "CHKJ" (case-sensitive). When a dialog asks if you want to rebuild now, say yes.
    Refactor the classes in this file. Start by opening the Package Explorer View (Window > Show View > Other > Java > Package Explorer).
    Create a new package. (Highlight "ejbModule", right-click, New > Other > Java > Package > "test", Finish.)
    Expand the "ejbModule" folder in the EJB project, highlight all of the .java files, right-click, "Refactor" > "Move". Choose the "test" package that you just created, "OK".
    You will see errors reported against ejb-jar.xml because the file refers to the old class names. Update every class name so that it's fully qualified.
    This test case passes if all of the messages disappear when they are supposed to and if there are no internal errors (e.g., NPE).


  2. Test EJB MDB 2.1 Validation

    Instructions to Tester
    Turn the global message maximum to 150. (Window > Preferences > Validation > set maximum to 150 > OK.)
    Filter the tasks so that it shows only the errors on one project at a time. (Launch the Tasks View Filter wizard, select "on any resource in same project".)
    Leave auto-validation on and fix each error. Verify that once all of the expected errors/warnings/infos are fixed, no messages remain in the tasks view.
    You do not need to check that each expected validation message is present because the automatic BVT checks for that.
    The test case passes if no unwanted messages remain and there are no internal errors. Test case passes with defect if minor problems (e.g., UI glitch) is noticed.

    a. Create a 2.1 JMS MDB bean with standard Activation Config Properties i.e (Acknowledgement mode, Destination and Durability)
    b. Change the value strings of these activation config properties to something other than the default values and check if a validation error is being put out for the invalid values. The standard values are list below
    Standard Activation Config Properties
    Acknowledge mode->"Auto-acknowledge", "Dups-ok-acknowledge"
    Destination Type->"Queue", "Topic"
    Durability->"Durable", "NonDurable"
    c. Add duplicate Activation Config in the Source Page of the xml editor by copying an existing one and pasting back again in the list of the activation config propperties and on saving the editor you should see and error for duplicate config properties
    d. The value of the destination activation config property should always match the message destination type value. Make them to not match by changng the string in one of them make sure an error is being put out.
    For e.g. If Destination Type activation confg property value is "Queue" then the message-destiantion-type value should be "javax.jms.Queue", if it is different from this then an error is being put out for unmatching values.

    Download the following ear MessageDestination.ear. Navigate via the browse button and select this ear from disk. Keep the default Project Name, select your Target runtime, and click finish.

    (Make sure there are no errors)
    A.. Open the MessageDrivenClient deployment descriptor and go to the source page.
    1. Remove the AppClient1 in the "message-destination-link" to make it empty and save Validation warning should appear in the problems view. Message destination link is empty for message destination ref 'AppClient1_Ref' in module 'MessageDestinationClient.jar' and EAR 'MessageDestination'. application-client.xml
    2. Change the MessageDestinationWeb.war#Web1 to MessageDestinationWebError.war#Web1 and save Validation warning should appear in the task bar. Message destination link 'MessageDestinationWebError.war#Web1' for message destination ref 'Web1_Ref' is unresolvable in module 'MessageDestinationClient.jar' and EAR 'MessageDestination'. application-client.xml
    3. Change the MessageDestinationEJB.jar#EJB2 to MessageDestinationEJB.jar#EJB2Error and save Validation warning should appear in the task bar. Message destination link 'MessageDestinationEJB.jar#EJB2Error' for message destination ref 'EJB2_Ref' is unresolvable in module 'MessageDestinationClient.jar' and EAR 'MessageDestination'.
    4. Revert the above changes and the save the xml editor. The error should go away.
    B. Open the EJB deployment descriptor.
    1. Remove the Message driven destination EJB2. Validation error messages should appear in the Task bar.
    2. Add the EJB2 message driven destination. Validation error messages should disappear.
    3. Go to the source page and change the MessageDestinationClient.jar#AppClient1Error and save. Validation error should be displayed. Message destination link 'MessageDestinationClient.jar#AppClient1Error' of MDB 'MDB21' is unresolvable in module 'MessageDestinationEJB.jar' and EAR 'MessageDestination'.
    C. Open the Web deployment descritpor.
    1. Remove the Web1 message destination and save. Validation error messages should appear in the task bar.
    2. Add the Web1 message destination and save. Validation error messages should disappear.