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