Search in sources :

Example 6 with BoundingBoxType

use of org.geotoolkit.ows.xml.v110.BoundingBoxType in project geotoolkit by Geomatys.

the class CswXMLBindingTest method briefRecordUnmarshalingTest.

/**
 * Test brief Record Unmarshalling.
 */
@Test
public void briefRecordUnmarshalingTest() throws JAXBException {
    Unmarshaller unmarshaller = pool.acquireUnmarshaller();
    /*
         * Test marshalling BRIEF csw Record v2.0.2
         */
    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<csw:BriefRecord 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\">\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";
    StringReader sr = new StringReader(xml);
    BriefRecordType result = (BriefRecordType) unmarshaller.unmarshal(sr);
    SimpleLiteral id = new SimpleLiteral("{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}");
    SimpleLiteral title = new SimpleLiteral("(JASON-1)");
    SimpleLiteral type = new SimpleLiteral("clearinghouse");
    List<BoundingBoxType> bbox = new ArrayList<>();
    bbox.add(new WGS84BoundingBoxType(180, -66.0000000558794, -180, 65.9999999720603));
    BriefRecordType expResult = new BriefRecordType(id, title, type, bbox);
    assertEquals(expResult, result);
    /*
         * Test marshalling csw Record v2.0.2
         */
    xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<csw:BriefRecord 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\">\n" + "  <dc:identifier>{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}</dc:identifier>\n" + "  <dc:identifier>urn:ogc:x-def:F7807C8AB645</dc:identifier>\n" + "  <dc:title>(JASON-1)</dc:title>\n" + "  <dc:title>(JASON-2)</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" + "  <ows:WGS84BoundingBox dimensions=\"2\">\n" + "    <ows:LowerCorner>176.0 -16.4</ows:LowerCorner>\n" + "    <ows:UpperCorner>-178.0 6.1</ows:UpperCorner>\n" + "  </ows:WGS84BoundingBox>\n" + "</csw:BriefRecord>\n";
    sr = new StringReader(xml);
    result = (BriefRecordType) unmarshaller.unmarshal(sr);
    List<SimpleLiteral> identifiers = new ArrayList<>();
    identifiers.add(new SimpleLiteral("{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}"));
    identifiers.add(new SimpleLiteral("urn:ogc:x-def:F7807C8AB645"));
    List<SimpleLiteral> titles = new ArrayList<>();
    titles.add(new SimpleLiteral("(JASON-1)"));
    titles.add(new SimpleLiteral("(JASON-2)"));
    type = new SimpleLiteral("clearinghouse");
    bbox = new ArrayList<>();
    bbox.add(new WGS84BoundingBoxType(180, -66.0000000558794, -180, 65.9999999720603));
    bbox.add(new WGS84BoundingBoxType(176, -16.4, -178, 6.1));
    expResult = new BriefRecordType(identifiers, titles, type, bbox);
    assertEquals(expResult, result);
    pool.recycle(unmarshaller);
}
Also used : BoundingBoxType(org.geotoolkit.ows.xml.v100.BoundingBoxType) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) StringReader(java.io.StringReader) ArrayList(java.util.ArrayList) SimpleLiteral(org.geotoolkit.dublincore.xml.v2.elements.SimpleLiteral) Unmarshaller(javax.xml.bind.Unmarshaller) BriefRecordType(org.geotoolkit.csw.xml.v202.BriefRecordType) Test(org.junit.Test)

Example 7 with BoundingBoxType

use of org.geotoolkit.ows.xml.v110.BoundingBoxType in project geotoolkit by Geomatys.

the class CswXMLBindingTest method transactionResponseUnmarshalingTest.

/**
 * Test simple Record Marshalling.
 */
