BAEL-3038 Add integration tests (#7495)

* Adds first tutorial examples

* Add README

* Add packages for XML- and JSON-stuff

* Update CreateJsonVersionedResource.java

* Update CreateJsonVersionedResource.java

* Update CreateXmlDatabase.java

* Update CreateJsonVersionedResource.java

* Add class and minor changes

* Add versioned XML resource example

* Add output when done

* Add exmaple

* Add example

* Add example

* Change to integration tests

* Move to persistence-modules / change class names / BDD test names

* Remove core-api-tutorial folder

* Add test and modify a test

* Add integration test

* Minor cleanup
This commit is contained in:
Johannes Lichtenberger
2019-08-12 17:01:00 +02:00
committed by maibin
parent f918e37fa6
commit 1f104924c7
34 changed files with 207893 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
target/
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
+3
View File
@@ -0,0 +1,3 @@
## Relevant articles:
- [Introduction to Sirix](https://www.baeldung.com/introduction-to-sirix)
+52
View File
@@ -0,0 +1,52 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.sirix</groupId>
<artifactId>core-api-tutorial</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>core-api-tutorial</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-java</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>io.sirix</groupId>
<artifactId>sirix-core</artifactId>
<version>0.9.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>${maven.release.version}</release>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.1</version> <!-- Use newer version of ASM -->
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.release.version>11</maven.release.version>
</properties>
</project>
@@ -0,0 +1,13 @@
package io.sirix.tutorial;
import java.nio.file.Path;
import java.nio.file.Paths;
public final class Constants {
private Constants() {
}
public static final String USER_HOME = System.getProperty("user.home");
public static final Path SIRIX_DATA_LOCATION = Paths.get(USER_HOME, "sirix-data");
}
@@ -0,0 +1,93 @@
package io.sirix.tutorial.json;
import org.sirix.access.trx.node.json.objectvalue.ArrayValue;
import org.sirix.access.trx.node.json.objectvalue.BooleanValue;
import org.sirix.access.trx.node.json.objectvalue.ObjectValue;
import org.sirix.access.trx.node.json.objectvalue.StringValue;
import org.sirix.api.json.JsonNodeTrx;
import org.sirix.exception.SirixException;
/**
* <h1>JSON-Document</h1>
*
* <p>
* This class creates a JSON document.
* </p>
*
* <code><pre>
* {
* "foo": ["bar", null, 2.33],
* "bar": { "hello": "world", "helloo": true },
* "baz": "hello",
* "tada": [{"foo":"bar"},{"baz":false},"boo",{},[]]
* }
* </pre></code>
*/
public final class JsonDocumentCreator {
public static final String JSON = "{\"foo\":[\"bar\",null,2.33],\"bar\":{\"hello\":\"world\",\"helloo\":true},\"baz\":\"hello\",\"tada\":[{\"foo\":\"bar\"},{\"baz\":false},\"boo\",{},[]]}";
/**
* Private Constructor, not used.
*/
private JsonDocumentCreator() {
throw new AssertionError("Not permitted to call constructor!");
}
/**
* Create simple test document containing all supported node kinds.
*
* @param wtx {@link JsonNodeWriteTrx} to write to
* @throws SirixException if anything weird happens
*/
public static void create(final JsonNodeTrx wtx) {
wtx.insertObjectAsFirstChild();
wtx.insertObjectRecordAsFirstChild("foo", new ArrayValue())
.insertStringValueAsFirstChild("bar")
.insertNullValueAsRightSibling()
.insertNumberValueAsRightSibling(2.33);
wtx.moveToParent().trx().moveToParent();
wtx.insertObjectRecordAsRightSibling("bar", new ObjectValue())
.insertObjectRecordAsFirstChild("hello", new StringValue("world"))
.moveToParent();
wtx.insertObjectRecordAsRightSibling("helloo", new BooleanValue(true))
.moveToParent().trx().moveToParent().trx().moveToParent();
wtx.insertObjectRecordAsRightSibling("baz", new StringValue("hello"))
.moveToParent();
wtx.insertObjectRecordAsRightSibling("tada", new ArrayValue())
.insertObjectAsFirstChild()
.insertObjectRecordAsFirstChild("foo", new StringValue("bar"))
.moveToParent().trx().moveToParent();
wtx.insertObjectAsRightSibling()
.insertObjectRecordAsFirstChild("baz", new BooleanValue(false))
.moveToParent().trx().moveToParent();
wtx.insertStringValueAsRightSibling("boo")
.insertObjectAsRightSibling()
.insertArrayAsRightSibling();
wtx.moveToDocumentRoot();
}
public static void createVersioned(final JsonNodeTrx wtx) {
// Create sample document.
JsonDocumentCreator.create(wtx);
wtx.commit();
// Add changes and commit a second revision.
wtx.moveToDocumentRoot().trx().moveToFirstChild();
wtx.insertObjectRecordAsFirstChild("revision2", new StringValue("yes"));
wtx.commit();
// Add changes and commit a third revision.
wtx.moveToDocumentRoot().trx().moveToFirstChild().trx().moveToFirstChild();
wtx.insertObjectRecordAsRightSibling("revision3", new StringValue("yes"));
wtx.commit();
}
}
@@ -0,0 +1,28 @@
package io.sirix.tutorial.json;
import org.sirix.access.ResourceConfiguration;
import org.sirix.api.Database;
import org.sirix.api.json.JsonResourceManager;
public final class VersionedJsonDocumentCreator {
/**
* Private Constructor, not used.
*/
private VersionedJsonDocumentCreator() {
throw new AssertionError("Not permitted to call constructor!");
}
public static void create(final Database<JsonResourceManager> database) {
final var resource = "resource";
database.createResource(ResourceConfiguration.newBuilder(resource)
.useTextCompression(false)
.useDeweyIDs(true)
.build());
try (final var manager = database.openResourceManager(resource);
final var wtx = manager.beginNodeTrx()) {
// Create sample document.
JsonDocumentCreator.createVersioned(wtx);
}
}
}
@@ -0,0 +1,33 @@
package io.sirix.tutorial.xml;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.sirix.diff.DiffDepth;
import org.sirix.diff.DiffFactory.DiffType;
import org.sirix.diff.DiffObserver;
import org.sirix.diff.DiffTuple;
public class MyXmlDiffObserver implements DiffObserver {
private final List<DiffTuple> diffTuples;
MyXmlDiffObserver() {
diffTuples = new ArrayList<>();
}
@Override
public void diffListener(DiffType diffType, long newNodeKey, long oldNodeKey, DiffDepth depth) {
if (diffType == DiffType.INSERTED || diffType == DiffType.DELETED || diffType == DiffType.UPDATED)
diffTuples.add(new DiffTuple(diffType, newNodeKey, oldNodeKey, depth));
}
@Override
public void diffDone() {
}
public List<DiffTuple> getDiffTuples() {
return Collections.unmodifiableList(diffTuples);
}
}
@@ -0,0 +1,27 @@
package io.sirix.tutorial.xml;
import org.sirix.access.ResourceConfiguration;
import org.sirix.api.Database;
import org.sirix.api.xml.XmlResourceManager;
public final class VersionedXmlDocumentCreator {
/**
* Private Constructor, not used.
*/
private VersionedXmlDocumentCreator() {
throw new AssertionError("Not permitted to call constructor!");
}
public static void create(final Database<XmlResourceManager> database) {
final var resource = "resource";
database.createResource(ResourceConfiguration.newBuilder(resource)
.useTextCompression(false)
.useDeweyIDs(true)
.build());
try (final var manager = database.openResourceManager(resource);
final var wtx = manager.beginNodeTrx()) {
XmlDocumentCreator.createVersioned(wtx);
}
}
}
@@ -0,0 +1,79 @@
package io.sirix.tutorial.json;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sirix.access.DatabaseConfiguration;
import org.sirix.access.Databases;
import org.sirix.access.ResourceConfiguration;
import org.sirix.service.json.serialize.JsonSerializer;
import org.sirix.service.json.shredder.JsonShredder;
import org.sirix.settings.VersioningType;
public final class CreateJsonDatabaseIntegrationTest {
private static final Path JSON_DIRECTORY = Paths.get("src", "test", "resources", "json");
private static final String TMP_DIRECTORY = System.getProperty("java.io.tmpdir");
private static final Path DATABASE_PATH = Paths.get(TMP_DIRECTORY, "sirix", "json-database");
private static final String COMPLEX_JSON =
"{\"problems\":[{\"Diabetes\":[{\"medications\":[{\"medicationsClasses\":[{\"className\":[{\"associatedDrug\":[{\"name\":\"asprin\",\"dose\":\"\",\"strength\":\"500 mg\"}],\"associatedDrug#2\":[{\"name\":\"somethingElse\",\"dose\":\"\",\"strength\":\"500 mg\"}]}],\"className2\":[{\"associatedDrug\":[{\"name\":\"asprin\",\"dose\":\"\",\"strength\":\"500 mg\"}],\"associatedDrug#2\":[{\"name\":\"somethingElse\",\"dose\":\"\",\"strength\":\"500 mg\"}]}]}]}],\"labs\":[{\"missing_field\":\"missing_value\"}]}],\"Asthma\":[{}]}]}";
@Before
public void setUp() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@After
public void tearDown() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@Test
public void createDatabaseResourceAndCheckWithSerialization() throws IOException {
final var pathToJsonFile = JSON_DIRECTORY.resolve("complex1.json");
// Create an empty JSON database.
Databases.createJsonDatabase(new DatabaseConfiguration(DATABASE_PATH));
// Open the database.
try (final var database = Databases.openJsonDatabase(DATABASE_PATH)) {
// Create a resource to store a JSON-document.
database.createResource(ResourceConfiguration.newBuilder("resource")
.useTextCompression(false)
.useDeweyIDs(true)
.versioningApproach(VersioningType.DIFFERENTIAL)
.revisionsToRestore(3)
.buildPathSummary(true)
.build());
// Import JSON.
try (final var manager = database.openResourceManager("resource");
final var wtx = manager.beginNodeTrx()) {
wtx.insertSubtreeAsFirstChild(JsonShredder.createFileReader(pathToJsonFile));
wtx.commit();
}
// Serialize JSON again and compare.
try (final var manager = database.openResourceManager("resource");
final Writer writer = new StringWriter()) {
final var serializer = JsonSerializer.newBuilder(manager, writer).build();
serializer.call();
assertEquals(COMPLEX_JSON, writer.toString());
}
}
}
}
@@ -0,0 +1,100 @@
package io.sirix.tutorial.json;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sirix.access.DatabaseConfiguration;
import org.sirix.access.Databases;
import org.sirix.api.ResourceManager;
import org.sirix.api.json.JsonNodeReadOnlyTrx;
import org.sirix.api.json.JsonNodeTrx;
import org.sirix.api.visitor.JsonNodeVisitor;
import org.sirix.api.visitor.VisitResult;
import org.sirix.api.visitor.VisitResultType;
import org.sirix.axis.temporal.PastAxis;
import org.sirix.axis.visitor.VisitorDescendantAxis;
import org.sirix.node.immutable.json.ImmutableObjectKeyNode;
public final class CreateVersionedJsonResourceAndQueryIntegrationTest {
private static final String TMP_DIRECTORY = System.getProperty("java.io.tmpdir");
private static final Path DATABASE_PATH = Paths.get(TMP_DIRECTORY, "sirix", "json-database");
@Before
public void setUp() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@After
public void tearDown() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@Test
public void createVersionedResourceAndQueryWithTheVisitoDescendantAxis() throws IOException {
Databases.createJsonDatabase(new DatabaseConfiguration(DATABASE_PATH));
try (final var database = Databases.openJsonDatabase(DATABASE_PATH)) {
VersionedJsonDocumentCreator.create(database);
try (final var manager = database.openResourceManager("resource");
// Starts a read only transaction on the most recent revision.
final var rtx = manager.beginNodeReadOnlyTrx()) {
final var axis = VisitorDescendantAxis.newBuilder(rtx)
.includeSelf()
.visitor(new MyJsonNodeVisitor(manager, rtx))
.build();
axis.forEach((unused) -> {});
}
}
}
private static final class MyJsonNodeVisitor implements JsonNodeVisitor {
private final ResourceManager<JsonNodeReadOnlyTrx, JsonNodeTrx> manager;
private final JsonNodeReadOnlyTrx trx;
public MyJsonNodeVisitor(final ResourceManager<JsonNodeReadOnlyTrx, JsonNodeTrx> manager, final JsonNodeReadOnlyTrx rtx) {
this.manager = manager;
this.trx = rtx;
}
@Override
public VisitResult visit(ImmutableObjectKeyNode node) {
System.out.println("Object key node (most recent revision " + trx.getRevisionNumber() + "): " + node.getName());
if (node.getNodeKey() == 24L) {
final var pastAxis = new PastAxis<>(manager, trx);
assertTrue(pastAxis.hasNext());
pastAxis.next();
assertFalse(pastAxis.hasNext());
} else if (node.getNodeKey() == 25L) {
final var pastAxis = new PastAxis<>(manager, trx);
assertFalse(pastAxis.hasNext());
}
// Axis to iterate over the node in past revisions (if the node existed back then).
final var pastAxis = new PastAxis<>(manager, trx);
pastAxis.forEachRemaining((trx) ->
System.out.println("Object key node in the past (revision " + trx.getRevisionNumber() + "): " + trx.getName()));
return VisitResultType.CONTINUE;
}
}
}
@@ -0,0 +1,96 @@
package io.sirix.tutorial.json;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.brackit.xquery.atomic.QNm;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sirix.access.DatabaseConfiguration;
import org.sirix.access.Databases;
public final class CreateVersionedJsonResourceIntegrationTest {
private static final String TMP_DIRECTORY = System.getProperty("java.io.tmpdir");
private static final Path DATABASE_PATH = Paths.get(TMP_DIRECTORY, "sirix", "json-database");
@Before
public void setUp() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@After
public void tearDown() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@Test
public void createVersionedDatabaseAndCheckAllRevisions() {
Databases.createJsonDatabase(new DatabaseConfiguration(DATABASE_PATH));
try (final var database = Databases.openJsonDatabase(DATABASE_PATH)) {
VersionedJsonDocumentCreator.create(database);
// Check first revision.
try (final var manager = database.openResourceManager("resource");
final var rtx = manager.beginNodeReadOnlyTrx(1)) {
rtx.moveToDocumentRoot().trx().moveToFirstChild().trx().moveToFirstChild();
assertEquals(new QNm("foo"), rtx.getName());
rtx.moveToFirstChild();
assertTrue(rtx.isArray());
}
// Check second revision.
try (final var manager = database.openResourceManager("resource");
final var rtx = manager.beginNodeReadOnlyTrx(2)) {
rtx.moveToDocumentRoot().trx().moveToFirstChild().trx().moveToFirstChild();
assertEquals(new QNm("revision2"), rtx.getName());
rtx.moveToFirstChild();
assertEquals("yes", rtx.getValue());
rtx.moveToParent().trx().moveToRightSibling();
assertEquals(new QNm("foo"), rtx.getName());
rtx.moveToFirstChild();
assertTrue(rtx.isArray());
}
// Check final revision.
try (final var manager = database.openResourceManager("resource");
final var rtx = manager.beginNodeReadOnlyTrx()) {
rtx.moveToDocumentRoot().trx().moveToFirstChild().trx().moveToFirstChild();
assertEquals(new QNm("revision2"), rtx.getName());
rtx.moveToFirstChild();
assertEquals("yes", rtx.getValue());
rtx.moveToParent().trx().moveToRightSibling();
assertEquals(new QNm("revision3"), rtx.getName());
rtx.moveToFirstChild();
assertEquals("yes", rtx.getValue());
}
}
}
}
@@ -0,0 +1,81 @@
package io.sirix.tutorial.json;
import static org.junit.Assert.assertEquals;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sirix.access.DatabaseConfiguration;
import org.sirix.access.Databases;
import org.sirix.access.ResourceConfiguration;
import org.sirix.api.json.JsonNodeReadOnlyTrx;
import org.sirix.axis.DescendantAxis;
import org.sirix.axis.IncludeSelf;
import org.sirix.axis.filter.FilterAxis;
import org.sirix.axis.filter.json.JsonNameFilter;
import org.sirix.service.json.shredder.JsonShredder;
import org.sirix.settings.VersioningType;
public final class JsonFilterIntegrationTest {
private static final Path JSON_DIRECTORY = Paths.get("src", "test", "resources", "json");
private static final String TMP_DIRECTORY = System.getProperty("java.io.tmpdir");
private static final Path DATABASE_PATH = Paths.get(TMP_DIRECTORY, "sirix", "json-database");
@Before
public void setUp() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@After
public void tearDown() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@Test
public void testFilter() {
final var pathToJsonFile = JSON_DIRECTORY.resolve("complex1.json");
// Create an empty JSON database.
Databases.createJsonDatabase(new DatabaseConfiguration(DATABASE_PATH));
// Open the database.
try (final var database = Databases.openJsonDatabase(DATABASE_PATH)) {
// Create a resource to store a JSON-document.
database.createResource(ResourceConfiguration.newBuilder("resource")
.useTextCompression(false)
.useDeweyIDs(true)
.versioningApproach(VersioningType.DIFFERENTIAL)
.revisionsToRestore(3)
.buildPathSummary(true)
.build());
// Import JSON.
try (final var manager = database.openResourceManager("resource");
final var wtx = manager.beginNodeTrx()) {
wtx.insertSubtreeAsFirstChild(JsonShredder.createFileReader(pathToJsonFile));
wtx.commit();
wtx.moveToDocumentRoot();
int foundTimes = 0;
final var axis = new DescendantAxis(wtx, IncludeSelf.YES);
final var filter = new JsonNameFilter(wtx, "associatedDrug");
for (var filterAxis = new FilterAxis<JsonNodeReadOnlyTrx>(axis, filter); filterAxis.hasNext();) {
filterAxis.next();
foundTimes++;
}
assertEquals(2, foundTimes);
}
}
}
}
@@ -0,0 +1,88 @@
package io.sirix.tutorial.json;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.stream.Collectors;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sirix.access.DatabaseConfiguration;
import org.sirix.access.Databases;
import org.sirix.api.json.JsonResourceManager;
import org.sirix.service.json.serialize.JsonSerializer;
public class SerializeVersionedJsonResourceIntegrationTest {
private static final Path JSON_TEST_RESULT_DIRECTORY = Paths.get("src", "test", "resources", "json-test-result-strings");
private static final String TMP_DIRECTORY = System.getProperty("java.io.tmpdir");
private static final Path DATABASE_PATH = Paths.get(TMP_DIRECTORY, "sirix", "json-database");
@Before
public void setUp() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@After
public void tearDown() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@Test
public void createVersionedResourceAndTestSerializations() throws IOException {
Databases.createJsonDatabase(new DatabaseConfiguration(DATABASE_PATH));
try (final var database = Databases.openJsonDatabase(DATABASE_PATH)) {
VersionedJsonDocumentCreator.create(database);
try (final var manager = database.openResourceManager("resource")) {
serializeRevisionOneAndTwo(manager);
serializeMostRecentRevision(manager);
serializeAllRevisions(manager);
}
}
}
private static void serializeRevisionOneAndTwo(final JsonResourceManager manager) throws IOException {
final var writer = new StringWriter();
final var serializer = JsonSerializer.newBuilder(manager, writer, 1, 2).build();
serializer.call();
final var expectedJson = Files.readAllLines(JSON_TEST_RESULT_DIRECTORY.resolve("revision1And2.json"),
StandardCharsets.UTF_8)
.stream()
.collect(Collectors.joining());
assertEquals(expectedJson, writer.toString());
}
private static void serializeMostRecentRevision(final JsonResourceManager manager) throws IOException {
final var writer = new StringWriter();
final var serializer = JsonSerializer.newBuilder(manager, writer).build();
serializer.call();
final var expectedJson = Files.readAllLines(JSON_TEST_RESULT_DIRECTORY.resolve("mostRecentRevision.json"),
StandardCharsets.UTF_8)
.stream()
.collect(Collectors.joining());
assertEquals(expectedJson, writer.toString());
}
private static void serializeAllRevisions(final JsonResourceManager manager) throws IOException {
final var writer = new StringWriter();
final var serializer = JsonSerializer.newBuilder(manager, writer, -1).build();
serializer.call();
final var expectedJson = Files.readAllLines(JSON_TEST_RESULT_DIRECTORY.resolve("allRevisions.json"),
StandardCharsets.UTF_8)
.stream()
.collect(Collectors.joining());
assertEquals(expectedJson, writer.toString());
}
}
@@ -0,0 +1,130 @@
package io.sirix.tutorial.xml;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sirix.access.DatabaseConfiguration;
import org.sirix.access.Databases;
import org.sirix.api.ResourceManager;
import org.sirix.api.visitor.VisitResult;
import org.sirix.api.visitor.VisitResultType;
import org.sirix.api.visitor.XmlNodeVisitor;
import org.sirix.api.xml.XmlNodeReadOnlyTrx;
import org.sirix.api.xml.XmlNodeTrx;
import org.sirix.axis.NonStructuralWrapperAxis;
import org.sirix.axis.temporal.PastAxis;
import org.sirix.axis.visitor.VisitorDescendantAxis;
import org.sirix.node.immutable.xdm.ImmutableElement;
import org.sirix.node.immutable.xdm.ImmutableText;
public final class CreateVersionedXmlResourceAndQueryIntegrationTest {
private static final String TMP_DIRECTORY = System.getProperty("java.io.tmpdir");
private static final Path DATABASE_PATH = Paths.get(TMP_DIRECTORY, "sirix", "xml-database");
@Before
public void setUp() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@After
public void tearDown() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@Test
public void createVersionedResourceAndQueryWithTheVisitoDescendantAxis() throws IOException {
Databases.createXmlDatabase(new DatabaseConfiguration(DATABASE_PATH));
try (final var database = Databases.openXmlDatabase(DATABASE_PATH)) {
VersionedXmlDocumentCreator.create(database);
try (final var manager = database.openResourceManager("resource");
// Starts a read only transaction on the most recent revision.
final var rtx = manager.beginNodeReadOnlyTrx()) {
final var axis = new NonStructuralWrapperAxis(
VisitorDescendantAxis.newBuilder(rtx)
.includeSelf()
.visitor(new MyXmlNodeVisitor(manager, rtx))
.build());
axis.forEach((unused) -> {});
}
}
}
private static final class MyXmlNodeVisitor implements XmlNodeVisitor {
private final ResourceManager<XmlNodeReadOnlyTrx, XmlNodeTrx> manager;
private final XmlNodeReadOnlyTrx trx;
public MyXmlNodeVisitor(final ResourceManager<XmlNodeReadOnlyTrx, XmlNodeTrx> manager, final XmlNodeReadOnlyTrx rtx) {
this.manager = manager;
this.trx = rtx;
}
@Override
public VisitResult visit(ImmutableElement node) {
System.out.println("Element (most recent revision " + trx.getRevisionNumber() + "): " + node.getName());
if (node.getNodeKey() == 14L) {
final var pastAxis = new PastAxis<>(manager, trx);
assertTrue(pastAxis.hasNext());
pastAxis.next();
assertFalse(pastAxis.hasNext());
} else if (node.getNodeKey() == 16L) {
final var pastAxis = new PastAxis<>(manager, trx);
assertFalse(pastAxis.hasNext());
}
// Axis to iterate over the node in past revisions (if the node existed back then).
final var pastAxis = new PastAxis<>(manager, trx);
pastAxis.forEachRemaining((trx) ->
System.out.println("Element in the past (revision " + trx.getRevisionNumber() + "): " + trx.getName()));
for (int i = 0, attributes = trx.getAttributeCount(); i < attributes; i++) {
trx.moveToAttribute(i);
System.out.println("Attribute (most recent revision " + trx.getRevisionNumber() + "):"
+ trx.getName() + " ='" + trx.getValue() + "'");
// Axis to iterate over the node in past revisions (if the node existed back then).
final var pastAttributeAxis = new PastAxis<>(manager, trx);
pastAttributeAxis.forEachRemaining((trx) ->
System.out.println("Attribute in the past (revision " + trx.getRevisionNumber() + "): "
+ trx.getName() + " ='" + trx.getValue() + "'"));
trx.moveToParent();
}
return VisitResultType.CONTINUE;
}
@Override
public VisitResult visit(ImmutableText node) {
System.out.println("Text (most recent revision " + trx.getRevisionNumber() + "): " + node.getValue());
// Axis to iterate over the node in past revisions (if the node existed back then).
final var pastAxis = new PastAxis<>(manager, trx);
pastAxis.forEachRemaining((trx) ->
System.out.println("Text in the past (revision " + trx.getRevisionNumber() + "): " + trx.getValue()));
return VisitResultType.CONTINUE;
}
}
}
@@ -0,0 +1,87 @@
package io.sirix.tutorial.xml;
import static org.junit.Assert.assertEquals;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.brackit.xquery.atomic.QNm;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sirix.access.DatabaseConfiguration;
import org.sirix.access.Databases;
public final class CreateVersionedXmlResourceIntegrationTest {
private static final String TMP_DIRECTORY = System.getProperty("java.io.tmpdir");
private static final Path DATABASE_PATH = Paths.get(TMP_DIRECTORY, "sirix", "json-database");
@Before
public void setUp() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@After
public void tearDown() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@Test
public void createVersionedResourceAndCheck() {
Databases.createXmlDatabase(new DatabaseConfiguration(DATABASE_PATH));
try (final var database = Databases.openXmlDatabase(DATABASE_PATH)) {
VersionedXmlDocumentCreator.create(database);
// Check first revision.
try (final var manager = database.openResourceManager("resource");
final var rtx = manager.beginNodeReadOnlyTrx(1)) {
rtx.moveToDocumentRoot().trx().moveToFirstChild().trx().moveToFirstChild();
assertEquals("oops1", rtx.getValue());
}
// Check second revision.
try (final var manager = database.openResourceManager("resource");
final var rtx = manager.beginNodeReadOnlyTrx(2)) {
rtx.moveToDocumentRoot().trx().moveToFirstChild().trx().moveToFirstChild();
assertEquals(new QNm("ns", "p", "a"), rtx.getName());
assertEquals(14L, rtx.getNodeKey());
rtx.moveToFirstChild();
assertEquals("OOPS4!", rtx.getValue());
assertEquals(15L, rtx.getNodeKey());
rtx.moveToParent().trx().moveToRightSibling();
assertEquals("oops1", rtx.getValue());
}
// Check second revision.
try (final var manager = database.openResourceManager("resource");
final var rtx = manager.beginNodeReadOnlyTrx()) {
rtx.moveToDocumentRoot().trx().moveToFirstChild().trx().moveToFirstChild();
assertEquals(new QNm("ns", "p", "a"), rtx.getName());
assertEquals(16L, rtx.getNodeKey());
rtx.moveToFirstChild();
assertEquals("OOPS4!", rtx.getValue());
assertEquals(17L, rtx.getNodeKey());
rtx.moveToParent().trx().moveToRightSibling();
assertEquals(new QNm("ns", "p", "a"), rtx.getName());
assertEquals(14L, rtx.getNodeKey());
}
}
}
}
@@ -0,0 +1,85 @@
package io.sirix.tutorial.xml;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.stream.Collectors;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sirix.access.DatabaseConfiguration;
import org.sirix.access.Databases;
import org.sirix.access.ResourceConfiguration;
import org.sirix.service.xml.serialize.XmlSerializer;
import org.sirix.service.xml.shredder.XmlShredder;
public final class CreateXmlDatabaseIntegrationTest {
private static final Path XML_TEST_RESULT_DIRECTORY = Paths.get("src", "test", "resources", "xml-test-result-strings");
private static final Path XML_DIRECTORY = Paths.get("src", "test", "resources", "xml");
private static final String TMP_DIRECTORY = System.getProperty("java.io.tmpdir");
private static final Path DATABASE_PATH = Paths.get(TMP_DIRECTORY, "sirix", "xml-database");
@Before
public void setUp() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@After
public void tearDown() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@Test
public void createDatabaseResourceAndCheckWithSerialization() throws IOException {
final var pathToXmlFile = XML_DIRECTORY.resolve("orga.xml");
// Create an empty XML database.
Databases.createXmlDatabase(new DatabaseConfiguration(DATABASE_PATH));
// Open the database.
try (final var database = Databases.openXmlDatabase(DATABASE_PATH)) {
// Create a resource to store an XML-document.
database.createResource(ResourceConfiguration.newBuilder("resource")
.useTextCompression(false)
.useDeweyIDs(true)
.build());
// Import XML.
try (final var manager = database.openResourceManager("resource");
final var wtx = manager.beginNodeTrx();
final var fileInputStream = new FileInputStream(pathToXmlFile.toFile())) {
wtx.insertSubtreeAsFirstChild(XmlShredder.createFileReader(fileInputStream));
wtx.commit();
}
// Serialize XML again and compare.
try (final var manager = database.openResourceManager("resource");
final var outputStream = new ByteArrayOutputStream()) {
final var serializer = XmlSerializer.newBuilder(manager, outputStream)
.emitXMLDeclaration()
.build();
serializer.call();
final var expectedXml = Files.readAllLines(XML_TEST_RESULT_DIRECTORY.resolve("orga.xml"),
StandardCharsets.UTF_8)
.stream()
.collect(Collectors.joining());
assertEquals(expectedXml, outputStream.toString(StandardCharsets.UTF_8));
}
}
}
}
@@ -0,0 +1,70 @@
package io.sirix.tutorial.xml;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sirix.access.DatabaseConfiguration;
import org.sirix.access.Databases;
import org.sirix.access.trx.node.HashType;
import org.sirix.diff.DiffFactory;
import org.sirix.diff.DiffFactory.DiffOptimized;
import org.sirix.diff.DiffFactory.DiffType;
import com.google.common.collect.ImmutableSet;
public class DiffXmlResourceIntegrationTest {
private static final String TMP_DIRECTORY = System.getProperty("java.io.tmpdir");
private static final Path DATABASE_PATH = Paths.get(TMP_DIRECTORY, "sirix", "xml-database");
@Before
public void setUp() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@After
public void tearDown() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@Test
public void createVersionedResourceAndCheckDiffingOfRevisionOneAndThree() throws IOException {
Databases.createXmlDatabase(new DatabaseConfiguration(DATABASE_PATH));
try (final var database = Databases.openXmlDatabase(DATABASE_PATH)) {
VersionedXmlDocumentCreator.create(database);
try (final var manager = database.openResourceManager("resource");
final var rtxOnFirstRevision = manager.beginNodeReadOnlyTrx(1);
final var rtxOnThirdRevision = manager.beginNodeReadOnlyTrx(3)) {
final var observer = new MyXmlDiffObserver();
DiffFactory.invokeFullXmlDiff(
new DiffFactory.Builder<>(manager, 3, 1, manager.getResourceConfig().hashType == HashType.NONE
? DiffOptimized.NO
: DiffOptimized.HASHED,
ImmutableSet.of(observer)).skipSubtrees(true));
final var diffs = observer.getDiffTuples();
assertEquals(2, diffs.size());
final var firstDiffTuple = diffs.get(0);
assertEquals(DiffType.INSERTED, firstDiffTuple.getDiff());
final var secondDiffTuple = diffs.get(1);
assertEquals(DiffType.INSERTED, secondDiffTuple.getDiff());
}
}
}
}
@@ -0,0 +1,106 @@
package io.sirix.tutorial.xml;
import static org.junit.Assert.assertEquals;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sirix.access.DatabaseConfiguration;
import org.sirix.access.Databases;
import org.sirix.access.ResourceConfiguration;
import org.sirix.api.Axis;
import org.sirix.axis.ChildAxis;
import org.sirix.axis.DescendantAxis;
import org.sirix.axis.IncludeSelf;
import org.sirix.axis.NestedAxis;
import org.sirix.axis.concurrent.ConcurrentAxis;
import org.sirix.axis.filter.FilterAxis;
import org.sirix.axis.filter.xml.XdmNameFilter;
import org.sirix.service.xml.shredder.XmlShredder;
/**
* Note that this simple test shows, that the higher level XQuery-API is much more user-friendly, when chaining
* axis is required.
*/
public class QueryXmlResourceWithConcurrentAxisIntegrationTest {
private static final Path XML_DIRECTORY = Paths.get("src", "test", "resources", "xml");
private static final String TMP_DIRECTORY = System.getProperty("java.io.tmpdir");
private static final Path DATABASE_PATH = Paths.get(TMP_DIRECTORY, "sirix", "xml-database");
@Before
public void setUp() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@After
public void tearDown() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@Test
public void createDatabaseAndXMarkResourceAndCheckQuery() throws IOException {
final var pathToXmlFile = XML_DIRECTORY.resolve("10mb.xml");
// Create an empty XML database.
Databases.createXmlDatabase(new DatabaseConfiguration(DATABASE_PATH));
// Open the database.
try (final var database = Databases.openXmlDatabase(DATABASE_PATH)) {
// Create a resource to store an XML-document.
database.createResource(ResourceConfiguration.newBuilder("resource")
.useTextCompression(false)
.useDeweyIDs(true)
.build());
// Import XML.
try (final var manager = database.openResourceManager("resource");
final var wtx = manager.beginNodeTrx();
final var fileInputStream = new FileInputStream(pathToXmlFile.toFile())) {
wtx.insertSubtreeAsFirstChild(XmlShredder.createFileReader(fileInputStream));
wtx.commit();
}
try (final var manager = database.openResourceManager("resource");
final var firstConcurrRtx = manager.beginNodeReadOnlyTrx();
final var secondConcurrRtx = manager.beginNodeReadOnlyTrx();
final var thirdConcurrRtx = manager.beginNodeReadOnlyTrx();
final var firstRtx = manager.beginNodeReadOnlyTrx();
final var secondRtx = manager.beginNodeReadOnlyTrx();
final var thirdRtx = manager.beginNodeReadOnlyTrx()) {
/* query: //regions/africa//location */
final Axis axis =
new NestedAxis(
new NestedAxis(
new ConcurrentAxis<>(firstConcurrRtx,
new FilterAxis<>(new DescendantAxis(firstRtx, IncludeSelf.YES),
new XdmNameFilter(firstRtx, "regions"))),
new ConcurrentAxis<>(secondConcurrRtx,
new FilterAxis<>(new ChildAxis(secondRtx),
new XdmNameFilter(secondRtx, "africa")))),
new ConcurrentAxis<>(thirdConcurrRtx,
new FilterAxis<>(new DescendantAxis(thirdRtx, IncludeSelf.YES),
new XdmNameFilter(thirdRtx, "location"))));
final var resultNumber = 55;
for (int i = 0; i < resultNumber; i++) {
assertEquals(true, axis.hasNext());
axis.next();
}
assertEquals(false, axis.hasNext());
}
}
}
}
@@ -0,0 +1,97 @@
package io.sirix.tutorial.xml;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.stream.Collectors;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sirix.access.DatabaseConfiguration;
import org.sirix.access.Databases;
import org.sirix.api.xml.XmlResourceManager;
import org.sirix.service.xml.serialize.XmlSerializer;
public class SerializeVersionedXmlResourceIntegrationTest {
private static final Path XML_TEST_RESULT_DIRECTORY = Paths.get("src", "test", "resources", "xml-test-result-strings");
private static final String TMP_DIRECTORY = System.getProperty("java.io.tmpdir");
private static final Path DATABASE_PATH = Paths.get(TMP_DIRECTORY, "sirix", "xml-database");
@Before
public void setUp() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@After
public void tearDown() throws Exception {
if (Files.exists(DATABASE_PATH))
Databases.removeDatabase(DATABASE_PATH);
}
@Test
public void createVersionedResourceAndTestSerializations() throws IOException {
Databases.createXmlDatabase(new DatabaseConfiguration(DATABASE_PATH));
try (final var database = Databases.openXmlDatabase(DATABASE_PATH)) {
VersionedXmlDocumentCreator.create(database);
try (final var manager = database.openResourceManager("resource")) {
serializeRevisionOneAndTwo(manager);
serializeMostRecentRevision(manager);
serializeAllRevisions(manager);
}
}
}
private static void serializeRevisionOneAndTwo(final XmlResourceManager manager) throws IOException {
final var outputStream = new ByteArrayOutputStream();
final var serializerForRevisionOneAndTwo =
XmlSerializer.newBuilder(manager, outputStream, 1, 2).emitIDs()
.prettyPrint()
.build();
serializerForRevisionOneAndTwo.call();
final var expectedXml = Files.readAllLines(XML_TEST_RESULT_DIRECTORY.resolve("revision1And2.xml"),
StandardCharsets.UTF_8)
.stream()
.collect(Collectors.joining(System.lineSeparator()));
assertEquals(expectedXml, outputStream.toString(StandardCharsets.UTF_8));
}
private static void serializeMostRecentRevision(final XmlResourceManager manager) throws IOException {
final var outputStream = new ByteArrayOutputStream();
final var serializerForMostRecentRevision =
XmlSerializer.newBuilder(manager, outputStream).emitIDs()
.prettyPrint()
.build();
serializerForMostRecentRevision.call();
final var expectedXml = Files.readAllLines(XML_TEST_RESULT_DIRECTORY.resolve("mostRecentRevision.xml"),
StandardCharsets.UTF_8)
.stream()
.collect(Collectors.joining(System.lineSeparator()));
assertEquals(expectedXml, outputStream.toString(StandardCharsets.UTF_8));
}
private static void serializeAllRevisions(final XmlResourceManager manager) throws IOException {
final var outputStream = new ByteArrayOutputStream();
final var serializerForAllRevisions =
XmlSerializer.newBuilder(manager, outputStream, -1).emitIDs()
.prettyPrint()
.build();
serializerForAllRevisions.call();
final var expectedXml = Files.readAllLines(XML_TEST_RESULT_DIRECTORY.resolve("allRevisions.xml"),
StandardCharsets.UTF_8)
.stream()
.collect(Collectors.joining(System.lineSeparator()));
assertEquals(expectedXml, outputStream.toString(StandardCharsets.UTF_8));
}
}
@@ -0,0 +1 @@
{"sirix":[{"revisionNumber":1,"revision":{"foo":["bar",null,2.33],"bar":{"hello":"world","helloo":true},"baz":"hello","tada":[{"foo":"bar"},{"baz":false},"boo",{},[]]}},{"revisionNumber":2,"revision":{"revision2":"yes","foo":["bar",null,2.33],"bar":{"hello":"world","helloo":true},"baz":"hello","tada":[{"foo":"bar"},{"baz":false},"boo",{},[]]}},{"revisionNumber":3,"revision":{"revision2":"yes","revision3":"yes","foo":["bar",null,2.33],"bar":{"hello":"world","helloo":true},"baz":"hello","tada":[{"foo":"bar"},{"baz":false},"boo",{},[]]}}]}
@@ -0,0 +1 @@
{"revision2":"yes","revision3":"yes","foo":["bar",null,2.33],"bar":{"hello":"world","helloo":true},"baz":"hello","tada":[{"foo":"bar"},{"baz":false},"boo",{},[]]}
@@ -0,0 +1 @@
{"sirix":[{"revisionNumber":1,"revision":{"foo":["bar",null,2.33],"bar":{"hello":"world","helloo":true},"baz":"hello","tada":[{"foo":"bar"},{"baz":false},"boo",{},[]]}},{"revisionNumber":2,"revision":{"revision2":"yes","foo":["bar",null,2.33],"bar":{"hello":"world","helloo":true},"baz":"hello","tada":[{"foo":"bar"},{"baz":false},"boo",{},[]]}}]}
@@ -0,0 +1,37 @@
{
"problems": [{
"Diabetes":[{
"medications":[{
"medicationsClasses":[{
"className":[{
"associatedDrug":[{
"name":"asprin",
"dose":"",
"strength":"500 mg"
}],
"associatedDrug#2":[{
"name":"somethingElse",
"dose":"",
"strength":"500 mg"
}]
}],
"className2":[{
"associatedDrug":[{
"name":"asprin",
"dose":"",
"strength":"500 mg"
}],
"associatedDrug#2":[{
"name":"somethingElse",
"dose":"",
"strength":"500 mg"
}]
}]
}]
}],
"labs":[{
"missing_field": "missing_value"
}]
}],
"Asthma":[{}]
}]}
@@ -0,0 +1,151 @@
{
"medications": [
{
"aceInhibitors": [
{
"name": "lisinopril",
"strength": "10 mg Tab",
"dose": "1 tab",
"route": "PO",
"sig": "daily",
"pillCount": "#90",
"refills": "Refill 3"
}
],
"antianginal": [
{
"name": "nitroglycerin",
"strength": "0.4 mg Sublingual Tab",
"dose": "1 tab",
"route": "SL",
"sig": "q15min PRN",
"pillCount": "#30",
"refills": "Refill 1"
}
],
"anticoagulants": [
{
"name": "warfarin sodium",
"strength": "3 mg Tab",
"dose": "1 tab",
"route": "PO",
"sig": "daily",
"pillCount": "#90",
"refills": "Refill 3"
}
],
"betaBlocker": [
{
"name": "metoprolol tartrate",
"strength": "25 mg Tab",
"dose": "1 tab",
"route": "PO",
"sig": "daily",
"pillCount": "#90",
"refills": "Refill 3"
}
],
"diuretic": [
{
"name": "furosemide",
"strength": "40 mg Tab",
"dose": "1 tab",
"route": "PO",
"sig": "daily",
"pillCount": "#90",
"refills": "Refill 3"
}
],
"mineral": [
{
"name": "potassium chloride ER",
"strength": "10 mEq Tab",
"dose": "1 tab",
"route": "PO",
"sig": "daily",
"pillCount": "#90",
"refills": "Refill 3"
}
]
}
],
"labs": [
{
"name": "Arterial Blood Gas",
"time": "Today",
"location": "Main Hospital Lab"
},
{
"name": "BMP",
"time": "Today",
"location": "Primary Care Clinic"
},
{
"name": "BNP",
"time": "3 Weeks",
"location": "Primary Care Clinic"
},
{
"name": "BUN",
"time": "1 Year",
"location": "Primary Care Clinic"
},
{
"name": "Cardiac Enzymes",
"time": "Today",
"location": "Primary Care Clinic"
},
{
"name": "CBC",
"time": "1 Year",
"location": "Primary Care Clinic"
},
{
"name": "Creatinine",
"time": "1 Year",
"location": "Main Hospital Lab"
},
{
"name": "Electrolyte Panel",
"time": "1 Year",
"location": "Primary Care Clinic"
},
{
"name": "Glucose",
"time": "1 Year",
"location": "Main Hospital Lab"
},
{
"name": "PT/INR",
"time": "3 Weeks",
"location": "Primary Care Clinic"
},
{
"name": "PTT",
"time": "3 Weeks",
"location": "Coumadin Clinic"
},
{
"name": "TSH",
"time": "1 Year",
"location": "Primary Care Clinic"
}
],
"imaging": [
{
"name": "Chest X-Ray",
"time": "Today",
"location": "Main Hospital Radiology"
},
{
"name": "Chest X-Ray",
"time": "Today",
"location": "Main Hospital Radiology"
},
{
"name": "Chest X-Ray",
"time": "Today",
"location": "Main Hospital Radiology"
}
]
}
@@ -0,0 +1 @@
{"foo":["bar",null,2.33],"bar":{"hello":"world","helloo":true},"baz":"hello","tada":[{"foo":"bar"},{"baz":false},"boo",{},[]]}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,50 @@
<sdb:sirix xmlns:sdb="https://sirix.io/rest">
<sdb:sirix-item sdb:revision="1">
<p:a xmlns:p="ns" sdb:id="1" i="j">
oops1
<b sdb:id="5">
foo
<c sdb:id="7"/>
</b>
oops2
<b sdb:id="9" p:x="y">
<c sdb:id="11"/>
bar
</b>
oops3
</p:a>
</sdb:sirix-item>
<sdb:sirix-item sdb:revision="2">
<p:a xmlns:p="ns" sdb:id="1" i="j">
<p:a sdb:id="14">OOPS4!</p:a>
oops1
<b sdb:id="5">
foo
<c sdb:id="7"/>
</b>
oops2
<b sdb:id="9" p:x="y">
<c sdb:id="11"/>
bar
</b>
oops3
</p:a>
</sdb:sirix-item>
<sdb:sirix-item sdb:revision="3">
<p:a xmlns:p="ns" sdb:id="1" i="j">
<p:a sdb:id="16">OOPS4!</p:a>
<p:a sdb:id="14">OOPS4!</p:a>
oops1
<b sdb:id="5">
foo
<c sdb:id="7"/>
</b>
oops2
<b sdb:id="9" p:x="y">
<c sdb:id="11"/>
bar
</b>
oops3
</p:a>
</sdb:sirix-item>
</sdb:sirix>
@@ -0,0 +1,17 @@
<p:a xmlns:p="ns" id="1" i="j">
<p:a id="16">OOPS4!</p:a>
<p:a id="14">OOPS4!</p:a>
oops1
<b id="5">
foo
<c id="7"/>
</b>
oops2
<b id="9" p:x="y">
<c id="11"/>
bar
</b>
oops3
</p:a>
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Organization><Department><Member employee="true" key="12"><Firstname>Kurt</Firstname><Lastname>Mayer</Lastname><DateOfBirth>1.4.1963</DateOfBirth><Title>Dr.-Ing.</Title></Member><Member employe="false" key="40"><Firstname>Hans</Firstname><Lastname>Mettmann</Lastname><DateOfBirth>12.9.1974</DateOfBirth><Title>Dipl.-Inf</Title></Member><Member/><Member/></Department><Project id="4711" priority="high"><Title>XML-DB</Title><Budget>10000</Budget></Project><Project id="666" priority="evenhigher"><Title>DISS</Title><Budget>7000</Budget><Abstract>Native<b>XML</b>-Databases</Abstract></Project></Organization>

Some files were not shown because too many files have changed in this diff Show More