Search in sources :

Example 6 with ServiceBindingType

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

the class RegistryPackageWebConverterTest method getSecondServiceBinding.

private ServiceBindingType getSecondServiceBinding() {
    ServiceBindingType binding = RIM_FACTORY.createServiceBindingType();
    binding.setId("urn:registry:federation:method:soap13");
    binding.setService("urn:service:id0");
    binding.setAccessURI("some:access:URI:any:URI");
    binding.setTargetBinding("some:target:binding:reference:URI");
    binding.getSlot().add(stHelper.create("queryAddress", "https://some/address/here", "xs:anyURI"));
    binding.getSlot().add(stHelper.create("ingestAddress", "https://some/address/here", "xs:anyURI"));
    binding.getSlot().add(stHelper.create("eventAddress", "https://some/address/here", "xs:anyURI"));
    binding.getSlot().add(stHelper.create("bindingType", "soap13", "xs:string"));
    binding.getSlot().add(stHelper.create("serviceType", "SOAP", "xs:string"));
    binding.getSlot().add(stHelper.create("endpointDocumentation", "https://some/path/to/docs.html", "xs:anyURI"));
    binding.setName(istHelper.create("Soap Federation Method"));
    binding.setDescription(istHelper.create("This is the Soap federation method."));
    binding.setVersionInfo(getVersionInfo("1.3"));
    binding.getSpecificationLink().add(getSecondSpecificationLink());
    return binding;
}
Also used : ServiceBindingType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType)

Example 7 with ServiceBindingType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType 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 8 with ServiceBindingType

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

the class RegistryPackageTypeHelperTest method testGetBindingTypesFromRegistryObjectList.

@Test
public void testGetBindingTypesFromRegistryObjectList() throws Exception {
    RegistryObjectListType registryObjectList = ((RegistryPackageType) registryObject).getRegistryObjectList();
    List<ServiceBindingType> bindings = rptHelper.getBindingTypes(registryObjectList);
    assertBindings(bindings);
}
Also used : RegistryObjectListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType) ServiceBindingType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) Test(org.junit.Test)

Example 9 with ServiceBindingType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType 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 10 with ServiceBindingType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType 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)

Aggregations

ServiceBindingType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType)8 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)3 List (java.util.List)2 Map (java.util.Map)2 SlotType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)2 IOException (java.io.IOException)1 Hashtable (java.util.Hashtable)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 RegistryObjectListType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType)1 RegistryPackageType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType)1 SpecificationLinkType (oasis.names.tc.ebxml_regrep.xsd.rim._3.SpecificationLinkType)1 RegistrySourceConfiguration (org.codice.ddf.registry.federationadmin.service.internal.RegistrySourceConfiguration)1 Test (org.junit.Test)1 Configuration (org.osgi.service.cm.Configuration)1