use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.
the class TreeTableFormatTest method testCitation.
/**
* Tests the formatting of a {@link DefaultCitation} object.
*
* @see <a href="https://issues.apache.org/jira/browse/SIS-298">SIS-298</a>
*/
@Test
public void testCitation() {
final DefaultCitation citation = DefaultCitationTest.create();
final String text = format.format(citation.asTreeTable());
assertMultilinesEquals("Citation……………………………………………………………………………… Undercurrent\n" + " ├─Alternate title………………………………………………… Andākarento\n" + " ├─Identifier……………………………………………………………… 9782505004509\n" + " │ └─Authority……………………………………………………… International Standard Book Number\n" + " │ └─Alternate title…………………………… ISBN\n" + " ├─Cited responsible party (1 of 2)\n" + " │ ├─Role…………………………………………………………………… Author\n" + " │ └─Party………………………………………………………………… Testsuya Toyoda\n" + " ├─Cited responsible party (2 of 2)\n" + " │ ├─Role…………………………………………………………………… EDITOR\n" + " │ ├─Extent……………………………………………………………… World\n" + " │ │ └─Geographic element\n" + " │ │ ├─West bound longitude…… 180°W\n" + " │ │ ├─East bound longitude…… 180°E\n" + " │ │ ├─South bound latitude…… 90°S\n" + " │ │ ├─North bound latitude…… 90°N\n" + " │ │ └─Extent type code……………… true\n" + " │ └─Party………………………………………………………………… Kōdansha\n" + " ├─Presentation form (1 of 2)…………………… Document digital\n" + " ├─Presentation form (2 of 2)…………………… Document hardcopy\n" + " └─ISBN……………………………………………………………………………… 9782505004509\n", text);
}
use of org.apache.sis.metadata.iso.citation.DefaultCitation 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.metadata.iso.citation.DefaultCitation in project sis by apache.
the class DefaultIdentifierTest method testMarshal.
/**
* Tests XML marshalling.
*
* @throws JAXBException if an error occurred during (un)marshalling.
*/
@Test
public void testMarshal() throws JAXBException {
final DefaultIdentifier identifier = new DefaultIdentifier();
identifier.setAuthority(new DefaultCitation("EPSG"));
identifier.setCode("4326");
assertXmlEquals(XML, marshal(identifier), "xmlns:*");
}
use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.
the class DefaultDataIdentificationTest method create.
/**
* Creates the instance to test.
*/
private static DefaultDataIdentification create() {
/*
* Citation
* ├─Title……………………………………………………………………………… Sea Surface Temperature Analysis Model
* ├─Date
* │ ├─Date……………………………………………………………………… Sep 22, 2005 00:00:00 AM
* │ └─Date type………………………………………………………… Creation
* └─Identifier
* └─Code……………………………………………………………………… NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc
*/
final DefaultCitation citation = new DefaultCitation("Sea Surface Temperature Analysis Model");
citation.setDates(singleton(new DefaultCitationDate(TestUtilities.date("2005-09-22 00:00:00"), DateType.CREATION)));
citation.setIdentifiers(singleton(new DefaultIdentifier("SST_Global.nc")));
/*
* Descriptive keywords
* ├─Keyword………………………………………………………………………… EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature
* ├─Type………………………………………………………………………………… Theme
* └─Thesaurus name
* └─Title…………………………………………………………………… GCMD Science Keywords
*/
final DefaultKeywords keywords = new DefaultKeywords("EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature");
keywords.setType(KeywordType.THEME);
keywords.setThesaurusName(new DefaultCitation("GCMD Science Keywords"));
/*
* Identification info
* ├─(above objects)
* ├─Abstract………………………………………………………………………………… NCEP SST Global 5.0 x 2.5 degree model data
* ├─Descriptive keywords
* │ ├─Keyword………………………………………………………………………… EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature
* │ ├─Type………………………………………………………………………………… Theme
* │ └─Thesaurus name
* │ └─Title…………………………………………………………………… GCMD Science Keywords
* ├─Resource constraints
* │ └─Use limitation……………………………………………………… Freely available
* ├─Spatial representation type……………………………… Grid
* ├─Language (1 of 2)………………………………………………………… en_US
* ├─Language (2 of 2)………………………………………………………… en
* ├─Character set…………………………………………………………………… US-ASCII
* └─Extent
* └─Geographic element
* ├─West bound longitude…………………………… 180°W
* ├─East bound longitude…………………………… 180°E
* ├─South bound latitude…………………………… 90°S
* ├─North bound latitude…………………………… 90°N
* └─Extent type code……………………………………… true
*/
final DefaultDataIdentification info = new DefaultDataIdentification(citation, "NCEP SST Global 5.0 x 2.5 degree model data", null, null);
info.setSpatialRepresentationTypes(singleton(SpatialRepresentationType.GRID));
info.setDescriptiveKeywords(singleton(keywords));
info.setResourceConstraints(singleton(new DefaultConstraints("Freely available")));
info.setExtents(singleton(Extents.WORLD));
info.setLanguages(asList(LOCALES));
info.setCharacterSets(singleton(CharacterSet.US_ASCII));
return info;
}
use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.
the class DefaultOperationMethodTest method create.
/**
* Creates a new two-dimensional operation method for an operation of the given name and identifier.
*
* @param method the operation name (example: "Mercator (variant A)").
* @param identifier the EPSG numeric identifier (example: "9804").
* @param formula formula citation (example: "EPSG guidance note #7-2").
* @param dimension the number of input and output dimension, or {@code null}.
* @param parameters the parameters (can be empty).
* @return the operation method.
*/
static DefaultOperationMethod create(final String method, final String identifier, final String formula, final Integer dimension, final ParameterDescriptor<?>... parameters) {
final Map<String, Object> properties = new HashMap<>(8);
assertNull(properties.put(OperationMethod.NAME_KEY, method));
assertNull(properties.put(ReferenceIdentifier.CODESPACE_KEY, "EPSG"));
assertNull(properties.put(Identifier.AUTHORITY_KEY, Citations.EPSG));
/*
* The parameter group for a Mercator projection is actually not empty, but it is not the purpose of
* this class to test DefaultParameterDescriptorGroup. So we use an empty group of parameters here.
*/
final ParameterDescriptorGroup pg = new DefaultParameterDescriptorGroup(properties, 1, 1, parameters);
/*
* NAME_KEY share the same Identifier instance for saving a little bit of memory.
* Then define the other properties to be given to OperationMethod.
*/
assertNotNull(properties.put(OperationMethod.NAME_KEY, pg.getName()));
assertNull(properties.put(OperationMethod.IDENTIFIERS_KEY, new ImmutableIdentifier(Citations.EPSG, "EPSG", identifier)));
assertNull(properties.put(OperationMethod.FORMULA_KEY, new DefaultCitation(formula)));
return new DefaultOperationMethod(properties, dimension, dimension, pg);
}
Aggregations