use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType in project ddf by codice.
the class RegistryPackageConverter method parseRegistryService.
private static void parseRegistryService(ServiceType service, MetacardImpl metacard) throws RegistryConversionException {
validateIdentifiable(service);
String xmlServiceBindingsTypesAttributeName = METACARD_XML_NAME_MAP.get(RegistryObjectMetacardType.SERVICE_BINDING_TYPES);
String xmlServiceBindingsAttributeName = METACARD_XML_NAME_MAP.get(RegistryObjectMetacardType.SERVICE_BINDINGS);
List<String> serviceBindings = new ArrayList<>();
List<String> serviceBindingTypes = new ArrayList<>();
List<String> bindings = new ArrayList<>();
List<String> bindingTypes = new ArrayList<>();
for (ServiceBindingType binding : service.getServiceBinding()) {
bindings.clear();
bindingTypes.clear();
Map<String, List<SlotType1>> slotMap = SLOT_TYPE_HELPER.getNameSlotMapDuplicateSlotNamesAllowed(binding.getSlot());
if (slotMap.containsKey(xmlServiceBindingsTypesAttributeName)) {
List<SlotType1> slots = slotMap.get(xmlServiceBindingsTypesAttributeName);
for (SlotType1 slot : slots) {
bindingTypes.addAll(SLOT_TYPE_HELPER.getStringValues(slot));
}
}
if (slotMap.containsKey(xmlServiceBindingsAttributeName)) {
List<SlotType1> slots = slotMap.get(xmlServiceBindingsAttributeName);
for (SlotType1 slot : slots) {
bindings.addAll(SLOT_TYPE_HELPER.getStringValues(slot));
}
}
serviceBindingTypes.addAll(bindingTypes);
serviceBindings.addAll(bindings);
}
metacard.setAttribute(RegistryObjectMetacardType.SERVICE_BINDING_TYPES, (Serializable) serviceBindingTypes);
metacard.setAttribute(RegistryObjectMetacardType.SERVICE_BINDINGS, (Serializable) serviceBindings);
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType 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.ServiceType 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.ServiceType in project ddf by codice.
the class RegistryPackageWebConverterTest method getFirstServiceBinding.
private ServiceBindingType getFirstServiceBinding() {
ServiceBindingType binding = RIM_FACTORY.createServiceBindingType();
binding.setId("urn:registry:federation:method:csw");
binding.setService("urn:service:id0");
binding.getSlot().add(stHelper.create("cswUrl", "https://some/address/here", "xs:anyURI"));
binding.getSlot().add(stHelper.create("bindingType", "Csw_Federated_Source", "xs:string"));
binding.getSlot().add(stHelper.create("serviceType", "REST", "xs:string"));
binding.getSlot().add(stHelper.create("endpointDocumentation", "https://some/path/to/docs.html", "xs:anyURI"));
binding.setName(istHelper.create("CSW Federation Method"));
binding.setDescription(istHelper.create("This is the CSW federation method."));
binding.setVersionInfo(getVersionInfo("2.0.2"));
binding.getSpecificationLink().add(getFirstSpecificationLink());
return binding;
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType in project UVMS-ExchangeModule-APP by UnionVMS.
the class MapperTest method testEntityAndModelToEntity.
@Test
public void testEntityAndModelToEntity() throws ExchangeDaoException, ExchangeDaoMappingException {
Integer id = 1;
Service entity = MockData.getEntity(id);
ServiceType service = MockData.getModel(1);
CapabilityListType capabilityListType = MockData.getCapabilityList();
SettingListType settingListType = MockData.getSettingList();
// mockDaoToEntity();
Service result = mapper.toServiceEntity(entity, service, capabilityListType, settingListType, "TEST");
assertSame(entity.getName(), result.getName());
assertSame(entity.getServiceClassName(), result.getServiceClassName());
}
Aggregations