@Test public void shouldProcessListClients() throws Exception { final List<MemberInfo> expectedMembers = Arrays.asList( createMember("producer", null), createMember("producer", "subsystem"), createMember("anothermemeber", null), createMember("anothermemeber", "somesub"), createMember("thirdmember", null)); GlobalConf.reload(new TestGlobalConf() { @Override public List<MemberInfo> getMembers(String... instanceIdentifier) { String[] instances = instanceIdentifier; assertThat("Wrong Xroad instance in query", instances, arrayContaining(EXPECTED_XR_INSTANCE)); return expectedMembers; } }); MetadataClientRequestProcessor processorToTest = new MetadataClientRequestProcessor(LIST_CLIENTS, mockRequest, mockResponse); processorToTest.process(); assertContentTypeIsIn(xmlUtf8ContentTypes()); List<MemberInfo> members = unmarshaller.unmarshal( mockServletOutputStream.getResponseSource(), ClientListType.class) .getValue() .getMember() .stream() .map(clientType -> new MemberInfo(clientType.getId(), clientType.getName())) .collect(Collectors.toList()); assertThat("Wrong amount of clients", members.size(), is(expectedMembers.size())); assertThat("Wrong members", members, containsInAnyOrder(expectedMembers.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();  }