Author: rvesse
Date: Wed Jul 9 13:45:07 2014
New Revision: 1609148
URL: http://svn.apache.org/r1609148
Log:
Remove broken tests for unsupportable behaviour that the bug I just fixed in
TripleWritable/QuadWritable was hiding
Modified:
jena/Experimental/hadoop-rdf/hadoop-rdf-common/src/test/java/org/apache/jena/hadoop/rdf/io/types/RdfTypesTest.java
jena/Experimental/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/TestDistinctTriples.java
Modified:
jena/Experimental/hadoop-rdf/hadoop-rdf-common/src/test/java/org/apache/jena/hadoop/rdf/io/types/RdfTypesTest.java
URL:
http://svn.apache.org/viewvc/jena/Experimental/hadoop-rdf/hadoop-rdf-common/src/test/java/org/apache/jena/hadoop/rdf/io/types/RdfTypesTest.java?rev=1609148&r1=1609147&r2=1609148&view=diff
==============================================================================
---
jena/Experimental/hadoop-rdf/hadoop-rdf-common/src/test/java/org/apache/jena/hadoop/rdf/io/types/RdfTypesTest.java
(original)
+++
jena/Experimental/hadoop-rdf/hadoop-rdf-common/src/test/java/org/apache/jena/hadoop/rdf/io/types/RdfTypesTest.java
Wed Jul 9 13:45:07 2014
@@ -16,349 +16,312 @@
* limitations under the License.
*/
-package org.apache.jena.hadoop.rdf.io.types;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-import org.apache.hadoop.io.WritableComparable;
-import org.apache.jena.atlas.lib.Tuple;
+package org.apache.jena.hadoop.rdf.io.types;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.apache.hadoop.io.WritableComparable;
+import org.apache.jena.atlas.lib.Tuple;
import org.apache.jena.hadoop.rdf.types.NodeTupleWritable;
import org.apache.jena.hadoop.rdf.types.NodeWritable;
import org.apache.jena.hadoop.rdf.types.QuadWritable;
import org.apache.jena.hadoop.rdf.types.TripleWritable;
-import org.junit.Assert;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
-import com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.graph.NodeFactory;
-import com.hp.hpl.jena.graph.Triple;
-import com.hp.hpl.jena.sparql.core.Quad;
-
-/**
- * Tests for the various RDF types defined by the
- * {@link org.apache.jena.hadoop.rdf.types} package
- *
- *
- *
- */
-public class RdfTypesTest {
-
- private static final Logger LOG =
LoggerFactory.getLogger(RdfTypesTest.class);
-
- private ByteArrayOutputStream outputStream;
- private ByteArrayInputStream inputStream;
-
- /**
- * Prepare for output
- *
- * @return Data output
- */
- private DataOutput prepareOutput() {
- this.outputStream = new ByteArrayOutputStream();
- return new DataOutputStream(this.outputStream);
- }
-
- /**
- * Prepare for input from the previously written output
- *
- * @return Data Input
- */
- private DataInput prepareInput() {
- this.inputStream = new
ByteArrayInputStream(this.outputStream.toByteArray());
- return new DataInputStream(this.inputStream);
- }
-
- /**
- * Prepare for input from the given data
- *
- * @param data
- * Data
- * @return Data Input
- */
- @SuppressWarnings("unused")
- private DataInput prepareInput(byte[] data) {
- this.inputStream = new ByteArrayInputStream(data);
- return new DataInputStream(this.inputStream);
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- private <T extends WritableComparable> void testWriteRead(T writable, T
expected) throws IOException, InstantiationException,
- IllegalAccessException, ClassNotFoundException {
- // Write out data
- DataOutput output = this.prepareOutput();
- writable.write(output);
-
- // Read back in data
- DataInput input = this.prepareInput();
- T actual = (T)
Class.forName(writable.getClass().getName()).newInstance();
- actual.readFields(input);
-
- LOG.info("Original = " + writable.toString());
- LOG.info("Round Tripped = " + actual.toString());
-
- // Check equivalent
- Assert.assertEquals(0, expected.compareTo(actual));
- }
-
- /**
- * Basic node writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void node_writable_uri_01() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Node n = NodeFactory.createURI("http://example.org");
- NodeWritable nw = new NodeWritable(n);
- testWriteRead(nw, nw);
- }
-
- /**
- * Basic node writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void node_writable_uri_02() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Node n =
NodeFactory.createURI("http://user:[email protected]/some/path?key=value#id");
- NodeWritable nw = new NodeWritable(n);
- testWriteRead(nw, nw);
- }
-
- /**
- * Basic node writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void node_writable_literal_01() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Node n = NodeFactory.createLiteral("simple");
- NodeWritable nw = new NodeWritable(n);
- testWriteRead(nw, nw);
- }
-
- /**
- * Basic node writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void node_writable_literal_02() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Node n = NodeFactory.createLiteral("language", "en", null);
- NodeWritable nw = new NodeWritable(n);
- testWriteRead(nw, nw);
- }
-
- /**
- * Basic node writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void node_writable_literal_03() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Node n = NodeFactory.createLiteral("string", XSDDatatype.XSDstring);
- NodeWritable nw = new NodeWritable(n);
- testWriteRead(nw, nw);
- }
-
- /**
- * Basic node writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void node_writable_literal_04() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Node n = NodeFactory.createLiteral("1234", XSDDatatype.XSDinteger);
- NodeWritable nw = new NodeWritable(n);
- testWriteRead(nw, nw);
- }
-
-
- /**
- * Basic node writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void node_writable_literal_05() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Node n = NodeFactory.createLiteral("123.4", XSDDatatype.XSDdecimal);
- NodeWritable nw = new NodeWritable(n);
- testWriteRead(nw, nw);
- }
-
-
- /**
- * Basic node writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void node_writable_literal_06() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Node n = NodeFactory.createLiteral("12.3e4", XSDDatatype.XSDdouble);
- NodeWritable nw = new NodeWritable(n);
- testWriteRead(nw, nw);
- }
-
-
- /**
- * Basic node writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void node_writable_literal_07() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Node n = NodeFactory.createLiteral("true", XSDDatatype.XSDboolean);
- NodeWritable nw = new NodeWritable(n);
- testWriteRead(nw, nw);
- }
-
-
- /**
- * Basic node writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void node_writable_bnode_01() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Node n = NodeFactory.createAnon();
- NodeWritable nw = new NodeWritable(n);
- testWriteRead(nw, nw);
- }
-
- /**
- * Basic node writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void node_writable_bnode_02() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Node n = NodeFactory.createAnon();
- NodeWritable nw = new NodeWritable(n);
- testWriteRead(nw, nw);
- NodeWritable nw2 = new NodeWritable(n);
- testWriteRead(nw2, nw2);
-
- Assert.assertEquals(0, nw.compareTo(nw2));
- }
-
- /**
- * Basic triple writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void triple_writable_01() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Triple t = new Triple(NodeFactory.createURI("http://example"),
NodeFactory.createURI("http://predicate"),
- NodeFactory.createLiteral("value"));
- TripleWritable tw = new TripleWritable(t);
- testWriteRead(tw, tw);
- }
-
- /**
- * Basic triple writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void triple_writable_02() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Triple t = new Triple(NodeFactory.createAnon(),
NodeFactory.createURI("http://predicate"),
- NodeFactory.createLiteral("value"));
- TripleWritable tw = new TripleWritable(t);
- testWriteRead(tw, tw);
- }
-
- /**
- * Basic quad writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void quad_writable_01() throws IOException, InstantiationException,
IllegalAccessException, ClassNotFoundException {
- Quad q = new Quad(Quad.defaultGraphNodeGenerated,
NodeFactory.createURI("http://example"),
NodeFactory.createURI("http://predicate"),
- NodeFactory.createLiteral("value"));
- QuadWritable qw = new QuadWritable(q);
- testWriteRead(qw, qw);
- }
-
- /**
- * Basic quad writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void quad_writable_02() throws IOException, InstantiationException,
IllegalAccessException, ClassNotFoundException {
- Quad q = new Quad(Quad.defaultGraphNodeGenerated,
NodeFactory.createAnon(), NodeFactory.createURI("http://predicate"),
- NodeFactory.createLiteral("value"));
- QuadWritable qw = new QuadWritable(q);
- testWriteRead(qw, qw);
- }
-
- /**
- * Basic tuple writable round tripping test
- *
- * @throws IOException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- */
- @Test
- public void tuple_writable_01() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
- Tuple<Node> t = Tuple.createTuple(NodeFactory.createURI("http://one"),
NodeFactory.createURI("http://two"),
- NodeFactory.createLiteral("value"),
NodeFactory.createLiteral("foo"), NodeFactory.createURI("http://three"));
- NodeTupleWritable tw = new NodeTupleWritable(t);
- testWriteRead(tw, tw);
- }
-}
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.NodeFactory;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.sparql.core.Quad;
+
+/**
+ * Tests for the various RDF types defined by the
+ * {@link org.apache.jena.hadoop.rdf.types} package
+ *
+ *
+ *
+ */
+public class RdfTypesTest {
+
+ private static final Logger LOG =
LoggerFactory.getLogger(RdfTypesTest.class);
+
+ private ByteArrayOutputStream outputStream;
+ private ByteArrayInputStream inputStream;
+
+ /**
+ * Prepare for output
+ *
+ * @return Data output
+ */
+ private DataOutput prepareOutput() {
+ this.outputStream = new ByteArrayOutputStream();
+ return new DataOutputStream(this.outputStream);
+ }
+
+ /**
+ * Prepare for input from the previously written output
+ *
+ * @return Data Input
+ */
+ private DataInput prepareInput() {
+ this.inputStream = new
ByteArrayInputStream(this.outputStream.toByteArray());
+ return new DataInputStream(this.inputStream);
+ }
+
+ /**
+ * Prepare for input from the given data
+ *
+ * @param data
+ * Data
+ * @return Data Input
+ */
+ @SuppressWarnings("unused")
+ private DataInput prepareInput(byte[] data) {
+ this.inputStream = new ByteArrayInputStream(data);
+ return new DataInputStream(this.inputStream);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ private <T extends WritableComparable> void testWriteRead(T writable, T
expected) throws IOException, InstantiationException, IllegalAccessException,
+ ClassNotFoundException {
+ // Write out data
+ DataOutput output = this.prepareOutput();
+ writable.write(output);
+
+ // Read back in data
+ DataInput input = this.prepareInput();
+ T actual = (T)
Class.forName(writable.getClass().getName()).newInstance();
+ actual.readFields(input);
+
+ LOG.info("Original = " + writable.toString());
+ LOG.info("Round Tripped = " + actual.toString());
+
+ // Check equivalent
+ Assert.assertEquals(0, expected.compareTo(actual));
+ }
+
+ /**
+ * Basic node writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void node_writable_uri_01() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Node n = NodeFactory.createURI("http://example.org");
+ NodeWritable nw = new NodeWritable(n);
+ testWriteRead(nw, nw);
+ }
+
+ /**
+ * Basic node writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void node_writable_uri_02() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Node n =
NodeFactory.createURI("http://user:[email protected]/some/path?key=value#id");
+ NodeWritable nw = new NodeWritable(n);
+ testWriteRead(nw, nw);
+ }
+
+ /**
+ * Basic node writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void node_writable_literal_01() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Node n = NodeFactory.createLiteral("simple");
+ NodeWritable nw = new NodeWritable(n);
+ testWriteRead(nw, nw);
+ }
+
+ /**
+ * Basic node writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void node_writable_literal_02() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Node n = NodeFactory.createLiteral("language", "en", null);
+ NodeWritable nw = new NodeWritable(n);
+ testWriteRead(nw, nw);
+ }
+
+ /**
+ * Basic node writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void node_writable_literal_03() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Node n = NodeFactory.createLiteral("string", XSDDatatype.XSDstring);
+ NodeWritable nw = new NodeWritable(n);
+ testWriteRead(nw, nw);
+ }
+
+ /**
+ * Basic node writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void node_writable_literal_04() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Node n = NodeFactory.createLiteral("1234", XSDDatatype.XSDinteger);
+ NodeWritable nw = new NodeWritable(n);
+ testWriteRead(nw, nw);
+ }
+
+ /**
+ * Basic node writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void node_writable_literal_05() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Node n = NodeFactory.createLiteral("123.4", XSDDatatype.XSDdecimal);
+ NodeWritable nw = new NodeWritable(n);
+ testWriteRead(nw, nw);
+ }
+
+ /**
+ * Basic node writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void node_writable_literal_06() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Node n = NodeFactory.createLiteral("12.3e4", XSDDatatype.XSDdouble);
+ NodeWritable nw = new NodeWritable(n);
+ testWriteRead(nw, nw);
+ }
+
+ /**
+ * Basic node writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void node_writable_literal_07() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Node n = NodeFactory.createLiteral("true", XSDDatatype.XSDboolean);
+ NodeWritable nw = new NodeWritable(n);
+ testWriteRead(nw, nw);
+ }
+
+ /**
+ * Basic node writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void node_writable_bnode_01() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Node n = NodeFactory.createAnon();
+ NodeWritable nw = new NodeWritable(n);
+ testWriteRead(nw, nw);
+ }
+
+ /**
+ * Basic node writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void node_writable_bnode_02() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Node n = NodeFactory.createAnon();
+ NodeWritable nw = new NodeWritable(n);
+ testWriteRead(nw, nw);
+ NodeWritable nw2 = new NodeWritable(n);
+ testWriteRead(nw2, nw2);
+
+ Assert.assertEquals(0, nw.compareTo(nw2));
+ }
+
+ /**
+ * Basic triple writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void triple_writable_01() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Triple t = new Triple(NodeFactory.createURI("http://example"),
NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral("value"));
+ TripleWritable tw = new TripleWritable(t);
+ testWriteRead(tw, tw);
+ }
+
+ /**
+ * Basic quad writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void quad_writable_01() throws IOException, InstantiationException,
IllegalAccessException, ClassNotFoundException {
+ Quad q = new Quad(Quad.defaultGraphNodeGenerated,
NodeFactory.createURI("http://example"),
NodeFactory.createURI("http://predicate"),
+ NodeFactory.createLiteral("value"));
+ QuadWritable qw = new QuadWritable(q);
+ testWriteRead(qw, qw);
+ }
+
+ /**
+ * Basic tuple writable round tripping test
+ *
+ * @throws IOException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void tuple_writable_01() throws IOException,
InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Tuple<Node> t = Tuple.createTuple(NodeFactory.createURI("http://one"),
NodeFactory.createURI("http://two"), NodeFactory.createLiteral("value"),
+ NodeFactory.createLiteral("foo"),
NodeFactory.createURI("http://three"));
+ NodeTupleWritable tw = new NodeTupleWritable(t);
+ testWriteRead(tw, tw);
+ }
+}
Modified:
jena/Experimental/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/TestDistinctTriples.java
URL:
http://svn.apache.org/viewvc/jena/Experimental/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/TestDistinctTriples.java?rev=1609148&r1=1609147&r2=1609148&view=diff
==============================================================================
---
jena/Experimental/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/TestDistinctTriples.java
(original)
+++
jena/Experimental/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/TestDistinctTriples.java
Wed Jul 9 13:45:07 2014
@@ -79,9 +79,6 @@ public class TestDistinctTriples
driver.addInput(new LongWritable(2), tw2);
driver.addOutput(NullWritable.get(), tw);
driver.addOutput(NullWritable.get(), tw2);
-
- BasicConfigurator.configure();
- Logger.getRootLogger().setLevel(Level.TRACE);
driver.runTest(false);
}