use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.
the class TreeNodeChildrenTest method testReadOnlyWithoutCollections.
/**
* Tests read-only operations on a list of properties for a shallow metadata object without collections.
*/
@Test
public void testReadOnlyWithoutCollections() {
final DefaultCitation citation = metadataWithoutCollections();
final TreeNodeChildren children = create(citation, ValueExistencePolicy.NON_EMPTY);
final String[] expected = { "Some title", "Some edition", "Some other details" };
assertEquals("titleProperty", -1, children.titleProperty);
assertFalse("isEmpty()", children.isEmpty());
assertEquals("size()", expected.length, children.size());
assertAllNextEqual(expected, children.iterator());
}
use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.
the class TreeNodeChildrenTest method metadataWithMultiOccurrences.
/**
* Creates a shallow metadata object with multi-occurrences (i.e. more than one value in collections).
* This method creates the following metadata:
*
* {@preformat text
* DefaultCitation
* ├─Title………………………………………………………… Some title
* ├─Alternate title (1 of 2)……… First alternate title
* ├─Alternate title (2 of 2)……… Second alternate title
* ├─Edition…………………………………………………… Some edition
* ├─Presentation form (1 of 2)… Map digital
* ├─Presentation form (2 of 2)… map hardcopy
* └─Other citation details…………… Some other details
* }
*/
static DefaultCitation metadataWithMultiOccurrences() {
final DefaultCitation citation = metadataWithSingletonInCollections();
assertTrue(citation.getAlternateTitles().add(new SimpleInternationalString("Second alternate title")));
assertTrue(citation.getPresentationForms().add(PresentationForm.MAP_HARDCOPY));
return citation;
}
use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.
the class TreeNodeChildrenTest method testRemoveWithoutCollections.
/**
* Tests the {@link Iterator#remove()} operation on a list of properties without collections.
*/
@Test
@DependsOnMethod("testReadOnlyWithoutCollections")
public void testRemoveWithoutCollections() {
final DefaultCitation citation = metadataWithoutCollections();
final TreeNodeChildren children = create(citation, ValueExistencePolicy.NON_EMPTY);
assertEquals("titleProperty", -1, children.titleProperty);
testRemove(TestUtilities.createRandomNumberGenerator(), children);
}
use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.
the class TreeNodeChildrenTest method metadataSimplifiable.
/**
* Creates a metadata object with a property than can be simplified.
* Strictly speaking, the metadata is:
*
* {@preformat text
* DefaultCitation
* └─Date
* ├─Date………………… 2012-01-01
* └─Date type…… Creation
* }
*
* However the tree view should simplify as:
*
* {@preformat text
* DefaultCitation
* └─Date………………………… 2012-01-01
* └─Date type…… Creation
* }
*
* @see <a href="https://issues.apache.org/jira/browse/SIS-298">SIS-298</a>
*/
static DefaultCitation metadataSimplifiable() {
final DefaultCitation citation = new DefaultCitation();
final DefaultCitationDate date = new DefaultCitationDate(TestUtilities.date("2012-01-01 00:00:00"), DateType.CREATION);
assertTrue(citation.getDates().add(date));
return citation;
}
use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.
the class TreeNodeChildrenTest method testReadOnlyWithMultiOccurrences.
/**
* Tests read-only operations on a list of properties for a shallow metadata object with more
* than one values in collections.
*/
@Test
@DependsOnMethod("testReadOnlyWithSingletonInCollections")
public void testReadOnlyWithMultiOccurrences() {
final DefaultCitation citation = metadataWithMultiOccurrences();
final TreeNodeChildren children = create(citation, ValueExistencePolicy.NON_EMPTY);
final String[] expected = { "Some title", "First alternate title", "Second alternate title", "Some edition", "PresentationForm[MAP_DIGITAL]", "PresentationForm[MAP_HARDCOPY]", "Some other details" };
assertEquals("titleProperty", -1, children.titleProperty);
assertFalse("isEmpty()", children.isEmpty());
assertEquals("size()", expected.length, children.size());
assertAllNextEqual(expected, children.iterator());
}
Aggregations