@Test public void shouldProcessListCentralServices() throws Exception { final List<CentralServiceId> expectedCentraServices = Arrays.asList( create(EXPECTED_XR_INSTANCE, "getInfo"), create(EXPECTED_XR_INSTANCE, "someService"), create(EXPECTED_XR_INSTANCE, "getRandom")); GlobalConf.reload(new TestGlobalConf() { @Override public List<CentralServiceId> getCentralServices(String instanceIdentifier) { assertThat("Wrong Xroad instance in query", instanceIdentifier, is(EXPECTED_XR_INSTANCE)); return expectedCentraServices; } }); MetadataClientRequestProcessor processorToTest = new MetadataClientRequestProcessor(LIST_CENTRAL_SERVICES, mockRequest, mockResponse); processorToTest.process(); assertContentTypeIsIn(xmlUtf8ContentTypes()); List<CentralServiceId> resultCentralServices = unmarshaller.unmarshal( mockServletOutputStream.getResponseSource(), CentralServiceListType.class) .getValue().getCentralService(); assertThat("Wrong amount of services", resultCentralServices.size(), is(expectedCentraServices.size())); assertThat("Wrong services", resultCentralServices, containsInAnyOrder(expectedCentraServices.toArray())); }
@Override public void process() throws Exception { switch (target) { case LIST_CLIENTS: handleListClients(); return; case LIST_CENTRAL_SERVICES: handleListCentralServices(); return; case WSDL: handleWsdl(); return; default: break; } }
MetadataClientRequestProcessor extends MessageProcessorBase { @Override public void process() throws Exception { switch (target) { case LIST_CLIENTS: handleListClients(); return; case LIST_CENTRAL_SERVICES: handleListCentralServices(); return; case WSDL: handleWsdl(); return; default: break; } } }
MetadataClientRequestProcessor extends MessageProcessorBase { @Override public void process() throws Exception { switch (target) { case LIST_CLIENTS: handleListClients(); return; case LIST_CENTRAL_SERVICES: handleListCentralServices(); return; case WSDL: handleWsdl(); return; default: break; } } MetadataClientRequestProcessor(String target,
            HttpServletRequest request, HttpServletResponse response); }
MetadataClientRequestProcessor extends MessageProcessorBase { @Override public void process() throws Exception { switch (target) { case LIST_CLIENTS: handleListClients(); return; case LIST_CENTRAL_SERVICES: handleListCentralServices(); return; case WSDL: handleWsdl(); return; default: break; } } MetadataClientRequestProcessor(String target,
            HttpServletRequest request, HttpServletResponse response); boolean canProcess(); @Override void process(); @Override MessageInfo createRequestMessageInfo(); }
MetadataClientRequestProcessor extends MessageProcessorBase { @Override public void process() throws Exception { switch (target) { case LIST_CLIENTS: handleListClients(); return; case LIST_CENTRAL_SERVICES: handleListCentralServices(); return; case WSDL: handleWsdl(); return; default: break; } } MetadataClientRequestProcessor(String target,
            HttpServletRequest request, HttpServletResponse response); boolean canProcess(); @Override void process(); @Override MessageInfo createRequestMessageInfo();  }