Search in sources :

Example 11 with SimpleInternationalString

use of org.apache.sis.util.iso.SimpleInternationalString in project sis by apache.

the class TreeNodeChildrenTest method metadataWithoutCollections.

/**
 * Creates a shallow metadata object without collections.
 *
 * {@preformat text
 *   DefaultCitation
 *     ├─Title………………………………………………… Some title
 *     ├─Edition…………………………………………… Some edition
 *     └─Other citation details…… Some other details
 * }
 */
static DefaultCitation metadataWithoutCollections() {
    final DefaultCitation citation = new DefaultCitation("Some title");
    citation.setEdition(new SimpleInternationalString("Some edition"));
    citation.setOtherCitationDetails(new SimpleInternationalString("Some other details"));
    return citation;
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString)

Example 12 with SimpleInternationalString

use of org.apache.sis.util.iso.SimpleInternationalString in project sis by apache.

the class TreeTableFormatTest method testTreeWithCustomElements.

/**
 * Tests the formatting of a {@link DefaultDataIdentification} object with custom code list elements
 */
@Test
public void testTreeWithCustomElements() {
    final DefaultCitation citation = new DefaultCitation();
    citation.setAlternateTitles(Arrays.asList(new SimpleInternationalString("Apple"), new SimpleInternationalString("Orange"), new SimpleInternationalString("Kiwi")));
    citation.setPresentationForms(Arrays.asList(PresentationForm.IMAGE_DIGITAL, // Existing form
    PresentationForm.valueOf("AUDIO_DIGITAL"), // Custom form
    PresentationForm.valueOf("test")));
    final String text = format.format(citation.asTreeTable());
    assertMultilinesEquals("Citation\n" + "  ├─Alternate title (1 of 3)………… Apple\n" + "  ├─Alternate title (2 of 3)………… Orange\n" + "  ├─Alternate title (3 of 3)………… Kiwi\n" + "  ├─Presentation form (1 of 3)…… Image digital\n" + // Missing localization resource for that one.
    "  ├─Presentation form (2 of 3)…… AUDIO-DIGITAL\n" + "  └─Presentation form (3 of 3)…… Test\n", text);
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) Test(org.junit.Test) DefaultCitationTest(org.apache.sis.metadata.iso.citation.DefaultCitationTest)

Example 13 with SimpleInternationalString

use of org.apache.sis.util.iso.SimpleInternationalString in project sis by apache.

the class DefaultGeorectifiedTest method testCheckPointAvailable.

/**
 * Tests {@link DefaultGeorectified#isCheckPointAvailable()} and
 * {@link DefaultGeorectified#setCheckPointAvailable(boolean)}.
 */
@Test
public void testCheckPointAvailable() {
    final DefaultGeorectified metadata = new DefaultGeorectified();
    final InternationalString description = new SimpleInternationalString("A check point description.");
    assertFalse("checkPointAvailability", metadata.isCheckPointAvailable());
    // Setting the description shall set automatically the availability.
    metadata.setCheckPointDescription(description);
    assertTrue("checkPointAvailability", metadata.isCheckPointAvailable());
    loggings.assertNoUnexpectedLog();
    // Setting the availability flag shall hide the description and logs a message.
    metadata.setCheckPointAvailable(false);
    assertNull("checkPointDescription", metadata.getCheckPointDescription());
    loggings.assertNextLogContains("checkPointDescription", "checkPointAvailability");
    loggings.assertNoUnexpectedLog();
    // Setting the availability flag shall bring back the description.
    metadata.setCheckPointAvailable(true);
    assertSame("checkPointDescription", description, metadata.getCheckPointDescription());
}
Also used : SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) InternationalString(org.opengis.util.InternationalString) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) Test(org.junit.Test)

Example 14 with SimpleInternationalString

use of org.apache.sis.util.iso.SimpleInternationalString in project sis by apache.

the class DefaultCitationTest method create.

/**
 * Creates a citation with an arbitrary title, presentation form and other properties.
 *
 * @return an arbitrary citation.
 *
 * @since 0.7
 */
