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 2013/08/09 19:12:07 UTC
svn commit: r1512403 - in /jena/trunk/jena-tdb: ./
src/test/java/com/hp/hpl/jena/tdb/index/
Author: andy
Date: Fri Aug 9 17:12:06 2013
New Revision: 1512403
URL: http://svn.apache.org/r1512403
Log:
Add publishing of test artifact.
Restructure tests so they can be used by other systems.
Added:
jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/AbstractTestTupleIndex.java
jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecordDirect.java
- copied, changed from r1512331, jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecord.java
Modified:
jena/trunk/jena-tdb/pom.xml
jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TS_Index.java
jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecord.java
jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleTable.java
Modified: jena/trunk/jena-tdb/pom.xml
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/pom.xml?rev=1512403&r1=1512402&r2=1512403&view=diff
==============================================================================
--- jena/trunk/jena-tdb/pom.xml (original)
+++ jena/trunk/jena-tdb/pom.xml Fri Aug 9 17:12:06 2013
@@ -123,24 +123,21 @@
<executions>
<execution>
<id>attach-sources</id>
- <!-- <phase>package</phase> package is the default -->
+ <!-- <phase>package</phase> package is the default -->
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
- <!-- Don't release test support code
<execution>
<id>attach-sources-test</id>
<goals>
<goal>test-jar-no-fork</goal>
</goals>
</execution>
- -->
</executions>
</plugin>
- <!-- Don't release test code
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
@@ -152,8 +149,7 @@
</execution>
</executions>
</plugin>
- -->
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Added: jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/AbstractTestTupleIndex.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/AbstractTestTupleIndex.java?rev=1512403&view=auto
==============================================================================
--- jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/AbstractTestTupleIndex.java (added)
+++ jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/AbstractTestTupleIndex.java Fri Aug 9 17:12:06 2013
@@ -0,0 +1,270 @@
+/*
+ * 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 com.hp.hpl.jena.tdb.index;
+
+
+import java.util.Iterator ;
+import java.util.Set ;
+
+import org.apache.jena.atlas.iterator.Iter ;
+import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.atlas.lib.Tuple ;
+import org.junit.Test ;
+
+import com.hp.hpl.jena.tdb.store.NodeId ;
+
+/** Test TupleIndexes (general) */
+public abstract class AbstractTestTupleIndex extends BaseTest
+{
+ protected static NodeId n1 = new NodeId(1) ;
+ protected static NodeId n2 = new NodeId(2) ;
+ protected static NodeId n3 = new NodeId(3) ;
+ protected static NodeId n4 = new NodeId(0x4040404040404040L) ;
+ protected static NodeId n5 = new NodeId(0x5555555555555555L) ;
+ protected static NodeId n6 = new NodeId(0x6666666666666666L) ;
+
+ protected abstract TupleIndex create(String description) ;
+
+ protected static void add(TupleIndex index, NodeId x1, NodeId x2, NodeId x3)
+ {
+ Tuple<NodeId> tuple = Tuple.create(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.create(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.create(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.create(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.create(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.create(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.create(n1, n2, n3))) ;
+ assertFalse(x.contains(Tuple.create(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.create(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.create(n1, n2, n3))) ;
+ assertTrue(x.contains(Tuple.create(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.create(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.create(n1, n2, n3))) ;
+ assertTrue(x.contains(Tuple.create(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.create(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.create(n1, n2, n3))) ;
+ }
+
+ {
+ Tuple<NodeId> tuple2 = Tuple.create(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.create(n2, n3, n4))) ;
+ }
+ }
+
+ @Test public void TupleIndexRecordPOS_1()
+ {
+ TupleIndex index = create("POS") ;
+ add(index, n1, n2, n3) ;
+ Tuple<NodeId> tuple2 = Tuple.create(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.create(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.create(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.create(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.create(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.create(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.create(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.create(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.create(n1, null, n6) ;
+ Iterator<Tuple<NodeId>> iter = index.find(tuple2) ;
+ assertFalse(iter.hasNext()) ;
+ }
+
+
+}
Modified: jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TS_Index.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TS_Index.java?rev=1512403&r1=1512402&r2=1512403&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TS_Index.java (original)
+++ jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TS_Index.java Fri Aug 9 17:12:06 2013
@@ -35,6 +35,7 @@ import com.hp.hpl.jena.tdb.index.ext.Tes
TestExtHash.class,
TestTupleIndexRecord.class,
+ TestTupleIndexRecordDirect.class,
TestTupleTable.class
} )
Modified: jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecord.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecord.java?rev=1512403&r1=1512402&r2=1512403&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecord.java (original)
+++ jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecord.java Fri Aug 9 17:12:06 2013
@@ -19,307 +19,22 @@
package com.hp.hpl.jena.tdb.index;
-import java.util.Iterator ;
-import java.util.Set ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.junit.BaseTest ;
import org.apache.jena.atlas.lib.ColumnMap ;
-import org.apache.jena.atlas.lib.Tuple ;
-import org.apache.jena.atlas.logging.Log ;
-import org.junit.Test ;
import com.hp.hpl.jena.tdb.base.file.FileSet ;
import com.hp.hpl.jena.tdb.base.record.RecordFactory ;
-import com.hp.hpl.jena.tdb.store.NodeId ;
import com.hp.hpl.jena.tdb.sys.SystemTDB ;
-public class TestTupleIndexRecord extends BaseTest
+public class TestTupleIndexRecord extends AbstractTestTupleIndex
{
- static { Log.setLog4j() ; }
-
static RecordFactory factory = new RecordFactory(3*SystemTDB.SizeOfNodeId, 0) ;
- static NodeId n1 = new NodeId(1) ;
- static NodeId n2 = new NodeId(2) ;
- static NodeId n3 = new NodeId(3) ;
- static NodeId n4 = new NodeId(0x4040404040404040L) ;
- static NodeId n5 = new NodeId(0x5555555555555555L) ;
- static NodeId n6 = new NodeId(0x6666666666666666L) ;
- static TupleIndexRecord create(String description)
+ @Override
+ protected TupleIndexRecord create(String description)
{
RangeIndex rIdx = IndexBuilder.mem().newRangeIndex(FileSet.mem(), factory) ;
ColumnMap cmap = new ColumnMap("SPO", description) ;
TupleIndexRecord index = new TupleIndexRecord(3, cmap, description, factory, rIdx) ;
return index ;
}
-
- static void add(TupleIndexRecord index, NodeId x1, NodeId x2, NodeId x3)
- {
- Tuple<NodeId> tuple = Tuple.create(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.create(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.create(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.create(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.create(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.create(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.create(n1, n2, n3))) ;
- assertFalse(x.contains(Tuple.create(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.create(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.create(n1, n2, n3))) ;
- assertTrue(x.contains(Tuple.create(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.create(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.create(n1, n2, n3))) ;
- assertTrue(x.contains(Tuple.create(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.create(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.create(n1, n2, n3))) ;
- }
-
- {
- Tuple<NodeId> tuple2 = Tuple.create(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.create(n2, n3, n4))) ;
- }
- }
-
- @Test public void TupleIndexRecordPOS_1()
- {
- TupleIndexRecord index = create("POS") ;
- add(index, n1, n2, n3) ;
-
-// {
-// Iterator<Tuple<NodeId>> iter = index.all() ;
-// for ( ; iter.hasNext() ; )
-// System.out.println(iter.next()) ;
-// }
-
- Tuple<NodeId> tuple2 = Tuple.create(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.create(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.create(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.create(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.create(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.create(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.create(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.create(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.create(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.create(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.create(n1, null, n6) ;
- Iterator<Tuple<NodeId>> iter = index.findOrPartialScan(tuple2) ;
- assertFalse(iter.hasNext()) ;
- }
-
-
}
Copied: jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecordDirect.java (from r1512331, jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecord.java)
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecordDirect.java?p2=jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecordDirect.java&p1=jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecord.java&r1=1512331&r2=1512403&rev=1512403&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecord.java (original)
+++ jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleIndexRecordDirect.java Fri Aug 9 17:12:06 2013
@@ -26,7 +26,6 @@ import org.apache.jena.atlas.iterator.It
import org.apache.jena.atlas.junit.BaseTest ;
import org.apache.jena.atlas.lib.ColumnMap ;
import org.apache.jena.atlas.lib.Tuple ;
-import org.apache.jena.atlas.logging.Log ;
import org.junit.Test ;
import com.hp.hpl.jena.tdb.base.file.FileSet ;
@@ -34,10 +33,8 @@ import com.hp.hpl.jena.tdb.base.record.R
import com.hp.hpl.jena.tdb.store.NodeId ;
import com.hp.hpl.jena.tdb.sys.SystemTDB ;
-public class TestTupleIndexRecord extends BaseTest
+public class TestTupleIndexRecordDirect extends BaseTest
{
- static { Log.setLog4j() ; }
-
static RecordFactory factory = new RecordFactory(3*SystemTDB.SizeOfNodeId, 0) ;
static NodeId n1 = new NodeId(1) ;
static NodeId n2 = new NodeId(2) ;
@@ -185,13 +182,6 @@ public class TestTupleIndexRecord extend
{
TupleIndexRecord index = create("POS") ;
add(index, n1, n2, n3) ;
-
-// {
-// Iterator<Tuple<NodeId>> iter = index.all() ;
-// for ( ; iter.hasNext() ; )
-// System.out.println(iter.next()) ;
-// }
-
Tuple<NodeId> tuple2 = Tuple.create(n1, n2, n3) ;
Iterator<Tuple<NodeId>> iter = index.findByIndex(tuple2) ;
assertTrue("Can't find tuple", iter.hasNext()) ;
Modified: jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleTable.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleTable.java?rev=1512403&r1=1512402&r2=1512403&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleTable.java (original)
+++ jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/index/TestTupleTable.java Fri Aug 9 17:12:06 2013
@@ -48,9 +48,9 @@ public class TestTupleTable extends Base
static private TupleTable create()
{
- TupleIndex idxSPO = TestTupleIndexRecord.create("SPO") ;
- TupleIndex idxPOS = TestTupleIndexRecord.create("POS") ;
- TupleIndex idxOSP = TestTupleIndexRecord.create("OSP") ;
+ 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 ;
@@ -58,7 +58,7 @@ public class TestTupleTable extends Base
static private TupleTable create2()
{
- TupleIndex idxSPO = TestTupleIndexRecord.create("SPO") ;
+ TupleIndex idxSPO = TestTupleIndexRecordDirect.create("SPO") ;
TupleIndex x[] = { idxSPO } ;
TupleTable table = new TupleTable(3, x) ;
return table ;