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.
Test suite: Code completion
Purpose: This test suite checks that code completion of web service annotations works.
Setup: Steps from previous test suite.
- Annotations
- Create a new line before the class declaration, place the caret to this line.
- Type '@' there and press Ctrl+Space to show the list of hints.
- 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.
- Attributes
- 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).
- Press Ctrl+Space.
- 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.
- Values
- Type @WebParam(header=) before the class declaration and place the caret just behind the '=' character.
- 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.
- Replace the text on the line with @WebParam(mode=), place the caret behind the '=' character again.
- 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".
- Endpoint interface forbidden
- Replace the content of web service file with the content of endpointInterface_forbidden.txt file.
- 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.
- 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.
- Exceptions forbidden
- Replace the content of web service file with the content of exceptions_forbidden.txt file.
- 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.
- Place cursor at line 11 and press Alt+Enter. Select "Remove @Oneway annotation" hint and press Enter.
- EXPECTED RESULT: The line 11 is deleted.
- Handlers conflict
- Replace the content of web service file with the content of handlers_conflict.txt file.
- 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.
- Place cursor at line 10 and press Alt+Enter. "Select Remove @HandlerChain annotation" hint and press Enter.
- EXPECTED RESULT: The line 10 is deleted.
- I/O parameters forbidden
- Replace the content of web service file with the content of io_parameters_forbidden.txt file.
- 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.
- Place cursor at line 13 and press Alt+Enter. Select Remove @Oneway annotation hint and press Enter.
- 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.
- Return value forbidden
- Replace the content of web service file with the content of return_value_forbidden.txt file.
- 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.
- 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.
- Service name forbidden
- Replace the content of web service file with the content of serviceName_forbidden.txt file.
- 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.
- 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.
- Add new operation
- Replace the content of web service file with the content of add_operation.txt file.
- 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.
- Place cursor at line 6 and press Alt+Enter. A hint "Add new operation" is suggested. Press Enter.
- "Add Operation" dialog is invoked. Click OK button.
- EXPECTED RESULT: New Web service opperation is added, javax.jws.WebMethod is imported.