Exemplo n.º 1
0
  @Test
  public void replace() throws Exception {
    SourceRecord record =
        SourceRecordHelper.getSourceRecordFromFile(
            "records/csw/Record_1ef30a8b-876d-4828-9246-c37ab4510bbd.xml");
    BuilderRecord mappedRecord = (BuilderRecord) cswMapper.map(record);
    String mappedRecordString = mappedRecord.getBuilder().string();

    assertThat(
        "Mapped record contains field", mappedRecordString, allOf(containsString("replacer")));
    assertThat(
        "Mapped record contains replaced coordinates as string",
        mappedRecordString,
        containsString(" [ \"60_042 13_754\", \"68_410 17_920\" ]"));
  }
Exemplo n.º 2
0
  @Test
  public void fullXml() throws Exception {
    SourceRecord record =
        SourceRecordHelper.getSourceRecordFromFile(
            "records/csw/Record_1ef30a8b-876d-4828-9246-c37ab4510bbd.xml");
    BuilderRecord mappedRecord = (BuilderRecord) cswMapper.map(record);
    String mappedRecordString = mappedRecord.getBuilder().string();

    assertThat(
        "Mapped record contains xmldoc field name", mappedRecordString, containsString("xmldoc"));
    assertThat(
        "Mapped record contains xml snippets",
        mappedRecordString,
        allOf(
            containsString("<dc:type>http://purl.org/dc/dcmitype/Service</dc:type>"),
            containsString("tifier>urn:uuid:1ef3"),
            containsString("<ows:LowerCorner>60.042 13.754</ows:LowerCorner>\\n")));
  }
Exemplo n.º 3
0
  @Test
  public void bbox() throws Exception {
    SourceRecord record =
        SourceRecordHelper.getSourceRecordFromFile(
            "records/csw/Record_1ef30a8b-876d-4828-9246-c37ab4510bbd.xml");
    BuilderRecord mappedRecord = (BuilderRecord) cswMapper.map(record);
    String mappedRecordString = mappedRecord.getBuilder().string();

    // https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-geo-shape-type.html#_envelope
    // lat lon as array > GeoJSON conform: [lon, lat]
    assertThat(
        "Mapped record contains envelope location",
        mappedRecordString,
        allOf(containsString("location"), containsString("envelope")));
    assertThat(
        "Mapped record contains correct coordinate string",
        mappedRecordString,
        containsString("[ [ 68.41, 13.754 ], [ 60.042, 17.92 ] ]"));
  }
Exemplo n.º 4
0
  @Test
  public void xmlSubelement() throws Exception {
    SourceRecord record =
        SourceRecordHelper.getSourceRecordFromFile(
            "records/csw/Record_1ef30a8b-876d-4828-9246-c37ab4510bbd.xml");
    BuilderRecord mappedRecord = (BuilderRecord) cswMapper.map(record);
    String mappedRecordString = mappedRecord.getBuilder().string();

    assertThat(
        "Mapped record contains xmldoc field name",
        mappedRecordString,
        containsString("bbox_xmldoc"));
    assertThat(
        "Mapped record contains xml snippets",
        mappedRecordString,
        JsonMatchers.hasJsonPath(
            "bbox_xmldoc",
            allOf(
                containsString("<ows:BoundingBox xmlns:"),
                containsString("<ows:LowerCorner>60.042 13.754</ows:LowerCorner>"),
                not(containsString("csw:Record")),
                not(containsString("urn:uuid")))));
  }