TS 61 WebServicesEditorSupport

Web Services Editor Support Test Specification

Author: Jindrich Sedek, Petr Dvorak
Introduction: This test specification is focused on testing Web Service support in Java editor which features code verification, error highlighting, hints or code completion of JSR 181 annotations. Setup: Execution of the following tests requires GlassFish application server installed on your computer.

Contents


Test suite: Code verification

Purpose: This test suite checks that error highlighting and annotations work correctly. It also verifies that a Glassfish server can be registered and that you can create an EJB module with a web service on it.

  1. Register application server
    1. Switch to "Services" tab
    2. Right-click "Servers" node, invoke Add Server from the pop-up menu
    3. Select "Glassfish V2" from the server list and fill in "GlassFish Application Server" as Name
    4. Push Next button.
    5. Set the correct platform location (use _Browse...__ button or type the location by hand)
    6. Leave the default settings of radio-buttons (it should be "Create Personal Domain" - if not, select it).
    7. Click Next.
    8. Set the domain folder (for example somewhere in your home directory).
    9. Click Next.
    10. Set the username and password.
    11. Click Next and then click Finish.
  1. Create EJB module
    1. Invoke File > New Project from the main menu.
    2. Select "Enterprise" category and "EJB Module" project type.
    3. Click Next.
    4. Fill in some project name.
    5. Click Next.
    6. Select "Glassfish Application Server" from the "Server" combo-box and click Finish.
  2. Create a web service
    1. Select the root of the project created in previous test case and invoke File > New File from the main menu.
    2. Choose "Web services" category, "Web service" file type.
    3. Click Next.
    4. Provide some package name and click Finish.
    • EXPECTED RESULT: The web service must show up in the "Projects" view, under "Web services" node. There should be the node under "Enterprise beans" node as well.
      File:Image4 TS 61 WebServicesEditorSupport.png screenshot
      Note: You can also check the structure of files in the "Files" view.There is a new ".java" file placed in sub-folders created according to the package you specified (under <projectname>/src/java/<packages*>" folder.
  1. Error highlighting
    1. Go to the source file of the service (double-click the service in the "Projects" view and invoke View > Editors > Source from the main menu).
    2. Change @WebService() to @WebService(serviceName="ms") in the source code.
    3. Change public class NewWebService { to public interface NewWebService {.
    1. Undo both of your changes.
    • EXPECTED RESULT: Errors should disappear.


Test suite: Code completion

Purpose: This test suite checks that code completion of web service annotations works.
Setup: Steps from previous test suite.

  1. Annotations
    1. Create a new line before the class declaration, place the caret to this line.
    2. Type '@' there and press Ctrl+Space to show the list of hints.
    3. Type 'H' to reduce the list size, select "HandlerChain" and press Enter.
    • EXPECTED RESULT: The code is automatically completed to @HandlerChain. There is an import for javax.jws.HandlerChain.
  2. Attributes
    1. Type '(' just behind the @HandlerChain (on the same line), the closing bracket appears if you didn't switch this functionality off (otherwise close the bracket manually and go between the brackets).
    2. Press Ctrl+Space.
    3. Select "file" from the list and press Enter
    • EXPECTED RESULT: The code is automatically completed to "@HandlerChain(file=)", delete all the text on this line - we will use this line in the next test case.
  3. Values
    1. Type @WebParam(header=) before the class declaration and place the caret just behind the '=' character.
    2. Press Ctrl+Space and select "true" from the list. Press Enter.
    • EXPECTED RESULT: Code is completed to @WebParam(header=true). There is an import for javax.jws.WebParam.
    1. Replace the text on the line with @WebParam(mode=), place the caret behind the '=' character again.
    2. Press Ctrl+Space, then press I to reduce the list size and select "Mode.INOUT". Press Enter.
    • EXPECTED RESULT: Code is completed to @WebParam(mode=WebParam.Mode.INOUT)


Test suite: Editor hints

Purpose: This test suite checks that error hints work correctly suggesting appropriate solutions to make user code WS compliant.
Setup: Steps from previous test suites. The web service file should be placed in the package called "test".

  1. Endpoint interface forbidden
    1. Replace the content of web service file with the content of endpointInterface_forbidden.txt file.
    2. There is an error on the line 7. Point with your mouse at red annotation at line 7. "The endpointInterface attribute is not allowed on interfaces" error message is displayed in the tooltip.
    3. Place cursor at line 7 and press Alt+Enter. Select Remove endpointInterface attribute hint and press Enter.
    • EXPECTED RESULT: Forbidden attribute is removed so that you have only @WebService() on the line.
  1. Exceptions forbidden
    1. Replace the content of web service file with the content of exceptions_forbidden.txt file.
    2. An error shows up on the line 11. Point with your mouse at red square at line 11. "An operation marked @Oneway must not declare any exception" error message is displayed in the tooltip.
    3. Place cursor at line 11 and press Alt+Enter. Select "Remove @Oneway annotation" hint and press Enter.
    • EXPECTED RESULT: The line 11 is deleted.
  1. Handlers conflict
    1. Replace the content of web service file with the content of handlers_conflict.txt file.
    2. Warnings show up on lines 10 and 11. Point with your mouse at red square at line 10. "It is not allowed to combine @HandlerChain annotation with @SOAPMessageHandlers annotation" error message is displayed.
    3. Place cursor at line 10 and press Alt+Enter. "Select Remove @HandlerChain annotation" hint and press Enter.
    • EXPECTED RESULT: The line 10 is deleted.
  1. I/O parameters forbidden
    1. Replace the content of web service file with the content of io_parameters_forbidden.txt file.
    2. There is an error on the line 13. Point with your mouse at red square at line 13. "An operation marked @Oneway must not have out/in-out parameters" error message is displayed.
    3. Place cursor at line 13 and press Alt+Enter. Select Remove @Oneway annotation hint and press Enter.
    4. You can repeat the steps 1-3 for the other line with @Oneway annotation that is marked as incorrect.
    • EXPECTED RESULT: Line(s) with a @Oneway annotation is (are) deleted.
  1. Return value forbidden
    1. Replace the content of web service file with the content of return_value_forbidden.txt file.
    2. Error shows up on the line 11. Point with your mouse at red square at line 11. "An operation marked @Oneway must not have a return value" error message is displayed.
    3. Place cursor at line 11 and press Alt+Enter. Select "Remove @Oneway annotation" hint and press Enter.
    • EXPECTED RESULT: The line with an @Oneway annotation is removed.
  1. Service name forbidden
    1. Replace the content of web service file with the content of serviceName_forbidden.txt file.
    2. Error shows up on the line 7. Point with your mouse at red square at line 7. "The serviceName attribute is not allowed on interface" error message is displayed.
    3. Place cursor at line 7 and press Alt+Enter. Select "Remove serviceName attribute" hint and press Enter.
    • EXPECTED RESULT: The attribute is removed so that you have only @WebService() on the line 7 in the source code.
  1. Add new operation
    1. Replace the content of web service file with the content of add_operation.txt file.
    2. An error shows up (line 7). Point with your mouse at red square at line 6. "A webservice must have at least one operation" error message is displayed.
    3. Place cursor at line 6 and press Alt+Enter. A hint "Add new operation" is suggested. Press Enter.
    4. "Add Operation" dialog is invoked. Click OK button.
    • EXPECTED RESULT: New Web service opperation is added, javax.jws.WebMethod is imported.


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