use of org.codice.ddf.registry.schemabindings.converter.web.RegistryPackageWebConverter in project ddf by codice.
the class FederationAdminTest method testGetLocalNodes.
@Test
public void testGetLocalNodes() throws Exception {
RegistryPackageType registryObject = getRegistryObjectFromResource("/csw-registry-package-smaller.xml");
Map<String, Object> registryObjectMap = new RegistryPackageWebConverter().convert(registryObject);
List<RegistryPackageType> registryPackages = new ArrayList<>();
registryPackages.add((RegistryPackageType) registryObject);
when(federationAdminService.getLocalRegistryObjects()).thenReturn(registryPackages);
Map<String, Object> localNodes = federationAdmin.getLocalNodes();
Map<String, Object> localNode = ((List<Map<String, Object>>) localNodes.get(LOCAL_NODE_KEY)).get(0);
verify(federationAdminService).getLocalRegistryObjects();
assertThat(localNode, is(equalTo(registryObjectMap)));
}
use of org.codice.ddf.registry.schemabindings.converter.web.RegistryPackageWebConverter in project ddf by codice.
the class RegistryPackageWebConverterTest method testRoundTrip.
@Test
public void testRoundTrip() throws Exception {
RegistryPackageWebConverter rpwConverter = new RegistryPackageWebConverter();
RegistryPackageType testRegistryPackage = getTestRegistryPackage();
Map<String, Object> testRegistryPackageMap = rpwConverter.convert(testRegistryPackage);
RegistryPackageTypeConverter rptConverter = new RegistryPackageTypeConverter();
Optional<RegistryPackageType> optionalRegistryPackage = rptConverter.convert(testRegistryPackageMap);
RegistryPackageType convertedTestRegistryPackage = optionalRegistryPackage.get();
assertThat(testRegistryPackage.getObjectType(), is(equalTo(convertedTestRegistryPackage.getObjectType())));
assertThat(testRegistryPackage.getId(), is(equalTo(convertedTestRegistryPackage.getId())));
assertThat(testRegistryPackage.getHome(), is(equalTo(convertedTestRegistryPackage.getHome())));
assertThat(testRegistryPackage.getExternalIdentifier(), is(equalTo(convertedTestRegistryPackage.getExternalIdentifier())));
assertThat((testRegistryPackage).getRegistryObjectList().getIdentifiable().size(), is(equalTo((convertedTestRegistryPackage).getRegistryObjectList().getIdentifiable().size())));
assertThat(testRegistryPackage, is(equalTo(convertedTestRegistryPackage)));
}
use of org.codice.ddf.registry.schemabindings.converter.web.RegistryPackageWebConverter in project ddf by codice.
the class FederationAdminTest method setup.
@Before
public void setup() throws Exception {
parser = new XmlParser();
configurator = parser.configureParser(Arrays.asList(RegistryObjectType.class.getPackage().getName(), EbrimConstants.OGC_FACTORY.getClass().getPackage().getName(), EbrimConstants.GML_FACTORY.getClass().getPackage().getName()), this.getClass().getClassLoader());
federationAdmin = new FederationAdmin(helper) {
@Override
public BundleContext getContext() {
return context;
}
};
federationAdmin.setFederationAdminService(federationAdminService);
federationAdmin.setRegistryTransformer(registryTransformer);
federationAdmin.setMetacardMarshaller(new MetacardMarshaller(parser));
federationAdmin.setSlotHelper(new SlotTypeHelper());
federationAdmin.setRegistryMapConverter(new RegistryPackageWebConverter());
federationAdmin.setRegistryTypeConverter(new RegistryPackageTypeConverter());
federationAdmin.setSourceConfigRefresh(sourceConfiguration);
mcard = new MetacardImpl(new RegistryObjectMetacardType());
mcard.setAttribute(RegistryObjectMetacardType.REGISTRY_ID, "myId");
mcard.setAttribute(RegistryObjectMetacardType.PUBLISHED_LOCATIONS, new ArrayList<>());
mcard.setId("someUUID");
when(queryResponse.getResults()).thenReturn(Collections.singletonList(new ResultImpl(mcard)));
when(catalogFramework.query(any(QueryRequest.class))).thenReturn(queryResponse);
catalogStoreMap.put("myDest", store);
}
Aggregations