Search in sources :

Example 1 with SlotTypeHelper

use of org.codice.ddf.registry.schemabindings.helper.SlotTypeHelper in project ddf by codice.

the class IdentityNodeInitializationTest method buildRegistryPackageType.

private RegistryPackageType buildRegistryPackageType() {
    SlotTypeHelper slotTypeHelper = new SlotTypeHelper();
    InternationalStringTypeHelper internationalStringTypeHelper = new InternationalStringTypeHelper();
    String registryPackageId = RegistryConstants.GUID_PREFIX + UUID.randomUUID().toString().replaceAll("-", "");
    RegistryPackageType registryPackage = RIM_FACTORY.createRegistryPackageType();
    registryPackage.setId(registryPackageId);
    registryPackage.setObjectType(RegistryConstants.REGISTRY_NODE_OBJECT_TYPE);
    ExtrinsicObjectType extrinsicObject = RIM_FACTORY.createExtrinsicObjectType();
    extrinsicObject.setObjectType(RegistryConstants.REGISTRY_NODE_OBJECT_TYPE);
    String extrinsicObjectId = RegistryConstants.GUID_PREFIX + UUID.randomUUID().toString().replaceAll("-", "");
    extrinsicObject.setId(extrinsicObjectId);
    extrinsicObject.setName(internationalStringTypeHelper.create(TEST_SITE_NAME));
    String home = SystemBaseUrl.getBaseUrl();
    extrinsicObject.setHome(home);
    registryPackage.setRegistryObjectList(RIM_FACTORY.createRegistryObjectListType());
    registryPackage.getRegistryObjectList().getIdentifiable().add(RIM_FACTORY.createIdentifiable(extrinsicObject));
    return registryPackage;
}
Also used : SlotTypeHelper(org.codice.ddf.registry.schemabindings.helper.SlotTypeHelper) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) InternationalStringTypeHelper(org.codice.ddf.registry.schemabindings.helper.InternationalStringTypeHelper) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)

Example 2 with SlotTypeHelper

use of org.codice.ddf.registry.schemabindings.helper.SlotTypeHelper 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)

Example 3 with SlotTypeHelper

use of org.codice.ddf.registry.schemabindings.helper.SlotTypeHelper in project ddf by codice.

the class SourceConfigurationHandlerTest method setUp.

