Search in sources :

Example 6 with RecordType

use of org.geotoolkit.csw.xml.v202.RecordType in project osate2 by osate.

the class AadlBaNameResolver method propertyNameResolver.

private boolean propertyNameResolver(EList<DeclarativePropertyName> propertyNames) {
    // Ambiguity between a property literal and a property name without field.
    // So the next property name is evaluated.
    // The first property name has already been resolved, excepted its field.
    ListIterator<DeclarativePropertyName> it = propertyNames.listIterator();
    DeclarativePropertyName currentName = it.next();
    Element previousContainer = null;
    int previousContainerId = -1;
    // Then resolve the property field.
    if (false == propertyIndexAndFieldResolution(currentName)) {
        return false;
    }
    while (it.hasNext()) {
        previousContainer = currentName.getOsateRef();
        previousContainerId = previousContainer.eClass().getClassifierID();
        currentName = it.next();
        // Case of properties defined by a property association.
        if (Aadl2Package.PROPERTY_ASSOCIATION == previousContainerId) {
            PropertyAssociation pa = (PropertyAssociation) previousContainer;
            if (propertyAssociationResolver(pa, currentName) && propertyIndexAndFieldResolution(currentName)) {
                continue;
            } else // Property association may exist but doesn't define the
            // property that interests us. So search within the property
            // definition.
            {
                previousContainer = pa.getProperty();
            }
        }
        // The sub property is defined within a property expression.
        if (previousContainer instanceof PropertyExpression) {
            if (propertyValueResolver((PropertyExpression) previousContainer, currentName) && propertyIndexAndFieldResolution(currentName)) {
                continue;
            } else // Try with the property expression type definition.
            {
                previousContainer = PropertyUtils.getContainingProperty((PropertyExpression) previousContainer);
            }
        }
        previousContainerId = previousContainer.eClass().getClassifierID();
        // Try to resolve the property name within the property declaration.
        if (Aadl2Package.PROPERTY == previousContainerId) {
            Property p = (Property) previousContainer;
            if (propertyDeclarationResolver(p, currentName) && propertyIndexAndFieldResolution(currentName)) {
                continue;
            } else // Then the property type definition.
            if (propertyTypeResolver(p.getPropertyType(), currentName) && propertyIndexAndFieldResolution(currentName)) {
                continue;
            } else {
                // propertyTypeResolver and propertyFieldResolution report any error.
                return false;
            }
        } else // BasciProperty EMF identifier == Aadl2Package.LIST_VALUE, why ????
        if (// Use instanceof instead.
        previousContainer instanceof BasicProperty) {
            // The sub property is defined within a Record field (basic property).
            BasicProperty bp = (BasicProperty) previousContainer;
            if (propertyTypeResolver(bp.getPropertyType(), currentName) && propertyIndexAndFieldResolution(currentName)) {
                continue;
            } else {
                // propertyTypeResolver and propertyFieldResolution report any error.
                return false;
            }
        } else // The property is defined within the type of a record.
        if (Aadl2Package.RECORD_TYPE == previousContainerId) {
            RecordType rt = (RecordType) previousContainer;
            if (recordFieldResolver(rt, currentName) && propertyIndexAndFieldResolution(currentName)) {
                continue;
            } else {
                return false;
            }
        } else if (Aadl2Package.ENUMERATION_TYPE == previousContainerId) {
            EnumerationType type = (EnumerationType) previousContainer;
            return enumerationTypeResolver(type, currentName);
        } else // other types like ListType, etc.
        {
            // As it doesn't make any sense to look after a name in a property type
            // report an error.
            reportNameError(currentName.getPropertyName(), currentName.getPropertyName().getId());
            return false;
        }
    }
    return true;
}
Also used : BasicProperty(org.osate.aadl2.BasicProperty) RecordType(org.osate.aadl2.RecordType) PropertyAssociation(org.osate.aadl2.PropertyAssociation) DeclarativeBasicPropertyAssociation(org.osate.ba.declarative.DeclarativeBasicPropertyAssociation) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) ContainmentPathElement(org.osate.aadl2.ContainmentPathElement) QualifiedNamedElement(org.osate.ba.declarative.QualifiedNamedElement) DeclarativeBehaviorElement(org.osate.ba.declarative.DeclarativeBehaviorElement) NamedElement(org.osate.aadl2.NamedElement) Element(org.osate.aadl2.Element) BehaviorElement(org.osate.ba.aadlba.BehaviorElement) EnumerationType(org.osate.aadl2.EnumerationType) PropertyExpression(org.osate.aadl2.PropertyExpression) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property) DeclarativePropertyName(org.osate.ba.declarative.DeclarativePropertyName)

