use of org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType in project ddf by codice.
the class RegistryPublicationServiceImplTest method setup.
@Before
public void setup() {
federationAdminService = mock(FederationAdminService.class);
registryPublicationService = Mockito.spy(new RegistryPublicationServiceImpl());
registryPublicationService.setFederationAdminService(federationAdminService);
metacard = new MetacardImpl(new RegistryObjectMetacardType());
metacard.setId("mcardId");
metacard.setTags(Collections.singleton(RegistryConstants.REGISTRY_TAG));
when(registryPublicationService.getBundleContext()).thenReturn(bundleContext);
when(bundleContext.getService(serviceReference)).thenReturn(registryStore);
doReturn(REGISTRY_STORE_REGISTRY_ID).when(registryStore).getRegistryId();
doReturn(REGISTRY_STORE_ID).when(registryStore).getId();
registryPublicationService.bindRegistryStore(serviceReference);
}
use of org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType in project ddf by codice.
the class RefreshRegistryEntriesTest method getPopulatedTestRegistryMetacard.
private MetacardImpl getPopulatedTestRegistryMetacard(String id, String regId, long dateOffset, boolean internal, String remoteMcardId) {
MetacardImpl registryMetacard = new MetacardImpl(new RegistryObjectMetacardType());
registryMetacard.setAttribute(new AttributeImpl(RegistryObjectMetacardType.REGISTRY_ID, regId));
registryMetacard.setAttribute(new AttributeImpl(Metacard.MODIFIED, new Date(new Date().getTime() + dateOffset)));
if (internal) {
registryMetacard.setAttribute(new AttributeImpl(RegistryObjectMetacardType.REMOTE_METACARD_ID, remoteMcardId));
registryMetacard.setAttribute(new AttributeImpl(RegistryObjectMetacardType.REMOTE_REGISTRY_ID, "remoteRegId"));
registryMetacard.setAttribute(new AttributeImpl(Metacard.TAGS, Collections.singletonList(RegistryConstants.REGISTRY_TAG_INTERNAL)));
} else {
registryMetacard.setAttribute(new AttributeImpl(Metacard.TAGS, Collections.singletonList(RegistryConstants.REGISTRY_TAG)));
}
registryMetacard.setAttribute(new AttributeImpl(Metacard.ID, id));
registryMetacard.setAttribute(new AttributeImpl(Metacard.METADATA, TEST_XML_STRING));
return registryMetacard;
}
use of org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType in project ddf by codice.
the class TestRegistryStore method getDefaultMetacard.
private MetacardImpl getDefaultMetacard() {
InputStream inputStream = getClass().getResourceAsStream("/csw-full-registry-package.xml");
BufferedReader buffer = new BufferedReader(new InputStreamReader(inputStream));
String xml = buffer.lines().collect(Collectors.joining("\n"));
MetacardImpl mcard = new MetacardImpl(new RegistryObjectMetacardType());
mcard.setId("testId");
mcard.setTags(Collections.singleton(RegistryConstants.REGISTRY_TAG));
mcard.setAttribute(RegistryObjectMetacardType.REGISTRY_ID, "registryId");
mcard.setContentTypeName(RegistryConstants.REGISTRY_NODE_METACARD_TYPE_NAME);
mcard.setMetadata(xml);
mcard.setTitle("testRegistryMetacard");
return mcard;
}
use of org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType in project ddf by codice.
the class RegistryReportBuilderTest method setup.
@Before
public void setup() {
parser = new XmlParser();
registryTransformer = spy(new RegistryTransformer());
registryTransformer.setParser(parser);
registryTransformer.setRegistryMetacardType(new RegistryObjectMetacardType());
configurator = parser.configureParser(Arrays.asList(RegistryObjectType.class.getPackage().getName(), EbrimConstants.OGC_FACTORY.getClass().getPackage().getName(), EbrimConstants.GML_FACTORY.getClass().getPackage().getName()), this.getClass().getClassLoader());
reportHelper = new RegistryReportBuilder();
reportHelper.setup();
}
use of org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType 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