Removed FileGraph tests as FileGraph was deleted. Fixed contract tests
Project: http://git-wip-us.apache.org/repos/asf/jena/repo Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/335a7617 Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/335a7617 Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/335a7617 Branch: refs/heads/add-contract-tests Commit: 335a7617cb73ccf97e3a42f3ae4e9afcc3dbd484 Parents: c004d80 Author: Claude Warren <[email protected]> Authored: Sun May 10 13:30:17 2015 +0100 Committer: Claude Warren <[email protected]> Committed: Sun May 10 13:30:17 2015 +0100 ---------------------------------------------------------------------- jena-core/pom.xml | 2 +- .../jena/assembler/test/TestAssemblerGroup.java | 8 +- .../apache/jena/graph/GraphContractTest.java | 9 ++- .../jena/graph/impl/FileGraphMaker_CS.java | 81 -------------------- .../impl/FileGraphTransactionHandler_CS.java | 56 -------------- .../apache/jena/graph/impl/FileGraph_CS.java | 79 ------------------- 6 files changed, 12 insertions(+), 223 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jena/blob/335a7617/jena-core/pom.xml ---------------------------------------------------------------------- diff --git a/jena-core/pom.xml b/jena-core/pom.xml index e18d331..d64e195 100644 --- a/jena-core/pom.xml +++ b/jena-core/pom.xml @@ -78,7 +78,7 @@ <dependency> <groupId>org.xenei</groupId> <artifactId>junit-contracts</artifactId> - <version>0.0.5</version> + <version>0.1.1</version> <scope>test</scope> </dependency> http://git-wip-us.apache.org/repos/asf/jena/blob/335a7617/jena-core/src/test/java/org/apache/jena/assembler/test/TestAssemblerGroup.java ---------------------------------------------------------------------- diff --git a/jena-core/src/test/java/org/apache/jena/assembler/test/TestAssemblerGroup.java b/jena-core/src/test/java/org/apache/jena/assembler/test/TestAssemblerGroup.java index f424993..8b38e5a 100644 --- a/jena-core/src/test/java/org/apache/jena/assembler/test/TestAssemblerGroup.java +++ b/jena-core/src/test/java/org/apache/jena/assembler/test/TestAssemblerGroup.java @@ -18,9 +18,11 @@ package org.apache.jena.assembler.test; +import java.util.Map; + import org.apache.jena.assembler.* ; import org.apache.jena.assembler.assemblers.* ; -import org.apache.jena.assembler.assemblers.AssemblerGroup.ExpandingAssemblerGroup ; +import org.apache.jena.assembler.assemblers.AssemblerGroup.ExpandingAssemblerGroup; import org.apache.jena.assembler.exceptions.* ; import org.apache.jena.graph.Graph ; import org.apache.jena.mem.GraphMemBase ; @@ -66,7 +68,9 @@ public class TestAssemblerGroup extends AssemblerTestBase public static class Trivial { - static { loaded = true; } + static { + loaded = true; + } } public void testLoadsClasses() http://git-wip-us.apache.org/repos/asf/jena/blob/335a7617/jena-core/src/test/java/org/apache/jena/graph/GraphContractTest.java ---------------------------------------------------------------------- diff --git a/jena-core/src/test/java/org/apache/jena/graph/GraphContractTest.java b/jena-core/src/test/java/org/apache/jena/graph/GraphContractTest.java index 55ad955..589f095 100644 --- a/jena-core/src/test/java/org/apache/jena/graph/GraphContractTest.java +++ b/jena-core/src/test/java/org/apache/jena/graph/GraphContractTest.java @@ -25,6 +25,8 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.function.Function; + import org.junit.After; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,7 +54,6 @@ import org.apache.jena.testing_framework.ContractTemplate; import org.apache.jena.testing_framework.NodeCreateUtils; import org.apache.jena.util.iterator.ClosableIterator; import org.apache.jena.util.iterator.ExtendedIterator; -import org.apache.jena.util.iterator.Map1; import static org.apache.jena.testing_framework.GraphHelper.*; @@ -1452,10 +1453,10 @@ public class GraphContractTest<T extends Graph> extends // // used to find the object set from the returned set for literal testing - private static final Map1<Triple, Node> getObject = new Map1<Triple, Node>() { + private static final Function<Triple, Node> getObject = new Function<Triple, Node>() { @Override - public Node map1(Triple o) { - return o.getObject(); + public Node apply(Triple t) { + return t.getObject(); } }; http://git-wip-us.apache.org/repos/asf/jena/blob/335a7617/jena-core/src/test/java/org/apache/jena/graph/impl/FileGraphMaker_CS.java ---------------------------------------------------------------------- diff --git a/jena-core/src/test/java/org/apache/jena/graph/impl/FileGraphMaker_CS.java b/jena-core/src/test/java/org/apache/jena/graph/impl/FileGraphMaker_CS.java deleted file mode 100644 index 5f1d36d..0000000 --- a/jena-core/src/test/java/org/apache/jena/graph/impl/FileGraphMaker_CS.java +++ /dev/null @@ -1,81 +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.graph.impl; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.HashMap; -import java.util.Map; - -import org.junit.runner.RunWith; -import org.xenei.junit.contract.Contract; -import org.xenei.junit.contract.ContractImpl; -import org.xenei.junit.contract.ContractSuite; -import org.xenei.junit.contract.IProducer; - -@RunWith(ContractSuite.class) -@ContractImpl(FileGraphMaker.class) -public class FileGraphMaker_CS { - - protected IProducer<FileGraphMaker> graphProducer; - - public FileGraphMaker_CS() throws IOException { - graphProducer = new FileGraphMakerProducer(); - } - - @Contract.Inject - public final IProducer<FileGraphMaker> getCollectionTestProducer() { - return graphProducer; - } - - private static class FileGraphMakerProducer implements IProducer<FileGraphMaker> { - private Map<Path,FileGraphMaker> map; - - public FileGraphMakerProducer () throws IOException { - map = new HashMap<Path,FileGraphMaker>(); - } - - - @Override - public FileGraphMaker newInstance() { - Path p; - try { - p = Files.createTempDirectory("fgm_CS"); - } catch (IOException e) { - throw new RuntimeException( "Unable to create temp directory", e ); - } - FileGraphMaker fgm = new FileGraphMaker( p.toString(), true); - map.put(p, fgm); - return fgm; - } - - @Override - public void cleanUp() { - for (Path p : map.keySet()) - { - map.get(p).close(); - p.toFile().delete(); - } - map.clear(); - } - - }; - -} http://git-wip-us.apache.org/repos/asf/jena/blob/335a7617/jena-core/src/test/java/org/apache/jena/graph/impl/FileGraphTransactionHandler_CS.java ---------------------------------------------------------------------- diff --git a/jena-core/src/test/java/org/apache/jena/graph/impl/FileGraphTransactionHandler_CS.java b/jena-core/src/test/java/org/apache/jena/graph/impl/FileGraphTransactionHandler_CS.java deleted file mode 100644 index 5e0feb4..0000000 --- a/jena-core/src/test/java/org/apache/jena/graph/impl/FileGraphTransactionHandler_CS.java +++ /dev/null @@ -1,56 +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.graph.impl; - -import org.junit.runner.RunWith; -import org.xenei.junit.contract.Contract; -import org.xenei.junit.contract.ContractImpl; -import org.xenei.junit.contract.ContractSuite; -import org.xenei.junit.contract.IProducer; - -@RunWith(ContractSuite.class) -@ContractImpl(FileGraphTransactionHandler.class) -public class FileGraphTransactionHandler_CS { - - protected IProducer<FileGraphTransactionHandler> graphProducer; - - public FileGraphTransactionHandler_CS() { - graphProducer = new IProducer<FileGraphTransactionHandler>() { - - private FileGraph_CS.FileGraphProducer fgp = new FileGraph_CS.FileGraphProducer(); - - @Override - public FileGraphTransactionHandler newInstance() { - return new FileGraphTransactionHandler( fgp.newInstance() ); - } - - @Override - public void cleanUp() { - fgp.cleanUp(); - } - - }; - } - - @Contract.Inject - public final IProducer<FileGraphTransactionHandler> getCollectionTestProducer() { - return graphProducer; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/335a7617/jena-core/src/test/java/org/apache/jena/graph/impl/FileGraph_CS.java ---------------------------------------------------------------------- diff --git a/jena-core/src/test/java/org/apache/jena/graph/impl/FileGraph_CS.java b/jena-core/src/test/java/org/apache/jena/graph/impl/FileGraph_CS.java deleted file mode 100644 index 1b4d321..0000000 --- a/jena-core/src/test/java/org/apache/jena/graph/impl/FileGraph_CS.java +++ /dev/null @@ -1,79 +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.graph.impl; - -import static org.apache.jena.testing_framework.GraphHelper.memGraph; - -import java.io.File; -import java.io.IOException; -import org.apache.jena.graph.Graph ; -import org.apache.jena.testing_framework.AbstractGraphProducer; -import org.junit.runner.RunWith; -import org.xenei.junit.contract.Contract; -import org.xenei.junit.contract.ContractImpl; -import org.xenei.junit.contract.ContractSuite; -import org.xenei.junit.contract.IProducer; - -//@RunWith(ContractSuite.class) -//@ContractImpl(FileGraph.class) -public class FileGraph_CS { - - protected IProducer<FileGraph> graphProducer; - - public FileGraph_CS() { - graphProducer = new FileGraphProducer(); - } - - @Contract.Inject - public final IProducer<FileGraph> getCollectionTestProducer() { - return graphProducer; - } - - public static class FileGraphProducer extends AbstractGraphProducer<FileGraph> { - - @Override - protected FileGraph createNewGraph() { - File f; - try { - f = File.createTempFile("fgp", ".ttl" ); - f.delete(); - } catch (IOException e) { - throw new RuntimeException( "Can not create file", e ); - } - return new FileGraph( f, true, true ); - } - - @Override - public Graph[] getDependsOn(Graph d) { - return null; - } - - @Override - public Graph[] getNotDependsOn(Graph g) { - return new Graph[] { memGraph() }; - } - - @Override - protected void afterClose(Graph g) { - ((FileGraph)g).name.delete(); - } - - }; - -}