public static DefaultCitation create() {
    final DefaultCitation citation = new DefaultCitation();
    final DefaultInternationalString title = new DefaultInternationalString();
    title.add(Locale.JAPANESE, "アンダーカレント");
    title.add(Locale.ENGLISH, "Undercurrent");
    citation.setTitle(title);
    citation.setISBN("9782505004509");
    citation.setPresentationForms(Arrays.asList(PresentationForm.DOCUMENT_HARDCOPY, PresentationForm.DOCUMENT_DIGITAL));
    citation.setAlternateTitles(Collections.singleton(// Actually a different script of the Japanese title.
    new SimpleInternationalString("Andākarento")));
    final DefaultResponsibleParty author = new DefaultResponsibleParty(Role.AUTHOR);
    author.setParties(Collections.singleton(new DefaultIndividual("Testsuya Toyoda", null, null)));
    final DefaultResponsibleParty editor = new DefaultResponsibleParty(Role.valueOf("EDITOR"));
    editor.setParties(Collections.singleton(new DefaultOrganisation("Kōdansha", null, null, null)));
    editor.setExtents(Collections.singleton(Extents.WORLD));
    citation.setCitedResponsibleParties(Arrays.asList(author, editor));
    return citation;
}
Also used : SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) DefaultInternationalString(org.apache.sis.util.iso.DefaultInternationalString)

Example 15 with SimpleInternationalString

use of org.apache.sis.util.iso.SimpleInternationalString in project sis by apache.

the class DefaultCitationTest method testMarshalling.

/**
 * Tests XML marshalling for the given metadata version.
 *
 * @param  file     file containing the expected metadata.
 * @param  version  the metadata version to marshal.
 */
private void testMarshalling(final String file, final Version version) throws JAXBException {
    final DefaultOnlineResource rs = new DefaultOnlineResource(URI.create("https://tools.ietf.org/html/rfc1149"));
    rs.setName("IP over Avian Carriers");
    rs.setDescription(new SimpleInternationalString("High delay, low throughput, and low altitude service."));
    rs.setFunction(OnLineFunction.OFFLINE_ACCESS);
    final DefaultContact contact = new DefaultContact(rs);
    contact.setContactInstructions(new SimpleInternationalString("Send carrier pigeon."));
    contact.getIdentifierMap().putSpecialized(IdentifierSpace.ID, "ip-protocol");
    final DefaultCitation c = new DefaultCitation("Fight against poverty");
    final DefaultResponsibleParty r1 = new DefaultResponsibleParty(Role.ORIGINATOR);
    final DefaultResponsibleParty r2 = new DefaultResponsibleParty(Role.valueOf("funder"));
    r1.setParties(Collections.singleton(new DefaultIndividual("Maid Marian", null, contact)));
    r2.setParties(Collections.singleton(new DefaultIndividual("Robin Hood", null, contact)));
    c.setCitedResponsibleParties(Arrays.asList(r1, r2));
    c.getDates().add(new DefaultCitationDate(TestUtilities.date("2015-10-17 00:00:00"), DateType.valueOf("adopted")));
    c.getPresentationForms().add(PresentationForm.valueOf("physicalObject"));
    /*
         * Check that XML file built by the marshaller is the same as the example file.
         */
    assertMarshalEqualsFile(file, c, version, "xmlns:*", "xsi:schemaLocation");
}
Also used : SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString)

Aggregations

SimpleInternationalString (org.apache.sis.util.iso.SimpleInternationalString)45 Test (org.junit.Test)20 DefaultCitation (org.apache.sis.metadata.iso.citation.DefaultCitation)19 InternationalString (org.opengis.util.InternationalString)14 URI (java.net.URI)4 DependsOnMethod (org.apache.sis.test.DependsOnMethod)4 NamedIdentifier (org.apache.sis.referencing.NamedIdentifier)3 Citation (org.opengis.metadata.citation.Citation)3 IdentifiedObject (org.opengis.referencing.IdentifiedObject)3 Collection (java.util.Collection)2 DefaultIdentifier (org.apache.sis.metadata.iso.DefaultIdentifier)2 DefaultMetadata (org.apache.sis.metadata.iso.DefaultMetadata)2 DefaultAcquisitionInformation (org.apache.sis.metadata.iso.acquisition.DefaultAcquisitionInformation)2 DefaultInstrument (org.apache.sis.metadata.iso.acquisition.DefaultInstrument)2 DefaultPlatform (org.apache.sis.metadata.iso.acquisition.DefaultPlatform)2 DefaultFormat (org.apache.sis.metadata.iso.distribution.DefaultFormat)2 DefaultDataQuality (org.apache.sis.metadata.iso.quality.DefaultDataQuality)2 InvocationHandler (java.lang.reflect.InvocationHandler)1 Method (java.lang.reflect.Method)1 URISyntaxException (java.net.URISyntaxException)1