use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType in project ddf by codice.
the class FederationAdminTest method testBindEndpointNullReference.
@Test
public void testBindEndpointNullReference() throws Exception {
List<RegistryPackageType> regObjects = Collections.singletonList((RegistryPackageType) getRegistryObjectFromResource("/csw-full-registry-package.xml"));
when(federationAdminService.getRegistryObjects()).thenReturn(regObjects);
mcard.setAttribute(RegistryObjectMetacardType.REGISTRY_ID, "urn:uuid:2014ca7f59ac46f495e32b4a67a51276");
when(federationAdminService.getRegistryMetacards()).thenReturn(Collections.singletonList(mcard));
federationAdmin.bindEndpoint(null);
Map<String, Object> autoValues = (Map<String, Object>) federationAdmin.getLocalNodes().get("autoPopulateValues");
assertThat(autoValues.size(), is(1));
Collection bindingValues = (Collection) autoValues.get("ServiceBinding");
assertThat(bindingValues.size(), is(0));
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType in project ddf by codice.
the class FederationAdminTest method testUpdateLocalEntryWithEmptyExistingList.
@Test(expected = FederationAdminException.class)
public void testUpdateLocalEntryWithEmptyExistingList() throws Exception {
RegistryPackageType registryObject = getRegistryObjectFromResource("/csw-full-registry-package.xml");
Map<String, Object> registryMap = getMapFromRegistryObject(registryObject);
List<Metacard> existingMetacards = new ArrayList<>();
when(federationAdminService.getLocalRegistryMetacardsByRegistryIds(Collections.singletonList(registryObject.getId()))).thenReturn(existingMetacards);
federationAdmin.updateLocalEntry(registryMap);
verify(federationAdminService, never()).getLocalRegistryMetacardsByRegistryIds(Collections.singletonList(registryObject.getId()));
verify(registryTransformer, never()).transform(any(InputStream.class));
verify(federationAdminService, never()).updateRegistryEntry(any(Metacard.class));
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType in project ddf by codice.
the class FederationAdminTest method testCreateLocalEntry.
@Test
public void testCreateLocalEntry() throws Exception {
String metacardId = "metacardId";
RegistryPackageType registryObject = getRegistryObjectFromResource("/csw-full-registry-package.xml");
Map<String, Object> registryMap = getMapFromRegistryObject(registryObject);
Metacard metacard = getTestMetacard();
when(registryTransformer.transform(any(InputStream.class))).thenReturn(metacard);
when(federationAdminService.addRegistryEntry(any(Metacard.class))).thenReturn(metacardId);
String createdMetacardId = federationAdmin.createLocalEntry(registryMap);
assertThat(createdMetacardId, is(equalTo(metacardId)));
verify(federationAdminService).addRegistryEntry(metacard);
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType in project ddf by codice.
the class FederationAdminServiceImplTest method testGetRegistryObjectByMetacardId.
@Test
public void testGetRegistryObjectByMetacardId() throws Exception {
Metacard metacard = testMetacard;
QueryRequest request = getTestQueryRequest();
QueryResponse response = getPopulatedTestQueryResponse(request, metacard);
RegistryPackageType expectedRegistryPackage = getTestRegistryPackage();
JAXBElement<RegistryPackageType> jaxbRegistryPackage = EbrimConstants.RIM_FACTORY.createRegistryPackage(expectedRegistryPackage);
when(catalogFramework.query(any(QueryRequest.class))).thenReturn(response);
when(parser.unmarshal(any(ParserConfigurator.class), eq(JAXBElement.class), any(InputStream.class))).thenReturn(jaxbRegistryPackage);
RegistryPackageType registryPackage = federationAdminServiceImpl.getRegistryObjectByRegistryId(TEST_METACARD_ID, null);
assertThat(registryPackage, is(sameInstance(expectedRegistryPackage)));
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType in project ddf by codice.
the class FederationAdminServiceImplTest method testGetRegistryObjectsWithNoRegistryEntries.
@Test
public void testGetRegistryObjectsWithNoRegistryEntries() throws Exception {
QueryRequest request = getTestQueryRequest();
QueryResponse response = getPopulatedTestQueryResponse(request);
when(catalogFramework.query(any(QueryRequest.class))).thenReturn(response);
List<RegistryPackageType> packages = federationAdminServiceImpl.getRegistryObjects();
assertThat(packages, empty());
verify(catalogFramework).query(any(QueryRequest.class));
verify(parser, never()).unmarshal(any(ParserConfigurator.class), eq(JAXBElement.class), any(InputStream.class));
}
Aggregations