Example 7 with RecordType

use of org.geotoolkit.csw.xml.v202.RecordType in project osate2 by osate.

the class AadlBaNameResolver method getBasicPropertyResolver.

private BasicProperty getBasicPropertyResolver(BehaviorVariable bv, Property p, String basicPropertyName) {
    QualifiedNamedElement qne = (QualifiedNamedElement) p;
    Property propNE = resolveProperty(qne);
    PropertyType pt = propNE.getPropertyType();
    if (pt instanceof RecordType) {
        RecordType rt = (RecordType) pt;
        for (BasicProperty bp : rt.getOwnedFields()) {
            if (bp.getName().equalsIgnoreCase(basicPropertyName)) {
                return bp;
            }
        }
    }
    return null;
}
Also used : BasicProperty(org.osate.aadl2.BasicProperty) QualifiedNamedElement(org.osate.ba.declarative.QualifiedNamedElement) RecordType(org.osate.aadl2.RecordType) PropertyType(org.osate.aadl2.PropertyType) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property)

Example 8 with RecordType

use of org.geotoolkit.csw.xml.v202.RecordType in project geotoolkit by Geomatys.

the class CswXMLBindingTest method getRecordsResponseUnMarshalingTest.

/**
 * Test getRecordById request Marshalling.
 */
