Search in sources :

Example 16 with SlotType1

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 in project ddf by codice.

the class SlotTypeHelperTest method testGetNameSlotMap.

@Test
public void testGetNameSlotMap() throws Exception {
    RegistryObjectType rot = getRegistryObjectFromResource("/registry-package-slots-only-with-dup.xml");
    List<SlotType1> slots = rot.getSlot();
    String specialSlotCase = "serviceType";
    String expectedServiceType = "SOAP";
    Map<String, SlotType1> slotMap = stHelper.getNameSlotMap(slots);
    for (SlotType1 slot : slots) {
        String slotName = slot.getName();
        // Skip special case which will be tested below
        if (specialSlotCase.equals(slotName)) {
            continue;
        }
        assertThat(slotMap, hasKey(slotName));
        SlotType1 mappedSlot = slotMap.get(slotName);
        assertThat(mappedSlot, is(equalTo(slot)));
    }
    // ServiceType slot is repeated in the test xml
    // Testing that the second one (SOAP)is stored
    SlotType1 serviceType = slotMap.get(specialSlotCase);
    assertThat(serviceType, notNullValue());
    String value = stHelper.getStringValues(serviceType).get(0);
    assertThat(value, is(equalTo(expectedServiceType)));
}
Also used : SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) RegistryObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType) Test(org.junit.Test)

Example 17 with SlotType1

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 in project ddf by codice.

the class RegistryPackageTypeHelperTest method assertExtrinsicObjects.

private void assertExtrinsicObjects(List<ExtrinsicObjectType> extrinsicObjects) {
    // Values from xml file
    int expectedSize = 4;
    int numberOfSlots = 10;
    String expectedName = "Node Name";
    String expectedDescription = "A little something describing this node in less than 1024 characters";
    String expectedVersion = "2.9.x";
    String linksSlotName = "links";
    String linksSlotValue = "https://some/link/to/my/repo";
    String regionSlotName = "region";
    String regionSlotValue = "USA";
    String inputDataSourcesSlotName = "inputDataSources";
    String inputDataSourcesSlotValue1 = "youtube";
    String inputDataSourcesSlotValue2 = "myCamera";
    String dataTypesSlotName = "dataTypes";
    String dataTypesSlotValue1 = "video";
    String dataTypesSlotValue2 = "sensor";
    String securityLevelSlotName = "securityLevel";
    String securityLevelSlotValue = "role=guest";
    assertThat(extrinsicObjects, hasSize(expectedSize));
    ExtrinsicObjectType extrinsicObject = extrinsicObjects.get(0);
    assertThat(extrinsicObject.isSetName(), is(true));
    assertIst(extrinsicObject.getName(), expectedName);
    assertThat(extrinsicObject.isSetDescription(), is(true));
    assertIst(extrinsicObject.getDescription(), expectedDescription);
    assertThat(extrinsicObject.isSetVersionInfo(), is(true));
    assertThat(extrinsicObject.getVersionInfo().getVersionName(), is(equalTo(expectedVersion)));
    assertThat(extrinsicObject.isSetSlot(), is(true));
    assertThat(extrinsicObject.getSlot(), hasSize(numberOfSlots));
    Map<String, SlotType1> slotMap = stHelper.getNameSlotMap(extrinsicObject.getSlot());
    assertThat(slotMap, hasKey(linksSlotName));
    assertSlotValue(slotMap.get(linksSlotName), 1, linksSlotValue);
    assertThat(slotMap, hasKey(regionSlotName));
    assertSlotValue(slotMap.get(regionSlotName), 1, regionSlotValue);
    assertThat(slotMap, hasKey(securityLevelSlotName));
    assertSlotValue(slotMap.get(securityLevelSlotName), 1, securityLevelSlotValue);
    assertThat(slotMap, hasKey(inputDataSourcesSlotName));
    assertSlotValue(slotMap.get(inputDataSourcesSlotName), 2, inputDataSourcesSlotValue1, inputDataSourcesSlotValue2);
    assertThat(slotMap, hasKey(dataTypesSlotName));
    assertSlotValue(slotMap.get(dataTypesSlotName), 2, dataTypesSlotValue1, dataTypesSlotValue2);
}
Also used : SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)

Example 18 with SlotType1

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 in project ddf by codice.

the class RegistryPackageTypeHelperTest method assertBindings.

