Search in sources :

Example 36 with DefaultCitation

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());
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) Test(org.junit.Test)

Example 37 with DefaultCitation

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;
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString)

Example 38 with DefaultCitation

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);
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Example 39 with DefaultCitation

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;
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) DefaultCitationDate(org.apache.sis.metadata.iso.citation.DefaultCitationDate)

Example 40 with DefaultCitation

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());
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Aggregations

DefaultCitation (org.apache.sis.metadata.iso.citation.DefaultCitation)65 Test (org.junit.Test)35 SimpleInternationalString (org.apache.sis.util.iso.SimpleInternationalString)32 DependsOnMethod (org.apache.sis.test.DependsOnMethod)21 InternationalString (org.opengis.util.InternationalString)14 Citation (org.opengis.metadata.citation.Citation)10 IdentifiedObject (org.opengis.referencing.IdentifiedObject)9 ImmutableIdentifier (org.apache.sis.metadata.iso.ImmutableIdentifier)5 DefaultResponsibleParty (org.apache.sis.metadata.iso.citation.DefaultResponsibleParty)5 URI (java.net.URI)3 DefaultIdentifier (org.apache.sis.metadata.iso.DefaultIdentifier)3 DefaultMetadata (org.apache.sis.metadata.iso.DefaultMetadata)3 DefaultCitationTest (org.apache.sis.metadata.iso.citation.DefaultCitationTest)3 DefaultOnlineResource (org.apache.sis.metadata.iso.citation.DefaultOnlineResource)3 ArrayList (java.util.ArrayList)2 CI_Citation (org.apache.sis.internal.jaxb.metadata.CI_Citation)2 SimpleIdentifiedObject (org.apache.sis.internal.simple.SimpleIdentifiedObject)2 SimpleIdentifier (org.apache.sis.internal.simple.SimpleIdentifier)2 DefaultCitationDate (org.apache.sis.metadata.iso.citation.DefaultCitationDate)2 DefaultIndividual (org.apache.sis.metadata.iso.citation.DefaultIndividual)2