@Before
public void setUp() throws Exception {
    parser = new XmlParser();
    adminService = mock(FederationAdminService.class);
    configAdmin = mock(ConfigurationAdmin.class);
    metaTypeService = mock(MetaTypeService.class);
    bundleContext = mock(BundleContext.class);
    executorService = mock(ExecutorService.class);
    sch = new SourceConfigurationHandler(adminService, executorService) {

        @Override
        protected BundleContext getBundleContext() {
            return bundleContext;
        }
    };
    sch.setMetacardMarshaller(new MetacardMarshaller(parser));
    sch.setConfigurationAdmin(configAdmin);
    sch.setMetaTypeService(metaTypeService);
    sch.setSlotHelper(new SlotTypeHelper());
    sch.setRegistryTypeHelper(new RegistryPackageTypeHelper());
    sch.setActivateConfigurations(false);
    sch.setPreserveActiveConfigurations(true);
    sch.setUrlBindingName("urlBindingName");
    sch.setBindingTypeFactoryPid(Collections.singletonList("CSW_2.0.2=Csw_Federated_Source"));
    sch.setSourceActivationPriorityOrder(Collections.singletonList("CSW_2.0.2"));
    sch.setCleanUpOnDelete(false);
    Bundle bundle = mock(Bundle.class);
    mti = mock(MetaTypeInformation.class);
    ocd = mock(ObjectClassDefinition.class);
    config = mock(Configuration.class);
    AttributeDefinition adi = new AttributeDefinitionImpl("attId", "attName", "attDesc", "attValue");
    when(adminService.getRegistryMetacards()).thenReturn(new ArrayList());
    when(bundleContext.getBundles()).thenReturn(new Bundle[] { bundle });
    when(configAdmin.listConfigurations("(id=TestRegNode")).thenReturn(null);
    when(configAdmin.listConfigurations("(registry-id=urn:uuid:2014ca7f59ac46f495e32b4a67a51276")).thenReturn(null);
    when(metaTypeService.getMetaTypeInformation(any(Bundle.class))).thenReturn(mti);
    when(mti.getObjectClassDefinition(anyString(), anyString())).thenReturn(ocd);
    when(ocd.getAttributeDefinitions(anyInt())).thenReturn(new AttributeDefinition[] { adi });
    when(configAdmin.createFactoryConfiguration(anyString(), anyString())).thenReturn(config);
    mcard = new MetacardImpl(new RegistryObjectMetacardType());
    mcard.setTags(Collections.singleton(RegistryConstants.REGISTRY_TAG));
    mcard.setId("2014ca7f59ac46f495e32b4a67a51276");
    mcard.setAttribute(RegistryObjectMetacardType.REGISTRY_ID, "urn:uuid:2014ca7f59ac46f495e32b4a67a51276");
    mcard.setMetadata(getMetadata("/csw-rim-node-csw-binding.xml"));
    mcard.setTitle("TestRegNode");
    Dictionary<String, Object> eventProperties = new Hashtable<>();
    eventProperties.put("ddf.catalog.event.metacard", mcard);
    createEvent = new Event("ddf/catalog/event/CREATED", eventProperties);
    updateEvent = new Event("ddf/catalog/event/UPDATED", eventProperties);
    deleteEvent = new Event("ddf/catalog/event/DELETED", eventProperties);
    System.setProperty(RegistryConstants.REGISTRY_ID_PROPERTY, "myRegId");
}
Also used : MetaTypeService(org.osgi.service.metatype.MetaTypeService) Configuration(org.osgi.service.cm.Configuration) SlotTypeHelper(org.codice.ddf.registry.schemabindings.helper.SlotTypeHelper) ArrayList(java.util.ArrayList) AttributeDefinition(org.osgi.service.metatype.AttributeDefinition) Matchers.anyString(org.mockito.Matchers.anyString) ObjectClassDefinition(org.osgi.service.metatype.ObjectClassDefinition) XmlParser(org.codice.ddf.parser.xml.XmlParser) MetacardMarshaller(org.codice.ddf.registry.schemabindings.helper.MetacardMarshaller) Bundle(org.osgi.framework.Bundle) Hashtable(java.util.Hashtable) FederationAdminService(org.codice.ddf.registry.federationadmin.service.internal.FederationAdminService) MetaTypeInformation(org.osgi.service.metatype.MetaTypeInformation) RegistryObjectMetacardType(org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) ExecutorService(java.util.concurrent.ExecutorService) Event(org.osgi.service.event.Event) RegistryPackageTypeHelper(org.codice.ddf.registry.schemabindings.helper.RegistryPackageTypeHelper) ConfigurationAdmin(org.osgi.service.cm.ConfigurationAdmin) BundleContext(org.osgi.framework.BundleContext) Before(org.junit.Before)

Aggregations

SlotTypeHelper (org.codice.ddf.registry.schemabindings.helper.SlotTypeHelper)3 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)2 XmlParser (org.codice.ddf.parser.xml.XmlParser)2 RegistryObjectMetacardType (org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType)2 MetacardMarshaller (org.codice.ddf.registry.schemabindings.helper.MetacardMarshaller)2 Before (org.junit.Before)2 BundleContext (org.osgi.framework.BundleContext)2 ResultImpl (ddf.catalog.data.impl.ResultImpl)1 QueryRequest (ddf.catalog.operation.QueryRequest)1 ArrayList (java.util.ArrayList)1 Hashtable (java.util.Hashtable)1 ExecutorService (java.util.concurrent.ExecutorService)1 ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)1 RegistryPackageType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType)1 FederationAdminService (org.codice.ddf.registry.federationadmin.service.internal.FederationAdminService)1 RegistryPackageTypeConverter (org.codice.ddf.registry.schemabindings.converter.type.RegistryPackageTypeConverter)1 RegistryPackageWebConverter (org.codice.ddf.registry.schemabindings.converter.web.RegistryPackageWebConverter)1 InternationalStringTypeHelper (org.codice.ddf.registry.schemabindings.helper.InternationalStringTypeHelper)1 RegistryPackageTypeHelper (org.codice.ddf.registry.schemabindings.helper.RegistryPackageTypeHelper)1 Matchers.anyString (org.mockito.Matchers.anyString)1