Search in sources :

Example 1 with Contact

use of org.opengis.metadata.citation.Contact in project sis by apache.

the class DefaultCitationTest method testUnmarshalling.

/**
 * Tests XML unmarshalling for a metadata version.
 * The version is not specified since it should be detected automatically.
 *
 * @param  file  file containing the metadata to unmarshal.
 */
private void testUnmarshalling(final String file) throws JAXBException {
    final DefaultCitation c = unmarshalFile(DefaultCitation.class, file);
    assertTitleEquals("title", "Fight against poverty", c);
    final CitationDate date = getSingleton(c.getDates());
    assertEquals("date", date.getDate(), TestUtilities.date("2015-10-17 00:00:00"));
    assertEquals("dateType", DateType.valueOf("adopted"), date.getDateType());
    assertEquals("presentationForm", PresentationForm.valueOf("physicalObject"), getSingleton(c.getPresentationForms()));
    final Iterator<ResponsibleParty> it = c.getCitedResponsibleParties().iterator();
    final Contact contact = assertResponsibilityEquals(Role.ORIGINATOR, "Maid Marian", it.next());
    assertEquals("Contact instruction", "Send carrier pigeon.", String.valueOf(contact.getContactInstructions()));
    final OnlineResource resource = contact.getOnlineResource();
    assertEquals("Resource name", "IP over Avian Carriers", String.valueOf(resource.getName()));
    assertEquals("Resource description", "High delay, low throughput, and low altitude service.", String.valueOf(resource.getDescription()));
    assertEquals("Resource linkage", "https://tools.ietf.org/html/rfc1149", String.valueOf(resource.getLinkage()));
    assertEquals("Resource function", OnLineFunction.OFFLINE_ACCESS, resource.getFunction());
    // Thanks to xlink:href, the Contact shall be the same instance as above.
    assertSame("contact", contact, assertResponsibilityEquals(Role.valueOf("funder"), "Robin Hood", it.next()));
    assertFalse(it.hasNext());
}
Also used : OnlineResource(org.opengis.metadata.citation.OnlineResource) CitationDate(org.opengis.metadata.citation.CitationDate) ResponsibleParty(org.opengis.metadata.citation.ResponsibleParty) Contact(org.opengis.metadata.citation.Contact)

Aggregations

CitationDate (org.opengis.metadata.citation.CitationDate)1 Contact (org.opengis.metadata.citation.Contact)1 OnlineResource (org.opengis.metadata.citation.OnlineResource)1 ResponsibleParty (org.opengis.metadata.citation.ResponsibleParty)1