You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2017/10/03 19:33:48 UTC
[02/65] [abbrv] jena git commit: JENA-1397: Rename java packages
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/Test_SPARQL_TDB.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/Test_SPARQL_TDB.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/Test_SPARQL_TDB.java
deleted file mode 100644
index 0acf7a6..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/Test_SPARQL_TDB.java
+++ /dev/null
@@ -1,222 +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.seaborne.tdb2.store;
-
-import static org.junit.Assert.*;
-import org.apache.jena.atlas.lib.StrUtils ;
-import org.apache.jena.graph.Graph ;
-import org.apache.jena.graph.NodeFactory ;
-import org.apache.jena.graph.Triple ;
-import org.apache.jena.query.* ;
-import org.apache.jena.rdf.model.Model ;
-import org.apache.jena.sparql.sse.SSE ;
-import org.apache.jena.update.* ;
-import org.junit.Test ;
-import org.seaborne.dboe.base.file.Location ;
-import org.seaborne.dboe.jenax.Txn ;
-import org.seaborne.tdb2.TDB2 ;
-import org.seaborne.tdb2.TDB2Factory ;
-
-/**
- * Test SPARQL
- */
-public class Test_SPARQL_TDB
-{
- private static Dataset create() {
- return TDB2Factory.createDataset() ;
- }
-
- private static Dataset create(Location location) {
- return TDB2Factory.connectDataset(location) ;
- }
-
- private static String graphName = "http://example/" ;
- private static Triple triple = SSE.parseTriple("(<x> <y> 123)") ;
-
- // Standalone graph.
- @Test public void sparql1()
- {
- // Test OpExecutor.execute(OpBGP) for a named graph used as a standalone model
- Dataset ds = create() ;
- add(ds, graphName, triple) ;
- Txn.executeRead(ds, ()->{
- Model m = ds.getNamedModel(graphName) ;
- String qs = "SELECT * { ?s ?p ?o . }" ;
- Query query = QueryFactory.create(qs) ;
- QueryExecution qexec = QueryExecutionFactory.create(query, m) ;
- ResultSet rs = qexec.execSelect() ;
- ResultSetFormatter.consume(rs) ;
- }) ;
- }
-
- // Standalone graph.
- @Test public void sparql2()
- {
- // Test OpExecutor.execute(OpFilter)for a named graph used as a standalone model
- Dataset ds = create() ;
- add(ds, graphName, triple) ;
-
- Txn.executeRead(ds, ()->{
- Model m = ds.getNamedModel(graphName) ;
- String qs = "SELECT * { ?s ?p ?o . FILTER ( ?o < 456 ) }" ;
- Query query = QueryFactory.create(qs) ;
- try(QueryExecution qexec = QueryExecutionFactory.create(query, m)) {
- ResultSet rs = qexec.execSelect() ;
- ResultSetFormatter.consume(rs) ;
- }
- }) ;
- }
-
- // Requires OpDatasetNames
- @Test public void sparql3()
- {
- Dataset dataset = create() ;
- // No triple added
- Txn.executeRead(dataset, ()->{
- Query query = QueryFactory.create("SELECT ?g { GRAPH ?g {} }") ;
- QueryExecution qExec = QueryExecutionFactory.create(query, dataset) ;
- ResultSet rs = qExec.execSelect() ;
- int n = ResultSetFormatter.consume(rs) ;
- assertEquals(0, n) ;
- }) ;
- }
-
- @Test public void sparql4()
- {
- Dataset dataset = create() ;
- add(dataset, graphName, triple) ;
- Txn.executeRead(dataset, ()->{
- Query query = QueryFactory.create("SELECT ?g { GRAPH ?g {} }") ;
- QueryExecution qExec = QueryExecutionFactory.create(query, dataset) ;
- ResultSet rs = qExec.execSelect() ;
- int n = ResultSetFormatter.consume(rs) ;
- assertEquals(1, n) ;
- }) ;
- }
-
- @Test public void sparql5()
- {
- Dataset dataset = create() ;
- add(dataset, graphName, triple);
- Txn.executeRead(dataset, ()->{
- Query query = QueryFactory.create("ASK { GRAPH <"+graphName+"> {} }") ;
- boolean b = QueryExecutionFactory.create(query, dataset).execAsk() ;
- assertEquals(true, b) ;
- }) ;
- }
-
- @Test public void sparql6()
- {
- Dataset dataset = create() ;
- add(dataset, graphName, triple);
- Txn.executeRead(dataset, ()->{
- Query query = QueryFactory.create("ASK { GRAPH <http://example/x> {} }") ;
- boolean b = QueryExecutionFactory.create(query, dataset).execAsk() ;
- assertEquals(false, b) ;
- }) ;
- }
-
- private static void add(Dataset dataset, String graphName, Triple triple) {
- Txn.executeWrite(dataset, ()->{
- Graph g2 = dataset.asDatasetGraph().getGraph(NodeFactory.createURI(graphName)) ;
- g2.add(triple) ;
- });
- }
-
- // Test transactions effective.
-
- @Test public void sparql_txn_1()
- {
- Dataset dataset = create() ;
- Txn.executeWrite(dataset, ()->{
- update(dataset, "INSERT DATA { <x:s> <x:p> <x:o> }") ;
- }) ;
- // Explicit trasnaction steps.
- dataset.begin(ReadWrite.READ) ;
- try {
- int n = count(dataset) ;
- assertEquals(1, n) ;
- n = count(dataset, "SELECT * { <x:s> <x:p> <x:o>}") ;
- assertEquals(1, n) ;
- } finally { dataset.end() ; }
- }
-
- @Test public void sparql_txn_2()
- {
- Dataset dataset1 = create(Location.mem("foo")) ;
- Dataset dataset2 = create(Location.mem("foo")) ;
-
- Txn.executeWrite(dataset1, ()->{
- update(dataset1, "INSERT DATA { <x:s> <x:p> <x:o> }") ;
- }) ;
-
- Txn.executeRead(dataset1, ()->{
- assertEquals(1, count(dataset1)) ;
- }) ;
-
- // Same location.
- Txn.executeRead(dataset2, ()->{
- assertEquals(1, count(dataset2)) ;
- }) ;
- }
-
- @Test public void sparql_update_unionGraph()
- {
- Dataset ds = TDB2Factory.createDataset() ;
- // Update concrete default graph
- Txn.executeWrite(ds, ()->{
- ds.asDatasetGraph().add(SSE.parseQuad("(<g> <s> <p> 123)")) ;
- }) ;
- ds.getContext().setTrue(TDB2.symUnionDefaultGraph) ;
-
- Txn.executeWrite(ds, ()->{
- // Update by looking in union graph
- String us = StrUtils.strjoinNL(
- "INSERT { GRAPH <http://example/g2> { ?s ?p 'NEW' } }",
- "WHERE { ",
- "?s ?p 123",
- " }" ) ;
- UpdateRequest req = UpdateFactory.create(us) ;
- UpdateAction.execute(req, ds) ;
- }) ;
-
- Txn.executeRead(ds, ()->{
- Model m = ds.getNamedModel("http://example/g2") ;
- assertEquals("Did not find 1 statement in named graph", 1, m.size()) ;
- }) ;
- }
-
- private int count(Dataset dataset)
- { return count(dataset, "SELECT * { ?s ?p ?o }") ; }
-
- private int count(Dataset dataset, String queryString)
-
- {
- Query query = QueryFactory.create(queryString) ;
- QueryExecution qExec = QueryExecutionFactory.create(query, dataset) ;
- ResultSet rs = qExec.execSelect() ;
- return ResultSetFormatter.consume(rs) ;
- }
- private void update(Dataset dataset, String string)
- {
- UpdateRequest req = UpdateFactory.create(string) ;
- UpdateProcessor proc = UpdateExecutionFactory.create(req, dataset) ;
- proc.execute() ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/AbstractTestNodeTable.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/AbstractTestNodeTable.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/AbstractTestNodeTable.java
deleted file mode 100644
index 9a49a2d..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/AbstractTestNodeTable.java
+++ /dev/null
@@ -1,67 +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.seaborne.tdb2.store.nodetable;
-
-import static org.junit.Assert.assertEquals ;
-import static org.junit.Assert.assertNotEquals ;
-import static org.junit.Assert.assertNotNull ;
-
-import org.apache.jena.graph.Node ;
-import org.apache.jena.sparql.util.NodeFactoryExtra ;
-import org.junit.Test ;
-import org.seaborne.tdb2.store.NodeId ;
-
-public abstract class AbstractTestNodeTable
-{
- protected abstract NodeTable createEmptyNodeTable() ;
-
- protected void testNode(String str) {
- testNode(NodeFactoryExtra.parseNode(str)) ;
- }
-
- protected void testNode(Node n) {
- NodeTable nt = createEmptyNodeTable() ;
- writeNode(nt, n) ;
- }
-
- protected static void writeNode(NodeTable nt, String str) {
- writeNode(nt, NodeFactoryExtra.parseNode(str)) ;
- }
-
- protected static void writeNode(NodeTable nt, Node n) {
- NodeId nodeId = nt.getAllocateNodeId(n) ;
- assertNotNull(nodeId) ;
- assertNotEquals(NodeId.NodeDoesNotExist, nodeId) ;
- assertNotEquals(NodeId.NodeIdAny, nodeId) ;
-
- Node n2 = nt.getNodeForNodeId(nodeId) ;
- assertEquals(n, n2) ;
-
- NodeId nodeId2 = nt.getNodeIdForNode(n) ;
- assertEquals(nodeId, nodeId2) ;
- }
-
- @Test public void nodetable_01() { testNode("<http://example/x>") ; }
- @Test public void nodetable_02() { testNode("1") ; }
- @Test public void nodetable_03() { testNode("_:x") ; }
- @Test public void nodetable_04() { testNode("'x'") ; }
- @Test public void nodetable_05() { testNode("'x'@en") ; }
- @Test public void nodetable_06() { testNode("'x'^^<http://example/dt>") ; }
- @Test public void nodetable_07() { testNode("'نواف'") ; }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TS_NodeTable.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TS_NodeTable.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TS_NodeTable.java
deleted file mode 100644
index a552bb0..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TS_NodeTable.java
+++ /dev/null
@@ -1,34 +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.seaborne.tdb2.store.nodetable;
-
-import org.junit.runner.RunWith ;
-import org.junit.runners.Suite ;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
- TestNodeTableBase.class
- , TestNodeTableStoredBase.class
- , TestNodeTableStored.class
- , TestNodeTable.class
-})
-public class TS_NodeTable
-{
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTable.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTable.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTable.java
deleted file mode 100644
index 0324dda..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTable.java
+++ /dev/null
@@ -1,38 +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.seaborne.tdb2.store.nodetable;
-
-import org.seaborne.dboe.base.file.Location ;
-import org.seaborne.tdb2.junit.BuildTestLib ;
-import org.seaborne.tdb2.setup.StoreParams ;
-import org.seaborne.tdb2.setup.StoreParamsBuilder ;
-
-public class TestNodeTable extends AbstractTestNodeTable
-{
- @Override
- protected NodeTable createEmptyNodeTable()
- {
- StoreParams params =
- StoreParamsBuilder.create()
- .nodeId2NodeCacheSize(10)
- .node2NodeIdCacheSize(10)
- .nodeMissCacheSize(10).build() ;
- return BuildTestLib.makeNodeTable(Location.mem(), "test", params) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTableBase.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTableBase.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTableBase.java
deleted file mode 100644
index df18a29..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTableBase.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.seaborne.tdb2.store.nodetable;
-
-import org.seaborne.dboe.base.file.Location ;
-import org.seaborne.tdb2.junit.BuildTestLib ;
-import org.seaborne.tdb2.setup.StoreParams ;
-import org.seaborne.tdb2.setup.StoreParamsBuilder ;
-
-public class TestNodeTableBase extends AbstractTestNodeTable
-{
- @Override
- protected NodeTable createEmptyNodeTable()
- {
- StoreParams params =
- StoreParamsBuilder.create()
- .nodeId2NodeCacheSize(-1)
- .node2NodeIdCacheSize(-1)
- .nodeMissCacheSize(-1).build() ;
-
- // No cache, no inlining.
- return BuildTestLib.makeNodeTableBase(Location.mem(), "test", params) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTableStored.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTableStored.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTableStored.java
deleted file mode 100644
index 0b67da9..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTableStored.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.seaborne.tdb2.store.nodetable;
-
-import org.apache.jena.atlas.lib.FileOps ;
-import org.seaborne.dboe.base.file.Location ;
-import org.seaborne.tdb2.ConfigTest ;
-import org.seaborne.tdb2.junit.BuildTestLib ;
-import org.seaborne.tdb2.setup.StoreParams ;
-import org.seaborne.tdb2.setup.StoreParamsBuilder ;
-
-
-public class TestNodeTableStored extends AbstractTestNodeTable
-{
- static String base = ConfigTest.getTestingDir() ;
- static Location location = Location.create(base+"/nodetable-test") ;
-
- @Override
- protected NodeTable createEmptyNodeTable()
- {
- FileOps.ensureDir(location.getDirectoryPath());
- FileOps.clearDirectory(location.getDirectoryPath());
- StoreParams params =
- StoreParamsBuilder.create()
- .nodeId2NodeCacheSize(10)
- .node2NodeIdCacheSize(10)
- .nodeMissCacheSize(10).build() ;
- return BuildTestLib.makeNodeTable(location, "test", params) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTableStoredBase.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTableStoredBase.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTableStoredBase.java
deleted file mode 100644
index 4e2d020..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/nodetable/TestNodeTableStoredBase.java
+++ /dev/null
@@ -1,47 +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.seaborne.tdb2.store.nodetable;
-
-import org.apache.jena.atlas.lib.FileOps ;
-import org.seaborne.dboe.base.file.Location ;
-import org.seaborne.tdb2.ConfigTest ;
-import org.seaborne.tdb2.junit.BuildTestLib ;
-import org.seaborne.tdb2.setup.StoreParams ;
-import org.seaborne.tdb2.setup.StoreParamsBuilder ;
-
-
-public class TestNodeTableStoredBase extends AbstractTestNodeTable
-{
-
- static String base = ConfigTest.getTestingDir() ;
- static Location location = Location.create(base+"/nodetable-test") ;
-
- @Override
- protected NodeTable createEmptyNodeTable()
- {
- FileOps.ensureDir(location.getDirectoryPath());
- FileOps.clearDirectory(location.getDirectoryPath());
- StoreParams params =
- StoreParamsBuilder.create()
- .nodeId2NodeCacheSize(-1)
- .node2NodeIdCacheSize(-1)
- .nodeMissCacheSize(-1).build() ;
- return BuildTestLib.makeNodeTableBase(location, "test", params) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/AbstractTestTupleIndex.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/AbstractTestTupleIndex.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/AbstractTestTupleIndex.java
deleted file mode 100644
index 1f05ee5..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/AbstractTestTupleIndex.java
+++ /dev/null
@@ -1,265 +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.seaborne.tdb2.store.tupletable;
-
-import static org.apache.jena.atlas.lib.tuple.TupleFactory.tuple ;
-
-import java.util.Iterator ;
-import java.util.Set ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import static org.junit.Assert.*;
-import org.apache.jena.atlas.lib.tuple.Tuple ;
-import org.junit.Test ;
-import org.seaborne.tdb2.store.NodeId ;
-import org.seaborne.tdb2.store.tupletable.TupleIndex ;
-import static org.seaborne.tdb2.store.tupletable.NData.*;
-
-/** Test TupleIndexes (general) */
-public abstract class AbstractTestTupleIndex
-{
- protected abstract TupleIndex create(String description) ;
-
- protected static void add(TupleIndex index, NodeId x1, NodeId x2, NodeId x3)
- {
- Tuple<NodeId> tuple = tuple(x1, x2, x3) ;
- index.add(tuple) ;
- }
-
- @Test public void TupleIndex_1()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
- }
-
- @Test public void TupleIndexRecordSPO_1()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, n2, n3) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- assertTrue(iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordSPO_2()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, n2, null) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- assertTrue(iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordSPO_3()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, null, n3) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- assertTrue(iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordSPO_4()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, NodeId.NodeIdAny, NodeId.NodeIdAny) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- assertTrue(iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordSPO_5()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n1, n2, n4) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, n2, n3) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- Set<Tuple<NodeId>> x = Iter.toSet(iter) ;
- assertEquals(1, x.size()) ;
- assertTrue(x.contains(tuple(n1, n2, n3))) ;
- assertFalse(x.contains(tuple(n1, n2, n4))) ;
- }
-
- @Test public void TupleIndexRecordSPO_6()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n1, n2, n4) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, n2, NodeId.NodeIdAny) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- Set<Tuple<NodeId>> x = Iter.toSet(iter) ;
- assertEquals(2, x.size()) ;
- assertTrue(x.contains(tuple(n1, n2, n3))) ;
- assertTrue(x.contains(tuple(n1, n2, n4))) ;
- }
-
- @Test public void TupleIndexRecordSPO_7()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n1, n2, n4) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, NodeId.NodeIdAny, NodeId.NodeIdAny) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- Set<Tuple<NodeId>> x = Iter.toSet(iter) ;
- assertEquals(2, x.size()) ;
- assertTrue(x.contains(tuple(n1, n2, n3))) ;
- assertTrue(x.contains(tuple(n1, n2, n4))) ;
- }
-
- @Test public void TupleIndexRecordSPO_8()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n2, n3, n4) ;
-
- {
- Tuple<NodeId> tuple2 = tuple(n1, NodeId.NodeIdAny, NodeId.NodeIdAny) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- Set<Tuple<NodeId>> x = Iter.toSet(iter) ;
- assertEquals(1, x.size()) ;
- assertTrue(x.contains(tuple(n1, n2, n3))) ;
- }
-
- {
- Tuple<NodeId> tuple2 = tuple(n2, NodeId.NodeIdAny, NodeId.NodeIdAny) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- Set<Tuple<NodeId>> x = Iter.toSet(iter) ;
- assertEquals(1, x.size()) ;
- assertTrue(x.contains(tuple(n2, n3, n4))) ;
- }
- }
-
- @Test public void TupleIndexRecordPOS_1()
- {
- TupleIndex index = create("POS") ;
- add(index, n1, n2, n3) ;
- Tuple<NodeId> tuple2 = tuple(n1, n2, n3) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- assertTrue("Can't find tuple", iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordPOS_2()
- {
- TupleIndex index = create("POS") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(null, n2, null) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- assertTrue("Can't find tuple",iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
-
- @Test public void TupleIndexRecordPOS_3()
- {
- TupleIndex index = create("POS") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(null, n2, n3) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- assertTrue("Can't find tuple", iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindNot_1()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n4, n5, n6) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- assertNotNull(iter) ;
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindNot_2()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, n5, n6) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindNot_3()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, null, n6) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindNot_4()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n1, n5, n6) ;
-
- Tuple<NodeId> tuple2 = tuple(n4, n5, n6) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindNot_5()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n1, n5, n6) ;
-
- Tuple<NodeId> tuple2 = tuple(n2, n5, n6) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindNot_6()
- {
- TupleIndex index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n4, n5, n6) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, null, n6) ;
- Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
- assertFalse(iter.hasNext()) ;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/NData.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/NData.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/NData.java
deleted file mode 100644
index b24d9a9..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/NData.java
+++ /dev/null
@@ -1,38 +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.seaborne.tdb2.store.tupletable;
-
-import org.apache.jena.atlas.lib.BitsLong;
-import org.seaborne.tdb2.store.NodeId;
-import org.seaborne.tdb2.store.NodeIdFactory;
-import org.seaborne.tdb2.store.NodeIdType;
-
-public class NData {
- public static NodeId n1 = create(1) ;
- public static NodeId n2 = create(2) ;
- public static NodeId n3 = create(3) ;
- public static NodeId n4 = NodeIdFactory.createValue(NodeIdType.XSD_INTEGER, 1);
- public static NodeId n5 = NodeIdFactory.createValue(NodeIdType.XSD_INTEGER, 2);
- // -2 as inlined.
- public static NodeId n6 = NodeIdFactory.createValue(NodeIdType.XSD_INTEGER, BitsLong.clear(-2L, 56, 64));
-
- private static NodeId create(long v) {
- return NodeIdFactory.createPtr(v);
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TS_TupleTable.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TS_TupleTable.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TS_TupleTable.java
deleted file mode 100644
index 7b394bd..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TS_TupleTable.java
+++ /dev/null
@@ -1,32 +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.seaborne.tdb2.store.tupletable;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
- TestTupleIndexRecord.class,
- TestTupleIndexRecordDirect.class,
- TestTupleTable.class
-} )
-
-public class TS_TupleTable
-{ }
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TestTupleIndexRecord.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TestTupleIndexRecord.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TestTupleIndexRecord.java
deleted file mode 100644
index eb36e15..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TestTupleIndexRecord.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.seaborne.tdb2.store.tupletable;
-
-import org.apache.jena.atlas.lib.tuple.TupleMap ;
-import org.seaborne.dboe.base.file.FileSet ;
-import org.seaborne.dboe.base.record.RecordFactory ;
-import org.seaborne.dboe.index.IndexParams ;
-import org.seaborne.dboe.index.RangeIndex ;
-import org.seaborne.tdb2.junit.BuildTestLib ;
-import org.seaborne.tdb2.setup.StoreParams ;
-import org.seaborne.tdb2.sys.SystemTDB ;
-
-public class TestTupleIndexRecord extends AbstractTestTupleIndex
-{
- static RecordFactory factory = new RecordFactory(3*SystemTDB.SizeOfNodeId, 0) ;
-
- @Override
- protected TupleIndexRecord create(String description)
- {
- IndexParams indexParams = StoreParams.getDftStoreParams() ;
- RangeIndex rIdx = BuildTestLib.buildRangeIndex(FileSet.mem(), factory, indexParams) ;
- TupleMap tmap = TupleMap.create("SPO", description) ;
- TupleIndexRecord index = new TupleIndexRecord(3, tmap, description, factory, rIdx) ;
- return index ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TestTupleIndexRecordDirect.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TestTupleIndexRecordDirect.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TestTupleIndexRecordDirect.java
deleted file mode 100644
index 13c0aa8..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TestTupleIndexRecordDirect.java
+++ /dev/null
@@ -1,315 +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.seaborne.tdb2.store.tupletable;
-
-import static org.seaborne.tdb2.store.tupletable.NData.*;
-import static org.apache.jena.atlas.lib.tuple.TupleFactory.tuple ;
-
-import java.util.Iterator ;
-import java.util.Set ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import static org.junit.Assert.*;
-import org.apache.jena.atlas.lib.tuple.Tuple ;
-import org.apache.jena.atlas.lib.tuple.TupleMap ;
-import org.junit.Test ;
-import org.seaborne.dboe.base.file.FileSet ;
-import org.seaborne.dboe.base.record.RecordFactory ;
-import org.seaborne.dboe.index.IndexParams ;
-import org.seaborne.dboe.index.RangeIndex ;
-import org.seaborne.tdb2.junit.BuildTestLib ;
-import org.seaborne.tdb2.setup.StoreParams ;
-import org.seaborne.tdb2.store.NodeId ;
-import org.seaborne.tdb2.sys.SystemTDB ;
-
-public class TestTupleIndexRecordDirect
-{
- static RecordFactory factory = new RecordFactory(3*SystemTDB.SizeOfNodeId, 0) ;
-
- static TupleIndexRecord create(String description)
- {
- IndexParams indexParams = StoreParams.getDftStoreParams() ;
- RangeIndex rIdx = BuildTestLib.buildRangeIndex(FileSet.mem(), factory, indexParams) ;
- TupleMap tmap = TupleMap.create("SPO", description) ;
- TupleIndexRecord index = new TupleIndexRecord(3, tmap, description, factory, rIdx) ;
- return index ;
- }
-
- static void add(TupleIndexRecord index, NodeId x1, NodeId x2, NodeId x3)
- {
- Tuple<NodeId> tuple = tuple(x1, x2, x3) ;
- index.add(tuple) ;
- }
-
- @Test public void TupleIndexRecord_1()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
- }
-
- @Test public void TupleIndexRecordSPO_1()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, n2, n3) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- assertTrue(iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordSPO_2()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, n2, null) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- assertTrue(iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordSPO_3()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, null, n3) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- assertNull(iter) ;
- iter = index.findOrPartialScan(tuple2) ;
- assertTrue(iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordSPO_4()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, NodeId.NodeIdAny, NodeId.NodeIdAny) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- assertTrue(iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordSPO_5()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n1, n2, n4) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, n2, n3) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- Set<Tuple<NodeId>> x = Iter.toSet(iter) ;
- assertEquals(1, x.size()) ;
- assertTrue(x.contains(tuple(n1, n2, n3))) ;
- assertFalse(x.contains(tuple(n1, n2, n4))) ;
- }
-
- @Test public void TupleIndexRecordSPO_6()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n1, n2, n4) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, n2, NodeId.NodeIdAny) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- Set<Tuple<NodeId>> x = Iter.toSet(iter) ;
- assertEquals(2, x.size()) ;
- assertTrue(x.contains(tuple(n1, n2, n3))) ;
- assertTrue(x.contains(tuple(n1, n2, n4))) ;
- }
-
- @Test public void TupleIndexRecordSPO_7()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n1, n2, n4) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, NodeId.NodeIdAny, NodeId.NodeIdAny) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- Set<Tuple<NodeId>> x = Iter.toSet(iter) ;
- assertEquals(2, x.size()) ;
- assertTrue(x.contains(tuple(n1, n2, n3))) ;
- assertTrue(x.contains(tuple(n1, n2, n4))) ;
- }
-
- @Test public void TupleIndexRecordSPO_8()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n2, n3, n4) ;
-
- {
- Tuple<NodeId> tuple2 = tuple(n1, NodeId.NodeIdAny, NodeId.NodeIdAny) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- Set<Tuple<NodeId>> x = Iter.toSet(iter) ;
- assertEquals(1, x.size()) ;
- assertTrue(x.contains(tuple(n1, n2, n3))) ;
- }
-
- {
- Tuple<NodeId> tuple2 = tuple(n2, NodeId.NodeIdAny, NodeId.NodeIdAny) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- Set<Tuple<NodeId>> x = Iter.toSet(iter) ;
- assertEquals(1, x.size()) ;
- assertTrue(x.contains(tuple(n2, n3, n4))) ;
- }
- }
-
- @Test public void TupleIndexRecordPOS_1()
- {
- TupleIndexRecord index = create("POS") ;
- add(index, n1, n2, n3) ;
- Tuple<NodeId> tuple2 = tuple(n1, n2, n3) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- assertTrue("Can't find tuple", iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordPOS_2()
- {
- TupleIndexRecord index = create("POS") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(null, n2, null) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- assertTrue("Can't find tuple",iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
-
- @Test public void TupleIndexRecordPOS_3()
- {
- TupleIndexRecord index = create("POS") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(null, n2, n3) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- assertTrue("Can't find tuple", iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindScan_1()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
- Tuple<NodeId> tuple2 = tuple(n1, null, n3) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- assertNull(iter) ;
- iter = index.findOrPartialScan(tuple2) ;
- assertTrue(iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindScan_2()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n1, n2, n4) ;
-
-
- Tuple<NodeId> tuple2 = tuple(null, null, n3) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- assertNull(iter) ;
-
- iter = index.findOrPartialScan(tuple2) ;
- assertNull(iter) ;
-
- iter = index.findOrScan(tuple2) ;
- assertTrue(iter.hasNext()) ;
- iter.next();
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindNot_1()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n4, n5, n6) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- assertNotNull(iter) ;
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindNot_2()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, n5, n6) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindNot_3()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, null, n6) ;
- Iterator<Tuple<NodeId>> iter = index.findOrPartialScan(tuple2) ;
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindNot_4()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n1, n5, n6) ;
-
- Tuple<NodeId> tuple2 = tuple(n4, n5, n6) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindNot_5()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n1, n5, n6) ;
-
- Tuple<NodeId> tuple2 = tuple(n2, n5, n6) ;
- Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
- assertFalse(iter.hasNext()) ;
- }
-
- @Test public void TupleIndexRecordFindNot_6()
- {
- TupleIndexRecord index = create("SPO") ;
- add(index, n1, n2, n3) ;
- add(index, n4, n5, n6) ;
-
- Tuple<NodeId> tuple2 = tuple(n1, null, n6) ;
- Iterator<Tuple<NodeId>> iter = index.findOrPartialScan(tuple2) ;
- assertFalse(iter.hasNext()) ;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TestTupleTable.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TestTupleTable.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TestTupleTable.java
deleted file mode 100644
index 6100464..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/tupletable/TestTupleTable.java
+++ /dev/null
@@ -1,152 +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.seaborne.tdb2.store.tupletable;
-
-import static org.apache.jena.atlas.lib.tuple.TupleFactory.tuple ;
-
-import java.util.Iterator ;
-import java.util.List ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import static org.junit.Assert.*;
-import org.apache.jena.atlas.lib.tuple.Tuple ;
-import org.junit.Test ;
-import org.seaborne.dboe.base.record.RecordFactory ;
-import org.seaborne.tdb2.store.NodeId ;
-import org.seaborne.tdb2.sys.SystemTDB ;
-import static org.seaborne.tdb2.store.tupletable.NData.*;
-
-public class TestTupleTable
-{
- static RecordFactory factory = new RecordFactory(3*SystemTDB.SizeOfNodeId, 0) ;
-
- static private TupleTable create()
- {
- TupleIndex idxSPO = TestTupleIndexRecordDirect.create("SPO") ;
- TupleIndex idxPOS = TestTupleIndexRecordDirect.create("POS") ;
- TupleIndex idxOSP = TestTupleIndexRecordDirect.create("OSP") ;
- TupleIndex x[] = { idxSPO, idxPOS, idxOSP } ;
- TupleTable table = new TupleTable(3, x) ;
- return table ;
- }
-
- static private TupleTable create2()
- {
- TupleIndex idxSPO = TestTupleIndexRecordDirect.create("SPO") ;
- TupleIndex x[] = { idxSPO } ;
- TupleTable table = new TupleTable(3, x) ;
- return table ;
- }
-
- static void add(TupleTable table, NodeId x1, NodeId x2, NodeId x3)
- {
- Tuple<NodeId> tuple = tuple(x1, x2, x3) ;
- table.add(tuple) ;
- }
-
- @Test public void create1() { create() ; }
-
- @Test public void createFind1()
- {
- TupleTable table = create() ;
- add(table, n1, n2, n3) ;
- // Cast removes compile lint warning.
- Tuple<NodeId> pat = tuple((NodeId)null, null, null) ;
- Iterator<Tuple<NodeId>> iter = table.find(pat) ;
- List<Tuple<NodeId>> x = Iter.toList(iter) ;
- int z = x.size() ;
- assertEquals(1, z) ;
- Tuple<NodeId> e1 = x.get(0) ;
- assertEquals(tuple(n1, n2, n3) , e1) ;
- }
-
- @Test public void createFind2()
- {
- TupleTable table = create() ;
- add(table, n1, n2, n3) ;
- add(table, n1, n2, n4) ;
-
- Tuple<NodeId> pat = tuple(null, n2, null) ;
- Iterator<Tuple<NodeId>> iter = table.find(pat) ;
- assertNotNull(iter) ;
- List<Tuple<NodeId>> x = Iter.toList(iter) ;
- int z = x.size() ;
- assertEquals(2, z) ;
-
- Tuple<NodeId> e1 = x.get(0) ;
- Tuple<NodeId> e2 = x.get(1) ;
- assertEquals(tuple(n1, n2, n3) , e1) ;
- assertEquals(tuple(n1, n2, n4) , e2) ;
- }
-
- @Test public void createFind3()
- {
- // test scan
- TupleTable table = create2() ;
- add(table, n1, n2, n3) ;
- add(table, n1, n2, n4) ;
-
- Tuple<NodeId> pat = tuple(n1, null, n3) ;
- Iterator<Tuple<NodeId>> iter = table.find(pat) ;
- assertNotNull(iter) ;
- List<Tuple<NodeId>> x = Iter.toList(iter) ;
- int z = x.size() ;
- assertEquals(1, z) ;
-
- Tuple<NodeId> e1 = x.get(0) ;
- assertEquals(tuple(n1, n2, n3) , e1) ;
- }
-
- @Test public void createFind4()
- {
- // test scan
- TupleTable table = create2() ;
- add(table, n1, n2, n3) ;
- add(table, n1, n2, n4) ;
-
- Tuple<NodeId> pat = tuple(null, null, n3) ;
- Iterator<Tuple<NodeId>> iter = table.find(pat) ;
- assertNotNull(iter) ;
- List<Tuple<NodeId>> x = Iter.toList(iter) ;
- int z = x.size() ;
- assertEquals(1, z) ;
-
- Tuple<NodeId> e1 = x.get(0) ;
- assertEquals(tuple(n1, n2, n3) , e1) ;
- }
-
- @Test public void createFind5()
- {
- // test scan
- TupleTable table = create2() ;
- add(table, n1, n2, n3) ;
- add(table, n1, n2, n4) ;
-
- Tuple<NodeId> pat = tuple(null, NodeId.NodeIdAny, n3) ;
- Iterator<Tuple<NodeId>> iter = table.find(pat) ;
- assertNotNull(iter) ;
- List<Tuple<NodeId>> x = Iter.toList(iter) ;
- int z = x.size() ;
- assertEquals(1, z) ;
-
- Tuple<NodeId> e1 = x.get(0) ;
- assertEquals(tuple(n1, n2, n3) , e1) ;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/value/TestDoubleNode62.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/value/TestDoubleNode62.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/value/TestDoubleNode62.java
deleted file mode 100644
index 112bd52..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/value/TestDoubleNode62.java
+++ /dev/null
@@ -1,123 +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.seaborne.tdb2.store.value;
-
-import org.apache.jena.atlas.lib.BitsLong;
-import org.junit.Test;
-import org.seaborne.tdb2.store.value.DoubleNode62;
-
-import static org.junit.Assert.*;
-
-public class TestDoubleNode62 {
- @Test public void double_01() { testRoundTripDouble(1d); }
- @Test public void double_02() { testRoundTripDouble(-1d); }
- @Test public void double_03() { testRoundTripDouble(-1111111111e50d); }
- @Test public void double_04() { testRoundTripDouble(1111111111e50d); }
-
- @Test public void double_05() { testNoEncoding(1e300); }
- @Test public void double_06() { testNoEncoding(1e100); }
- @Test public void double_07() { testNoEncoding(1e78); }
- @Test public void double_08() { testNoEncoding(2e77); }
- @Test public void double_09() { testRoundTripDouble(1e77); }
-
- @Test public void double_10() { testNoEncoding(3e-300); }
- @Test public void double_11() { testNoEncoding(3e-100); }
- @Test public void double_12() { testNoEncoding(3e-77); }
- @Test public void double_13() { testRoundTripDouble(3.5e-77); }
- @Test public void double_14() { testRoundTripDouble(4e-77); }
- @Test public void double_15() { testRoundTripDouble(1e-76); }
- @Test public void double_16() { testRoundTripDouble(1e-75); }
-
- @Test public void double_20() { testRoundTripDouble(Double.POSITIVE_INFINITY); }
- @Test public void double_21() { testRoundTripDouble(Double.NEGATIVE_INFINITY); }
- @Test public void double_22() { testRoundTripDouble(Double.NaN); }
- @Test public void double_23() { testNoEncoding(Double.MAX_VALUE); }
- @Test public void double_24() { testNoEncoding(Double.MIN_NORMAL); }
- @Test public void double_25() { testNoEncoding(Double.MIN_VALUE); }
-
- @Test public void double_30() { testRoundTripDouble(DoubleNode62.POSITIVE_INFINITY); }
- @Test public void double_31() { testRoundTripDouble(DoubleNode62.NEGATIVE_INFINITY); }
- @Test public void double_32() { testRoundTripDouble(DoubleNode62.NaN); }
- @Test public void double_33() { testNoEncoding(DoubleNode62.MAX_VALUE); }
- @Test public void double_34() { testNoEncoding(DoubleNode62.MIN_NORMAL); }
- @Test public void double_35() { testNoEncoding(DoubleNode62.MIN_VALUE); }
-
- @Test public void double_40() { sameValue(DoubleNode62.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); }
- @Test public void double_41() { sameValue(DoubleNode62.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); }
- @Test public void double_42() { sameValue(DoubleNode62.NaN, Double.NaN); }
-
- @Test public void double_50() { testConst(DoubleNode62.POSITIVE_INFINITY_BITS, 0x1ff0000000000000L); }
- @Test public void double_51() { testConst(DoubleNode62.NEGATIVE_INFINITY_BITS, 0x3ff0000000000000L); }
- @Test public void double_52() { testConst(DoubleNode62.NaN_BITS, 0x1ff8000000000000L); }
- @Test public void double_53() { testConst(DoubleNode62.MAX_VALUE_BITS, 0x3fefffffffffffffL); }
- @Test public void double_54() { testConst(DoubleNode62.MIN_NORMAL_BITS, 0x0010000000000000L); }
- @Test public void double_55() { testConst(DoubleNode62.MIN_VALUE_BITS, 0x01L); }
-
- private void sameValue(double d1, double d2) {
- // Not d1 == d2 - NaN != NaN
- assertEquals(Double.valueOf(d1), Double.valueOf(d2));
- }
-
- private static void testConst(long x, long expected) {
- //print(expected);
- //print(x);
- assertEquals(expected, x);
- double d = DoubleNode62.unpack(x);
- long z = DoubleNode62.pack(d);
- assertEquals(expected, z);
- }
-
- private void testNoEncoding(double d) {
- testRoundTripDouble(d, false);
- }
-
- private static void testRoundTripDouble(double d) {
- testRoundTripDouble(d, true);
- }
-
- private static void testRoundTripDouble(double d, boolean valid) {
- //System.out.printf("Double: %.2e\n", d);
- long x0 = Double.doubleToRawLongBits(d);
- //print(x0);
- long x = DoubleNode62.pack(d);
- //print(x);
- if ( x == DoubleNode62.NO_ENCODING ) {
- if ( valid )
- fail("Expect no encoding");
-
- //System.out.println("No encoding");
- //System.out.println();
- return;
- }
-
- double d2 = DoubleNode62.unpack(x);
-
- Double double1 = d ;
- Double double2 = d2 ;
- assertEquals(double1, double2);
- }
-
- private static void print(long x) {
- long z[] = new long[4];
- for ( int i = 0 ; i < 4 ; i++ ) {
- z[3-i] = BitsLong.unpack(x, i*16, (i+1)*16) ;
- }
- System.out.printf("0x%04X %04X %04X %04X\n", z[0], z[1], z[2], z[3]);
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/value/TestNodeIdInline.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/value/TestNodeIdInline.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/value/TestNodeIdInline.java
deleted file mode 100644
index 3b8babb..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/store/value/TestNodeIdInline.java
+++ /dev/null
@@ -1,286 +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.seaborne.tdb2.store.value;
-
-import static org.junit.Assert.*;
-import org.apache.jena.datatypes.xsd.XSDDatatype;
-import org.apache.jena.graph.Node;
-import org.apache.jena.graph.NodeFactory;
-import org.apache.jena.sparql.expr.NodeValue;
-import org.apache.jena.sparql.util.NodeFactoryExtra;
-import org.junit.Test;
-import org.seaborne.tdb2.store.NodeId;
-
-public class TestNodeIdInline
-{
- @Test public void nodeId_int_01()
- { test("'1'^^xsd:integer") ; }
-
- @Test public void nodeId_int_02()
- { test("2") ; }
-
- @Test public void nodeId_int_03()
- { test("'3'^^xsd:int") ; }
-
- @Test public void nodeId_int_04()
- { testNoInline("'3'") ; }
-
- @Test public void nodeId_int_05()
- { test("-1") ; }
-
- @Test public void nodeId_int_06()
- { test("-180") ; }
-
- @Test public void nodeId_int_07()
- { test("01", "1") ; }
-
- @Test public void nodeId_int_08()
- { test("+01", "1") ; }
-
- @Test public void nodeId_int_09()
- // More than Long.MAX_VALUE
- { testNoInline("92233720368547758070") ; }
-
- // On the edge.
-
- static final long X = 1L<<55 ; // Just too large
- static final long Y = -((1L<<55) +1) ; // Just too small
-
- @Test public void nodeId_int_10()
- { testNoInline("\""+Long.toString(X)+"\"^^xsd:integer") ; }
-
- @Test public void nodeId_int_11()
- {
- Node n = NodeValue.makeInteger(X-1).asNode() ;
- test("\""+Long.toString(X-1)+"\"^^xsd:integer", n) ;
- }
-
- @Test public void nodeId_int_12()
- { testNoInline("\""+Long.toString(Y)+"\"^^xsd:integer") ; }
-
- @Test public void nodeId_int_13()
- {
- Node n = NodeValue.makeInteger(Y+1).asNode() ;
- test("\""+Long.toString(Y+1)+"\"^^xsd:integer", n) ;
- }
-
- @Test public void nodeId_int_20()
- { test("'30'^^xsd:positiveInteger") ; }
-
- @Test public void nodeId_int_21()
- { testNoInline("'300'^^xsd:byte") ; }
-
- @Test public void nodeId_decimal_1()
- { test("3.14", "3.14") ; }
-
- @Test public void nodeId_decimal_2()
- { testNoInline("123456789.123456789") ; }
-
- // Just this once, directly create the Node.
- @Test public void nodeId_decimal_3()
- { test("12.89", NodeFactory.createLiteral("12.89", XSDDatatype.XSDdecimal)) ; }
-
- @Test public void nodeId_decimal_4()
- { test("-1.0", "-1.0") ; }
-
- // This number has > 47 bits of value : 2412.80478192688
- @Test public void nodeId_decimal_5()
- { testNoInline("2412.80478192688") ; }
-
- // This number has > 47 bits of value : -2412.80478192688
- @Test public void nodeId_decimal_6()
- { testNoInline("-2412.80478192688") ; }
-
- @Test public void nodeId_decimal_7()
- { test("'0.00000001'^^xsd:decimal",
- NodeFactory.createLiteral("0.00000001", XSDDatatype.XSDdecimal)) ;
- }
-
- @Test public void nodeId_decimal_8()
- { test("0.00000001", NodeFactory.createLiteral("0.00000001", XSDDatatype.XSDdecimal)) ; }
-
- @Test public void nodeId_dateTime_01()
- { test("'2008-04-28T15:36:15+01:00'^^xsd:dateTime") ; }
-
- @Test public void nodeId_dateTime_02()
- { test("'2008-04-28T15:36:15Z'^^xsd:dateTime") ; }
-
- @Test public void nodeId_dateTime_03()
- { test("'2008-04-28T15:36:15+00:00'^^xsd:dateTime") ; }
-
- @Test public void nodeId_dateTime_04()
- { test("'2008-04-28T15:36:15-05:00'^^xsd:dateTime") ; }
-
- // No timezone.
- @Test public void nodeId_dateTime_05()
- { test("'2008-04-28T15:36:15'^^xsd:dateTime") ; }
-
- // Note the trailing zero - system does not preserve perfect lexical forms.
- @Test public void nodeId_dateTime_06()
- { test("'2008-04-28T15:36:05.450'^^xsd:dateTime", "'2008-04-28T15:36:05.45'^^xsd:dateTime") ; }
-
- // Old Java bug, now fixed: T24:00:00 not accepted by DatatypeFactory.newXMLGregorianCalendar(lex)
- // Note the Jena value is an XSDDateTime so it retains the "24"/"00" next day distinction.
- @Test public void nodeId_dateTime_07()
- { test("'2008-04-28T24:00:00'^^xsd:dateTime") ; }
-
- // Out of range.
- @Test public void nodeId_dateTime_08()
- { testNoInline("'8008-04-28T15:36:05.45'^^xsd:dateTime") ; }
-
- @Test public void nodeId_dateTime_09()
- { test("'2008-04-28T15:36:05.001'^^xsd:dateTime") ; }
-
- @Test public void nodeId_dateTime_10()
- { test("'2008-04-28T15:36:05.01'^^xsd:dateTime") ; }
-
- @Test public void nodeId_dateTime_11()
- { test("'2008-04-28T15:36:05.1'^^xsd:dateTime") ; }
-
- // Canonicalization test - fractional seconds.
- @Test public void nodeId_dateTime_12()
- { test("'2008-04-28T15:36:05.010'^^xsd:dateTime", "'2008-04-28T15:36:05.01'^^xsd:dateTime") ; }
-
- @Test public void nodeId_dateTime_13()
- { test("'2008-04-28T15:36:05.100'^^xsd:dateTime", "'2008-04-28T15:36:05.1'^^xsd:dateTime") ; }
-
- @Test public void nodeId_dateTime_14()
- { test("'2012-07-29T20:39:11.100+01:15'^^xsd:dateTime", "'2012-07-29T20:39:11.1+01:15'^^xsd:dateTime") ; }
-
- @Test public void nodeId_dateTime_15()
- { test("'2012-07-29T20:39:11.100-01:15'^^xsd:dateTime", "'2012-07-29T20:39:11.1-01:15'^^xsd:dateTime") ; }
-
- @Test public void nodeId_dateTime_16()
- { test("'2012-07-29T20:39:11.100+01:30'^^xsd:dateTime", "'2012-07-29T20:39:11.1+01:30'^^xsd:dateTime") ; }
-
- @Test public void nodeId_dateTime_17()
- { test("'2012-07-29T20:39:11.100-01:45'^^xsd:dateTime", "'2012-07-29T20:39:11.1-01:45'^^xsd:dateTime") ; }
-
- @Test public void nodeId_dateTime_18()
- { test("'2012-07-29T20:39:11.100Z'^^xsd:dateTime", "'2012-07-29T20:39:11.1Z'^^xsd:dateTime") ; }
-
- @Test public void nodeId_dateTimeStamp_01()
- { test("'2012-07-29T20:39:11.100Z'^^xsd:dateTimeStamp", "'2012-07-29T20:39:11.1Z'^^xsd:dateTimeStamp") ; }
-
-
- @Test public void nodeId_date_1()
- { test("'2008-04-28Z'^^xsd:date", "'2008-04-28Z'^^xsd:date") ; }
-
- @Test public void nodeId_date_2()
- { test("'2008-04-28+00:00'^^xsd:date", "'2008-04-28+00:00'^^xsd:date") ; }
-
- @Test public void nodeId_date_3()
- { test("'2008-04-28-05:00'^^xsd:date", "'2008-04-28-05:00'^^xsd:date") ; }
-
- @Test public void nodeId_date_4()
- { test("'2008-04-28+02:00'^^xsd:date", "'2008-04-28+02:00'^^xsd:date") ; }
-
- @Test public void nodeId_date_5()
- { testNoInline("'8008-04-28'^^xsd:date") ; }
-
- @Test public void nodeId_date_6()
- { test("'2012-07-29+06:15'^^xsd:date", "'2012-07-29+06:15'^^xsd:date") ; }
-
- @Test public void nodeId_date_7()
- { test("'2012-07-29-06:30'^^xsd:date", "'2012-07-29-06:30'^^xsd:date") ; }
-
- @Test public void nodeId_boolean_1()
- { test("'true'^^xsd:boolean", "'true'^^xsd:boolean") ; }
-
- @Test public void nodeId_boolean_2()
- { test("'false'^^xsd:boolean", "'false'^^xsd:boolean") ; }
-
- @Test public void nodeId_boolean_3()
- { test("'1'^^xsd:boolean", "'true'^^xsd:boolean") ; }
-
- @Test public void nodeId_boolean_4()
- { test("'0'^^xsd:boolean", "'false'^^xsd:boolean") ; }
-
- // Many tests in TestDoubleNode62
-
- @Test public void nodeId_double_1()
- { test("1.0e0", NodeFactory.createLiteral("1.0e0", XSDDatatype.XSDdouble)) ; }
-
- // Becomes the RDF/SPARQL preferred form - with expooent - for pretty printing.
- @Test public void nodeId_double_2()
- { test("'-0001.0'^^xsd:double", NodeFactory.createLiteral("-1.0e0", XSDDatatype.XSDdouble)) ; }
-
- @Test public void nodeId_double_3()
- { test("'NaN'^^xsd:double", NodeFactory.createLiteral("NaN", XSDDatatype.XSDdouble)) ; }
-
- @Test public void nodeId_double_4()
- { test("'INF'^^xsd:double", NodeFactory.createLiteral("INF", XSDDatatype.XSDdouble)) ; }
-
- @Test public void nodeId_double_5()
- { test("'-INF'^^xsd:double", NodeFactory.createLiteral("-INF", XSDDatatype.XSDdouble)) ; }
-
- @Test public void nodeId_double_6()
- { test("'1.1E9'^^xsd:double") ; }
-
- @Test public void nodeId_double_7()
- { test("1.1E9") ; }
-
- @Test public void nodeId_double_8()
- { testNoInline("1.1E80") ; }
-
- @Test public void nodeId_double_9()
- { testNoInline("1.1E-80") ; }
-
- @Test public void nodeId_float_1()
- { test("'0.0'^^xsd:float") ; }
-
- @Test public void nodeId_float_2()
- { test("'0'^^xsd:float", "'0.0'^^xsd:float") ; }
-
- @Test public void nodeId_float_3()
- { testNoInline("'x'^^xsd:float") ; }
-
- @Test public void nodeId_float_4()
- { test("'1.1e1'^^xsd:float", "'11.0'^^xsd:float") ; }
-
- @Test public void nodeId_float_5()
- { test("'1.1E9'^^xsd:float") ; }
-
- private void test(String x) { test(x, x) ; }
-
- private void test(String x, String expected) {
- test(x, NodeFactoryExtra.parseNode(expected)) ;
- }
-
- private void testNoInline(String x) {
- Node n = NodeFactoryExtra.parseNode(x) ;
- NodeId nodeId = NodeId.inline(n) ;
- assertNull("Converted NodeId but expected no inline form: "+x, nodeId) ;
- }
-
- private void test(String x, Node correct) {
- Node n = NodeFactoryExtra.parseNode(x) ;
- NodeId nodeId = NodeId.inline(n) ;
- assertNotNull("Expected inlining: "+x, nodeId);
-
- boolean b = NodeId.hasInlineDatatype(n) ;
- assertTrue("Converted NodeId but datatype test was false", b) ;
- Node n2 = NodeId.extract(nodeId) ;
- assertNotNull("Expected recovery", n2) ;
- String s = "("+correct.getLiteralLexicalForm()+","+n2.getLiteralLexicalForm()+")" ;
- assertTrue("Not same value: "+s, correct.sameValueAs(n2)) ;
- // Term equality.
- assertEquals("Not same term", correct, n2) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TS_Sys.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TS_Sys.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TS_Sys.java
deleted file mode 100644
index 7608682..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TS_Sys.java
+++ /dev/null
@@ -1,34 +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.seaborne.tdb2.sys;
-
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
- TestDatabaseOps.class
- , TestDatabaseConnection.class
- , TestSys.class
- //, TestOps.class
-})
-
-public class TS_Sys
-{}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestDatabaseConnection.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestDatabaseConnection.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestDatabaseConnection.java
deleted file mode 100644
index 8e6bdcc..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestDatabaseConnection.java
+++ /dev/null
@@ -1,69 +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.seaborne.tdb2.sys;
-
-import static org.junit.Assert.assertNotSame ;
-import static org.junit.Assert.assertSame ;
-
-import org.apache.jena.atlas.lib.FileOps ;
-import org.apache.jena.sparql.core.DatasetGraph ;
-import org.junit.Test ;
-import org.seaborne.dboe.base.file.Location ;
-import org.seaborne.tdb2.ConfigTest ;
-import org.seaborne.tdb2.sys.DatabaseConnection ;
-
-public class TestDatabaseConnection {
-
- @Test
- public void testStoreConnectionTxn1() {
- TDBInternal.reset() ;
- // Only do disk things for test that need them (disk takes time!).
- String DIRx = ConfigTest.getCleanDir() ;
- Location DIR = Location.create(DIRx);
- FileOps.clearDirectory(DIRx) ;
- try {
- DatasetGraph dg1 = DatabaseConnection.connectCreate(DIR).getDatasetGraph() ;
- DatasetGraph dg2 = DatabaseConnection.connectCreate(DIR).getDatasetGraph() ;
- assertSame(dg1, dg2) ;
- }
- finally {
- FileOps.clearDirectory(DIRx) ;
- }
- }
-
- @Test
- public void testStoreConnectionTxn2() {
- // Named memory locations
- TDBInternal.reset() ;
- DatasetGraph dg1 = DatabaseConnection.connectCreate(Location.mem("FOO")).getDatasetGraph() ;
- DatasetGraph dg2 = DatabaseConnection.connectCreate(Location.mem("FOO")).getDatasetGraph() ;
- assertSame(dg1, dg2) ;
- }
-
- @Test
- public void testStoreConnectionTxn3() {
- // Un-named memory locations
- TDBInternal.reset() ;
- DatasetGraph dg1 = DatabaseConnection.connectCreate(Location.mem()).getDatasetGraph() ;
- DatasetGraph dg2 = DatabaseConnection.connectCreate(Location.mem()).getDatasetGraph() ;
- assertNotSame(dg1, dg2) ;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestDatabaseOps.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestDatabaseOps.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestDatabaseOps.java
deleted file mode 100644
index eab1861..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestDatabaseOps.java
+++ /dev/null
@@ -1,173 +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.seaborne.tdb2.sys;
-
-import static org.junit.Assert.* ;
-import static org.junit.Assert.assertFalse ;
-import static org.junit.Assert.assertNotEquals ;
-import static org.junit.Assert.assertTrue ;
-
-import org.apache.commons.io.FileUtils ;
-import org.apache.jena.atlas.lib.FileOps ;
-import org.apache.jena.graph.Graph ;
-import org.apache.jena.graph.Triple ;
-import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.sparql.core.DatasetGraph ;
-import org.apache.jena.sparql.core.Quad ;
-import org.apache.jena.sparql.sse.SSE ;
-import org.junit.After ;
-import org.junit.Before ;
-import org.junit.Test ;
-import org.seaborne.dboe.base.file.Location ;
-import org.seaborne.dboe.jenax.Txn ;
-import org.seaborne.tdb2.ConfigTest ;
-import org.seaborne.tdb2.DatabaseMgr ;
-import org.seaborne.tdb2.store.DatasetGraphSwitchable ;
-import org.seaborne.tdb2.store.DatasetGraphTDB ;
-
-public class TestDatabaseOps
-{
- static String DIRx = ConfigTest.getCleanDir() ;
- static Location DIR = Location.create(DIRx);
-
- static Quad quad1 = SSE.parseQuad("(_ <s> <p> 1)") ;
- static Quad quad2 = SSE.parseQuad("(_ _:a <p> 2)") ;
- static Triple triple1 = quad1.asTriple();
- static Triple triple2 = quad2.asTriple();
- static Triple triple3 = SSE.parseTriple("(<s> <q> 3)") ;
-
- @Before
- public void before() {
- FileUtils.deleteQuietly(IOX.asFile(DIR));
- FileOps.ensureDir(DIR.getDirectoryPath());
- }
-
- @After
- public void after() {
- TDBInternal.reset();
- FileUtils.deleteQuietly(IOX.asFile(DIR));
- }
-
- @Test public void compact_dsg_1() {
- DatasetGraph dsg = DatabaseMgr.connectDatasetGraph(DIR);
- DatasetGraphSwitchable dsgs = (DatasetGraphSwitchable)dsg;
- DatasetGraph dsg1 = dsgs.get();
- Location loc1 = ((DatasetGraphTDB)dsg1).getLocation();
-
- Txn.executeWrite(dsg, ()-> {
- dsg.add(quad2) ;
- dsg.add(quad1) ;
- }) ;
- DatabaseMgr.compact(dsg);
-
- assertFalse(StoreConnection.isSetup(loc1));
-
- DatasetGraph dsg2 = dsgs.get();
- Location loc2 = ((DatasetGraphTDB)dsg2).getLocation();
-
- assertNotEquals(dsg1, dsg2);
- assertNotEquals(loc1, loc2);
-
- Txn.executeRead(dsg, ()-> {
- assertTrue(dsg.contains(quad2)) ;
- assertTrue(dsg.contains(quad1)) ;
- }) ;
-
- // dsg1 was closed and expelled. We must carefully reopen its storage only.
- DatasetGraph dsgOld = StoreConnection.connectCreate(loc1).getDatasetGraph();
-
- Txn.executeWrite(dsgOld, ()->dsgOld.delete(quad2));
- Txn.executeRead(dsg, ()->assertTrue(dsg.contains(quad2)) );
- Txn.executeRead(dsg2, ()->assertTrue(dsg2.contains(quad2)) ) ;
- }
-
- @Test public void compact_graph_2() {
- // graphs across compaction.
- DatasetGraph dsg = DatabaseMgr.connectDatasetGraph(DIR);
- Graph g = dsg.getDefaultGraph();
-
- DatasetGraphSwitchable dsgs = (DatasetGraphSwitchable)dsg;
- DatasetGraph dsg1 = dsgs.get();
- Location loc1 = ((DatasetGraphTDB)dsg1).getLocation();
-
- Txn.executeWrite(dsg, ()-> {
- dsg.add(quad2) ;
- dsg.add(quad1) ;
- }) ;
- DatabaseMgr.compact(dsg);
- Txn.executeRead(dsg, ()-> {
- assertEquals(2, g.size());
- assertTrue(g.contains(triple2));
- }) ;
-
- // Check is not attached to the old graph.
- DatasetGraph dsgOld = StoreConnection.connectCreate(loc1).getDatasetGraph();
-
- Txn.executeWrite(dsgOld, ()->dsgOld.getDefaultGraph().delete(triple2));
- Txn.executeRead(dsg, ()->assertTrue(g.contains(triple2)) );
-
- Txn.executeWrite(dsg, ()->g.add(triple3));
- Txn.executeRead(dsgOld, ()->assertFalse(dsgOld.getDefaultGraph().contains(triple3)) );
- }
-
- @Test public void compact_prefixes_3() {
- // prefixes axcross compaction.
- DatasetGraph dsg = DatabaseMgr.connectDatasetGraph(DIR);
- Graph g = dsg.getDefaultGraph();
- Txn.executeWrite(dsg, ()-> g.getPrefixMapping().setNsPrefix("ex", "http://example/") );
-
- DatasetGraphSwitchable dsgs = (DatasetGraphSwitchable)dsg;
- DatasetGraph dsg1 = dsgs.get();
- Location loc1 = ((DatasetGraphTDB)dsg1).getLocation();
-
- DatabaseMgr.compact(dsg);
-
- Txn.executeRead(dsg, ()-> {
- assertEquals("ex", g.getPrefixMapping().getNsURIPrefix("http://example/"));
- assertEquals("http://example/", g.getPrefixMapping().getNsPrefixURI("ex"));
- }) ;
-
- // Check is not attached to the old graph.
- DatasetGraph dsgOld = StoreConnection.connectCreate(loc1).getDatasetGraph();
-
- Txn.executeWrite(dsgOld, ()->dsgOld.getDefaultGraph().getPrefixMapping().removeNsPrefix("ex"));
- Txn.executeRead(dsg, ()->assertEquals("http://example/", g.getPrefixMapping().getNsPrefixURI("ex")));
-
- Txn.executeWrite(dsg, ()->g.getPrefixMapping().setNsPrefix("ex2", "http://exampl2/") );
- Txn.executeRead(dsgOld, ()->assertNull(dsgOld.getDefaultGraph().getPrefixMapping().getNsPrefixURI("ex")));
- }
-
- @Test public void backup_1() {
- DatasetGraph dsg = DatabaseMgr.connectDatasetGraph(DIR);
- Txn.executeWrite(dsg, ()-> {
- dsg.add(quad2) ;
- dsg.add(quad1) ;
- }) ;
- String file1 = DatabaseMgr.backup(dsg);
- DatasetGraph dsg2 = RDFDataMgr.loadDatasetGraph(file1);
- Txn.executeRead(dsg, ()-> {
- assertTrue(dsg.contains(quad1)) ;
- assertEquals(2, dsg.getDefaultGraph().size());
- assertTrue(dsg2.getDefaultGraph().isIsomorphicWith(dsg.getDefaultGraph()));
- }) ;
- String file2 = DatabaseMgr.backup(dsg);
- assertNotEquals(file1, file2);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestOps.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestOps.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestOps.java
deleted file mode 100644
index f2a8636..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestOps.java
+++ /dev/null
@@ -1,32 +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.seaborne.tdb2.sys;
-
-import org.seaborne.dboe.base.block.FileMode ;
-import org.seaborne.tdb2.sys.SystemTDB ;
-
-public class TestOps
-{
- public static void setFileMode(FileMode mode)
- {
- SystemTDB.internalSetFileMode(mode) ;
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestSys.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestSys.java b/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestSys.java
deleted file mode 100644
index e9cf1ba..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/seaborne/tdb2/sys/TestSys.java
+++ /dev/null
@@ -1,33 +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.seaborne.tdb2.sys;
-
-
-import static org.junit.Assert.*;
-import org.junit.Test ;
-import org.seaborne.tdb2.TDB2 ;
-
-public class TestSys
-{
- @Test public void sys1()
- {
- assertNotNull(TDB2.VERSION) ;
- assertNotNull(TDB2.BUILD_DATE) ;
- }
-}