Search in sources :

Example 16 with ServiceType

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);
}
Also used : ServiceBindingType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType) SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 17 with ServiceType

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)));
}
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 18 with ServiceType

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);
}
Also used : ServiceBindingType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType) List(java.util.List)

Example 19 with ServiceType

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;
}
Also used : ServiceBindingType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType)

Example 20 with ServiceType

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());
}
Also used : CapabilityListType(eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType) ServiceType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType) Service(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service) SettingListType(eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)8 ServiceType (eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType)7 Test (org.junit.Test)7 Service (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service)5 RegistryObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)5 ServiceBindingType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType)5 ServiceType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType)5 ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)4 OrganizationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType)4 PersonType (oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType)4 CapabilityListType (eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType)3 SettingListType (eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType)3 ServiceCapability (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability)3 ServiceSetting (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting)3 HashMap (java.util.HashMap)3 List (java.util.List)3 AssociationType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1)3 SlotType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)3 Map (java.util.Map)2 ServiceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType)1