use of ee.ria.xroad.common.metadata.MetadataRequests.LIST_CLIENTS in project X-Road by nordic-institute.
the class MetadataClientRequestProcessorTest method shouldProcessListClients.
@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 TestSuiteGlobalConf() {
@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()));
}
Aggregations