@Test
public void getRecordsResponseUnMarshalingTest() throws JAXBException {
    Unmarshaller unmarshaller = pool.acquireUnmarshaller();
    /*
         * Test marshalling csw getRecordByIdResponse v2.0.2
         */
    SimpleLiteral id = new SimpleLiteral("{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}");
    SimpleLiteral title = new SimpleLiteral("(JASON-1)");
    SimpleLiteral type = new SimpleLiteral("clearinghouse");
    List<SimpleLiteral> subject = new ArrayList<>();
    subject.add(new SimpleLiteral("oceans elevation NASA/JPL/JASON-1"));
    subject.add(new SimpleLiteral("oceans elevation 2"));
    SimpleLiteral modified = new SimpleLiteral("2007-11-15 21:26:49");
    SimpleLiteral Abstract = new SimpleLiteral("Jason-1 is the first follow-on to the highly successful TOPEX/Poseidonmission that measured ocean surface topography to an accuracy of 4.2cm.");
    SimpleLiteral references = new SimpleLiteral("http://keel.esri.com/output/TOOLKIT_Browse_Metadata_P7540_T8020_D1098.xml");
    SimpleLiteral spatial = new SimpleLiteral("northlimit=65.9999999720603; eastlimit=180; southlimit=-66.0000000558794; westlimit=-180;");
    List<BoundingBoxType> bbox = new ArrayList<>();
    bbox.add(new WGS84BoundingBoxType(180, -66.0000000558794, -180, 65.9999999720603));
    RecordType record = new RecordType(id, title, type, subject, null, modified, null, Abstract, bbox, null, null, null, spatial, references);
    BriefRecordType briefRecord = new BriefRecordType(id, title, type, bbox);
    SummaryRecordType sumRecord = new SummaryRecordType(id, title, type, bbox, subject, null, modified, Abstract);
    List<Object> records = new ArrayList<>();
    records.add(record);
    records.add(briefRecord);
    records.add(sumRecord);
    final SearchResultsType sr = new SearchResultsType("set", ElementSetType.BRIEF, 1, records, 1, 0);
    GetRecordsResponse expResult = new GetRecordsResponseType("rid", 100000, "v1.2", sr);
    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<csw:GetRecordsResponse version=\"v1.2\" xmlns:ows=\"http://www.opengis.net/ows\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:csw=\"http://www.opengis.net/cat/csw/2.0.2\" xmlns:dct=\"http://purl.org/dc/terms/\">\n" + "  <csw:RequestId>rid</csw:RequestId>\n" + "  <csw:SearchStatus timestamp=\"1970-01-01T01:01:40.000+01:00\"/>\n" + "  <csw:SearchResults resultSetId=\"set\" elementSet=\"brief\" numberOfRecordsMatched=\"1\" numberOfRecordsReturned=\"1\" nextRecord=\"0\">\n" + "  <csw:Record>\n" + "    <dc:identifier>{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}</dc:identifier>\n" + "    <dc:title>(JASON-1)</dc:title>\n" + "    <dc:type>clearinghouse</dc:type>\n" + "    <dc:subject>oceans elevation NASA/JPL/JASON-1</dc:subject>\n" + "    <dc:subject>oceans elevation 2</dc:subject>\n" + "    <dct:modified>2007-11-15 21:26:49</dct:modified>\n" + "    <dct:abstract>Jason-1 is the first follow-on to the highly successful TOPEX/Poseidonmission that measured ocean surface topography to an accuracy of 4.2cm.</dct:abstract>\n" + "    <dct:references>http://keel.esri.com/output/TOOLKIT_Browse_Metadata_P7540_T8020_D1098.xml</dct:references>\n" + "    <dct:spatial>northlimit=65.9999999720603; eastlimit=180; southlimit=-66.0000000558794; westlimit=-180;</dct:spatial>\n" + "    <ows:WGS84BoundingBox dimensions=\"2\">\n" + "      <ows:LowerCorner>180.0 -66.0000000558794</ows:LowerCorner>\n" + "      <ows:UpperCorner>-180.0 65.9999999720603</ows:UpperCorner>\n" + "    </ows:WGS84BoundingBox>\n" + "  </csw:Record>\n" + "  <csw:BriefRecord>\n" + "    <dc:identifier>{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}</dc:identifier>\n" + "    <dc:title>(JASON-1)</dc:title>\n" + "    <dc:type>clearinghouse</dc:type>\n" + "    <ows:WGS84BoundingBox dimensions=\"2\">\n" + "      <ows:LowerCorner>180.0 -66.0000000558794</ows:LowerCorner>\n" + "      <ows:UpperCorner>-180.0 65.9999999720603</ows:UpperCorner>\n" + "    </ows:WGS84BoundingBox>\n" + "  </csw:BriefRecord>\n" + "  <csw:SummaryRecord>\n" + "    <dc:identifier>{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}</dc:identifier>\n" + "    <dc:title>(JASON-1)</dc:title>\n" + "    <dc:type>clearinghouse</dc:type>\n" + "    <dc:subject>oceans elevation NASA/JPL/JASON-1</dc:subject>\n" + "    <dc:subject>oceans elevation 2</dc:subject>\n" + "    <dct:modified>2007-11-15 21:26:49</dct:modified>\n" + "    <dct:abstract>Jason-1 is the first follow-on to the highly successful TOPEX/Poseidonmission that measured ocean surface topography to an accuracy of 4.2cm.</dct:abstract>\n" + "    <ows:WGS84BoundingBox dimensions=\"2\">\n" + "      <ows:LowerCorner>180.0 -66.0000000558794</ows:LowerCorner>\n" + "      <ows:UpperCorner>-180.0 65.9999999720603</ows:UpperCorner>\n" + "    </ows:WGS84BoundingBox>\n" + "  </csw:SummaryRecord>\n" + "  </csw:SearchResults>\n" + "</csw:GetRecordsResponse>\n";
    GetRecordsResponse result = ((JAXBElement<GetRecordsResponse>) unmarshaller.unmarshal(new StringReader(xml))).getValue();
    assertTrue(result.getSearchResults().getAny() instanceof List);
    List<Object> resultList = result.getSearchResults().getAny();
    List<Object> expResultList = expResult.getSearchResults().getAny();
    assertEquals(expResultList.get(0), resultList.get(0));
    assertEquals(expResultList.get(1), resultList.get(1));
    assertEquals(expResultList.get(2), resultList.get(2));
    assertEquals(expResultList, resultList);
    assertEquals(expResult.getSearchResults().getAny(), result.getSearchResults().getAny());
    assertEquals(expResult.getSearchStatus(), result.getSearchStatus());
    assertEquals(expResult, result);
    pool.recycle(unmarshaller);
}
Also used : SummaryRecordType(org.geotoolkit.csw.xml.v202.SummaryRecordType) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) SearchResultsType(org.geotoolkit.csw.xml.v202.SearchResultsType) ArrayList(java.util.ArrayList) JAXBElement(javax.xml.bind.JAXBElement) BriefRecordType(org.geotoolkit.csw.xml.v202.BriefRecordType) BoundingBoxType(org.geotoolkit.ows.xml.v100.BoundingBoxType) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) AbstractRecordType(org.geotoolkit.csw.xml.v202.AbstractRecordType) BriefRecordType(org.geotoolkit.csw.xml.v202.BriefRecordType) SummaryRecordType(org.geotoolkit.csw.xml.v202.SummaryRecordType) RecordType(org.geotoolkit.csw.xml.v202.RecordType) StringReader(java.io.StringReader) GetRecordsResponseType(org.geotoolkit.csw.xml.v202.GetRecordsResponseType) SimpleLiteral(org.geotoolkit.dublincore.xml.v2.elements.SimpleLiteral) List(java.util.List) ArrayList(java.util.ArrayList) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test)

