Search in sources :

Example 41 with DefaultCitation

use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.

the class TreeNodeChildrenTest method testRemoveWithMultiOccurrences.

/**
 * Tests the {@link Iterator#remove()} operation on a list of properties with
 * collections containing more than one element.
 */
@Test
@DependsOnMethod({ "testRemoveWithSingletonInCollections", "testReadOnlyWithMultiOccurrences" })
public void testRemoveWithMultiOccurrences() {
    final DefaultCitation citation = metadataWithSingletonInCollections();
    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 42 with DefaultCitation

use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.

the class TreeNodeChildrenTest method metadataWithSingletonInCollections.

/**
 * Creates a shallow metadata object with singleton value in collections.
 * This method creates the following metadata:
 *
 * {@preformat text
 *   DefaultCitation
 *     ├─Title………………………………………………… Some title
 *     ├─Alternate title……………………… First alternate title
 *     ├─Edition…………………………………………… Some edition
 *     ├─Presentation form………………… Map digital
 *     └─Other citation details…… Some other details
 * }
 */
static DefaultCitation metadataWithSingletonInCollections() {
    final DefaultCitation citation = metadataWithoutCollections();
    assertTrue(citation.getAlternateTitles().add(new SimpleInternationalString("First alternate title")));
    assertTrue(citation.getPresentationForms().add(PresentationForm.MAP_DIGITAL));
    return citation;
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString)

Example 43 with DefaultCitation

use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.

the class TreeNodeTest method testRootNode.

/**
 * Tests the properties of the root node.
 */
@Test
public void testRootNode() {
    final DefaultCitation citation = TreeNodeChildrenTest.metadataWithoutCollections();
    final TreeNode node = create(citation, Citation.class);
    assertEquals("getName()", "Citation", node.getName());
    assertEquals("getIdentifier()", "CI_Citation", node.getIdentifier());
    assertEquals("baseType", Citation.class, node.baseType);
    assertSame("getUserObject()", citation, node.getUserObject());
    assertFalse("isWritable()", node.isWritable());
    assertNull("getParent()", node.getParent());
    assertFalse("isLeaf()", node.isLeaf());
    final TreeNodeChildren children = (TreeNodeChildren) node.getChildren();
    assertEquals("children.titleProperty", -1, children.titleProperty);
    assertSame("children.metadata", citation, children.metadata);
    assertFalse("children.isEmpty()", node.getChildren().isEmpty());
    assertSame("children.parent", node, children.iterator().next().getParent());
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) Test(org.junit.Test)

Example 44 with DefaultCitation

use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.

the class TreeNodeTest method testGetNameForSingleton.

/**
 * Tests {@link TreeNode#getName()} on a metadata with only one entry in collections.
 * Those names shall <em>not</em> contain numbering like <cite>"(1 of 2)"</cite>.
 */
@Test
// Because tested more basic methods than 'getValue(TableColumn)'.
@DependsOnMethod("testRootNode")
public void testGetNameForSingleton() {
    final DefaultCitation citation = TreeNodeChildrenTest.metadataWithSingletonInCollections();
    assertColumnContentEquals(create(citation, Citation.class), TableColumn.NAME, "Citation", "Title", "Alternate title", "Edition", "Presentation form", "Other citation details");
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) Citation(org.opengis.metadata.citation.Citation) DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Example 45 with DefaultCitation

use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.

the class CodeListMarshallingTest method testExtraCodes.

/**
 * Tests marshaling of a code list which is not in the list of standard codes.
 *
 * @throws JAXBException if an error occurred while marshaling the XML.
 */
@Test
public void testExtraCodes() throws JAXBException {
    final DefaultCitation id = new DefaultCitation();
    id.setPresentationForms(Arrays.asList(// Existing code with UML id="imageDigital"
    PresentationForm.valueOf("IMAGE_DIGITAL"), // New code
    PresentationForm.valueOf("test")));
    final String xml = marshal(id);
    /*
         * "IMAGE_DIGITAL" is marshalled as "imageDigital" because is contains a UML id, which is lower-case.
         */
    assertXmlEquals("<cit:CI_Citation xmlns:cit=\"" + Namespaces.CIT + "\">\n" + "  <cit:presentationForm>\n" + "    <cit:CI_PresentationFormCode codeListValue=\"imageDigital\">Image digital</cit:CI_PresentationFormCode>\n" + "  </cit:presentationForm>\n" + "  <cit:presentationForm>\n" + "    <cit:CI_PresentationFormCode codeListValue=\"test\">Test</cit:CI_PresentationFormCode>\n" + "  </cit:presentationForm>\n" + "</cit:CI_Citation>\n", xml, "xmlns:*", "codeList", "codeSpace");
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) Test(org.junit.Test)

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