@Test
public void transactionResponseUnmarshalingTest() throws JAXBException {
    Unmarshaller unmarshaller = pool.acquireUnmarshaller();
    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<csw:TransactionResponse version=\"2.0.2\" xmlns:csw=\"http://www.opengis.net/cat/csw/2.0.2\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:ows=\"http://www.opengis.net/ows\">\n" + "  <csw:TransactionSummary requestId=\"rid\">\n" + "    <csw:totalInserted>2</csw:totalInserted>\n" + "    <csw:totalUpdated>0</csw:totalUpdated>\n" + "    <csw:totalDeleted>1</csw:totalDeleted>\n" + "  </csw:TransactionSummary>\n" + "  <csw:InsertResult>\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:InsertResult>\n" + "</csw:TransactionResponse>\n";
    TransactionResponseType result = ((JAXBElement<TransactionResponseType>) unmarshaller.unmarshal(new StringReader(xml))).getValue();
    SimpleLiteral id = new SimpleLiteral("{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}");
    SimpleLiteral title = new SimpleLiteral("(JASON-1)");
    SimpleLiteral type = new SimpleLiteral("clearinghouse");
    List<BoundingBoxType> bbox = new ArrayList<>();
    bbox.add(new WGS84BoundingBoxType(180, -66.0000000558794, -180, 65.9999999720603));
    Object record = new BriefRecordType(id, title, type, bbox);
    final List<InsertResultType> inserteds = new ArrayList<>();
    inserteds.add(new InsertResultType(Arrays.asList(record), null));
    TransactionSummaryType summ = new TransactionSummaryType(2, 0, 1, "rid");
    TransactionResponseType expResult = new TransactionResponseType(summ, inserteds, "2.0.2");
    assertEquals(expResult.getTransactionSummary(), result.getTransactionSummary());
    assertEquals(expResult.getInsertResult(), result.getInsertResult());
    assertEquals(expResult, result);
    pool.recycle(unmarshaller);
}
Also used : WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) ArrayList(java.util.ArrayList) JAXBElement(javax.xml.bind.JAXBElement) TransactionSummaryType(org.geotoolkit.csw.xml.v202.TransactionSummaryType) BriefRecordType(org.geotoolkit.csw.xml.v202.BriefRecordType) TransactionResponseType(org.geotoolkit.csw.xml.v202.TransactionResponseType) BoundingBoxType(org.geotoolkit.ows.xml.v100.BoundingBoxType) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) StringReader(java.io.StringReader) SimpleLiteral(org.geotoolkit.dublincore.xml.v2.elements.SimpleLiteral) Unmarshaller(javax.xml.bind.Unmarshaller) InsertResultType(org.geotoolkit.csw.xml.v202.InsertResultType) Test(org.junit.Test)

Example 8 with BoundingBoxType

use of org.geotoolkit.ows.xml.v110.BoundingBoxType 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 9 with BoundingBoxType

use of org.geotoolkit.ows.xml.v110.BoundingBoxType 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)

Example 10 with BoundingBoxType

use of org.geotoolkit.ows.xml.v110.BoundingBoxType in project geotoolkit by Geomatys.

the class CswXMLBindingTest method summmaryRecordMarshalingTest.

/**
 * Test summary Record Marshalling.
 */
