Search in sources :

Example 1 with RegistryObjectMetacardType

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);
}
Also used : FederationAdminService(org.codice.ddf.registry.federationadmin.service.internal.FederationAdminService) RegistryObjectMetacardType(org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Before(org.junit.Before)

Example 2 with RegistryObjectMetacardType

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;
}
Also used : AttributeImpl(ddf.catalog.data.impl.AttributeImpl) RegistryObjectMetacardType(org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Date(java.util.Date)

Example 3 with RegistryObjectMetacardType

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;
}
Also used : InputStreamReader(java.io.InputStreamReader) InputStream(java.io.InputStream) BufferedReader(java.io.BufferedReader) RegistryObjectMetacardType(org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType) MetacardImpl(ddf.catalog.data.impl.MetacardImpl)

Example 4 with RegistryObjectMetacardType

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();
}
Also used : XmlParser(org.codice.ddf.parser.xml.XmlParser) RegistryTransformer(org.codice.ddf.registry.transformer.RegistryTransformer) RegistryObjectMetacardType(org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType) Before(org.junit.Before)

Example 5 with RegistryObjectMetacardType

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);
}
Also used : XmlParser(org.codice.ddf.parser.xml.XmlParser) QueryRequest(ddf.catalog.operation.QueryRequest) MetacardMarshaller(org.codice.ddf.registry.schemabindings.helper.MetacardMarshaller) SlotTypeHelper(org.codice.ddf.registry.schemabindings.helper.SlotTypeHelper) RegistryPackageWebConverter(org.codice.ddf.registry.schemabindings.converter.web.RegistryPackageWebConverter) ResultImpl(ddf.catalog.data.impl.ResultImpl) RegistryObjectMetacardType(org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) RegistryPackageTypeConverter(org.codice.ddf.registry.schemabindings.converter.type.RegistryPackageTypeConverter) BundleContext(org.osgi.framework.BundleContext) Before(org.junit.Before)

Aggregations

RegistryObjectMetacardType (org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType)10 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)7 Before (org.junit.Before)6 XmlParser (org.codice.ddf.parser.xml.XmlParser)5 MetacardMarshaller (org.codice.ddf.registry.schemabindings.helper.MetacardMarshaller)3 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)2 FederationAdminService (org.codice.ddf.registry.federationadmin.service.internal.FederationAdminService)2 SlotTypeHelper (org.codice.ddf.registry.schemabindings.helper.SlotTypeHelper)2 RegistryTransformer (org.codice.ddf.registry.transformer.RegistryTransformer)2 BundleContext (org.osgi.framework.BundleContext)2 MetacardTypeImpl (ddf.catalog.data.impl.MetacardTypeImpl)1 ResultImpl (ddf.catalog.data.impl.ResultImpl)1 ContactAttributes (ddf.catalog.data.impl.types.ContactAttributes)1 CoreAttributes (ddf.catalog.data.impl.types.CoreAttributes)1 DateTimeAttributes (ddf.catalog.data.impl.types.DateTimeAttributes)1 MediaAttributes (ddf.catalog.data.impl.types.MediaAttributes)1 TopicAttributes (ddf.catalog.data.impl.types.TopicAttributes)1 QueryRequest (ddf.catalog.operation.QueryRequest)1 BufferedReader (java.io.BufferedReader)1 InputStream (java.io.InputStream)1