private void assertBindings(List<ServiceBindingType> bindings) {
    // Values from xml file
    int expectedSize = 2;
    int numberOfSlots = 4;
    String expectedName = "CSW Federation Method";
    String expectedDescription = "This is the CSW federation method.";
    String expectedVersion = "2.0.2";
    String cswUrlSlotName = "cswUrl";
    String cswUrlSlotValue = "https://some/address/here";
    String bindingTypeSlotName = "bindingType";
    String bindingTypeSlotValue = "Csw_Federated_Source";
    String serviceTypeSlotName = "serviceType";
    String serviceTypeSlotValue = "REST";
    String endpointDocumentationSlotName = "endpointDocumentation";
    String endpointDocumentationSlotValue = "https://some/path/to/docs.html";
    assertThat(bindings, hasSize(expectedSize));
    ServiceBindingType binding = bindings.get(0);
    assertThat(binding.isSetAccessURI(), is(false));
    assertThat(binding.isSetName(), is(true));
    assertIst(binding.getName(), expectedName);
    assertThat(binding.isSetDescription(), is(true));
    assertIst(binding.getDescription(), expectedDescription);
    assertThat(binding.isSetVersionInfo(), is(true));
    assertThat(binding.getVersionInfo().getVersionName(), is(equalTo(expectedVersion)));
    assertThat(binding.isSetSlot(), is(true));
    assertThat(binding.getSlot(), hasSize(numberOfSlots));
    Map<String, List<SlotType1>> slotMap = stHelper.getNameSlotMapDuplicateSlotNamesAllowed(binding.getSlot());
    assertThat(slotMap, hasKey(cswUrlSlotName));
    assertSlotValue(slotMap.get(cswUrlSlotName).get(0), 1, cswUrlSlotValue);
    assertThat(slotMap, hasKey(bindingTypeSlotName));
    assertSlotValue(slotMap.get(bindingTypeSlotName).get(0), 1, bindingTypeSlotValue);
    assertThat(slotMap, hasKey(serviceTypeSlotName));
    assertSlotValue(slotMap.get(serviceTypeSlotName).get(0), 1, serviceTypeSlotValue);
    assertThat(slotMap, hasKey(endpointDocumentationSlotName));
    assertSlotValue(slotMap.get(endpointDocumentationSlotName).get(0), 1, endpointDocumentationSlotValue);
}
Also used : ServiceBindingType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType) List(java.util.List)

Example 19 with SlotType1

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 in project ddf by codice.

the class SlotTypeHelperTest method testGetStringValues.

@Test
public void testGetStringValues() throws Exception {
    List<SlotType1> slots = registryObject.getSlot();
    int expectedSize = 1;
    for (SlotType1 slot : slots) {
        String slotTypeUC = slot.getSlotType().toUpperCase();
        // skip location because helper doesn't handle GM_Point
        if (slot.getName().equals("location")) {
            continue;
        }
        if (!slotTypeUC.contains("DATE")) {
            List<String> values = stHelper.getStringValues(slot);
            if (slot.getName().equals("inputDataSources") || slot.getName().equals("dataTypes")) {
                assertThat("SlotName: " + slot.getName(), values, hasSize(2));
            } else {
                assertThat("SlotName: " + slot.getName(), values, hasSize(expectedSize));
            }
        }
    }
}
Also used : SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) Test(org.junit.Test)

Example 20 with SlotType1

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 in project ddf by codice.

the class SlotTypeHelperTest method createSingleValue.

@Test
public void createSingleValue() throws Exception {
    String slotName = "slotName";
    String slotValue = "slotValue";
    String slotType = "slotType";
    SlotType1 slot = stHelper.create(slotName, slotValue, slotType);
    assertThat(slot, notNullValue());
    assertThat(slot.getName(), is(equalTo(slotName)));
    assertThat(slot.getSlotType(), is(equalTo(slotType)));
    List<String> values = stHelper.getStringValues(slot);
    assertThat(values, hasSize(1));
    assertThat(values.get(0), is(equalTo(slotValue)));
}
Also used : SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) Test(org.junit.Test)

Aggregations

SlotType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)23 ArrayList (java.util.ArrayList)8 Test (org.junit.Test)7 List (java.util.List)6 HashMap (java.util.HashMap)5 ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)5 ValueListType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType)5 JAXBElement (javax.xml.bind.JAXBElement)4 Map (java.util.Map)3 AnyValueType (net.opengis.cat.wrs.v_1_0_2.AnyValueType)3 ValueListType (net.opengis.cat.wrs.v_1_0_2.ValueListType)3 DirectPositionType (net.opengis.gml.v_3_1_1.DirectPositionType)3 EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)3 PointType (net.opengis.gml.v_3_1_1.PointType)3 ClassificationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ClassificationType)3 RegistryObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)3 OffsetDateTime (java.time.OffsetDateTime)2 Collectors (java.util.stream.Collectors)2 RegistryPackageType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType)2 ServiceBindingType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType)2