Java Reference
In-Depth Information
LOGGER.debug("Executing.");
String response = gateway.authorize("bgates");
assertEquals("N/A", response);
}
}
Using JUnit 4.4, you can set up your proxies only once, and JUnit's @Before annotation will
set up a fresh instance of the service and the port for each test method to use.
The following shows the output of running the JUnit test:
Received request:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header/>
<S:Body>
<gatewayRequest
xmlns="http://ns.soacookbook.com/gateway">jgosling</gatewayRequest>
</S:Body>
</S:Envelope>
Building SOAP Response.
Creating SOAP Response for user: jgosling
4/15/08-15:05 DEBUG com.soacookbook.ch04.MyProvider.createResponse -
Response ready:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/">
<SOAP-ENV:Header>
<sso xmlns="urn:myNS" authToken="2878f38f-5515..."
gateway="192.168.1.102"/>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<gatewayResponse>ADMIN</gatewayResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The unit test sends two messages. One containing a username that should be authorized and
get a temporary authorization Single Sign On token. The other contains a username that
should not be authorized, and gets no header element set with no token, and the response in-
dicates “N/A” for “Not Authorized.”
Search WWH ::




Custom Search