summaryrefslogtreecommitdiff
path: root/unoxml/qa/complex
diff options
context:
space:
mode:
Diffstat (limited to 'unoxml/qa/complex')
-rw-r--r--unoxml/qa/complex/tests.sce1
-rw-r--r--unoxml/qa/complex/unoxml/RDFRepositoryTest.java (renamed from unoxml/qa/complex/RDFRepositoryTest.java)332
-rw-r--r--unoxml/qa/complex/unoxml/TestDocument.java39
-rw-r--r--unoxml/qa/complex/unoxml/makefile.mk (renamed from unoxml/qa/complex/makefile.mk)44
-rw-r--r--unoxml/qa/complex/unoxml/testdocuments/example.rdf (renamed from unoxml/qa/complex/testdocuments/example.rdf)0
5 files changed, 250 insertions, 166 deletions
diff --git a/unoxml/qa/complex/tests.sce b/unoxml/qa/complex/tests.sce
deleted file mode 100644
index 20596551f156..000000000000
--- a/unoxml/qa/complex/tests.sce
+++ /dev/null
@@ -1 +0,0 @@
--o complex.unoxml.RDFRepositoryTest
diff --git a/unoxml/qa/complex/RDFRepositoryTest.java b/unoxml/qa/complex/unoxml/RDFRepositoryTest.java
index f3f9cbd8ae41..d047ef77440e 100644
--- a/unoxml/qa/complex/RDFRepositoryTest.java
+++ b/unoxml/qa/complex/unoxml/RDFRepositoryTest.java
@@ -27,21 +27,16 @@
package complex.unoxml;
-import complexlib.ComplexTestCase;
import helper.StreamSimulator;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
-import com.sun.star.uno.Any;
import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.lang.XInitialization;
-import com.sun.star.lang.XEventListener;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lang.WrappedTargetRuntimeException;
import com.sun.star.beans.XPropertySet;
-import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.Pair;
import com.sun.star.beans.StringPair;
import com.sun.star.container.XEnumeration;
@@ -52,6 +47,15 @@ import com.sun.star.io.XOutputStream;
import com.sun.star.text.XTextRange;
import com.sun.star.text.XText;
import com.sun.star.rdf.*;
+import lib.TestParameters;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
/**
* Test case for service com.sun.star.rdf.Repository
@@ -60,7 +64,7 @@ import com.sun.star.rdf.*;
*
* @author mst
*/
-public class RDFRepositoryTest extends ComplexTestCase
+public class RDFRepositoryTest
{
XComponentContext xContext;
String tempDir;
@@ -80,112 +84,113 @@ public class RDFRepositoryTest extends ComplexTestCase
XLiteral littype;
String rdfs = "http://www.w3.org/2000/01/rdf-schema#";
- public String[] getTestMethodNames ()
- {
- return new String[] { "check", "checkSPARQL", "checkRDFa" };
- }
+ /**
+ * The test parameters
+ */
+ private static TestParameters param = null;
+
+// public String[] getTestMethodNames ()
+// {
+// return new String[] { "check", "checkSPARQL", "checkRDFa" };
+// }
- public void before()
+ @Before public void before()
{
try {
- XMultiServiceFactory xMSF = (XMultiServiceFactory) param.getMSF();
- assure("could not create MultiServiceFactory.", xMSF != null);
- XPropertySet xPropertySet = (XPropertySet)
- UnoRuntime.queryInterface(XPropertySet.class, xMSF);
+ XMultiServiceFactory xMSF = getMSF();
+ param = new TestParameters();
+ param.put("ServiceFactory", xMSF);
+
+ assertNotNull("could not create MultiServiceFactory.", xMSF);
+ XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xMSF);
Object defaultCtx = xPropertySet.getPropertyValue("DefaultContext");
- xContext = (XComponentContext)
- UnoRuntime.queryInterface(XComponentContext.class, defaultCtx);
- assure("could not get component context.", xContext != null);
+ xContext = UnoRuntime.queryInterface(XComponentContext.class, defaultCtx);
+ assertNotNull("could not get component context.", xContext);
tempDir = util.utils.getOfficeTemp/*Dir*/(xMSF);
- log.println("tempdir: " + tempDir);
+ System.out.println("tempdir: " + tempDir);
foo = URI.create(xContext, "uri:foo");
- assure("foo", null != foo);
+ assertNotNull("foo", foo);
bar = URI.create(xContext, "uri:bar");
- assure("bar", null != bar);
+ assertNotNull("bar", bar);
baz = URI.create(xContext, "uri:baz");
- assure("baz", null != baz);
+ assertNotNull("baz", baz);
uint = URI.create(xContext, "uri:int");
- assure("uint", null != uint);
+ assertNotNull("uint", uint);
blank = BlankNode.create(xContext, "_:uno");
- assure("blank", null != blank);
+ assertNotNull("blank", blank);
lit = Literal.create(xContext, "i am the literal");
- assure("lit", null != lit);
+ assertNotNull("lit", lit);
litlang = Literal.createWithLanguage(xContext,
"i am the literal", "en");
- assure("litlang", null != litlang);
+ assertNotNull("litlang", litlang);
littype = Literal.createWithType(xContext, "42", uint);
- assure("littype", null != littype);
+ assertNotNull("littype", littype);
rdfslabel = URI.create(xContext, rdfs + "label");
- assure("rdfslabel", null != rdfslabel);
+ assertNotNull("rdfslabel", rdfslabel);
manifest = URI.create(xContext, "manifest:manifest"); //FIXME
- assure("manifest", null != manifest);
+ assertNotNull("manifest", manifest);
uuid = URI.create(xContext,
"urn:uuid:224ab023-77b8-4396-a75a-8cecd85b81e3");
- assure("uuid", null != uuid);
+ assertNotNull("uuid", uuid);
base = URI.create(xContext, "base-uri:"); //FIXME
- assure("base", null != base);
+ assertNotNull("base", base);
} catch (Exception e) {
report(e);
}
+ //FIXME: ?
+// xRep = Repository.create(xContext);
+ System.out.println("Creating service Repository...");
+ xRep = UnoRuntime.queryInterface(XDocumentRepository.class, Repository.create(xContext));
+ assertNotNull("null", xRep);
+ System.out.println("...done");
}
- public void after()
+ @After public void after()
{
xRep = null;
}
- public void check()
+ @Test public void check()
{
try {
-
- log.println("Creating service Repository...");
-
- //FIXME: ?
-// xRep = Repository.create(xContext);
- xRep = (XDocumentRepository) UnoRuntime.queryInterface(
- XDocumentRepository.class, Repository.create(xContext));
- assure("null", null != xRep);
-
- log.println("...done");
-
- log.println("Checking that new repository is really empty...");
- assure("empty: graphs", 0 == xRep.getGraphNames().length);
+ System.out.println("Checking that new repository is really empty...");
+ assertTrue("empty: graphs", 0 == xRep.getGraphNames().length);
XEnumeration stmts;
stmts = xRep.getStatements(null, null, null);
- assure("empty: stmts", !stmts.hasMoreElements());
+ assertTrue("empty: stmts", !stmts.hasMoreElements());
- log.println("...done");
+ System.out.println("...done");
- log.println("Checking graph creation...");
+ System.out.println("Checking graph creation...");
XNamedGraph xFooGraph = xRep.createGraph(foo);
- assure("foo graph", null != xFooGraph);
+ assertNotNull("foo graph", xFooGraph);
try {
xRep.createGraph(foo);
- assure("creating duplicate graph was allowed", false);
+ assertFalse("creating duplicate graph was allowed", false);
} catch (ElementExistException e) {
// ignore
}
try {
xRep.createGraph(null);
- assure("invalid graph name was allowed", false);
+ assertFalse("invalid graph name was allowed", false);
} catch (IllegalArgumentException e) {
// ignore
}
XURI[] names = xRep.getGraphNames();
- assure("no foo graph in getGraphNames",
+ assertTrue("no foo graph in getGraphNames",
1 == names.length && eq(names[0], foo));
- assure("no foo graph", null != xRep.getGraph(foo));
+ assertNotNull("no foo graph", xRep.getGraph(foo));
stmts = xFooGraph.getStatements(null, null, null);
- assure("stmts in foo graph", !stmts.hasMoreElements());
+ assertTrue("stmts in foo graph", !stmts.hasMoreElements());
XOutputStream xFooOut =
new StreamSimulator(tempDir + "empty.rdf", false, param);
@@ -195,94 +200,94 @@ public class RDFRepositoryTest extends ComplexTestCase
XInputStream xFooIn =
new StreamSimulator(tempDir + "empty.rdf", true, param);
xRep.importGraph(FileFormat.RDF_XML, xFooIn, bar, base);
- assure("no bar graph", null != xRep.getGraph(bar));
+ assertNotNull("no bar graph", xRep.getGraph(bar));
- log.println("...done");
+ System.out.println("...done");
- log.println("Checking graph manipulation...");
+ System.out.println("Checking graph manipulation...");
XEnumeration xFooEnum;
Statement xFoo_FooBarBaz = new Statement(foo, bar, baz, foo);
xFooGraph.addStatement(foo, bar, baz);
xFooEnum = xFooGraph.getStatements(null, null, null);
- assure("addStatement(foo,bar,baz)",
+ assertTrue("addStatement(foo,bar,baz)",
eq(xFooEnum, new Statement[] { xFoo_FooBarBaz }));
Statement xFoo_FooBarBlank = new Statement(foo, bar, blank, foo);
xFooGraph.addStatement(foo, bar, blank);
xFooEnum = xFooGraph.getStatements(null, null, null);
- assure("addStatement(foo,bar,blank)",
+ assertTrue("addStatement(foo,bar,blank)",
eq(xFooEnum,
new Statement[] { xFoo_FooBarBaz, xFoo_FooBarBlank }));
xFooEnum = xRep.getStatements(null, null, null);
- assure("addStatement(foo,bar,blank) (global)",
+ assertTrue("addStatement(foo,bar,blank) (global)",
eq(xFooEnum,
new Statement[] { xFoo_FooBarBaz, xFoo_FooBarBlank }));
Statement xFoo_BazBarLit = new Statement(baz, bar, lit, foo);
xFooGraph.addStatement(baz, bar, lit);
xFooEnum = xFooGraph.getStatements(null, null, null);
- assure("addStatement(baz,bar,lit)",
+ assertTrue("addStatement(baz,bar,lit)",
eq(xFooEnum, new Statement[] {
xFoo_FooBarBaz, xFoo_FooBarBlank, xFoo_BazBarLit }));
xFooEnum = xFooGraph.getStatements(baz, bar, null);
- assure("addStatement(baz,bar,lit) (baz,bar)",
+ assertTrue("addStatement(baz,bar,lit) (baz,bar)",
eq(xFooEnum, new Statement[] { xFoo_BazBarLit }));
Statement xFoo_BazBarLitlang =
new Statement(baz, bar, litlang, foo);
xFooGraph.addStatement(baz, bar, litlang);
xFooEnum = xFooGraph.getStatements(null, null, null);
- assure("addStatement(baz,bar,litlang)",
+ assertTrue("addStatement(baz,bar,litlang)",
eq(xFooEnum, new Statement[] {
xFoo_FooBarBaz, xFoo_FooBarBlank, xFoo_BazBarLit,
xFoo_BazBarLitlang }));
xFooEnum = xFooGraph.getStatements(null, null, baz);
- assure("addStatement(baz,bar,litlang) (baz)",
+ assertTrue("addStatement(baz,bar,litlang) (baz)",
eq(xFooEnum, new Statement[] { xFoo_FooBarBaz }));
Statement xFoo_BazBarLittype =
new Statement(baz, bar, littype, foo);
xFooGraph.addStatement(baz, bar, littype);
xFooEnum = xFooGraph.getStatements(null, null, null);
- assure("addStatement(baz,bar,littype)",
+ assertTrue("addStatement(baz,bar,littype)",
eq(xFooEnum, new Statement[] { xFoo_FooBarBaz, xFoo_FooBarBlank,
xFoo_BazBarLit, xFoo_BazBarLitlang, xFoo_BazBarLittype }));
xFooGraph.removeStatements(baz, bar, litlang);
xFooEnum = xFooGraph.getStatements(null, null, null);
- assure("removeStatement(baz,bar,litlang)",
+ assertTrue("removeStatement(baz,bar,litlang)",
eq(xFooEnum, new Statement[] { xFoo_FooBarBaz, xFoo_FooBarBlank,
xFoo_BazBarLit, xFoo_BazBarLittype }));
xFooGraph.removeStatements(foo, bar, null);
xFooEnum = xFooGraph.getStatements(null, null, null);
- assure("removeStatement(foo,bar,null)",
+ assertTrue("removeStatement(foo,bar,null)",
eq(xFooEnum, new Statement[] {
xFoo_BazBarLit, xFoo_BazBarLittype }));
xFooGraph.addStatement(foo, bar, baz);
xFooEnum = xFooGraph.getStatements(null, null, null);
- assure("addStatement(foo,bar,baz) (re-add)",
+ assertTrue("addStatement(foo,bar,baz) (re-add)",
eq(xFooEnum, new Statement[] { xFoo_FooBarBaz,
xFoo_BazBarLit, xFoo_BazBarLittype }));
xFooGraph.addStatement(foo, bar, baz);
xFooEnum = xFooGraph.getStatements(null, null, null);
- assure("addStatement(foo,bar,baz) (duplicate)",
+ assertTrue("addStatement(foo,bar,baz) (duplicate)",
eq(xFooEnum, new Statement[] { xFoo_FooBarBaz,
xFoo_BazBarLit, xFoo_BazBarLittype }));
xFooGraph.addStatement(xFooGraph, bar, baz);
xFooEnum = xFooGraph.getStatements(null, null, null);
- assure("addStatement(foo,bar,baz) (triplicate, as graph)",
+ assertTrue("addStatement(foo,bar,baz) (triplicate, as graph)",
eq(xFooEnum, new Statement[] { xFoo_FooBarBaz,
xFoo_BazBarLit, xFoo_BazBarLittype }));
- log.println("...done");
+ System.out.println("...done");
- log.println("Checking graph import/export...");
+ System.out.println("Checking graph import/export...");
xFooOut = new StreamSimulator(tempDir + "foo.rdf", false, param);
xRep.exportGraph(FileFormat.RDF_XML, xFooOut, foo, base);
@@ -291,7 +296,7 @@ public class RDFRepositoryTest extends ComplexTestCase
xFooIn = new StreamSimulator(tempDir + "foo.rdf", true, param);
try {
xRep.importGraph(FileFormat.RDF_XML, xFooIn, bar, base);
- assure("importing existing graph did not fail", false);
+ assertFalse("importing existing graph did not fail", false);
} catch (ElementExistException e) {
// ignore
}
@@ -299,77 +304,77 @@ public class RDFRepositoryTest extends ComplexTestCase
xFooIn = new StreamSimulator(tempDir + "foo.rdf", true, param);
xRep.importGraph(FileFormat.RDF_XML, xFooIn, baz, base);
XNamedGraph xBazGraph = xRep.getGraph(baz);
- assure("no baz graph", null != xBazGraph);
+ assertNotNull("no baz graph", xBazGraph);
Statement xBaz_FooBarBaz = new Statement(foo, bar, baz, baz);
Statement xBaz_BazBarLit = new Statement(baz, bar, lit, baz);
Statement xBaz_BazBarLittype =
new Statement(baz, bar, littype, baz);
XEnumeration xBazEnum = xBazGraph.getStatements(null, null, null);
- assure("importing exported graph",
+ assertTrue("importing exported graph",
eq(xBazEnum, new Statement[] {
xBaz_FooBarBaz, xBaz_BazBarLit, xBaz_BazBarLittype }));
- log.println("...done");
+ System.out.println("...done");
- log.println("Checking graph deletion...");
+ System.out.println("Checking graph deletion...");
xFooGraph.clear();
xFooEnum = xFooGraph.getStatements(null, null, null);
- assure("clear", eq(xFooEnum, new Statement[] { }));
+ assertTrue("clear", eq(xFooEnum, new Statement[] { }));
xRep.destroyGraph(baz);
- assure("baz graph zombie", null == xRep.getGraph(baz));
+ assertNull("baz graph zombie", xRep.getGraph(baz));
try {
xBazGraph.clear();
- assure("deleted graph not invalid (clear)", false);
+ assertFalse("deleted graph not invalid (clear)", false);
} catch (NoSuchElementException e) {
// ignore
}
try {
xBazGraph.addStatement(foo, foo, foo);
- assure("deleted graph not invalid (add)", false);
+ assertFalse("deleted graph not invalid (add)", false);
} catch (NoSuchElementException e) {
// ignore
}
try {
xBazGraph.removeStatements(null, null, null);
- assure("deleted graph not invalid (remove)", false);
+ assertFalse("deleted graph not invalid (remove)", false);
} catch (NoSuchElementException e) {
// ignore
}
try {
xBazGraph.getStatements(null, null, null);
- assure("deleted graph not invalid (get)", false);
+ assertFalse("deleted graph not invalid (get)", false);
} catch (NoSuchElementException e) {
// ignore
}
- log.println("...done");
+ System.out.println("...done");
} catch (Exception e) {
report(e);
}
}
- public void checkSPARQL()
+ @Test public void checkSPARQL()
{
try {
- log.println("Checking SPARQL queries...");
+ System.out.println("Checking SPARQL queries...");
- XInputStream xIn = new StreamSimulator(
- util.utils.getFullTestDocName("example.rdf"), true, param);
+ XInputStream xIn = new StreamSimulator(TestDocument.getUrl("example.rdf"), true, param);
+ // util.utils.getFullTestDocName("example.rdf"), true, param);
xRep.importGraph(FileFormat.RDF_XML, xIn, manifest, base);
String query;
query = "SELECT ?p WHERE { ?p rdf:type pkg:Package . }";
XQuerySelectResult result = xRep.querySelect(mkNss() + query);
- assure("query: package-id\n" + query,
+ assertTrue("query: package-id\n" + query,
eq(result, new String[] { "p" },
new XNode[][] { { uuid } }));
@@ -377,7 +382,7 @@ public class RDFRepositoryTest extends ComplexTestCase
"> WHERE { ?pkg rdf:type pkg:Package . ?pkg pkg:hasPart ?part ."
+ " ?part pkg:path ?path . ?part rdf:type odf:ContentFile. }";
result = xRep.querySelect(mkNss() + query);
- assure("query: contentfile",
+ assertTrue("query: contentfile",
eq(result, new String[] { "part", "path" },
new XNode[][] { { BlankNode.create(xContext, "whatever"),
Literal.create(xContext, "content.xml") } }));
@@ -386,7 +391,7 @@ public class RDFRepositoryTest extends ComplexTestCase
+ "?pkg rdf:type pkg:Package . ?pkg pkg:hasPart ?part . "
+ "?part pkg:path ?path . ?part rdf:type odf:ContentFile. }";
result = xRep.querySelect(mkNss() + query);
- assure("query: contentfile\n" + query,
+ assertTrue("query: contentfile\n" + query,
eq(result, new String[] { "pkg", "path" },
new XNode[][] { { uuid ,
Literal.create(xContext, "content.xml") } }));
@@ -395,7 +400,7 @@ public class RDFRepositoryTest extends ComplexTestCase
+ "?pkg rdf:type pkg:Package . ?pkg pkg:hasPart ?part . "
+ "?part pkg:path ?path . ?part rdf:type odf:StylesFile. }";
result = xRep.querySelect(mkNss() + query);
- assure("query: stylesfile\n" + query,
+ assertTrue("query: stylesfile\n" + query,
eq(result, new String[] { "part", "path" },
new XNode[][] { }));
@@ -403,7 +408,7 @@ public class RDFRepositoryTest extends ComplexTestCase
+ "?pkg rdf:type pkg:Package . ?pkg pkg:hasPart ?part . "
+ "?part pkg:path ?path . ?part rdf:type odf:MetadataFile. }";
result = xRep.querySelect(mkNss() + query);
- assure("query: metadatafile\n" + query,
+ assertTrue("query: metadatafile\n" + query,
eq(result, new String[] { "part", "path" },
new XNode[][] { {
URI.create(xContext, "http://hospital-employee/doctor"),
@@ -424,9 +429,9 @@ public class RDFRepositoryTest extends ComplexTestCase
+ " pkg:idref ?idref . "
+ " FILTER (?type = odf:ContentFile || ?type = odf:StylesFile)"
+ " }";
-//log.println(query);
+//System.out.println(query);
result = xRep.querySelect(mkNss() + query);
- assure("query: example-element-2\n" + query,
+ assertTrue("query: example-element-2\n" + query,
eq(result, new String[] { "path", "idref" },
new XNode[][] { {
Literal.create(xContext, "content.xml"),
@@ -438,24 +443,24 @@ public class RDFRepositoryTest extends ComplexTestCase
lit.getStringValue() + "\" } FROM <" + toS(manifest) +
"> WHERE { ?pkg rdf:type pkg:Package . } ";
XEnumeration xResultEnum = xRep.queryConstruct(mkNss() + query);
- assure("query: construct\n" + query,
+ assertTrue("query: construct\n" + query,
eq(xResultEnum, new Statement[] { x_PkgFooLit }));
query = "ASK { ?pkg rdf:type pkg:Package . }";
boolean bResult = xRep.queryAsk(mkNss() + query);
- assure("query: ask\n" + query, bResult);
+ assertTrue("query: ask\n" + query, bResult);
- log.println("...done");
+ System.out.println("...done");
} catch (Exception e) {
report(e);
}
}
- public void checkRDFa()
+ @Test public void checkRDFa()
{
try {
- log.println("Checking RDFa gunk...");
+ System.out.println("Checking RDFa gunk...");
String content = "behold, for i am the content.";
XTextRange xTR = new TestRange(content);
@@ -463,19 +468,19 @@ public class RDFRepositoryTest extends ComplexTestCase
Pair<Statement[], Boolean> result =
xRep.getStatementRDFa((XMetadatable)xTR);
- assure("RDFa: get: not empty (initial)",
+ assertTrue("RDFa: get: not empty (initial)",
0 == result.First.length);
try {
xRep.setStatementRDFa(foo, new XURI[] {}, xM, "", null);
- assure("RDFa: set: no predicate", false);
+ assertFalse("RDFa: set: no predicate", false);
} catch (IllegalArgumentException e) {
// ignore
}
try {
xRep.setStatementRDFa(foo, new XURI[] {bar}, null, "", null);
- assure("RDFa: set: null", false);
+ assertFalse("RDFa: set: null", false);
} catch (IllegalArgumentException e) {
// ignore
}
@@ -485,16 +490,16 @@ public class RDFRepositoryTest extends ComplexTestCase
xRep.setStatementRDFa(foo, new XURI[] { bar }, xM, "", null);
result = xRep.getStatementRDFa((XMetadatable)xTR);
- assure("RDFa: get: without content",
+ assertTrue("RDFa: get: without content",
!result.Second && (1 == result.First.length)
- && eq((Statement)result.First[0], x_FooBarTRLit));
+ && eq(result.First[0], x_FooBarTRLit));
//FIXME: do this?
xTR.setString(lit.getStringValue());
/*
Statement xFooBarLit = new Statement(foo, bar, lit, null);
result = xRep.getStatementRDFa((XMetadatable)xTR);
- assure("RDFa: get: change",
+ assertTrue("RDFa: get: change",
eq((Statement)result.First, xFooBarLit) && null == result.Second);
*/
@@ -502,17 +507,17 @@ public class RDFRepositoryTest extends ComplexTestCase
xRep.setStatementRDFa(foo, new XURI[] { bar }, xM, "42", uint);
result = xRep.getStatementRDFa((XMetadatable)xTR);
- assure("RDFa: get: with content",
+ assertTrue("RDFa: get: with content",
result.Second &&
(1 == result.First.length) &&
- eq((Statement)result.First[0], x_FooBarLittype));
+ eq(result.First[0], x_FooBarLittype));
//FIXME: do this?
xTR.setString(content);
/*
Statement xFooLabelTRLit = new Statement(foo, rdfslabel, trlit, null);
result = xRep.getStatementRDFa((XMetadatable)xTR);
- assure("RDFa: get: change (label)",
+ assertTrue("RDFa: get: change (label)",
eq((Statement)result.First, xFooBarLittype) &&
eq((Statement)result.Second, xFooLabelTRLit));
*/
@@ -520,7 +525,7 @@ public class RDFRepositoryTest extends ComplexTestCase
xRep.removeStatementRDFa((XMetadatable)xTR);
result = xRep.getStatementRDFa((XMetadatable)xTR);
- assure("RDFa: get: not empty (removed)",
+ assertTrue("RDFa: get: not empty (removed)",
0 == result.First.length);
xRep.setStatementRDFa(foo, new XURI[] { foo, bar, baz }, xM,
@@ -529,7 +534,7 @@ public class RDFRepositoryTest extends ComplexTestCase
Statement x_FooFooTRLit = new Statement(foo, foo, trlit, null);
Statement x_FooBazTRLit = new Statement(foo, baz, trlit, null);
result = xRep.getStatementRDFa((XMetadatable) xTR);
- assure("RDFa: get: without content (multiple predicates, reinsert)",
+ assertTrue("RDFa: get: without content (multiple predicates, reinsert)",
!result.Second &&
eq(result.First, new Statement[] {
x_FooFooTRLit, x_FooBarTRLit, x_FooBazTRLit }));
@@ -537,10 +542,10 @@ public class RDFRepositoryTest extends ComplexTestCase
xRep.removeStatementRDFa((XMetadatable)xTR);
result = xRep.getStatementRDFa((XMetadatable) xTR);
- assure("RDFa: get: not empty (re-removed)",
+ assertTrue("RDFa: get: not empty (re-removed)",
0 == result.First.length);
- log.println("...done");
+ System.out.println("...done");
} catch (Exception e) {
report(e);
@@ -553,36 +558,38 @@ public class RDFRepositoryTest extends ComplexTestCase
{
if (e instanceof WrappedTargetException)
{
- log.println("Cause:");
+ System.out.println("Cause:");
Exception cause = (Exception)
(((WrappedTargetException)e).TargetException);
- log.println(cause.toString());
+ System.out.println(cause.toString());
report2(cause);
} else if (e instanceof WrappedTargetRuntimeException) {
- log.println("Cause:");
+ System.out.println("Cause:");
Exception cause = (Exception)
(((WrappedTargetRuntimeException)e).TargetException);
- log.println(cause.toString());
+ System.out.println(cause.toString());
report2(cause);
}
}
public void report(Exception e) {
- log.println("Exception occurred:");
- e.printStackTrace((java.io.PrintWriter) log);
+ System.out.println("Exception occurred:");
+ e.printStackTrace();
report2(e);
- failed();
+ fail();
}
public static String toS(XNode n) {
- if (null == n) return "< null >";
+ if (null == n)
+ {
+ return "< null >";
+ }
return n.getStringValue();
}
static boolean isBlank(XNode i_node)
{
- XBlankNode blank = (XBlankNode) UnoRuntime.queryInterface(
- XBlankNode.class, i_node);
+ XBlankNode blank = UnoRuntime.queryInterface(XBlankNode.class, i_node);
return blank != null;
}
@@ -615,7 +622,7 @@ public class RDFRepositoryTest extends ComplexTestCase
java.util.Collection c = new java.util.Vector();
while (i_Enum.hasMoreElements()) {
Statement s = (Statement) i_Enum.nextElement();
-//log.println("toSeq: " + s.getSubject().getStringValue() + " " + s.getPredicate().getStringValue() + " " + s.getObject().getStringValue() + ".");
+//System.out.println("toSeq: " + s.getSubject().getStringValue() + " " + s.getPredicate().getStringValue() + " " + s.getObject().getStringValue() + ".");
c.add(s);
}
// return (Statement[]) c.toArray();
@@ -650,7 +657,10 @@ public class RDFRepositoryTest extends ComplexTestCase
{
XNode[] left = (XNode[]) i_Left;
XNode[] right = (XNode[]) i_Right;
- if (left.length != right.length) throw new RuntimeException();
+ if (left.length != right.length)
+ {
+ throw new RuntimeException();
+ }
for (int i = 0; i < left.length; ++i) {
int eq = (left[i].getStringValue().compareTo(
right[i].getStringValue()));
@@ -667,10 +677,22 @@ public class RDFRepositoryTest extends ComplexTestCase
int eq;
Statement left = (Statement) i_Left;
Statement right = (Statement) i_Right;
- if ((eq = cmp(left.Graph, right.Graph )) != 0) return eq;
- if ((eq = cmp(left.Subject, right.Subject )) != 0) return eq;
- if ((eq = cmp(left.Predicate, right.Predicate)) != 0) return eq;
- if ((eq = cmp(left.Object, right.Object )) != 0) return eq;
+ if ((eq = cmp(left.Graph, right.Graph )) != 0)
+ {
+ return eq;
+ }
+ if ((eq = cmp(left.Subject, right.Subject )) != 0)
+ {
+ return eq;
+ }
+ if ((eq = cmp(left.Predicate, right.Predicate)) != 0)
+ {
+ return eq;
+ }
+ if ((eq = cmp(left.Object, right.Object )) != 0)
+ {
+ return eq;
+ }
return 0;
}
@@ -693,23 +715,23 @@ public class RDFRepositoryTest extends ComplexTestCase
XURI lG = i_Left.Graph;
XURI rG = i_Right.Graph;
if (!eq(lG, rG)) {
- log.println("Graphs differ: " + toS(lG) + " != " + toS(rG));
+ System.out.println("Graphs differ: " + toS(lG) + " != " + toS(rG));
return false;
}
if (!eq(i_Left.Subject, i_Right.Subject)) {
- log.println("Subjects differ: " +
+ System.out.println("Subjects differ: " +
i_Left.Subject.getStringValue() + " != " +
i_Right.Subject.getStringValue());
return false;
}
if (!eq(i_Left.Predicate, i_Right.Predicate)) {
- log.println("Predicates differ: " +
+ System.out.println("Predicates differ: " +
i_Left.Predicate.getStringValue() + " != " +
i_Right.Predicate.getStringValue());
return false;
}
if (!eq(i_Left.Object, i_Right.Object)) {
- log.println("Objects differ: " +
+ System.out.println("Objects differ: " +
i_Left.Object.getStringValue() + " != " +
i_Right.Object.getStringValue());
return false;
@@ -720,7 +742,7 @@ public class RDFRepositoryTest extends ComplexTestCase
static boolean eq(Statement[] i_Result, Statement[] i_Expected)
{
if (i_Result.length != i_Expected.length) {
- log.println("eq: different lengths: " + i_Result.length + " " +
+ System.out.println("eq: different lengths: " + i_Result.length + " " +
i_Expected.length);
return false;
}
@@ -729,7 +751,10 @@ public class RDFRepositoryTest extends ComplexTestCase
java.util.Arrays.sort(i_Result, new StmtComp());
java.util.Arrays.sort(expected, new StmtComp());
for (int i = 0; i < expected.length; ++i) {
- if (!eq(i_Result[i], expected[i])) return false;
+ if (!eq(i_Result[i], expected[i]))
+ {
+ return false;
+ }
}
return true;
}
@@ -760,11 +785,11 @@ public class RDFRepositoryTest extends ComplexTestCase
XEnumeration iter = (XEnumeration) i_Result;
XNode[][] bindings = toSeqs(iter);
if (vars.length != i_Vars.length) {
- log.println("var lengths differ");
+ System.out.println("var lengths differ");
return false;
}
if (bindings.length != i_Bindings.length) {
- log.println("binding lengths differ: " + i_Bindings.length +
+ System.out.println("binding lengths differ: " + i_Bindings.length +
" vs " + bindings.length );
return false;
}
@@ -772,16 +797,16 @@ public class RDFRepositoryTest extends ComplexTestCase
java.util.Arrays.sort(i_Bindings, new BindingComp());
for (int i = 0; i < i_Bindings.length; ++i) {
if (i_Bindings[i].length != i_Vars.length) {
- log.println("TEST ERROR!");
+ System.out.println("TEST ERROR!");
throw new Exception();
}
if (bindings[i].length != i_Vars.length) {
- log.println("binding length and var length differ");
+ System.out.println("binding length and var length differ");
return false;
}
for (int j = 0; j < i_Vars.length; ++j) {
if (!eq(bindings[i][j], i_Bindings[i][j])) {
- log.println("bindings differ: " +
+ System.out.println("bindings differ: " +
toS(bindings[i][j]) + " != " + toS(i_Bindings[i][j]));
return false;
}
@@ -789,7 +814,7 @@ public class RDFRepositoryTest extends ComplexTestCase
}
for (int i = 0; i < i_Vars.length; ++i) {
if (!vars[i].equals(i_Vars[i])) {
- log.println("variable names differ: " +
+ System.out.println("variable names differ: " +
vars[i] + " != " + i_Vars[i]);
return false;
}
@@ -828,7 +853,7 @@ public class RDFRepositoryTest extends ComplexTestCase
{ return new StringPair(m_Stream, m_XmlId); }
public void setMetadataReference(StringPair i_Ref)
throws IllegalArgumentException
- { m_Stream = (String)i_Ref.First; m_XmlId = (String)i_Ref.Second; }
+ { m_Stream = i_Ref.First; m_XmlId = i_Ref.Second; }
public void ensureMetadataReference()
{ m_Stream = "content.xml"; m_XmlId = "42"; }
@@ -843,5 +868,26 @@ public class RDFRepositoryTest extends ComplexTestCase
public String getString() { return m_Text; }
public void setString(String i_Str) { m_Text = i_Str; }
}
+
+ private XMultiServiceFactory getMSF()
+ {
+ final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
+ return xMSF1;
+ }
+
+ // setup and close connections
+ @BeforeClass public static void setUpConnection() throws Exception {
+ System.out.println("setUpConnection()");
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ System.out.println("tearDownConnection()");
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
}
diff --git a/unoxml/qa/complex/unoxml/TestDocument.java b/unoxml/qa/complex/unoxml/TestDocument.java
new file mode 100644
index 000000000000..bce9510e4d94
--- /dev/null
+++ b/unoxml/qa/complex/unoxml/TestDocument.java
@@ -0,0 +1,39 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+package complex.unoxml;
+
+import java.io.File;
+import org.openoffice.test.OfficeFileUrl;
+
+final class TestDocument {
+ public static String getUrl(String name) {
+ return OfficeFileUrl.getAbsolute(new File("testdocuments", name));
+ }
+
+ private TestDocument() {}
+}
diff --git a/unoxml/qa/complex/makefile.mk b/unoxml/qa/complex/unoxml/makefile.mk
index c74cbcb80dcf..136d23a9a232 100644
--- a/unoxml/qa/complex/makefile.mk
+++ b/unoxml/qa/complex/unoxml/makefile.mk
@@ -25,35 +25,35 @@
#
#***********************************************************************/
-PRJ = ..$/..
-TARGET = unoxml_test
-PRJNAME = $(TARGET)
-PACKAGE = complex$/unoxml
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
-# --- Settings -----------------------------------------------------
-.INCLUDE: settings.mk
-
-
-#----- compile .java files -----------------------------------------
+PRJ = ../../..
+PRJNAME = unoxml
+TARGET = qa_complex_unoxml
-JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
-JAVAFILES = RDFRepositoryTest.java \
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = complex/unoxml
+JAVATESTFILES = \
+ RDFRepositoryTest.java
-JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+JAVAFILES = $(JAVATESTFILES) \
+ TestDocument.java
-#----- make a jar from compiled files ------------------------------
+JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
-MAXLINELENGTH = 100000
+# Sample how to debug
+# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y
+.END
-JARCLASSDIRS = $(PACKAGE)
-JARTARGET = $(TARGET).jar
-JARCOMPRESS = TRUE
-
-# --- Targets ------------------------------------------------------
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
-.INCLUDE : target.mk
+ALLTAR : javatest
+.END
-run:
- +java -cp $(CLASSPATH) org.openoffice.Runner -TestBase java_complex -sce tests.sce -tdoc $(PWD)$/testdocuments
diff --git a/unoxml/qa/complex/testdocuments/example.rdf b/unoxml/qa/complex/unoxml/testdocuments/example.rdf
index 07ef7f07b6fd..07ef7f07b6fd 100644
--- a/unoxml/qa/complex/testdocuments/example.rdf
+++ b/unoxml/qa/complex/unoxml/testdocuments/example.rdf