Search in sources :

Example 21 with RegistryPackageType

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

the class RegistryReportBuilderTest method getRegistryPackageFromResource.

private RegistryPackageType getRegistryPackageFromResource(String path) throws ParserException {
    RegistryPackageType registryPackage = null;
    JAXBElement<RegistryPackageType> jaxbRegistryObject = parser.unmarshal(configurator, JAXBElement.class, getClass().getResourceAsStream(path));
    if (jaxbRegistryObject != null) {
        registryPackage = jaxbRegistryObject.getValue();
    }
    return registryPackage;
}
Also used : RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType)

Example 22 with RegistryPackageType

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

the class RegistryPackageTypeHelperTest method testGetExtrinsicObjectTypesFromRegistryObjectList.

@Test
public void testGetExtrinsicObjectTypesFromRegistryObjectList() throws Exception {
    RegistryObjectListType registryObjectList = ((RegistryPackageType) registryObject).getRegistryObjectList();
    List<ExtrinsicObjectType> extrinsicObjects = rptHelper.getExtrinsicObjects(registryObjectList);
    assertExtrinsicObjects(extrinsicObjects);
}
Also used : RegistryObjectListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) Test(org.junit.Test)

Example 23 with RegistryPackageType

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

the class RegistryPackageTypeHelperTest method testGetObjectsAssociatedToServiceFromRegistryObjectList.

@Test
public void testGetObjectsAssociatedToServiceFromRegistryObjectList() throws Exception {
    String testServiceId = "urn:service:id0";
    RegistryObjectListType registryObjectList = ((RegistryPackageType) registryObject).getRegistryObjectList();
    List<OrganizationType> organizations = rptHelper.getAssociatedObjects(registryObjectList, testServiceId, OrganizationType.class);
    assertThat(organizations, hasSize(1));
    assertThat(organizations.get(0).getId(), is(equalTo("urn:organization:id0")));
    List<PersonType> contacts = rptHelper.getAssociatedObjects(testServiceId, PersonType.class);
    assertThat(contacts, hasSize(1));
    assertThat(contacts.get(0).getId(), is(equalTo("urn:contact:id1")));
}
Also used : RegistryObjectListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) PersonType(oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType) OrganizationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType) Test(org.junit.Test)

Example 24 with RegistryPackageType

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

the class FederationAdminServiceImplTest method testGetLocalRegistryObjects.

@Test
public void testGetLocalRegistryObjects() throws Exception {
    Metacard localMetacardOne = testMetacard;
    Metacard localMetacardTwo = testMetacard;
    List<Metacard> localMetacards = new ArrayList<>();
    localMetacards.add(localMetacardOne);
    localMetacards.add(localMetacardTwo);
    doReturn(localMetacards).when(federationAdminServiceImpl).getLocalRegistryMetacards();
    JAXBElement<RegistryPackageType> jaxbRegistryPackage = EbrimConstants.RIM_FACTORY.createRegistryPackage(getTestRegistryPackage());
    when(parser.unmarshal(any(ParserConfigurator.class), eq(JAXBElement.class), any(InputStream.class))).thenReturn(jaxbRegistryPackage);
    List<RegistryPackageType> packages = federationAdminServiceImpl.getLocalRegistryObjects();
    assertThat(packages, hasSize(2));
    verify(parser, times(2)).unmarshal(any(ParserConfigurator.class), eq(JAXBElement.class), any(InputStream.class));
}
Also used : ParserConfigurator(org.codice.ddf.parser.ParserConfigurator) Metacard(ddf.catalog.data.Metacard) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) JAXBElement(javax.xml.bind.JAXBElement) Test(org.junit.Test)

Example 25 with RegistryPackageType

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

the class FederationAdminServiceImplTest method testGetRegistryObjects.

@Test
public void testGetRegistryObjects() throws Exception {
    Metacard metacardOne = testMetacard;
    Metacard metacardTwo = testMetacard;
    JAXBElement<RegistryPackageType> jaxbRegistryPackage = EbrimConstants.RIM_FACTORY.createRegistryPackage(getTestRegistryPackage());
    QueryRequest request = getTestQueryRequest();
    QueryResponse response = getPopulatedTestQueryResponse(request, metacardOne, metacardTwo);
    when(catalogFramework.query(any(QueryRequest.class))).thenReturn(response);
    when(parser.unmarshal(any(ParserConfigurator.class), eq(JAXBElement.class), any(InputStream.class))).thenReturn(jaxbRegistryPackage);
    List<RegistryPackageType> regObjects = federationAdminServiceImpl.getRegistryObjects();
    assertThat(regObjects, hasSize(2));
    verify(catalogFramework).query(any(QueryRequest.class));
    verify(parser, times(2)).unmarshal(any(ParserConfigurator.class), eq(JAXBElement.class), any(InputStream.class));
}
Also used : ParserConfigurator(org.codice.ddf.parser.ParserConfigurator) Metacard(ddf.catalog.data.Metacard) QueryRequest(ddf.catalog.operation.QueryRequest) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) InputStream(java.io.InputStream) QueryResponse(ddf.catalog.operation.QueryResponse) JAXBElement(javax.xml.bind.JAXBElement) Test(org.junit.Test)

Aggregations

RegistryPackageType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType)46 Test (org.junit.Test)26 Metacard (ddf.catalog.data.Metacard)16 InputStream (java.io.InputStream)12 RegistryObjectListType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType)11 ArrayList (java.util.ArrayList)9 JAXBElement (javax.xml.bind.JAXBElement)9 ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)9 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)7 HashMap (java.util.HashMap)5 IOException (java.io.IOException)4 Map (java.util.Map)4 AssociationType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1)4 OrganizationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType)4 PersonType (oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType)4 RegistryObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)4 ParserConfigurator (org.codice.ddf.parser.ParserConfigurator)4 FederationAdminException (org.codice.ddf.registry.federationadmin.service.internal.FederationAdminException)4 QueryRequest (ddf.catalog.operation.QueryRequest)3 QueryResponse (ddf.catalog.operation.QueryResponse)3