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)));
}
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);
}
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);
}
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));
}
}
}
}
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)));
}
Aggregations