You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by rv...@apache.org on 2014/10/20 16:47:55 UTC
[33/50] [abbrv] Get Jena Hadoop RDF Tools building
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/BZippedNTriplesInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/BZippedNTriplesInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/BZippedNTriplesInputTest.java
new file mode 100644
index 0000000..fb1ab8b
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/BZippedNTriplesInputTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.ntriples;
+
+import org.apache.hadoop.io.compress.BZip2Codec;
+
+
+/**
+ * Tests for BZipped NTriples input
+ *
+ *
+ *
+ */
+public class BZippedNTriplesInputTest extends AbstractCompressedNTriplesInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public BZippedNTriplesInputTest() {
+ super(".nt.bz2", new BZip2Codec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/BZippedWholeFileNTriplesInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/BZippedWholeFileNTriplesInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/BZippedWholeFileNTriplesInputTest.java
new file mode 100644
index 0000000..d50b6eb
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/BZippedWholeFileNTriplesInputTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.ntriples;
+
+import org.apache.hadoop.io.compress.BZip2Codec;
+
+
+/**
+ * Tests for BZipped NTriples input
+ *
+ *
+ *
+ */
+public class BZippedWholeFileNTriplesInputTest extends AbstractCompressedWholeFileNTriplesInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public BZippedWholeFileNTriplesInputTest() {
+ super(".nt.bz2", new BZip2Codec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/DeflatedBlockedNTriplesInput.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/DeflatedBlockedNTriplesInput.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/DeflatedBlockedNTriplesInput.java
new file mode 100644
index 0000000..9780707
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/DeflatedBlockedNTriplesInput.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.ntriples;
+
+import org.apache.hadoop.io.compress.DefaultCodec;
+
+/**
+ * Tests for deflated blocked NTriples input
+ *
+ *
+ *
+ */
+public class DeflatedBlockedNTriplesInput extends AbstractCompressedBlockedNTriplesInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public DeflatedBlockedNTriplesInput() {
+ super(".nt.deflate", new DefaultCodec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/DeflatedNTriplesInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/DeflatedNTriplesInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/DeflatedNTriplesInputTest.java
new file mode 100644
index 0000000..b6dd1e9
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/DeflatedNTriplesInputTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.ntriples;
+
+import org.apache.hadoop.io.compress.DefaultCodec;
+
+
+/**
+ * Tests for deflated NTriples input
+ *
+ *
+ *
+ */
+public class DeflatedNTriplesInputTest extends AbstractCompressedNTriplesInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public DeflatedNTriplesInputTest() {
+ super(".nt.deflate", new DefaultCodec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/DeflatedWholeFileNTriplesInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/DeflatedWholeFileNTriplesInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/DeflatedWholeFileNTriplesInputTest.java
new file mode 100644
index 0000000..e1e57f4
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/DeflatedWholeFileNTriplesInputTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.ntriples;
+
+import org.apache.hadoop.io.compress.DefaultCodec;
+
+
+/**
+ * Tests for deflated NTriples input
+ *
+ *
+ *
+ */
+public class DeflatedWholeFileNTriplesInputTest extends AbstractCompressedWholeFileNTriplesInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public DeflatedWholeFileNTriplesInputTest() {
+ super(".nt.deflate", new DefaultCodec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/GZippedBlockedNTriplesInput.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/GZippedBlockedNTriplesInput.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/GZippedBlockedNTriplesInput.java
new file mode 100644
index 0000000..012fd58
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/GZippedBlockedNTriplesInput.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.ntriples;
+
+import org.apache.hadoop.io.compress.GzipCodec;
+
+/**
+ * Tests for GZipped blocked NTriples input
+ *
+ *
+ *
+ */
+public class GZippedBlockedNTriplesInput extends AbstractCompressedBlockedNTriplesInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public GZippedBlockedNTriplesInput() {
+ super(".nt.gz", new GzipCodec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/GZippedNTriplesInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/GZippedNTriplesInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/GZippedNTriplesInputTest.java
new file mode 100644
index 0000000..3cb4ee0
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/GZippedNTriplesInputTest.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.ntriples;
+
+import org.apache.hadoop.io.compress.GzipCodec;
+
+
+
+
+/**
+ * Tests for GZipped NTriples input
+ *
+ *
+ *
+ */
+public class GZippedNTriplesInputTest extends AbstractCompressedNTriplesInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public GZippedNTriplesInputTest() {
+ super(".nt.gz", new GzipCodec());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/GZippedWholeFileNTriplesInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/GZippedWholeFileNTriplesInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/GZippedWholeFileNTriplesInputTest.java
new file mode 100644
index 0000000..b7acc08
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/ntriples/GZippedWholeFileNTriplesInputTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.ntriples;
+
+import org.apache.hadoop.io.compress.GzipCodec;
+
+/**
+ * Tests for GZipped NTriples input
+ *
+ *
+ *
+ */
+public class GZippedWholeFileNTriplesInputTest extends AbstractCompressedWholeFileNTriplesInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public GZippedWholeFileNTriplesInputTest() {
+ super(".nt.gz", new GzipCodec());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/AbstractCompressedRdfJsonInputFormatTests.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/AbstractCompressedRdfJsonInputFormatTests.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/AbstractCompressedRdfJsonInputFormatTests.java
new file mode 100644
index 0000000..cdcf24a
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/AbstractCompressedRdfJsonInputFormatTests.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.rdfjson;
+
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.io.compress.CompressionCodec;
+import org.apache.hadoop.mapreduce.InputFormat;
+import org.apache.jena.hadoop.rdf.io.input.RdfJsonInputFormat;
+import org.apache.jena.hadoop.rdf.io.input.compressed.AbstractCompressedWholeFileTripleInputFormatTests;
+import org.apache.jena.hadoop.rdf.types.TripleWritable;
+import org.apache.jena.riot.Lang;
+
+
+/**
+ * Abstract compressed RDF/JSON input tests
+ *
+ *
+ *
+ */
+public abstract class AbstractCompressedRdfJsonInputFormatTests extends AbstractCompressedWholeFileTripleInputFormatTests {
+
+ private String ext;
+ private CompressionCodec codec;
+
+ /**
+ * Creates new tests
+ *
+ * @param ext
+ * File extension
+ * @param codec
+ * Compression codec
+ */
+ public AbstractCompressedRdfJsonInputFormatTests(String ext, CompressionCodec codec) {
+ this.ext = ext;
+ this.codec = codec;
+ }
+
+ @Override
+ protected final String getFileExtension() {
+ return this.ext;
+ }
+
+ @Override
+ protected final CompressionCodec getCompressionCodec() {
+ return this.codec;
+ }
+
+ @Override
+ protected final Lang getRdfLanguage() {
+ return Lang.RDFJSON;
+ }
+
+ @Override
+ protected final InputFormat<LongWritable, TripleWritable> getInputFormat() {
+ return new RdfJsonInputFormat();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/BZippedRdfJsonInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/BZippedRdfJsonInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/BZippedRdfJsonInputTest.java
new file mode 100644
index 0000000..6e58d4b
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/BZippedRdfJsonInputTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.rdfjson;
+
+import org.apache.hadoop.io.compress.BZip2Codec;
+
+/**
+ * Tests for BZipped RDF/JSON input
+ *
+ *
+ *
+ */
+public class BZippedRdfJsonInputTest extends AbstractCompressedRdfJsonInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public BZippedRdfJsonInputTest() {
+ super(".rj.bz2", new BZip2Codec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/DeflatedRdfJsonInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/DeflatedRdfJsonInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/DeflatedRdfJsonInputTest.java
new file mode 100644
index 0000000..8b7b044
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/DeflatedRdfJsonInputTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.rdfjson;
+
+import org.apache.hadoop.io.compress.DefaultCodec;
+
+/**
+ * Tests for Deflated RDF/JSON input
+ *
+ *
+ *
+ */
+public class DeflatedRdfJsonInputTest extends AbstractCompressedRdfJsonInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public DeflatedRdfJsonInputTest() {
+ super(".rj.deflate", new DefaultCodec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/GZippedRdfJsonInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/GZippedRdfJsonInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/GZippedRdfJsonInputTest.java
new file mode 100644
index 0000000..66996dd
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfjson/GZippedRdfJsonInputTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.rdfjson;
+
+import org.apache.hadoop.io.compress.GzipCodec;
+
+/**
+ * Tests for GZipped RDF/JSON input
+ *
+ *
+ *
+ */
+public class GZippedRdfJsonInputTest extends AbstractCompressedRdfJsonInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public GZippedRdfJsonInputTest() {
+ super(".rj.gz", new GzipCodec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/AbstractCompressedRdfXmlInputFormatTests.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/AbstractCompressedRdfXmlInputFormatTests.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/AbstractCompressedRdfXmlInputFormatTests.java
new file mode 100644
index 0000000..36b935b
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/AbstractCompressedRdfXmlInputFormatTests.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.rdfxml;
+
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.io.compress.CompressionCodec;
+import org.apache.hadoop.mapreduce.InputFormat;
+import org.apache.jena.hadoop.rdf.io.input.RdfXmlInputFormat;
+import org.apache.jena.hadoop.rdf.io.input.compressed.AbstractCompressedWholeFileTripleInputFormatTests;
+import org.apache.jena.hadoop.rdf.types.TripleWritable;
+import org.apache.jena.riot.Lang;
+
+
+/**
+ * Abstract compressed RDF/XML input tests
+ *
+ *
+ *
+ */
+public abstract class AbstractCompressedRdfXmlInputFormatTests extends
+ AbstractCompressedWholeFileTripleInputFormatTests {
+
+ private String ext;
+ private CompressionCodec codec;
+
+ /**
+ * Creates new tests
+ *
+ * @param ext
+ * File extension
+ * @param codec
+ * Compression codec
+ */
+ public AbstractCompressedRdfXmlInputFormatTests(String ext, CompressionCodec codec) {
+ this.ext = ext;
+ this.codec = codec;
+ }
+
+ @Override
+ protected final String getFileExtension() {
+ return this.ext;
+ }
+
+ @Override
+ protected final CompressionCodec getCompressionCodec() {
+ return this.codec;
+ }
+
+ @Override
+ protected final Lang getRdfLanguage() {
+ return Lang.RDFXML;
+ }
+
+ @Override
+ protected final InputFormat<LongWritable, TripleWritable> getInputFormat() {
+ return new RdfXmlInputFormat();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/BZippedRdfXmlInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/BZippedRdfXmlInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/BZippedRdfXmlInputTest.java
new file mode 100644
index 0000000..30a6c39
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/BZippedRdfXmlInputTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.rdfxml;
+
+import org.apache.hadoop.io.compress.BZip2Codec;
+
+/**
+ * Tests for BZipped RDF/XML input
+ *
+ *
+ *
+ */
+public class BZippedRdfXmlInputTest extends AbstractCompressedRdfXmlInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public BZippedRdfXmlInputTest() {
+ super(".rdf.bz2", new BZip2Codec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/DeflatedRdfXmlInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/DeflatedRdfXmlInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/DeflatedRdfXmlInputTest.java
new file mode 100644
index 0000000..a3d747c
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/DeflatedRdfXmlInputTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.rdfxml;
+
+import org.apache.hadoop.io.compress.DefaultCodec;
+
+/**
+ * Tests for Deflated RDF/XML input
+ *
+ *
+ *
+ */
+public class DeflatedRdfXmlInputTest extends AbstractCompressedRdfXmlInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public DeflatedRdfXmlInputTest() {
+ super(".rdf.deflate", new DefaultCodec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/GZippedRdfXmlInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/GZippedRdfXmlInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/GZippedRdfXmlInputTest.java
new file mode 100644
index 0000000..748785c
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/rdfxml/GZippedRdfXmlInputTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.rdfxml;
+
+import org.apache.hadoop.io.compress.GzipCodec;
+
+/**
+ * Tests for GZipped RDF/XML input
+ *
+ *
+ *
+ */
+public class GZippedRdfXmlInputTest extends AbstractCompressedRdfXmlInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public GZippedRdfXmlInputTest() {
+ super(".rdf.gz", new GzipCodec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/AbstractCompressedTriGInputFormatTests.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/AbstractCompressedTriGInputFormatTests.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/AbstractCompressedTriGInputFormatTests.java
new file mode 100644
index 0000000..9b92502
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/AbstractCompressedTriGInputFormatTests.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.trig;
+
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.io.compress.CompressionCodec;
+import org.apache.hadoop.mapreduce.InputFormat;
+import org.apache.jena.hadoop.rdf.io.input.TriGInputFormat;
+import org.apache.jena.hadoop.rdf.io.input.compressed.AbstractCompressedWholeFileQuadInputFormatTests;
+import org.apache.jena.hadoop.rdf.types.QuadWritable;
+import org.apache.jena.riot.Lang;
+
+
+/**
+ * Abstract compressed Turtle input tests
+ *
+ *
+ *
+ */
+public abstract class AbstractCompressedTriGInputFormatTests extends
+ AbstractCompressedWholeFileQuadInputFormatTests {
+
+ private String ext;
+ private CompressionCodec codec;
+
+ /**
+ * Creates new tests
+ *
+ * @param ext
+ * File extension
+ * @param codec
+ * Compression codec
+ */
+ public AbstractCompressedTriGInputFormatTests(String ext, CompressionCodec codec) {
+ this.ext = ext;
+ this.codec = codec;
+ }
+
+ @Override
+ protected final String getFileExtension() {
+ return this.ext;
+ }
+
+ @Override
+ protected final CompressionCodec getCompressionCodec() {
+ return this.codec;
+ }
+
+ @Override
+ protected final Lang getRdfLanguage() {
+ return Lang.TRIG;
+ }
+
+ @Override
+ protected final InputFormat<LongWritable, QuadWritable> getInputFormat() {
+ return new TriGInputFormat();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/BZippedTriGInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/BZippedTriGInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/BZippedTriGInputTest.java
new file mode 100644
index 0000000..b2b3c33
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/BZippedTriGInputTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.trig;
+
+import org.apache.hadoop.io.compress.BZip2Codec;
+
+/**
+ * Tests for BZipped TriG input
+ *
+ *
+ *
+ */
+public class BZippedTriGInputTest extends AbstractCompressedTriGInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public BZippedTriGInputTest() {
+ super(".trig.bz2", new BZip2Codec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/DeflatedTriGInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/DeflatedTriGInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/DeflatedTriGInputTest.java
new file mode 100644
index 0000000..c9579a9
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/DeflatedTriGInputTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.trig;
+
+import org.apache.hadoop.io.compress.DefaultCodec;
+
+/**
+ * Tests for Deflated TriG input
+ *
+ *
+ *
+ */
+public class DeflatedTriGInputTest extends AbstractCompressedTriGInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public DeflatedTriGInputTest() {
+ super(".trig.deflate", new DefaultCodec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/GZippedTriGInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/GZippedTriGInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/GZippedTriGInputTest.java
new file mode 100644
index 0000000..c3e4106
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/trig/GZippedTriGInputTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.trig;
+
+import org.apache.hadoop.io.compress.GzipCodec;
+
+/**
+ * Tests for GZipped TriG input
+ *
+ *
+ *
+ */
+public class GZippedTriGInputTest extends AbstractCompressedTriGInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public GZippedTriGInputTest() {
+ super(".trig.gz", new GzipCodec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/AbstractCompressedTurtleInputFormatTests.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/AbstractCompressedTurtleInputFormatTests.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/AbstractCompressedTurtleInputFormatTests.java
new file mode 100644
index 0000000..c6be25c
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/AbstractCompressedTurtleInputFormatTests.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.turtle;
+
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.io.compress.CompressionCodec;
+import org.apache.hadoop.mapreduce.InputFormat;
+import org.apache.jena.hadoop.rdf.io.input.TurtleInputFormat;
+import org.apache.jena.hadoop.rdf.io.input.compressed.AbstractCompressedWholeFileTripleInputFormatTests;
+import org.apache.jena.hadoop.rdf.types.TripleWritable;
+import org.apache.jena.riot.Lang;
+
+
+/**
+ * Abstract compressed Turtle input tests
+ *
+ *
+ *
+ */
+public abstract class AbstractCompressedTurtleInputFormatTests extends
+ AbstractCompressedWholeFileTripleInputFormatTests {
+
+ private String ext;
+ private CompressionCodec codec;
+
+ /**
+ * Creates new tests
+ *
+ * @param ext
+ * File extension
+ * @param codec
+ * Compression codec
+ */
+ public AbstractCompressedTurtleInputFormatTests(String ext, CompressionCodec codec) {
+ this.ext = ext;
+ this.codec = codec;
+ }
+
+ @Override
+ protected final String getFileExtension() {
+ return this.ext;
+ }
+
+ @Override
+ protected final CompressionCodec getCompressionCodec() {
+ return this.codec;
+ }
+
+ @Override
+ protected final Lang getRdfLanguage() {
+ return Lang.TURTLE;
+ }
+
+ @Override
+ protected final InputFormat<LongWritable, TripleWritable> getInputFormat() {
+ return new TurtleInputFormat();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/BZippedTurtleInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/BZippedTurtleInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/BZippedTurtleInputTest.java
new file mode 100644
index 0000000..724b847
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/BZippedTurtleInputTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.turtle;
+
+import org.apache.hadoop.io.compress.BZip2Codec;
+
+/**
+ * Tests for BZipped NTriples input
+ *
+ *
+ *
+ */
+public class BZippedTurtleInputTest extends AbstractCompressedTurtleInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public BZippedTurtleInputTest() {
+ super(".nt.bz2", new BZip2Codec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/DeflatedTurtleInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/DeflatedTurtleInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/DeflatedTurtleInputTest.java
new file mode 100644
index 0000000..eb5ee03
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/DeflatedTurtleInputTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.turtle;
+
+import org.apache.hadoop.io.compress.DefaultCodec;
+
+/**
+ * Tests for Deflated NTriples input
+ *
+ *
+ *
+ */
+public class DeflatedTurtleInputTest extends AbstractCompressedTurtleInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public DeflatedTurtleInputTest() {
+ super(".nt.deflate", new DefaultCodec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/GZippedTurtleInputTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/GZippedTurtleInputTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/GZippedTurtleInputTest.java
new file mode 100644
index 0000000..817805c
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/compressed/turtle/GZippedTurtleInputTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.compressed.turtle;
+
+import org.apache.hadoop.io.compress.GzipCodec;
+
+/**
+ * Tests for GZipped NTriples input
+ *
+ *
+ *
+ */
+public class GZippedTurtleInputTest extends AbstractCompressedTurtleInputFormatTests {
+
+ /**
+ * Creates new tests
+ */
+ public GZippedTurtleInputTest() {
+ super(".nt.gz", new GzipCodec());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/util/AbstractTrackableInputStreamTests.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/util/AbstractTrackableInputStreamTests.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/util/AbstractTrackableInputStreamTests.java
new file mode 100644
index 0000000..9532d56
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/util/AbstractTrackableInputStreamTests.java
@@ -0,0 +1,701 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.jena.hadoop.rdf.io.input.util.TrackableInputStream;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Abstract tests for {@link TrackableInputStream} implementations
+ *
+ *
+ *
+ */
+public abstract class AbstractTrackableInputStreamTests {
+
+ protected static final int KILO = 1024;
+ protected static final int BYTES_PER_KB = KILO;
+ protected static final int BYTES_PER_MB = BYTES_PER_KB * KILO;
+
+ /**
+ * Gets the instance to test using the given input as the stream to track
+ *
+ * @param input
+ * Input Stream
+ * @return Trackable Input Stream
+ */
+ protected abstract TrackableInputStream getInstance(InputStream input);
+
+ /**
+ * Generates an input stream containing the given number of bytes
+ *
+ * @param length
+ * Number of bytes
+ * @return Input stream
+ */
+ protected final InputStream generateData(int length) {
+ ByteArrayOutputStream output = new ByteArrayOutputStream(length);
+ byte b = (byte) 'b';
+ for (int i = 0; i < length; i++) {
+ output.write(b);
+ }
+ return new ByteArrayInputStream(output.toByteArray());
+ }
+
+ protected final void testSingleByteRead(int length) throws IOException {
+ InputStream input = this.generateData(length);
+ TrackableInputStream trackable = this.getInstance(input);
+ long count = 0;
+ while (trackable.read() >= 0) {
+ count++;
+ }
+ Assert.assertEquals(length, count);
+ Assert.assertEquals(length, trackable.getBytesRead());
+ trackable.close();
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_single_01() throws IOException {
+ this.testSingleByteRead(0);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_single_02() throws IOException {
+ this.testSingleByteRead(100);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_single_03() throws IOException {
+ // 1KB
+ this.testSingleByteRead(BYTES_PER_KB);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_single_04() throws IOException {
+ // 1 MB
+ this.testSingleByteRead(BYTES_PER_MB);
+ }
+
+ protected final void testMultiByteRead(int length, int bufferSize) throws IOException {
+ if (bufferSize < 1)
+ throw new IllegalArgumentException("bufferSize must be >= 1");
+ InputStream input = this.generateData(length);
+ TrackableInputStream trackable = this.getInstance(input);
+ long count = 0;
+ byte[] buffer = new byte[bufferSize];
+ long read;
+ do {
+ read = trackable.read(buffer);
+ if (read > 0)
+ count += read;
+ } while (read >= 0);
+ Assert.assertEquals(length, count);
+ Assert.assertEquals(length, trackable.getBytesRead());
+ trackable.close();
+ }
+
+ /**
+ * Test reading multiple bytes i.e. calling {@link InputStream#read(byte[])}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_01() throws IOException {
+ this.testMultiByteRead(0, 1);
+ }
+
+ /**
+ * Test reading multiple bytes i.e. calling {@link InputStream#read(byte[])}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_02() throws IOException {
+ this.testMultiByteRead(0, 16);
+ }
+
+ /**
+ * Test reading multiple bytes i.e. calling {@link InputStream#read(byte[])}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_03() throws IOException {
+ this.testMultiByteRead(0, BYTES_PER_KB);
+ }
+
+ /**
+ * Test reading multiple bytes i.e. calling {@link InputStream#read(byte[])}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_04() throws IOException {
+ // 1KB
+ this.testMultiByteRead(BYTES_PER_KB, 1);
+ }
+
+ /**
+ * Test reading multiple bytes i.e. calling {@link InputStream#read(byte[])}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_05() throws IOException {
+ // 1KB
+ this.testMultiByteRead(BYTES_PER_KB, 16);
+ }
+
+ /**
+ * Test reading multiple bytes i.e. calling {@link InputStream#read(byte[])}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_06() throws IOException {
+ // 1KB
+ this.testMultiByteRead(BYTES_PER_KB, BYTES_PER_KB);
+ }
+
+ /**
+ * Test reading multiple bytes i.e. calling {@link InputStream#read(byte[])}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_07() throws IOException {
+ // 1MB
+ this.testMultiByteRead(BYTES_PER_MB, 1);
+ }
+
+ /**
+ * Test reading multiple bytes i.e. calling {@link InputStream#read(byte[])}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_08() throws IOException {
+ // 1MB
+ this.testMultiByteRead(BYTES_PER_MB, 16);
+ }
+
+ /**
+ * Test reading multiple bytes i.e. calling {@link InputStream#read(byte[])}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_09() throws IOException {
+ // 1MB
+ this.testMultiByteRead(BYTES_PER_MB, BYTES_PER_KB);
+ }
+
+ protected final void testMultiByteRead(int length, int bufferSize, int readSize) throws IOException {
+ if (bufferSize < 1)
+ throw new IllegalArgumentException("bufferSize must be >= 1");
+ if (readSize < 1 || readSize > bufferSize)
+ throw new IllegalArgumentException("readSize must be >= 1 and <= bufferSize");
+ InputStream input = this.generateData(length);
+ TrackableInputStream trackable = this.getInstance(input);
+ long count = 0;
+ byte[] buffer = new byte[bufferSize];
+ long read;
+ do {
+ read = trackable.read(buffer, 0, readSize);
+ if (read > 0)
+ count += read;
+ } while (read >= 0);
+ Assert.assertEquals(length, count);
+ Assert.assertEquals(length, trackable.getBytesRead());
+ trackable.close();
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_01() throws IOException {
+ this.testMultiByteRead(0, 1, 1);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_02() throws IOException {
+ this.testMultiByteRead(0, 16, 1);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_03() throws IOException {
+ this.testMultiByteRead(0, 16, 16);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_04() throws IOException {
+ this.testMultiByteRead(0, BYTES_PER_KB, 1);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_05() throws IOException {
+ this.testMultiByteRead(0, BYTES_PER_KB, 16);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_06() throws IOException {
+ this.testMultiByteRead(0, BYTES_PER_KB, BYTES_PER_KB);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_07() throws IOException {
+ // 1KB
+ this.testMultiByteRead(BYTES_PER_KB, 1, 1);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_08() throws IOException {
+ // 1KB
+ this.testMultiByteRead(BYTES_PER_KB, 16, 1);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_09() throws IOException {
+ // 1KB
+ this.testMultiByteRead(BYTES_PER_KB, 16, 16);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_10() throws IOException {
+ // 1KB
+ this.testMultiByteRead(BYTES_PER_KB, BYTES_PER_KB, 1);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_11() throws IOException {
+ // 1KB
+ this.testMultiByteRead(BYTES_PER_KB, BYTES_PER_KB, 16);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_12() throws IOException {
+ // 1KB
+ this.testMultiByteRead(BYTES_PER_KB, BYTES_PER_KB, BYTES_PER_KB);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_13() throws IOException {
+ // 1MB
+ this.testMultiByteRead(BYTES_PER_MB, 1, 1);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_14() throws IOException {
+ // 1MB
+ this.testMultiByteRead(BYTES_PER_MB, 16, 1);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_15() throws IOException {
+ // 1MB
+ this.testMultiByteRead(BYTES_PER_MB, 16, 16);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_16() throws IOException {
+ // 1MB
+ this.testMultiByteRead(BYTES_PER_MB, BYTES_PER_KB, 1);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_17() throws IOException {
+ // 1MB
+ this.testMultiByteRead(BYTES_PER_MB, BYTES_PER_KB, 16);
+ }
+
+ /**
+ * Test reading multiple bytes while reading less than the buffer size bytes
+ * i.e. calling {@link InputStream#read(byte[], int, int)}
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_read_multiple_partial_18() throws IOException {
+ // 1MB
+ this.testMultiByteRead(BYTES_PER_MB, BYTES_PER_KB, BYTES_PER_KB);
+ }
+
+ protected final void testSkip(int length, long skipSize) throws IOException {
+ if (skipSize < 1)
+ throw new IllegalArgumentException("skipSize must be >= 1");
+ InputStream input = this.generateData(length);
+ TrackableInputStream trackable = this.getInstance(input);
+ long count = 0;
+ long skipped;
+ do {
+ skipped = trackable.skip(skipSize);
+ if (skipped > 0)
+ count += skipped;
+ } while (skipped > 0);
+ Assert.assertEquals(length, count);
+ Assert.assertEquals(length, trackable.getBytesRead());
+ trackable.close();
+ }
+
+ /**
+ * Test skipping
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_skip_single_01() throws IOException {
+ this.testSkip(0, 1);
+ }
+
+ /**
+ * Test skipping
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_skip_single_02() throws IOException {
+ this.testSkip(100, 1);
+ }
+
+ /**
+ * Test skipping
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_skip_single_03() throws IOException {
+ this.testSkip(100, 16);
+ }
+
+ /**
+ * Test skipping
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_skip_single_04() throws IOException {
+ this.testSkip(100, BYTES_PER_KB);
+ }
+
+ /**
+ * Test skipping
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_skip_single_05() throws IOException {
+ // 1KB
+ this.testSkip(BYTES_PER_KB, 1);
+ }
+
+ /**
+ * Test skipping
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_skip_single_06() throws IOException {
+ // 1KB
+ this.testSkip(BYTES_PER_KB, 16);
+ }
+
+ /**
+ * Test skipping
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_skip_single_07() throws IOException {
+ // 1KB
+ this.testSkip(BYTES_PER_KB, BYTES_PER_KB);
+ }
+
+ /**
+ * Test skipping
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_skip_single_08() throws IOException {
+ // 1KB
+ this.testSkip(BYTES_PER_KB, BYTES_PER_MB);
+ }
+
+ /**
+ * Test skipping
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_skip_single_09() throws IOException {
+ // 1 MB
+ this.testSkip(BYTES_PER_MB, 1);
+ }
+
+ /**
+ * Test skipping
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_skip_single_10() throws IOException {
+ // 1 MB
+ this.testSkip(BYTES_PER_MB, 16);
+ }
+
+ /**
+ * Test skipping
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_skip_single_11() throws IOException {
+ // 1 MB
+ this.testSkip(BYTES_PER_MB, BYTES_PER_KB);
+ }
+
+ /**
+ * Test skipping
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_skip_single_12() throws IOException {
+ // 1 MB
+ this.testSkip(BYTES_PER_MB, BYTES_PER_MB);
+ }
+
+ /**
+ * Tests behaviour after closing
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_post_close_01() throws IOException {
+ InputStream input = this.generateData(0);
+ TrackableInputStream trackable = this.getInstance(input);
+ trackable.close();
+ Assert.assertEquals(-1, trackable.read());
+ }
+
+ /**
+ * Tests behaviour after closing
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_post_close_02() throws IOException {
+ InputStream input = this.generateData(0);
+ TrackableInputStream trackable = this.getInstance(input);
+ trackable.close();
+ Assert.assertEquals(0, trackable.read(new byte[0]));
+ }
+
+ /**
+ * Tests behaviour after closing
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_post_close_03() throws IOException {
+ InputStream input = this.generateData(0);
+ TrackableInputStream trackable = this.getInstance(input);
+ trackable.close();
+ Assert.assertEquals(-1, trackable.read(new byte[1]));
+ }
+
+ /**
+ * Tests behaviour after closing
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_post_close_04() throws IOException {
+ InputStream input = this.generateData(0);
+ TrackableInputStream trackable = this.getInstance(input);
+ trackable.close();
+ Assert.assertEquals(0, trackable.read(new byte[16], 0, 0));
+ }
+
+ /**
+ * Tests behaviour after closing
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_post_close_05() throws IOException {
+ InputStream input = this.generateData(0);
+ TrackableInputStream trackable = this.getInstance(input);
+ trackable.close();
+ Assert.assertEquals(-1, trackable.read(new byte[16], 0, 8));
+ }
+
+ /**
+ * Tests behaviour after closing
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_post_close_06() throws IOException {
+ InputStream input = this.generateData(0);
+ TrackableInputStream trackable = this.getInstance(input);
+ trackable.close();
+ Assert.assertEquals(0, trackable.skip(0));
+ }
+
+ /**
+ * Tests exceptions are thrown trying to perform actions after closing the
+ * input
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void trackable_input_post_close_07() throws IOException {
+ InputStream input = this.generateData(0);
+ TrackableInputStream trackable = this.getInstance(input);
+ trackable.close();
+ Assert.assertEquals(0, trackable.skip(1));
+ }
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/util/BlockInputStreamTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/util/BlockInputStreamTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/util/BlockInputStreamTest.java
new file mode 100644
index 0000000..f8819bc
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/util/BlockInputStreamTest.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.jena.hadoop.rdf.io.input.util.BlockInputStream;
+import org.apache.jena.hadoop.rdf.io.input.util.TrackableInputStream;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests for the {@link BlockInputStream}
+ *
+ *
+ *
+ */
+public class BlockInputStreamTest extends AbstractTrackableInputStreamTests {
+
+ @Override
+ protected TrackableInputStream getInstance(InputStream input) {
+ return new BlockInputStream(input, Long.MAX_VALUE);
+ }
+
+ /**
+ * Gets an instance of a block input stream
+ *
+ * @param input
+ * Underlying input stream
+ * @param limit
+ * Limit on bytes to read
+ * @return Block input stream
+ */
+ protected BlockInputStream getInstance(InputStream input, long limit) {
+ return new BlockInputStream(input, limit);
+ }
+
+ protected final void testSingleByteRead(int length, long limit) throws IOException {
+ InputStream input = this.generateData(length);
+ TrackableInputStream trackable = this.getInstance(input, limit);
+ long count = 0;
+ while (trackable.read() >= 0) {
+ count++;
+ }
+ int expected = (int) Math.min(length, limit);
+ Assert.assertEquals(expected, count);
+ Assert.assertEquals(expected, trackable.getBytesRead());
+ trackable.close();
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_01() throws IOException {
+ this.testSingleByteRead(0, 0);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_02() throws IOException {
+ this.testSingleByteRead(100, 0);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_03() throws IOException {
+ this.testSingleByteRead(100, 50);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_04() throws IOException {
+ this.testSingleByteRead(100, 100);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_05() throws IOException {
+ // 1KB
+ this.testSingleByteRead(BYTES_PER_KB, 1);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_06() throws IOException {
+ // 1KB
+ this.testSingleByteRead(BYTES_PER_KB, 100);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_07() throws IOException {
+ // 1KB
+ this.testSingleByteRead(BYTES_PER_KB, BYTES_PER_KB / 2);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_08() throws IOException {
+ // 1KB
+ this.testSingleByteRead(BYTES_PER_KB, BYTES_PER_KB);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_09() throws IOException {
+ // 1KB
+ this.testSingleByteRead(BYTES_PER_KB, BYTES_PER_MB);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_10() throws IOException {
+ // 1KB
+ this.testSingleByteRead(BYTES_PER_KB, BYTES_PER_MB * 10);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_11() throws IOException {
+ // 1MB
+ this.testSingleByteRead(BYTES_PER_MB, 1);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_12() throws IOException {
+ // 1MB
+ this.testSingleByteRead(BYTES_PER_MB, 100);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_13() throws IOException {
+ // 1MB
+ this.testSingleByteRead(BYTES_PER_MB, BYTES_PER_KB);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_14() throws IOException {
+ // 1MB
+ this.testSingleByteRead(BYTES_PER_MB, BYTES_PER_MB / 2);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_15() throws IOException {
+ // 1MB
+ this.testSingleByteRead(BYTES_PER_MB, BYTES_PER_MB);
+ }
+
+ /**
+ * Test reading byte by byte
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void block_input_read_single_16() throws IOException {
+ // 1MB
+ this.testSingleByteRead(BYTES_PER_MB, BYTES_PER_MB * 10);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/util/TrackedInputStreamTest.java
----------------------------------------------------------------------
diff --git a/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/util/TrackedInputStreamTest.java b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/util/TrackedInputStreamTest.java
new file mode 100644
index 0000000..f453aa5
--- /dev/null
+++ b/jena-hadoop-rdf/hadoop-rdf-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/util/TrackedInputStreamTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.hadoop.rdf.io.input.util;
+
+import java.io.InputStream;
+
+import org.apache.jena.hadoop.rdf.io.input.util.TrackableInputStream;
+import org.apache.jena.hadoop.rdf.io.input.util.TrackedInputStream;
+
+/**
+ * Tests for the {@link TrackedInputStream}
+ *
+ *
+ *
+ */
+public class TrackedInputStreamTest extends AbstractTrackableInputStreamTests {
+
+ @Override
+ protected TrackableInputStream getInstance(InputStream input) {
+ return new TrackedInputStream(input);
+ }
+
+}