use of io.atlasmap.v2.Document in project mycore by MyCoRe-Org.
the class MCRXSLTransformationTest method transform.
@Test
public void transform() {
Element root = new Element("root");
Document in = new Document(root);
root.addContent(new Element("child").setAttribute("hasChildren", "no"));
Document out = MCRXSLTransformation.transform(in, stylesheet.getAbsolutePath());
assertTrue("Input not the same as Output", MCRXMLHelper.deepEqual(in, out));
}
use of io.atlasmap.v2.Document in project mycore by MyCoRe-Org.
the class MCRCategLinkServiceImplTest method loadWorldClassification.
private void loadWorldClassification() throws URISyntaxException, MCRException, SAXParseException, IOException {
URL worlClassUrl = this.getClass().getResource(WORLD_CLASS_RESOURCE_NAME);
Document xml = MCRXMLParserFactory.getParser().parseXML(new MCRVFSContent(worlClassUrl));
category = MCRXMLTransformer.getCategory(xml);
}
use of io.atlasmap.v2.Document in project mycore by MyCoRe-Org.
the class MCRMetadataStoreTest method getNextFreeID.
@Test
public void getNextFreeID() throws Exception {
int id1 = getMetaDataStore().getNextFreeID();
assertTrue(id1 >= 0);
assertFalse(getMetaDataStore().exists(id1));
Document xml1 = new Document(new Element("root"));
int id2 = getMetaDataStore().create(new MCRJDOMContent(xml1)).getID();
assertTrue(id2 > id1);
assertTrue(getMetaDataStore().getNextFreeID() > id2);
}
use of io.atlasmap.v2.Document in project mycore by MyCoRe-Org.
the class MCRMetadataStoreTest method retrieve.
@Test
public void retrieve() throws Exception {
Document xml1 = new Document(new Element("root"));
int id = getMetaDataStore().create(new MCRJDOMContent(xml1)).getID();
MCRStoredMetadata sm1 = getMetaDataStore().retrieve(id);
MCRContent xml2 = sm1.getMetadata();
assertEquals(new MCRJDOMContent(xml1).asString(), xml2.asString());
}
use of io.atlasmap.v2.Document in project mycore by MyCoRe-Org.
the class MCRMetadataStoreTest method createDocumentInt.
@Test
public void createDocumentInt() throws Exception {
Document xml1 = new Document(new Element("root"));
try {
getMetaDataStore().create(new MCRJDOMContent(xml1), 0);
fail("metadata store allows to save with id \"0\".");
} catch (Exception e) {
// test passed
}
int id = getMetaDataStore().getNextFreeID();
assertTrue(id > 0);
MCRStoredMetadata sm1 = getMetaDataStore().create(new MCRJDOMContent(xml1), id);
assertNotNull(sm1);
MCRContent xml2 = getMetaDataStore().retrieve(id).getMetadata();
assertEquals(new MCRJDOMContent(xml1).asString(), xml2.asString());
getMetaDataStore().create(new MCRJDOMContent(xml1), id + 1);
MCRContent xml3 = getMetaDataStore().retrieve(id + 1).getMetadata();
assertEquals(new MCRJDOMContent(xml1).asString(), xml3.asString());
}
Aggregations