Example 9 with RecordType

use of org.geotoolkit.csw.xml.v202.RecordType in project geotoolkit by Geomatys.

the class CswXMLBindingTest method getRecordsResponseMarshalingTest.

/**
 * Test getRecordById request Marshalling.
 */
@Test
public void getRecordsResponseMarshalingTest() throws JAXBException {
    Marshaller marshaller = pool.acquireMarshaller();
    /*
         * Test marshalling csw getRecordByIdResponse v2.0.2
         */
    SimpleLiteral id = new SimpleLiteral("{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}");
    SimpleLiteral title = new SimpleLiteral("(JASON-1)");
    SimpleLiteral type = new SimpleLiteral("clearinghouse");
    List<SimpleLiteral> subject = new ArrayList<>();
    subject.add(new SimpleLiteral("oceans elevation NASA/JPL/JASON-1"));
    subject.add(new SimpleLiteral("oceans elevation 2"));
    SimpleLiteral modified = new SimpleLiteral("2007-11-15 21:26:49");
    SimpleLiteral Abstract = new SimpleLiteral("Jason-1 is the first follow-on to the highly successful TOPEX/Poseidonmission that measured ocean surface topography to an accuracy of 4.2cm.");
    SimpleLiteral references = new SimpleLiteral("http://keel.esri.com/output/TOOLKIT_Browse_Metadata_P7540_T8020_D1098.xml");
    SimpleLiteral spatial = new SimpleLiteral("northlimit=65.9999999720603; eastlimit=180; southlimit=-66.0000000558794; westlimit=-180;");
    List<BoundingBoxType> bbox = new ArrayList<>();
    bbox.add(new WGS84BoundingBoxType(180, -66.0000000558794, -180, 65.9999999720603));
    RecordType record = new RecordType(id, title, type, subject, null, modified, null, Abstract, bbox, null, null, null, spatial, references);
    BriefRecordType briefRecord = new BriefRecordType(id, title, type, bbox);
    SummaryRecordType sumRecord = new SummaryRecordType(id, title, type, bbox, subject, null, modified, Abstract);
    List<Object> records = new ArrayList<>();
    records.add(record);
    records.add(briefRecord);
    records.add(sumRecord);
    final SearchResultsType sr = new SearchResultsType("set", ElementSetType.BRIEF, 1, records, 1, 0);
    GetRecordsResponse response = new GetRecordsResponseType("rid", 100000, "v1.2", sr);
    StringWriter sw = new StringWriter();
    marshaller.marshal(response, sw);
    String result = sw.toString();
    String expResult = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<csw:GetRecordsResponse version=\"v1.2\" xmlns:ows=\"http://www.opengis.net/ows\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:csw=\"http://www.opengis.net/cat/csw/2.0.2\" xmlns:dct=\"http://purl.org/dc/terms/\">\n" + "  <csw:RequestId>rid</csw:RequestId>\n" + "  <csw:SearchStatus timestamp=\"1970-01-01T01:01:40.000+01:00\"/>\n" + "  <csw:SearchResults resultSetId=\"set\" elementSet=\"brief\" numberOfRecordsMatched=\"1\" numberOfRecordsReturned=\"1\" nextRecord=\"0\">\n" + "    <csw:Record>\n" + "      <dc:identifier>{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}</dc:identifier>\n" + "      <dc:title>(JASON-1)</dc:title>\n" + "      <dc:type>clearinghouse</dc:type>\n" + "      <dc:subject>oceans elevation NASA/JPL/JASON-1</dc:subject>\n" + "      <dc:subject>oceans elevation 2</dc:subject>\n" + "      <dct:modified>2007-11-15 21:26:49</dct:modified>\n" + "      <dct:abstract>Jason-1 is the first follow-on to the highly successful TOPEX/Poseidonmission that measured ocean surface topography to an accuracy of 4.2cm.</dct:abstract>\n" + "      <dct:references>http://keel.esri.com/output/TOOLKIT_Browse_Metadata_P7540_T8020_D1098.xml</dct:references>\n" + "      <dct:spatial>northlimit=65.9999999720603; eastlimit=180; southlimit=-66.0000000558794; westlimit=-180;</dct:spatial>\n" + "      <ows:WGS84BoundingBox dimensions=\"2\">\n" + "        <ows:LowerCorner>180.0 -66.0000000558794</ows:LowerCorner>\n" + "        <ows:UpperCorner>-180.0 65.9999999720603</ows:UpperCorner>\n" + "      </ows:WGS84BoundingBox>\n" + "    </csw:Record>\n" + "    <csw:BriefRecord>\n" + "      <dc:identifier>{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}</dc:identifier>\n" + "      <dc:title>(JASON-1)</dc:title>\n" + "      <dc:type>clearinghouse</dc:type>\n" + "      <ows:WGS84BoundingBox dimensions=\"2\">\n" + "        <ows:LowerCorner>180.0 -66.0000000558794</ows:LowerCorner>\n" + "        <ows:UpperCorner>-180.0 65.9999999720603</ows:UpperCorner>\n" + "      </ows:WGS84BoundingBox>\n" + "    </csw:BriefRecord>\n" + "    <csw:SummaryRecord>\n" + "      <dc:identifier>{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}</dc:identifier>\n" + "      <dc:title>(JASON-1)</dc:title>\n" + "      <dc:type>clearinghouse</dc:type>\n" + "      <dc:subject>oceans elevation NASA/JPL/JASON-1</dc:subject>\n" + "      <dc:subject>oceans elevation 2</dc:subject>\n" + "      <dct:modified>2007-11-15 21:26:49</dct:modified>\n" + "      <dct:abstract>Jason-1 is the first follow-on to the highly successful TOPEX/Poseidonmission that measured ocean surface topography to an accuracy of 4.2cm.</dct:abstract>\n" + "      <ows:WGS84BoundingBox dimensions=\"2\">\n" + "        <ows:LowerCorner>180.0 -66.0000000558794</ows:LowerCorner>\n" + "        <ows:UpperCorner>-180.0 65.9999999720603</ows:UpperCorner>\n" + "      </ows:WGS84BoundingBox>\n" + "    </csw:SummaryRecord>\n" + "  </csw:SearchResults>\n" + "</csw:GetRecordsResponse>\n";
    LOGGER.log(Level.FINER, "RESULT:\n{0}", result);
    LOGGER.log(Level.FINER, "EXPRESULT:\n{0}", expResult);
    assertXmlEquals(expResult, result, "xmlns:*");
    pool.recycle(marshaller);
}
Also used : SummaryRecordType(org.geotoolkit.csw.xml.v202.SummaryRecordType) Marshaller(javax.xml.bind.Marshaller) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) SearchResultsType(org.geotoolkit.csw.xml.v202.SearchResultsType) ArrayList(java.util.ArrayList) BriefRecordType(org.geotoolkit.csw.xml.v202.BriefRecordType) BoundingBoxType(org.geotoolkit.ows.xml.v100.BoundingBoxType) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) AbstractRecordType(org.geotoolkit.csw.xml.v202.AbstractRecordType) BriefRecordType(org.geotoolkit.csw.xml.v202.BriefRecordType) SummaryRecordType(org.geotoolkit.csw.xml.v202.SummaryRecordType) RecordType(org.geotoolkit.csw.xml.v202.RecordType) StringWriter(java.io.StringWriter) GetRecordsResponseType(org.geotoolkit.csw.xml.v202.GetRecordsResponseType) SimpleLiteral(org.geotoolkit.dublincore.xml.v2.elements.SimpleLiteral) Test(org.junit.Test)