@Test
public void summmaryRecordMarshalingTest() throws JAXBException {
    Marshaller marshaller = pool.acquireMarshaller();
    /*
         * Test marshalling csw summmary Record 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"));
    List<SimpleLiteral> formats = new ArrayList<>();
    formats.add(new SimpleLiteral("format 11-11"));
    formats.add(new SimpleLiteral("format 22-22"));
    SimpleLiteral modified = new SimpleLiteral("2007-11-15 21:26:49");
    List<SimpleLiteral> Abstract = new ArrayList<>();
    Abstract.add(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."));
    List<BoundingBoxType> bbox = new ArrayList<>();
    bbox.add(new WGS84BoundingBoxType(180, -66.0000000558794, -180, 65.9999999720603));
    SummaryRecordType record = new SummaryRecordType(id, title, type, bbox, subject, formats, modified, Abstract);
    StringWriter sw = new StringWriter();
    marshaller.marshal(record, sw);
    String result = sw.toString();
    String expResult = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<csw:SummaryRecord 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>format 11-11</dc:format>\n" + "  <dc:format>format 22-22</dc:format>\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";
    assertXmlEquals(expResult, result, "xmlns:*");
    /*
         * Test marshalling csw summmary Record v2.0.2
         */
    List<SimpleLiteral> ids = new ArrayList<>();
    ids.add(new SimpleLiteral("{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}"));
    ids.add(new SimpleLiteral("urn:ogc-x:df:F7807C8AB645"));
    List<SimpleLiteral> titles = new ArrayList<>();
    titles.add(new SimpleLiteral("(JASON-1)"));
    titles.add(new SimpleLiteral("(JASON-2)"));
    type = new SimpleLiteral("clearinghouse");
    subject = new ArrayList<>();
    subject.add(new SimpleLiteral("oceans elevation NASA/JPL/JASON-1"));
    subject.add(new SimpleLiteral("oceans elevation 2"));
    formats = new ArrayList<>();
    formats.add(new SimpleLiteral("format 11-11"));
    formats.add(new SimpleLiteral("format 22-22"));
    List<SimpleLiteral> modifieds = new ArrayList<>();
    modifieds.add(new SimpleLiteral("2007-11-15 21:26:49"));
    modifieds.add(new SimpleLiteral("2007-11-15 21:26:48"));
    Abstract = new ArrayList<>();
    Abstract.add(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."));
    Abstract.add(new SimpleLiteral("Jason-2 blablablablabla."));
    bbox = new ArrayList<>();
    bbox.add(new WGS84BoundingBoxType(180, -66.0000000558794, -180, 65.9999999720603));
    bbox.add(new WGS84BoundingBoxType(100, -6.04, -144, 5.9));
    record = new SummaryRecordType(ids, titles, type, bbox, subject, formats, modifieds, Abstract);
    sw = new StringWriter();
    marshaller.marshal(record, sw);
    result = sw.toString();
    expResult = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<csw:SummaryRecord 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:identifier>urn:ogc-x:df:F7807C8AB645</dc:identifier>\n" + "  <dc:title>(JASON-1)</dc:title>\n" + "  <dc:title>(JASON-2)</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>format 11-11</dc:format>\n" + "  <dc:format>format 22-22</dc:format>\n" + "  <dct:modified>2007-11-15 21:26:49</dct:modified>\n" + "  <dct:modified>2007-11-15 21:26:48</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:abstract>Jason-2 blablablablabla.</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" + "  <ows:WGS84BoundingBox dimensions=\"2\">\n" + "    <ows:LowerCorner>100.0 -6.04</ows:LowerCorner>\n" + "    <ows:UpperCorner>-144.0 5.9</ows:UpperCorner>\n" + "  </ows:WGS84BoundingBox>\n" + "</csw:SummaryRecord>\n";
    assertXmlEquals(expResult, result, "xmlns:*");
    pool.recycle(marshaller);
}
Also used : BoundingBoxType(org.geotoolkit.ows.xml.v100.BoundingBoxType) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) SummaryRecordType(org.geotoolkit.csw.xml.v202.SummaryRecordType) Marshaller(javax.xml.bind.Marshaller) StringWriter(java.io.StringWriter) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) ArrayList(java.util.ArrayList) SimpleLiteral(org.geotoolkit.dublincore.xml.v2.elements.SimpleLiteral) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)15 ArrayList (java.util.ArrayList)13 SimpleLiteral (org.geotoolkit.dublincore.xml.v2.elements.SimpleLiteral)13 BoundingBoxType (org.geotoolkit.ows.xml.v100.BoundingBoxType)13 WGS84BoundingBoxType (org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType)13 BriefRecordType (org.geotoolkit.csw.xml.v202.BriefRecordType)11 SummaryRecordType (org.geotoolkit.csw.xml.v202.SummaryRecordType)9 StringWriter (java.io.StringWriter)8 Marshaller (javax.xml.bind.Marshaller)8 AbstractRecordType (org.geotoolkit.csw.xml.v202.AbstractRecordType)7 RecordType (org.geotoolkit.csw.xml.v202.RecordType)7 StringReader (java.io.StringReader)6 Unmarshaller (javax.xml.bind.Unmarshaller)6 JAXBElement (javax.xml.bind.JAXBElement)3 GeneralEnvelope (org.apache.sis.geometry.GeneralEnvelope)3 BoundingBoxType (org.geotoolkit.ows.xml.v110.BoundingBoxType)3 BoundingBoxType (org.geotoolkit.ows.xml.v200.BoundingBoxType)3 Data (org.geotoolkit.wps.xml.v200.Data)3 List (java.util.List)2 GeodeticObjectBuilder (org.apache.sis.internal.referencing.GeodeticObjectBuilder)2