@Test public void testDoSendSucceeds() throws Exception { EgovWebService service = new EgovWebService("test", 5000, integrationDefinition, echoClient); EgovIntegrationMessage requestMessage = service.createRequestMessage(); EgovIntegrationMessage responseMessage = service.doSend(requestMessage); assertNotNull(responseMessage); assertNotNull(responseMessage.getHeader()); EgovIntegrationMessageHeader requestHeader = requestMessage.getHeader(); EgovIntegrationMessageHeader responseHeader = responseMessage.getHeader(); assertEquals(requestHeader.getIntegrationId(), responseHeader.getIntegrationId()); assertEquals( requestHeader.getProviderOrganizationId(), responseHeader.getProviderOrganizationId()); assertEquals(requestHeader.getProviderSystemId(), responseHeader.getProviderSystemId()); assertEquals(requestHeader.getProviderServiceId(), responseHeader.getProviderServiceId()); assertEquals( requestHeader.getConsumerOrganizationId(), responseHeader.getConsumerOrganizationId()); assertEquals(requestHeader.getConsumerSystemId(), responseHeader.getConsumerSystemId()); assertEquals(requestHeader.getRequestSendTime(), responseHeader.getRequestSendTime()); assertNotNull(responseHeader.getRequestReceiveTime()); assertNotNull(responseHeader.getResponseSendTime()); assertNotNull(responseHeader.getResponseReceiveTime()); assertEquals(ResultCode.OK, responseHeader.getResultCode()); }
@Test public void testCreateRequestMessageSucceeds() throws Exception { EgovWebService service = new EgovWebService("test", 5000, integrationDefinition, echoClient); EgovIntegrationMessage requestMessage = service.createRequestMessage(); assertNotNull(requestMessage); assertNotNull(requestMessage.getHeader()); EgovIntegrationMessageHeader header = requestMessage.getHeader(); assertEquals(integrationDefinition.getId(), header.getIntegrationId()); assertEquals(providerOrganization.getId(), header.getProviderOrganizationId()); assertEquals(providerSystem.getId(), header.getProviderSystemId()); assertEquals(providerService.getId(), header.getProviderServiceId()); assertEquals(consumerOrganization.getId(), header.getConsumerOrganizationId()); assertEquals(consumerSystem.getId(), header.getConsumerSystemId()); assertNotNull(requestMessage.getBody()); assertEquals(0, requestMessage.getBody().size()); }