Example 10 with RecordType

use of org.geotoolkit.csw.xml.v202.RecordType in project geotoolkit by Geomatys.

the class CswXMLBindingTest method recordUnmarshalingTest.

/**
 * Test simple Record Marshalling.
 */
@Test
public void recordUnmarshalingTest() throws JAXBException {
    Unmarshaller unmarshaller = pool.acquireUnmarshaller();
    /*
         * Test Unmarshalling csw Record v2.0.2
         */
    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<csw:Record xmlns:ows=\"http://www.opengis.net/ows\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:csw=\"http://www.opengis.net/cat/csw/2.0.2\" xmlns:dct=\"http://purl.org/dc/terms/\">\n" + "  <dc:identifier>{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}</dc:identifier>\n" + "  <dc:title>(JASON-1)</dc:title>\n" + "  <dc:type>clearinghouse</dc:type>\n" + "  <dc:subject>oceans elevation NASA/JPL/JASON-1</dc:subject>\n" + "  <dc:subject>oceans elevation 2</dc:subject>\n" + "  <dc:format>binary</dc:format>\n" + "  <dc:date>2007-12-01</dc:date>\n" + "  <dc:publisher>geomatys</dc:publisher>\n" + "  <dc:creator>geomatys</dc:creator>\n" + "  <dct:modified>2007-11-15 21:26:49</dct:modified>\n" + "  <dct:abstract>Jason-1 is the first follow-on to the highly successful TOPEX/Poseidonmission that measured ocean surface topography to an accuracy of 4.2cm.</dct:abstract>\n" + "  <dct:spatial>northlimit=65.9999999720603; eastlimit=180; southlimit=-66.0000000558794; westlimit=-180;</dct:spatial>\n" + "  <dct:references>http://keel.esri.com/output/TOOLKIT_Browse_Metadata_P7540_T8020_D1098.xml</dct:references>\n" + "  <ows:WGS84BoundingBox dimensions=\"2\">\n" + "    <ows:LowerCorner>180.0 -66.0000000558794</ows:LowerCorner>\n" + "    <ows:UpperCorner>-180.0 65.9999999720603</ows:UpperCorner>\n" + "  </ows:WGS84BoundingBox>\n" + "</csw:Record>\n";
    StringReader sr = new StringReader(xml);
    RecordType result = (RecordType) unmarshaller.unmarshal(sr);
    SimpleLiteral id = new SimpleLiteral("{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}");
    SimpleLiteral title = new SimpleLiteral("(JASON-1)");
    SimpleLiteral type = new SimpleLiteral("clearinghouse");
    List<SimpleLiteral> subject = new ArrayList<>();
    subject.add(new SimpleLiteral("oceans elevation NASA/JPL/JASON-1"));
    subject.add(new SimpleLiteral("oceans elevation 2"));
    SimpleLiteral modified = new SimpleLiteral("2007-11-15 21:26:49");
    SimpleLiteral date = new SimpleLiteral("2007-12-01");
    SimpleLiteral Abstract = new SimpleLiteral("Jason-1 is the first follow-on to the highly successful TOPEX/Poseidonmission that measured ocean surface topography to an accuracy of 4.2cm.");
    SimpleLiteral references = new SimpleLiteral("http://keel.esri.com/output/TOOLKIT_Browse_Metadata_P7540_T8020_D1098.xml");
    SimpleLiteral spatial = new SimpleLiteral("northlimit=65.9999999720603; eastlimit=180; southlimit=-66.0000000558794; westlimit=-180;");
    SimpleLiteral format = new SimpleLiteral("binary");
    SimpleLiteral distributor = new SimpleLiteral("geomatys");
    SimpleLiteral creator = new SimpleLiteral("geomatys");
    List<BoundingBoxType> bbox = new ArrayList<>();
    bbox.add(new WGS84BoundingBoxType(180, -66.0000000558794, -180, 65.9999999720603));
    RecordType expResult = new RecordType(id, title, type, subject, format, modified, date, Abstract, bbox, creator, distributor, null, spatial, references);
    assertEquals(expResult.getDate(), result.getDate());
    assertEquals(expResult.getAbstract(), result.getAbstract());
    assertEquals(expResult.getSpatial(), result.getSpatial());
    assertEquals(expResult.getBoundingBox().get(0).getValue(), result.getBoundingBox().get(0).getValue());
    assertEquals(expResult, result);
    /*
         * Test Unmarshalling csw Record v2.0.0 with http://purl... DC namespace
         */
    xml = "<csw:Record xmlns:csw=\"http://www.opengis.net/cat/csw\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n" + "  <dc:identifier>ESIGNGRAVIMÉTRICOPENINSULAYBALEARES200703070000</dc:identifier>\n" + "  <dc:title>Estudio Gravimétrico de la Península Ibérica y Baleares</dc:title>\n" + "  <dc:title>Mapa de Anomalías Gravimétricas</dc:title>\n" + "  <dc:creator>Instituto Geográfico Nacional</dc:creator>\n" + "  <dc:subject>http://www.fao.org/aos/concept#4668.Gravimetría</dc:subject>\n" + "  <dc:subject>Anomalías Gravimétricas</dc:subject>\n" + "  <dc:subject>Anomalías Aire Libre</dc:subject>\n" + "  <dc:subject>Anomalías Bouguer</dc:subject>\n" + "  <dc:subject>Información geocientífica</dc:subject>\n" + "  <dc:description>El Estudio Gravimétrico de la Península Ibérica y Baleares, que representa las anomalías gravimétricas de esa zona, fue generado por el Instituto Geográfico Nacional en el año 1996. El estudio está constituido por dos mapas; Anomalías Gravimétricas Aire Libre de la Península Ibérica y Baleares, Anomalías Gravimétricas Bouguer de la Península Ibérica y Baleares más una memoria. Inicialmente para su generación se creó una base de datos gravimétrica homogénea a partir de observaciones de distinta procedencia, también se formó un modelo digital del terreno homogéneo a partir de otros modelos digitales del terreno procedentes de España, Portugal y Francia. Los mapas contienen isolíneas de anomalías gravimétricas en intervalos de 2mGal. Los datos se almacenan en formato DGN.</dc:description>\n" + "  <dc:date>2007-03-07</dc:date>\n" + "  <dc:type>mapHardcopy</dc:type>\n" + "  <dc:type>mapDigital</dc:type>\n" + "  <dc:type>documentHardcopy</dc:type>\n" + "  <dc:format>DGN - Microstation format (Intergraph Corporation)</dc:format>\n" + "  <dc:format>Papel</dc:format>\n" + "  <dc:identifier>www.cnig.es</dc:identifier>\n" + "  <dc:source>El Banco de Datos Gravimétricos es una base de datos compuesta principalmente por las observaciones realizadas por el Instituto Geográfico Nacional desde 1960. Además se han añadido los datos del Instituto Portugués de Geografía y Catastro, del proyecto ECORS, de la Universidad de Cantabria y del Bureau Gravimétrico Internacional.</dc:source>\n" + "  <dc:source>Para la creación del Modelo Digital del Terreno a escala 1:200.000 para toda la Península Ibérica, áreas marinas y terrestres adyacentes, en particular, se ha dispuesto de la siguiente información; Modelo Digital del Terreno a escala 1:200.000, Modelo Digital del Terreno obtenido del Defense Mapping Agency de los Estados Unidos, para completar la zona de Portugal; Modelo Digital del Terreno obtenido del Instituto Geográfico Nacional de Francia para la parte francesa del Pirineo y el Modelo Digital del Terreno generado a partir de las cartas náuticas del Instituto Hidrográfico de la Marina de España, que completa la parte marina hasta los 167 km. de la costa con un ancho de malla de 5 km.</dc:source>\n" + "  <dc:language>es</dc:language>\n" + "  <dcterms:spatial>northlimit=43.83; southlimit=36.00; westlimit=-9.35; eastlimit=4.32;</dcterms:spatial>\n" + "  <dcterms:spatial>ESPAÑA.ANDALUCÍA</dcterms:spatial>\n" + "  <dcterms:spatial>ESPAÑA.ARAGÓN</dcterms:spatial>\n" + "</csw:Record>";
    sr = new StringReader(xml);
    org.geotoolkit.csw.xml.v200.RecordType result2 = (org.geotoolkit.csw.xml.v200.RecordType) unmarshaller.unmarshal(sr);
    LOGGER.log(Level.FINER, "result:{0}", result2.toString());
    /*
         * Test Unmarshalling csw Record v2.0.0 with http://www.purl... DC namespace
         */
    xml = "<csw:Record xmlns:csw=\"http://www.opengis.net/cat/csw\" xmlns:dcterms=\"http://www.purl.org/dc/terms/\" xmlns:dc=\"http://www.purl.org/dc/elements/1.1/\">\n" + "  <dc:identifier>ESIGNGRAVIMÉTRICOPENINSULAYBALEARES200703070000</dc:identifier>\n" + "  <dc:title>Estudio Gravimétrico de la Península Ibérica y Baleares</dc:title>\n" + "  <dc:title>Mapa de Anomalías Gravimétricas</dc:title>\n" + "  <dc:creator>Instituto Geográfico Nacional</dc:creator>\n" + "  <dc:subject>http://www.fao.org/aos/concept#4668.Gravimetría</dc:subject>\n" + "  <dc:subject>Anomalías Gravimétricas</dc:subject>\n" + "  <dc:subject>Anomalías Aire Libre</dc:subject>\n" + "  <dc:subject>Anomalías Bouguer</dc:subject>\n" + "  <dc:subject>Información geocientífica</dc:subject>\n" + "  <dc:description>El Estudio Gravimétrico de la Península Ibérica y Baleares, que representa las anomalías gravimétricas de esa zona, fue generado por el Instituto Geográfico Nacional en el año 1996. El estudio está constituido por dos mapas; Anomalías Gravimétricas Aire Libre de la Península Ibérica y Baleares, Anomalías Gravimétricas Bouguer de la Península Ibérica y Baleares más una memoria. Inicialmente para su generación se creó una base de datos gravimétrica homogénea a partir de observaciones de distinta procedencia, también se formó un modelo digital del terreno homogéneo a partir de otros modelos digitales del terreno procedentes de España, Portugal y Francia. Los mapas contienen isolíneas de anomalías gravimétricas en intervalos de 2mGal. Los datos se almacenan en formato DGN.</dc:description>\n" + "  <dc:date>2007-03-07</dc:date>\n" + "  <dc:type>mapHardcopy</dc:type>\n" + "  <dc:type>mapDigital</dc:type>\n" + "  <dc:type>documentHardcopy</dc:type>\n" + "  <dc:format>DGN - Microstation format (Intergraph Corporation)</dc:format>\n" + "  <dc:format>Papel</dc:format>\n" + "  <dc:identifier>www.cnig.es</dc:identifier>\n" + "  <dc:source>El Banco de Datos Gravimétricos es una base de datos compuesta principalmente por las observaciones realizadas por el Instituto Geográfico Nacional desde 1960. Además se han añadido los datos del Instituto Portugués de Geografía y Catastro, del proyecto ECORS, de la Universidad de Cantabria y del Bureau Gravimétrico Internacional.</dc:source>\n" + "  <dc:source>Para la creación del Modelo Digital del Terreno a escala 1:200.000 para toda la Península Ibérica, áreas marinas y terrestres adyacentes, en particular, se ha dispuesto de la siguiente información; Modelo Digital del Terreno a escala 1:200.000, Modelo Digital del Terreno obtenido del Defense Mapping Agency de los Estados Unidos, para completar la zona de Portugal; Modelo Digital del Terreno obtenido del Instituto Geográfico Nacional de Francia para la parte francesa del Pirineo y el Modelo Digital del Terreno generado a partir de las cartas náuticas del Instituto Hidrográfico de la Marina de España, que completa la parte marina hasta los 167 km. de la costa con un ancho de malla de 5 km.</dc:source>\n" + "  <dc:language>es</dc:language>\n" + "  <dcterms:spatial>northlimit=43.83; southlimit=36.00; westlimit=-9.35; eastlimit=4.32;</dcterms:spatial>\n" + "  <dcterms:spatial>ESPAÑA.ANDALUCÍA</dcterms:spatial>\n" + "  <dcterms:spatial>ESPAÑA.ARAGÓN</dcterms:spatial>\n" + "</csw:Record>";
    sr = new StringReader(xml);
    result2 = (org.geotoolkit.csw.xml.v200.RecordType) unmarshaller.unmarshal(sr);
    LOGGER.log(Level.FINER, "result:{0}", result2.toString());
    pool.recycle(unmarshaller);
}
Also used : WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) ArrayList(java.util.ArrayList) BoundingBoxType(org.geotoolkit.ows.xml.v100.BoundingBoxType) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) AbstractRecordType(org.geotoolkit.csw.xml.v202.AbstractRecordType) BriefRecordType(org.geotoolkit.csw.xml.v202.BriefRecordType) SummaryRecordType(org.geotoolkit.csw.xml.v202.SummaryRecordType) RecordType(org.geotoolkit.csw.xml.v202.RecordType) StringReader(java.io.StringReader) SimpleLiteral(org.geotoolkit.dublincore.xml.v2.elements.SimpleLiteral) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)8 AbstractRecordType (org.geotoolkit.csw.xml.v202.AbstractRecordType)7 BriefRecordType (org.geotoolkit.csw.xml.v202.BriefRecordType)7 RecordType (org.geotoolkit.csw.xml.v202.RecordType)7 SummaryRecordType (org.geotoolkit.csw.xml.v202.SummaryRecordType)7 SimpleLiteral (org.geotoolkit.dublincore.xml.v2.elements.SimpleLiteral)7 BoundingBoxType (org.geotoolkit.ows.xml.v100.BoundingBoxType)7 WGS84BoundingBoxType (org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType)7 Test (org.junit.Test)7 List (java.util.List)6 RecordType (org.openarchives.oai._2.RecordType)6 OAIPMH (org.openarchives.oai._2.OAIPMH)5 ResumptionTokenType (org.openarchives.oai._2.ResumptionTokenType)5 StringWriter (java.io.StringWriter)4 Marshaller (javax.xml.bind.Marshaller)4 Property (org.osate.aadl2.Property)4 RecordType (org.osate.aadl2.RecordType)4 JAXBElement (javax.xml.bind.JAXBElement)3 BasicProperty (org.osate.aadl2.BasicProperty)3 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)3