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;
}
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);
}
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());
}
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;
}
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");
}
Aggregations