http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/AbstractQuadValidityFilterTests.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/AbstractQuadValidityFilterTests.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/AbstractQuadValidityFilterTests.java deleted file mode 100644 index 9458f83..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/AbstractQuadValidityFilterTests.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.mapreduce.filter; - -import org.apache.jena.hadoop.rdf.types.QuadWritable; - -import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; -import com.hp.hpl.jena.graph.NodeFactory; -import com.hp.hpl.jena.sparql.core.Quad; - -/** - * Abstract tests for triple filter mappers that check triple validity - * - * - * - */ -public abstract class AbstractQuadValidityFilterTests extends AbstractNodeTupleFilterTests<Quad, QuadWritable> { - - @Override - protected QuadWritable createValidValue(int i) { - return new QuadWritable( - new Quad(Quad.defaultGraphNodeGenerated, NodeFactory.createURI("http://subjects/" + i), - NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), - XSDDatatype.XSDinteger))); - } - - @Override - protected QuadWritable createInvalidValue(int i) { - switch (i % 8) { - case 0: - // Invalid to use Literal as Graph - return new QuadWritable(new Quad(NodeFactory.createLiteral("invalid"), NodeFactory.createURI("http://subjects/" + i), - NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), - XSDDatatype.XSDinteger))); - case 1: - // Invalid to use Variable as Graph - return new QuadWritable(new Quad(NodeFactory.createVariable("invalid"), - NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - case 2: - // Invalid to use Literal as Subject - return new QuadWritable(new Quad(Quad.defaultGraphNodeGenerated, NodeFactory.createLiteral("invalid"), - NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), - XSDDatatype.XSDinteger))); - case 3: - // Invalid to use Variable as Subject - return new QuadWritable(new Quad(Quad.defaultGraphNodeGenerated, NodeFactory.createVariable("invalid"), - NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), - XSDDatatype.XSDinteger))); - case 4: - // Invalid to use Blank Node as Predicate - return new QuadWritable(new Quad(Quad.defaultGraphNodeGenerated, NodeFactory.createURI("http://subjects/" + i), - NodeFactory.createAnon(), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - case 5: - // Invalid to use Literal as Predicate - return new QuadWritable(new Quad(Quad.defaultGraphNodeGenerated, NodeFactory.createURI("http://subjects/" + i), - NodeFactory.createLiteral("invalid"), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - case 6: - // Invalid to use Variable as Predicate - return new QuadWritable( - new Quad(Quad.defaultGraphNodeGenerated, NodeFactory.createURI("http://subjects/" + i), - NodeFactory.createVariable("invalid"), NodeFactory.createLiteral(Integer.toString(i), - XSDDatatype.XSDinteger))); - default: - // Invalid to use Variable as Object - return new QuadWritable(new Quad(Quad.defaultGraphNodeGenerated, NodeFactory.createURI("http://subjects/" + i), - NodeFactory.createURI("http://predicate"), NodeFactory.createVariable("invalid"))); - } - } -}
http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/AbstractTripleValidityFilterTests.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/AbstractTripleValidityFilterTests.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/AbstractTripleValidityFilterTests.java deleted file mode 100644 index 3c41710..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/AbstractTripleValidityFilterTests.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.mapreduce.filter; - -import org.apache.jena.hadoop.rdf.types.TripleWritable; - -import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; -import com.hp.hpl.jena.graph.NodeFactory; -import com.hp.hpl.jena.graph.Triple; - -/** - * Abstract tests for triple filter mappers that check triple validity - * - * - * - */ -public abstract class AbstractTripleValidityFilterTests extends AbstractNodeTupleFilterTests<Triple, TripleWritable> { - - @Override - protected TripleWritable createValidValue(int i) { - return new TripleWritable( - new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - } - - @Override - protected TripleWritable createInvalidValue(int i) { - switch (i % 6) { - case 0: - // Invalid to use Literal as Subject - return new TripleWritable(new Triple(NodeFactory.createLiteral("invalid"), NodeFactory.createURI("http://predicate"), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - case 1: - // Invalid to use Variable as Subject - return new TripleWritable(new Triple(NodeFactory.createVariable("invalid"), - NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), - XSDDatatype.XSDinteger))); - case 2: - // Invalid to use Blank Node as Predicate - return new TripleWritable(new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createAnon(), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - case 3: - // Invalid to use Literal as Predicate - return new TripleWritable(new Triple(NodeFactory.createURI("http://subjects/" + i), - NodeFactory.createLiteral("invalid"), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - case 4: - // Invalid to use Variable as Predicate - return new TripleWritable( - new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createVariable("invalid"), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - default: - // Invalid to use Variable as Object - return new TripleWritable(new Triple(NodeFactory.createURI("http://subjects/" + i), - NodeFactory.createURI("http://predicate"), NodeFactory.createVariable("invalid"))); - } - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleFilterByNoPredicateMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleFilterByNoPredicateMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleFilterByNoPredicateMapperTest.java deleted file mode 100644 index 4c9fb5a..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleFilterByNoPredicateMapperTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.mapreduce.filter; - -import org.apache.jena.hadoop.rdf.mapreduce.filter.positional.TripleFilterByPredicateUriMapper; - -/** - * Tests for the {@link TripleFilterByPredicateUriMapper} where there are no - * predicates and thus all data must be invalid - * - * - * - */ -public class TripleFilterByNoPredicateMapperTest extends TripleFilterByPredicateMapperTest { - - private static final String[] EMPTY_PREDICATE_POOL = new String[0]; - - /** - * Gets the pool of predicates considered valid - * - * @return Predicate pool - */ - @Override - protected String[] getPredicatePool() { - return EMPTY_PREDICATE_POOL; - } - - @Override - protected boolean noValidInputs() { - return true; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleFilterByPredicateMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleFilterByPredicateMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleFilterByPredicateMapperTest.java deleted file mode 100644 index add363e..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleFilterByPredicateMapperTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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.mapreduce.filter; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.hadoop.mrunit.mapreduce.MapDriver; -import org.apache.jena.hadoop.rdf.mapreduce.RdfMapReduceConstants; -import org.apache.jena.hadoop.rdf.mapreduce.filter.positional.TripleFilterByPredicateUriMapper; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - -import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; -import com.hp.hpl.jena.graph.NodeFactory; -import com.hp.hpl.jena.graph.Triple; -import com.hp.hpl.jena.vocabulary.RDF; -import com.hp.hpl.jena.vocabulary.RDFS; - -/** - * Tests for the {@link TripleFilterByPredicateUriMapper} - * - * - * - */ -public class TripleFilterByPredicateMapperTest extends AbstractNodeTupleFilterTests<Triple, TripleWritable> { - - private static final String[] DEFAULT_PREDICATE_POOL = new String[] { RDF.type.getURI(), RDFS.range.getURI(), - RDFS.domain.getURI() }; - - @Override - protected Mapper<LongWritable, TripleWritable, LongWritable, TripleWritable> getInstance() { - return new TripleFilterByPredicateUriMapper<LongWritable>(); - } - - @Override - protected void configureDriver(MapDriver<LongWritable, TripleWritable, LongWritable, TripleWritable> driver) { - super.configureDriver(driver); - driver.getContext().getConfiguration().setStrings(RdfMapReduceConstants.FILTER_PREDICATE_URIS, this.getPredicatePool()); - } - - /** - * Gets the pool of predicates considered valid - * - * @return Predicate pool - */ - protected String[] getPredicatePool() { - return DEFAULT_PREDICATE_POOL; - } - - @Override - protected TripleWritable createInvalidValue(int i) { - return new TripleWritable( - new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - } - - @Override - protected TripleWritable createValidValue(int i) { - String[] predicates = this.getPredicatePool(); - if (predicates.length == 0) return this.createInvalidValue(i); - return new TripleWritable(new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI(predicates[i - % predicates.length]), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleInvertedFilterByNoPredicateMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleInvertedFilterByNoPredicateMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleInvertedFilterByNoPredicateMapperTest.java deleted file mode 100644 index fb7dd25..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleInvertedFilterByNoPredicateMapperTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.mapreduce.filter; - -import org.apache.jena.hadoop.rdf.mapreduce.filter.positional.TripleFilterByPredicateUriMapper; - -/** - * Tests for the {@link TripleFilterByPredicateUriMapper} where there are no - * predicates and thus all data must be invalid - * - * - * - */ -public class TripleInvertedFilterByNoPredicateMapperTest extends TripleInvertedFilterByPredicateMapperTest { - - private static final String[] EMPTY_PREDICATE_POOL = new String[0]; - - /** - * Gets the pool of predicates considered valid - * - * @return Predicate pool - */ - @Override - protected String[] getPredicatePool() { - return EMPTY_PREDICATE_POOL; - } - - @Override - protected boolean noValidInputs() { - return true; - } - - @Override - protected boolean isInverted() { - return true; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleInvertedFilterByPredicateMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleInvertedFilterByPredicateMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleInvertedFilterByPredicateMapperTest.java deleted file mode 100644 index b24e9c2..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/TripleInvertedFilterByPredicateMapperTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.mapreduce.filter; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.hadoop.mrunit.mapreduce.MapDriver; -import org.apache.jena.hadoop.rdf.mapreduce.RdfMapReduceConstants; -import org.apache.jena.hadoop.rdf.mapreduce.filter.positional.TripleFilterByPredicateUriMapper; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - -import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; -import com.hp.hpl.jena.graph.NodeFactory; -import com.hp.hpl.jena.graph.Triple; -import com.hp.hpl.jena.vocabulary.RDF; -import com.hp.hpl.jena.vocabulary.RDFS; - -/** - * Tests for the {@link TripleFilterByPredicateUriMapper} - * - * - * - */ -public class TripleInvertedFilterByPredicateMapperTest extends AbstractNodeTupleFilterTests<Triple, TripleWritable> { - - private static final String[] DEFAULT_PREDICATE_POOL = new String[] { RDF.type.getURI(), RDFS.range.getURI(), - RDFS.domain.getURI() }; - - @Override - protected Mapper<LongWritable, TripleWritable, LongWritable, TripleWritable> getInstance() { - return new TripleFilterByPredicateUriMapper<LongWritable>(); - } - - @Override - protected void configureDriver(MapDriver<LongWritable, TripleWritable, LongWritable, TripleWritable> driver) { - super.configureDriver(driver); - driver.getContext().getConfiguration().setStrings(RdfMapReduceConstants.FILTER_PREDICATE_URIS, this.getPredicatePool()); - driver.getContext().getConfiguration().setBoolean(RdfMapReduceConstants.FILTER_INVERT, true); - } - - @Override - protected boolean isInverted() { - return true; - } - - /** - * Gets the pool of predicates considered valid - * - * @return Predicate pool - */ - protected String[] getPredicatePool() { - return DEFAULT_PREDICATE_POOL; - } - - @Override - protected TripleWritable createInvalidValue(int i) { - return new TripleWritable( - new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - } - - @Override - protected TripleWritable createValidValue(int i) { - String[] predicates = this.getPredicatePool(); - if (predicates.length == 0) - return this.createInvalidValue(i); - return new TripleWritable(new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI(predicates[i - % predicates.length]), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/ValidQuadFilterMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/ValidQuadFilterMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/ValidQuadFilterMapperTest.java deleted file mode 100644 index 33b4bd1..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/ValidQuadFilterMapperTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.mapreduce.filter; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.mapreduce.filter.ValidQuadFilterMapper; -import org.apache.jena.hadoop.rdf.types.QuadWritable; - - -/** - * Tests for the {@link ValidQuadFilterMapper} - * - * - * - */ -public class ValidQuadFilterMapperTest extends AbstractQuadValidityFilterTests { - - @Override - protected Mapper<LongWritable, QuadWritable, LongWritable, QuadWritable> getInstance() { - return new ValidQuadFilterMapper<LongWritable>(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/ValidTripleFilterMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/ValidTripleFilterMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/ValidTripleFilterMapperTest.java deleted file mode 100644 index 9de6395..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/filter/ValidTripleFilterMapperTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.mapreduce.filter; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.mapreduce.filter.ValidTripleFilterMapper; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - - -/** - * Tests for the {@link ValidTripleFilterMapper} - * - * - * - */ -public class ValidTripleFilterMapperTest extends AbstractTripleValidityFilterTests { - - @Override - protected Mapper<LongWritable, TripleWritable, LongWritable, TripleWritable> getInstance() { - return new ValidTripleFilterMapper<LongWritable>(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/AbstractNodeTupleGroupingTests.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/AbstractNodeTupleGroupingTests.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/AbstractNodeTupleGroupingTests.java deleted file mode 100644 index 1e362d1..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/AbstractNodeTupleGroupingTests.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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.mapreduce.group; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mrunit.mapreduce.MapDriver; -import org.apache.jena.hadoop.rdf.mapreduce.AbstractMapperTests; -import org.apache.jena.hadoop.rdf.mapreduce.split.AbstractNodeTupleSplitToNodesMapper; -import org.apache.jena.hadoop.rdf.types.AbstractNodeTupleWritable; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.junit.Test; - - -/** - * Abstract tests for {@link AbstractNodeTupleSplitToNodesMapper} - * implementations - * - * - * - * @param <TValue> - * Tuple type - * @param <T> - * Writable tuple type - */ -public abstract class AbstractNodeTupleGroupingTests<TValue, T extends AbstractNodeTupleWritable<TValue>> extends - AbstractMapperTests<LongWritable, T, NodeWritable, T> { - - /** - * Generates data for use in tests - * - * @param driver - * Driver - * @param num - * Number of tuples to generate - */ - protected void generateData(MapDriver<LongWritable, T, NodeWritable, T> driver, int num) { - for (int i = 0; i < num; i++) { - LongWritable inputKey = new LongWritable(i); - T value = this.createValue(i); - NodeWritable outputKey = this.getOutputKey(value); - - driver.addInput(inputKey, value); - driver.addOutput(outputKey, value); - } - } - - protected abstract T createValue(int i); - - protected abstract NodeWritable getOutputKey(T tuple); - - protected final void testGrouping(int num) throws IOException { - MapDriver<LongWritable, T, NodeWritable, T> driver = this.getMapDriver(); - this.generateData(driver, num); - driver.runTest(); - } - - /** - * Test grouping tuples by nodes - * - * @throws IOException - */ - @Test - public final void grouping_01() throws IOException { - this.testGrouping(1); - } - - /** - * Test grouping tuples by nodes - * - * @throws IOException - */ - @Test - public final void grouping_02() throws IOException { - this.testGrouping(100); - } - - /** - * Test grouping tuples by nodes - * - * @throws IOException - */ - @Test - public final void grouping_03() throws IOException { - this.testGrouping(1000); - } - - /** - * Test grouping tuples by nodes - * - * @throws IOException - */ - @Test - public final void grouping_04() throws IOException { - this.testGrouping(2500); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/AbstractQuadGroupingTests.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/AbstractQuadGroupingTests.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/AbstractQuadGroupingTests.java deleted file mode 100644 index 562512f..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/AbstractQuadGroupingTests.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.mapreduce.group; - -import org.apache.jena.hadoop.rdf.mapreduce.group.AbstractQuadGroupingMapper; -import org.apache.jena.hadoop.rdf.types.QuadWritable; - -import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; -import com.hp.hpl.jena.graph.NodeFactory; -import com.hp.hpl.jena.graph.Triple; -import com.hp.hpl.jena.sparql.core.Quad; - -/** - * Abstract tests for {@link AbstractQuadGroupingMapper} implementations - * - * - * - */ -public abstract class AbstractQuadGroupingTests extends AbstractNodeTupleGroupingTests<Quad, QuadWritable> { - - @Override - protected QuadWritable createValue(int i) { - return new QuadWritable(new Quad(Quad.defaultGraphNodeGenerated, new Triple( - NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger)))); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/AbstractTripleGroupingTests.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/AbstractTripleGroupingTests.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/AbstractTripleGroupingTests.java deleted file mode 100644 index 8e3d33c..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/AbstractTripleGroupingTests.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.mapreduce.group; - -import org.apache.jena.hadoop.rdf.mapreduce.group.AbstractTripleGroupingMapper; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - -import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; -import com.hp.hpl.jena.graph.NodeFactory; -import com.hp.hpl.jena.graph.Triple; - -/** - * Abstract tests for {@link AbstractTripleGroupingMapper} implementations - * - * - */ -public abstract class AbstractTripleGroupingTests extends AbstractNodeTupleGroupingTests<Triple, TripleWritable> { - - @Override - protected TripleWritable createValue(int i) { - return new TripleWritable( - new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupByGraphMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupByGraphMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupByGraphMapperTest.java deleted file mode 100644 index 370f820..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupByGraphMapperTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.mapreduce.group; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.mapreduce.group.QuadGroupByGraphMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.QuadWritable; - - -/** - * Tests for the {@link QuadGroupByGraphMapper} - * - * - * - */ -public class QuadGroupByGraphMapperTest extends AbstractQuadGroupingTests { - - @Override - protected NodeWritable getOutputKey(QuadWritable tuple) { - return new NodeWritable(tuple.get().getGraph()); - } - - @Override - protected Mapper<LongWritable, QuadWritable, NodeWritable, QuadWritable> getInstance() { - return new QuadGroupByGraphMapper<LongWritable>(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupByObjectMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupByObjectMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupByObjectMapperTest.java deleted file mode 100644 index 919696d..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupByObjectMapperTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.mapreduce.group; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.mapreduce.group.QuadGroupByObjectMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.QuadWritable; - - -/** - * Tests for the {@link QuadGroupByObjectMapper} - * - * - * - */ -public class QuadGroupByObjectMapperTest extends AbstractQuadGroupingTests { - - @Override - protected NodeWritable getOutputKey(QuadWritable tuple) { - return new NodeWritable(tuple.get().getObject()); - } - - @Override - protected Mapper<LongWritable, QuadWritable, NodeWritable, QuadWritable> getInstance() { - return new QuadGroupByObjectMapper<LongWritable>(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupByPredicateMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupByPredicateMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupByPredicateMapperTest.java deleted file mode 100644 index 2a1b520..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupByPredicateMapperTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.mapreduce.group; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.mapreduce.group.QuadGroupByPredicateMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.QuadWritable; - - -/** - * Tests for the {@link QuadGroupByPredicateMapper} - * - * - * - */ -public class QuadGroupByPredicateMapperTest extends AbstractQuadGroupingTests { - - @Override - protected NodeWritable getOutputKey(QuadWritable tuple) { - return new NodeWritable(tuple.get().getPredicate()); - } - - @Override - protected Mapper<LongWritable, QuadWritable, NodeWritable, QuadWritable> getInstance() { - return new QuadGroupByPredicateMapper<LongWritable>(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupBySubjectMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupBySubjectMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupBySubjectMapperTest.java deleted file mode 100644 index 3b0bb1a..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/QuadGroupBySubjectMapperTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.mapreduce.group; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.mapreduce.group.QuadGroupBySubjectMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.QuadWritable; - - -/** - * Tests for the {@link QuadGroupBySubjectMapper} - * - * - * - */ -public class QuadGroupBySubjectMapperTest extends AbstractQuadGroupingTests { - - @Override - protected NodeWritable getOutputKey(QuadWritable tuple) { - return new NodeWritable(tuple.get().getSubject()); - } - - @Override - protected Mapper<LongWritable, QuadWritable, NodeWritable, QuadWritable> getInstance() { - return new QuadGroupBySubjectMapper<LongWritable>(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/TripleGroupByObjectMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/TripleGroupByObjectMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/TripleGroupByObjectMapperTest.java deleted file mode 100644 index c769bb4..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/TripleGroupByObjectMapperTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.mapreduce.group; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.mapreduce.group.TripleGroupByObjectMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - - -/** - * Tests for the {@link TripleGroupByObjectMapper} - * - * - * - */ -public class TripleGroupByObjectMapperTest extends AbstractTripleGroupingTests { - - @Override - protected NodeWritable getOutputKey(TripleWritable tuple) { - return new NodeWritable(tuple.get().getObject()); - } - - @Override - protected Mapper<LongWritable, TripleWritable, NodeWritable, TripleWritable> getInstance() { - return new TripleGroupByObjectMapper<LongWritable>(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/TripleGroupByPredicateMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/TripleGroupByPredicateMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/TripleGroupByPredicateMapperTest.java deleted file mode 100644 index e41cf50..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/TripleGroupByPredicateMapperTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.mapreduce.group; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.mapreduce.group.TripleGroupByPredicateMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - - -/** - * Tests for the {@link TripleGroupByPredicateMapper} - * - * - * - */ -public class TripleGroupByPredicateMapperTest extends AbstractTripleGroupingTests { - - @Override - protected NodeWritable getOutputKey(TripleWritable tuple) { - return new NodeWritable(tuple.get().getPredicate()); - } - - @Override - protected Mapper<LongWritable, TripleWritable, NodeWritable, TripleWritable> getInstance() { - return new TripleGroupByPredicateMapper<LongWritable>(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/TripleGroupBySubjectMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/TripleGroupBySubjectMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/TripleGroupBySubjectMapperTest.java deleted file mode 100644 index 64335f4..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/group/TripleGroupBySubjectMapperTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.mapreduce.group; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.mapreduce.group.TripleGroupBySubjectMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - - -/** - * Tests for the {@link TripleGroupBySubjectMapper} - * - * - * - */ -public class TripleGroupBySubjectMapperTest extends AbstractTripleGroupingTests { - - @Override - protected NodeWritable getOutputKey(TripleWritable tuple) { - return new NodeWritable(tuple.get().getSubject()); - } - - @Override - protected Mapper<LongWritable, TripleWritable, NodeWritable, TripleWritable> getInstance() { - return new TripleGroupBySubjectMapper<LongWritable>(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractNodeTupleSplitToNodesTests.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractNodeTupleSplitToNodesTests.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractNodeTupleSplitToNodesTests.java deleted file mode 100644 index 1de39cd..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractNodeTupleSplitToNodesTests.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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.mapreduce.split; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mrunit.mapreduce.MapDriver; -import org.apache.jena.hadoop.rdf.mapreduce.AbstractMapperTests; -import org.apache.jena.hadoop.rdf.mapreduce.split.AbstractNodeTupleSplitToNodesMapper; -import org.apache.jena.hadoop.rdf.types.AbstractNodeTupleWritable; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.junit.Test; - - -/** - * Abstract tests for {@link AbstractNodeTupleSplitToNodesMapper} - * implementations - * - * - * - * @param <TValue> - * Tuple type - * @param <T> - * Writable tuple type - */ -public abstract class AbstractNodeTupleSplitToNodesTests<TValue, T extends AbstractNodeTupleWritable<TValue>> extends - AbstractMapperTests<LongWritable, T, LongWritable, NodeWritable> { - - /** - * Generates data for use in tests - * - * @param driver - * Driver - * @param num - * Number of tuples to generate - */ - protected void generateData(MapDriver<LongWritable, T, LongWritable, NodeWritable> driver, int num) { - for (int i = 0; i < num; i++) { - LongWritable key = new LongWritable(i); - T value = this.createValue(i); - NodeWritable[] nodes = this.getNodes(value); - - driver.addInput(key, value); - for (NodeWritable n : nodes) { - driver.addOutput(key, n); - } - } - } - - protected abstract T createValue(int i); - - protected abstract NodeWritable[] getNodes(T tuple); - - protected final void testSplitToNodes(int num) throws IOException { - MapDriver<LongWritable, T, LongWritable, NodeWritable> driver = this.getMapDriver(); - this.generateData(driver, num); - driver.runTest(); - } - - /** - * Test splitting tuples into their constituent nodes - * - * @throws IOException - */ - @Test - public final void split_to_nodes_01() throws IOException { - this.testSplitToNodes(1); - } - - /** - * Test splitting tuples into their constituent nodes - * - * @throws IOException - */ - @Test - public final void split_to_nodes_02() throws IOException { - this.testSplitToNodes(100); - } - - /** - * Test splitting tuples into their constituent nodes - * - * @throws IOException - */ - @Test - public final void split_to_nodes_03() throws IOException { - this.testSplitToNodes(1000); - } - - /** - * Test splitting tuples into their constituent nodes - * - * @throws IOException - */ - @Test - public final void split_to_nodes_04() throws IOException { - this.testSplitToNodes(2500); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractNodeTupleSplitWithNodesTests.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractNodeTupleSplitWithNodesTests.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractNodeTupleSplitWithNodesTests.java deleted file mode 100644 index 71136c2..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractNodeTupleSplitWithNodesTests.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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.mapreduce.split; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mrunit.mapreduce.MapDriver; -import org.apache.jena.hadoop.rdf.mapreduce.AbstractMapperTests; -import org.apache.jena.hadoop.rdf.mapreduce.split.AbstractNodeTupleSplitWithNodesMapper; -import org.apache.jena.hadoop.rdf.types.AbstractNodeTupleWritable; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.junit.Test; - - -/** - * Abstract tests for {@link AbstractNodeTupleSplitWithNodesMapper} - * implementations - * - * - * - * @param <TValue> - * Tuple type - * @param <T> - * Writable tuple type - */ -public abstract class AbstractNodeTupleSplitWithNodesTests<TValue, T extends AbstractNodeTupleWritable<TValue>> extends - AbstractMapperTests<LongWritable, T, T, NodeWritable> { - - /** - * Generates data for use in tests - * - * @param driver - * Driver - * @param num - * Number of tuples to generate - */ - protected void generateData(MapDriver<LongWritable, T, T, NodeWritable> driver, int num) { - for (int i = 0; i < num; i++) { - LongWritable key = new LongWritable(i); - T value = this.createValue(i); - NodeWritable[] nodes = this.getNodes(value); - - driver.addInput(key, value); - for (NodeWritable n : nodes) { - driver.addOutput(value, n); - } - } - } - - protected abstract T createValue(int i); - - protected abstract NodeWritable[] getNodes(T tuple); - - protected final void testSplitToNodes(int num) throws IOException { - MapDriver<LongWritable, T, T, NodeWritable> driver = this.getMapDriver(); - this.generateData(driver, num); - driver.runTest(); - } - - /** - * Test splitting tuples into their constituent nodes - * - * @throws IOException - */ - @Test - public final void split_to_nodes_01() throws IOException { - this.testSplitToNodes(1); - } - - /** - * Test splitting tuples into their constituent nodes - * - * @throws IOException - */ - @Test - public final void split_to_nodes_02() throws IOException { - this.testSplitToNodes(100); - } - - /** - * Test splitting tuples into their constituent nodes - * - * @throws IOException - */ - @Test - public final void split_to_nodes_03() throws IOException { - this.testSplitToNodes(1000); - } - - /** - * Test splitting tuples into their constituent nodes - * - * @throws IOException - */ - @Test - public final void split_to_nodes_04() throws IOException { - this.testSplitToNodes(2500); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractQuadSplitToNodesTests.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractQuadSplitToNodesTests.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractQuadSplitToNodesTests.java deleted file mode 100644 index 07192c6..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractQuadSplitToNodesTests.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.mapreduce.split; - -import org.apache.jena.hadoop.rdf.mapreduce.split.AbstractNodeTupleSplitToNodesMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.QuadWritable; - -import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; -import com.hp.hpl.jena.graph.NodeFactory; -import com.hp.hpl.jena.graph.Triple; -import com.hp.hpl.jena.sparql.core.Quad; - -/** - * Abstract tests for {@link AbstractNodeTupleSplitToNodesMapper} - * implementations that work on Quads - * - * - * - */ -public abstract class AbstractQuadSplitToNodesTests extends AbstractNodeTupleSplitToNodesTests<Quad, QuadWritable> { - - @Override - protected QuadWritable createValue(int i) { - return new QuadWritable(new Quad(Quad.defaultGraphNodeGenerated, new Triple( - NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger)))); - } - - @Override - protected NodeWritable[] getNodes(QuadWritable tuple) { - Quad q = tuple.get(); - return new NodeWritable[] { new NodeWritable(q.getGraph()), new NodeWritable(q.getSubject()), - new NodeWritable(q.getPredicate()), new NodeWritable(q.getObject()) }; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractQuadSplitWithNodesTests.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractQuadSplitWithNodesTests.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractQuadSplitWithNodesTests.java deleted file mode 100644 index 80517b2..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractQuadSplitWithNodesTests.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.mapreduce.split; - -import org.apache.jena.hadoop.rdf.mapreduce.split.AbstractNodeTupleSplitToNodesMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.QuadWritable; - -import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; -import com.hp.hpl.jena.graph.NodeFactory; -import com.hp.hpl.jena.graph.Triple; -import com.hp.hpl.jena.sparql.core.Quad; - -/** - * Abstract tests for {@link AbstractNodeTupleSplitToNodesMapper} - * implementations that work on Quads - * - * - * - */ -public abstract class AbstractQuadSplitWithNodesTests extends AbstractNodeTupleSplitWithNodesTests<Quad, QuadWritable> { - - @Override - protected QuadWritable createValue(int i) { - return new QuadWritable(new Quad(Quad.defaultGraphNodeGenerated, new Triple( - NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger)))); - } - - @Override - protected NodeWritable[] getNodes(QuadWritable tuple) { - Quad q = tuple.get(); - return new NodeWritable[] { new NodeWritable(q.getGraph()), new NodeWritable(q.getSubject()), - new NodeWritable(q.getPredicate()), new NodeWritable(q.getObject()) }; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractTripleSplitToNodesTests.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractTripleSplitToNodesTests.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractTripleSplitToNodesTests.java deleted file mode 100644 index 7e497ab..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractTripleSplitToNodesTests.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.mapreduce.split; - -import org.apache.jena.hadoop.rdf.mapreduce.split.AbstractNodeTupleSplitToNodesMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - -import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; -import com.hp.hpl.jena.graph.NodeFactory; -import com.hp.hpl.jena.graph.Triple; - -/** - * Abstract tests for {@link AbstractNodeTupleSplitToNodesMapper} - * implementations that work on Triples - * - * - * - */ -public abstract class AbstractTripleSplitToNodesTests extends AbstractNodeTupleSplitToNodesTests<Triple, TripleWritable> { - - @Override - protected TripleWritable createValue(int i) { - return new TripleWritable( - new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - } - - @Override - protected NodeWritable[] getNodes(TripleWritable tuple) { - Triple t = tuple.get(); - return new NodeWritable[] { new NodeWritable(t.getSubject()), new NodeWritable(t.getPredicate()), - new NodeWritable(t.getObject()) }; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractTripleSplitWithNodesTests.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractTripleSplitWithNodesTests.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractTripleSplitWithNodesTests.java deleted file mode 100644 index babcad1..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/AbstractTripleSplitWithNodesTests.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.mapreduce.split; - -import org.apache.jena.hadoop.rdf.mapreduce.split.AbstractNodeTupleSplitToNodesMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - -import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; -import com.hp.hpl.jena.graph.NodeFactory; -import com.hp.hpl.jena.graph.Triple; - -/** - * Abstract tests for {@link AbstractNodeTupleSplitToNodesMapper} - * implementations that work on Triples - * - * - * - */ -public abstract class AbstractTripleSplitWithNodesTests extends AbstractNodeTupleSplitWithNodesTests<Triple, TripleWritable> { - - @Override - protected TripleWritable createValue(int i) { - return new TripleWritable( - new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); - } - - @Override - protected NodeWritable[] getNodes(TripleWritable tuple) { - Triple t = tuple.get(); - return new NodeWritable[] { new NodeWritable(t.getSubject()), new NodeWritable(t.getPredicate()), - new NodeWritable(t.getObject()) }; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/QuadSplitToNodesMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/QuadSplitToNodesMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/QuadSplitToNodesMapperTest.java deleted file mode 100644 index 61058c6..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/QuadSplitToNodesMapperTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.mapreduce.split; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.mapreduce.split.QuadSplitToNodesMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.QuadWritable; - - -/** - * Tests for the {@link QuadSplitToNodesMapper} - * - * - * - */ -public class QuadSplitToNodesMapperTest extends AbstractQuadSplitToNodesTests { - - @Override - protected Mapper<LongWritable, QuadWritable, LongWritable, NodeWritable> getInstance() { - return new QuadSplitToNodesMapper<LongWritable>(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/QuadSplitWithNodesMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/QuadSplitWithNodesMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/QuadSplitWithNodesMapperTest.java deleted file mode 100644 index a171ffb..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/QuadSplitWithNodesMapperTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.mapreduce.split; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.mapreduce.split.QuadSplitWithNodesMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.QuadWritable; - - -/** - * Tests for the {@link QuadSplitWithNodesMapper} - * - * - * - */ -public class QuadSplitWithNodesMapperTest extends AbstractQuadSplitWithNodesTests { - - @Override - protected Mapper<LongWritable, QuadWritable, QuadWritable, NodeWritable> getInstance() { - return new QuadSplitWithNodesMapper<LongWritable>(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/TripleSplitToNodesMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/TripleSplitToNodesMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/TripleSplitToNodesMapperTest.java deleted file mode 100644 index d91efca..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/TripleSplitToNodesMapperTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.mapreduce.split; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.mapreduce.split.TripleSplitToNodesMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - - -/** - * Tests for the {@link TripleSplitToNodesMapper} - * - * - * - */ -public class TripleSplitToNodesMapperTest extends AbstractTripleSplitToNodesTests { - - @Override - protected Mapper<LongWritable, TripleWritable, LongWritable, NodeWritable> getInstance() { - return new TripleSplitToNodesMapper<LongWritable>(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/TripleSplitWithNodesMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/TripleSplitWithNodesMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/TripleSplitWithNodesMapperTest.java deleted file mode 100644 index 3b71f40..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/split/TripleSplitWithNodesMapperTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.mapreduce.split; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.mapreduce.split.TripleSplitToNodesMapper; -import org.apache.jena.hadoop.rdf.mapreduce.split.TripleSplitWithNodesMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - - -/** - * Tests for the {@link TripleSplitToNodesMapper} - * - * - * - */ -public class TripleSplitWithNodesMapperTest extends AbstractTripleSplitWithNodesTests { - - @Override - protected Mapper<LongWritable, TripleWritable, TripleWritable, NodeWritable> getInstance() { - return new TripleSplitWithNodesMapper<LongWritable>(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/92fb810a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/transform/QuadsToTriplesMapperTest.java ---------------------------------------------------------------------- diff --git a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/transform/QuadsToTriplesMapperTest.java b/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/transform/QuadsToTriplesMapperTest.java deleted file mode 100644 index 51b29cb..0000000 --- a/hadoop-rdf/hadoop-rdf-mapreduce/src/test/java/org/apache/jena/hadoop/rdf/mapreduce/transform/QuadsToTriplesMapperTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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.mapreduce.transform; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.hadoop.mrunit.mapreduce.MapDriver; -import org.apache.hadoop.mrunit.types.Pair; -import org.apache.jena.hadoop.rdf.mapreduce.AbstractMapperTests; -import org.apache.jena.hadoop.rdf.mapreduce.transform.QuadsToTriplesMapper; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.junit.Test; - -import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; -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 {@link QuadsToTriplesMapper} - * - * - * - */ -public class QuadsToTriplesMapperTest extends AbstractMapperTests<LongWritable, QuadWritable, LongWritable, TripleWritable> { - - @Override - protected Mapper<LongWritable, QuadWritable, LongWritable, TripleWritable> getInstance() { - return new QuadsToTriplesMapper<LongWritable>(); - } - - protected void generateData(MapDriver<LongWritable, QuadWritable, LongWritable, TripleWritable> driver, int num) { - for (int i = 0; i < num; i++) { - Triple t = new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), - NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger)); - Quad q = new Quad(Quad.defaultGraphNodeGenerated, t); - driver.addInput(new LongWritable(i), new QuadWritable(q)); - driver.addOutput(new LongWritable(i), new TripleWritable(t)); - } - } - - /** - * Tests quads to triples conversion - * - * @throws IOException - */ - @Test - public void quads_to_triples_mapper_01() throws IOException { - MapDriver<LongWritable, QuadWritable, LongWritable, TripleWritable> driver = this.getMapDriver(); - - Triple t = new Triple(NodeFactory.createURI("http://s"), NodeFactory.createURI("http://p"), - NodeFactory.createLiteral("test")); - Quad q = new Quad(Quad.defaultGraphNodeGenerated, t); - driver.withInput(new Pair<LongWritable, QuadWritable>(new LongWritable(1), new QuadWritable(q))).withOutput( - new Pair<LongWritable, TripleWritable>(new LongWritable(1), new TripleWritable(t))); - driver.runTest(); - } - - /** - * Tests quads to triples conversion - * - * @throws IOException - */ - @Test - public void quads_to_triples_mapper_02() throws IOException { - MapDriver<LongWritable, QuadWritable, LongWritable, TripleWritable> driver = this.getMapDriver(); - this.generateData(driver, 100); - driver.runTest(); - } - - /** - * Tests quads to triples conversion - * - * @throws IOException - */ - @Test - public void quads_to_triples_mapper_03() throws IOException { - MapDriver<LongWritable, QuadWritable, LongWritable, TripleWritable> driver = this.getMapDriver(); - this.generateData(driver, 1000); - driver.runTest(); - } - - /** - * Tests quads to triples conversion - * - * @throws IOException - */ - @Test - public void quads_to_triples_mapper_04() throws IOException { - MapDriver<LongWritable, QuadWritable, LongWritable, TripleWritable> driver = this.getMapDriver(); - this.generateData(driver, 10000); - driver.runTest(); - } -}