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:34:24 UTC
[38/65] [abbrv] jena git commit: JENA-1397: Rename java packages
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/buffer/TestPtrBuffer.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/buffer/TestPtrBuffer.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/buffer/TestPtrBuffer.java
deleted file mode 100644
index 0cafa40..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/buffer/TestPtrBuffer.java
+++ /dev/null
@@ -1,316 +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.dboe.base.buffer;
-
-import java.nio.ByteBuffer ;
-
-import org.junit.AfterClass ;
-import org.junit.Assert ;
-import org.junit.BeforeClass ;
-import org.junit.Test ;
-import org.seaborne.dboe.sys.SystemIndex ;
-
-public class TestPtrBuffer extends Assert
-{
- static boolean originalNullOut ;
- @BeforeClass static public void beforeClass()
- {
- originalNullOut = SystemIndex.getNullOut() ;
- SystemIndex.setNullOut(true) ;
- }
-
- @AfterClass static public void afterClass()
- {
- SystemIndex.setNullOut(originalNullOut) ;
- }
-
- // Testing the test framework!
- @Test public void ptrbuffer01()
- {
- PtrBuffer pb = make(4) ;
- contains(pb, 2, 4, 6, 8) ;
- }
-
- // No BinarySearch test
-
- // Shift at LHS
- @Test public void ptrbuffer03()
- {
- PtrBuffer pb = make(4,5) ;
- contains(pb, 2, 4, 6, 8) ;
-
- pb.shiftUp(0) ;
- pb.set(0, 99) ;
- contains(pb, 99, 2, 4, 6, 8) ;
-
- pb.shiftDown(0) ;
- contains(pb, 2, 4, 6, 8) ;
- }
-
- @Test public void ptrbuffer04()
- {
- PtrBuffer pb = make(4,5) ;
- contains(pb, 2, 4, 6, 8) ;
- pb.shiftDown(0) ;
-
- contains(pb, 4, 6, 8) ;
- pb.shiftUp(0) ;
-
- pb.set(0,1) ;
- contains(pb, 1, 4, 6, 8) ;
- }
-
-
- // Shift at middle
- @Test public void ptrbuffer05()
- {
- PtrBuffer pb = make(4,5) ;
- contains(pb, 2, 4, 6, 8) ;
- pb.shiftUp(2) ;
- pb.set(2, 0) ;
- contains(pb, 2, 4, 0, 6, 8) ;
- pb.shiftDown(2) ;
- contains(pb, 2, 4, 6, 8) ;
- }
-
- @Test public void ptrbuffer06()
- {
- PtrBuffer pb = make(4,5) ;
- contains(pb, 2, 4, 6, 8) ;
- pb.shiftDown(2) ;
- contains(pb, 2, 4, 8) ;
- pb.shiftUp(2) ;
- assertTrue(pb.isClear(2)) ;
- contains(pb, 2, 4, -1, 8) ;
- }
-
- // Shift RHS - out of bounds
- @Test public void ptrbuffer07()
- {
- PtrBuffer pb = make(4,5) ;
- contains(pb, 2, 4, 6, 8) ;
- pb.shiftUp(3) ;
- pb.set(3, 1) ;
- contains(pb, 2, 4, 6, 1, 8) ;
- pb.shiftDown(3) ;
- contains(pb, 2, 4, 6, 8) ;
- }
-
- @Test public void ptrbuffer08()
- {
- PtrBuffer pb = make(4,5) ;
- contains(pb, 2, 4, 6, 8) ;
- pb.shiftDown(3) ;
- contains(pb, 2, 4, 6) ;
- pb.shiftUp(2) ;
- contains(pb, 2, 4, -1, 6) ;
- }
-
- // Errors - IllegalArgumentException
- @Test(expected=BufferException.class)
- public void ptrbuffer09()
- {
- PtrBuffer pb = make(4,5) ;
- contains(pb, 2, 4, 6, 8) ;
- pb.shiftDown(4) ;
- }
-
- @Test(expected=BufferException.class)
- public void ptrbuffer10()
- {
- PtrBuffer pb = make(4,5) ;
- contains(pb, 2, 4, 6, 8) ;
- pb.shiftUp(4) ;
- }
-
- @Test(expected=BufferException.class)
- public void ptrbuffer11()
- {
- PtrBuffer pb = make(5,5) ;
- contains(pb, 2, 4, 6, 8, 10) ;
- pb.add(12) ;
- }
-
- // Copy, duplicate, clear
- @Test public void ptrbuffer12()
- {
- PtrBuffer pb = make(5,5) ;
- contains(pb, 2, 4, 6, 8, 10) ;
- PtrBuffer pb2 = pb.duplicate() ;
- pb2.set(1, 99) ;
- contains(pb, 2, 4, 6, 8, 10) ;
- contains(pb2, 2, 99, 6, 8, 10) ;
- }
-
- @Test public void ptrbuffer13()
- {
- PtrBuffer pb = make(5,5) ;
- contains(pb, 2, 4, 6, 8, 10) ;
- pb.clear(1, 3) ;
- contains(pb, 2, -1, -1, -1, 10) ;
- }
-
- @Test public void ptrbuffer14()
- {
- PtrBuffer pb = make(5,5) ;
- contains(pb, 2, 4, 6, 8, 10) ;
-
- PtrBuffer pb2 = make(5,5) ;
- contains(pb2, 2, 4, 6, 8, 10) ;
-
- pb.copy(0, pb2, 1, 4) ;
- contains(pb2, 2, 2, 4, 6, 8) ;
- }
-
- // Remove tests
-
- @Test public void ptrbuffer15()
- {
- PtrBuffer pb = make(5,5) ;
- contains(pb, 2, 4, 6, 8, 10) ;
- pb.removeTop() ;
- contains(pb, 2, 4, 6, 8) ;
- pb.remove(1) ;
- contains(pb, 2, 6, 8) ;
- pb.remove(2) ;
- contains(pb, 2, 6) ;
- pb.remove(0) ;
- contains(pb, 6) ;
- pb.remove(0) ;
- contains(pb) ;
- }
-
- @Test public void ptrbuffer20()
- {
- PtrBuffer pb1 = make(5,5) ;
- contains(pb1, 2, 4, 6, 8, 10) ;
- PtrBuffer pb2 = make(0,5) ;
- contains(pb2) ;
-
- pb1.shiftRight(pb2) ;
- contains(pb1, 2, 4, 6, 8) ;
- contains(pb2, 10) ;
- }
-
- @Test public void ptrbuffer21()
- {
- PtrBuffer pb1 = make(3,5) ;
- contains(pb1, 2, 4, 6) ;
- PtrBuffer pb2 = make(0,5) ;
- contains(pb2) ;
-
- pb1.shiftRight(pb2) ;
- contains(pb1, 2, 4) ;
- contains(pb2, 6) ;
- }
-
- @Test public void ptrbuffer22()
- {
- PtrBuffer pb1 = make(3,5) ;
- contains(pb1, 2, 4, 6) ;
- PtrBuffer pb2 = make(2,5) ;
- contains(pb2, 2, 4) ;
-
- pb1.shiftRight(pb2) ;
- contains(pb1, 2, 4) ;
- contains(pb2, 6, 2, 4) ;
- }
-
- @Test public void ptrbuffer24()
- {
- PtrBuffer pb1 = make(0,5) ;
- contains(pb1) ;
- PtrBuffer pb2 = make(5,5) ;
- contains(pb2, 2, 4, 6, 8, 10) ;
-
- pb1.shiftLeft(pb2) ;
- contains(pb1, 2) ;
- contains(pb2, 4, 6, 8, 10) ;
- }
-
- @Test public void ptrbuffer25()
- {
- PtrBuffer pb1 = make(0,5) ;
- contains(pb1) ;
- PtrBuffer pb2 = make(3,5) ;
- contains(pb2, 2, 4, 6) ;
-
- pb1.shiftLeft(pb2) ;
- contains(pb1, 2) ;
- contains(pb2, 4, 6) ;
- }
-
- @Test public void ptrbuffer26()
- {
- PtrBuffer pb1 = make(2,5) ;
- contains(pb1, 2, 4) ;
- PtrBuffer pb2 = make(3,5) ;
- contains(pb2, 2, 4, 6) ;
-
- pb1.shiftLeft(pb2) ;
- contains(pb1, 2, 4, 2) ;
- contains(pb2, 4, 6) ;
- }
-
- @Test public void ptrbuffer27()
- {
- PtrBuffer pb1 = make(2,4) ;
- PtrBuffer pb2 = make(2,4) ;
- pb1.copyToTop(pb2) ;
- contains(pb2, 2,4,2,4) ;
- }
-
- @Test public void ptrbuffer28()
- {
- PtrBuffer pb1 = make(0,5) ;
- PtrBuffer pb2 = make(2,4) ;
- pb1.copyToTop(pb2) ;
- contains(pb2, 2,4) ;
- }
-
- @Test public void ptrbuffer29()
- {
- PtrBuffer pb1 = make(0,5) ;
- PtrBuffer pb2 = make(2,4) ;
- pb2.copyToTop(pb1) ;
- contains(pb1, 2,4) ;
- }
-
- // ---- Support
- private static void contains(PtrBuffer pb, int... vals)
- {
- assertEquals("Length mismatch: ", vals.length, pb.size()) ;
- for ( int i = 0 ; i < vals.length ; i++ )
- if ( vals[i] == -1 )
- assertTrue(pb.isClear(i)) ;
- else
- assertEquals("Value mismatch: ", vals[i], pb.get(i)) ;
- }
-
- // Make : 2,4,6,8, ..
- private static PtrBuffer make(int n) { return make(n,n) ; }
- private static PtrBuffer make(int n, int len)
- {
- ByteBuffer bb = ByteBuffer.allocate(4*len) ;
- PtrBuffer pb = new PtrBuffer(bb, 0) ;
- for ( int i = 0 ; i < n ; i++ )
- pb.add(2+2*i) ;
- return pb ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/buffer/TestRecordBuffer.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/buffer/TestRecordBuffer.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/buffer/TestRecordBuffer.java
deleted file mode 100644
index 7e3a9a5..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/buffer/TestRecordBuffer.java
+++ /dev/null
@@ -1,346 +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.dboe.base.buffer;
-
-import static org.seaborne.dboe.test.RecordLib.intToRecord ;
-import static org.seaborne.dboe.test.RecordLib.r ;
-
-import java.util.Iterator ;
-import java.util.List ;
-
-import org.junit.Assert ;
-import org.junit.AfterClass ;
-import org.junit.BeforeClass ;
-import org.junit.Test ;
-import org.seaborne.dboe.base.buffer.BufferException ;
-import org.seaborne.dboe.base.buffer.RecordBuffer ;
-import org.seaborne.dboe.base.record.Record ;
-import org.seaborne.dboe.base.record.RecordFactory ;
-import org.seaborne.dboe.sys.SystemIndex ;
-import org.seaborne.dboe.test.RecordLib ;
-
-public class TestRecordBuffer extends Assert
-{
- static RecordFactory recordFactory = new RecordFactory(RecordLib.TestRecordLength, 0) ;
-
- static boolean originalNullOut ;
- @BeforeClass static public void beforeClass()
- {
- originalNullOut = SystemIndex.getNullOut() ;
- SystemIndex.setNullOut(true) ;
- }
-
- @AfterClass static public void afterClass()
- {
- SystemIndex.setNullOut(originalNullOut) ;
- }
-
- @Test public void recBuffer01()
- {
- RecordBuffer rb = make(4, 4) ;
- contains(rb, 2, 4, 6, 8) ;
- }
-
- @Test public void recBuffer02()
- {
- RecordBuffer rb = make(4, 4) ;
- int idx = -1 ;
- idx = find(rb, 6) ;
- assertEquals(2, idx) ;
- idx = find(rb, 8) ;
-
- assertEquals(3, idx) ;
- idx = find(rb, 4) ;
- assertEquals(1, idx) ;
- idx = find(rb, 2) ;
- assertEquals(0, idx) ;
-
- idx = find(rb, 3) ;
- assertEquals(-2, idx) ;
- idx = find(rb, 0) ;
- assertEquals(-1, idx) ;
- idx = find(rb, 10) ;
- assertEquals(-5, idx) ;
- }
-
- // Shift at LHS
- @Test public void recBuffer03()
- {
- RecordBuffer rb = make(4,5) ;
- contains(rb, 2, 4, 6, 8) ;
- rb.shiftUp(0) ;
- rb.set(0, r(0)) ;
- contains(rb, 0, 2, 4, 6, 8) ;
- rb.shiftDown(0) ;
- contains(rb, 2, 4, 6, 8) ;
- }
-
- @Test public void recBuffer04()
- {
- RecordBuffer rb = make(4,5) ;
- contains(rb, 2, 4, 6, 8) ;
- rb.shiftDown(0) ;
-
- contains(rb, 4, 6, 8) ;
- rb.shiftUp(0) ;
-
- rb.set(0,r(1)) ;
- contains(rb, 1, 4, 6, 8) ;
- }
-
-
- // Shift at middle
- @Test public void recBuffer05()
- {
- RecordBuffer rb = make(4,5) ;
- contains(rb, 2, 4, 6, 8) ;
- rb.shiftUp(2) ;
- rb.set(2, r(0)) ;
- contains(rb, 2, 4, 0, 6, 8) ;
- rb.shiftDown(2) ;
- contains(rb, 2, 4, 6, 8) ;
- }
-
- @Test public void recBuffer06()
- {
- RecordBuffer rb = make(4,5) ;
- contains(rb, 2, 4, 6, 8) ;
- rb.shiftDown(2) ;
- contains(rb, 2, 4, 8) ;
- rb.shiftUp(2) ;
- contains(rb, 2, 4, -1, 8) ;
- }
-
- // Shift RHS - out of bounds
- @Test public void recBuffer07()
- {
- RecordBuffer rb = make(4,5) ;
- contains(rb, 2, 4, 6, 8) ;
- rb.shiftUp(3) ;
- rb.set(3, r(1)) ;
- contains(rb, 2, 4, 6, 1, 8) ;
- rb.shiftDown(3) ;
- contains(rb, 2, 4, 6, 8) ;
- }
-
- @Test public void recBuffer08()
- {
- RecordBuffer rb = make(4,5) ;
- contains(rb, 2, 4, 6, 8) ;
- rb.shiftDown(3) ;
- contains(rb, 2, 4, 6) ;
- rb.shiftUp(2) ;
- contains(rb, 2, 4, -1, 6) ;
- }
-
- // Errors
-
- @Test(expected=BufferException.class)
- public void recBuffer09()
- {
- RecordBuffer rb = make(4,5) ;
- contains(rb, 2, 4, 6, 8) ;
- rb.shiftDown(4) ;
- }
-
- @Test(expected=BufferException.class)
- public void recBuffer10()
- {
- RecordBuffer rb = make(4,5) ;
- contains(rb, 2, 4, 6, 8) ;
- rb.shiftUp(4) ;
- }
-
- @Test(expected=BufferException.class)
- public void recBuffer11()
- {
- RecordBuffer rb = make(5,5) ;
- contains(rb, 2, 4, 6, 8, 10) ;
- rb.add(r(12)) ;
- }
-
- // Copy, duplicate, clear
- @Test public void recBuffer12()
- {
- RecordBuffer rb = make(5,5) ;
- contains(rb, 2, 4, 6, 8, 10) ;
- RecordBuffer rb2 = rb.duplicate() ;
- rb2.set(1, r(99)) ;
- contains(rb, 2, 4, 6, 8, 10) ;
- contains(rb2, 2, 99, 6, 8, 10) ;
- }
-
- @Test public void recBuffer13()
- {
- RecordBuffer rb = make(5,5) ;
- contains(rb, 2, 4, 6, 8, 10) ;
- rb.clear(1, 3) ;
- contains(rb, 2, -1, -1, -1, 10) ;
- }
-
- @Test public void recBuffer14()
- {
- RecordBuffer rb = make(5,5) ;
- contains(rb, 2, 4, 6, 8, 10) ;
- RecordBuffer rb2 = make(5,5) ;
- contains(rb2, 2, 4, 6, 8, 10) ;
- rb.copy(0, rb2, 1, 4) ;
- contains(rb2, 2, 2, 4, 6, 8) ;
- }
-
- // Remove tests
-
- @Test public void recBuffer15()
- {
- RecordBuffer rb = make(5,5) ;
- contains(rb, 2, 4, 6, 8, 10) ;
- rb.removeTop() ;
- contains(rb, 2, 4, 6, 8) ;
- rb.remove(1) ;
- contains(rb, 2, 6, 8) ;
- rb.remove(2) ;
- contains(rb, 2, 6) ;
- rb.remove(0) ;
- contains(rb, 6) ;
- rb.remove(0) ;
- contains(rb) ;
- }
-
- @Test public void recBufferIterate01()
- {
- RecordBuffer rb = make(5,5) ;
- same(rb.iterator(), 2,4,6,8,10) ;
- }
-
- @Test public void recBufferIterate02()
- {
- RecordBuffer rb = make(3,5) ;
- Iterator<Record> iter = rb.iterator() ;
- same(iter, 2, 4, 6) ;
- }
-
- @Test public void recBufferIterate03()
- {
- RecordBuffer rb = make(3,5) ;
- Iterator<Record> iter = rb.iterator( intToRecord(4), null) ;
- same(iter, 4, 6) ;
- }
-
- @Test public void recBufferIterate04()
- {
- RecordBuffer rb = make(3,5) ;
- Iterator<Record> iter = rb.iterator( intToRecord(3), null) ;
- same(iter, 4, 6) ;
- }
-
- @Test public void recBufferIterate05()
- {
- RecordBuffer rb = make(3,5) ;
- Iterator<Record> iter = rb.iterator( intToRecord(1), null) ;
- same(iter, 2, 4, 6) ;
- }
-
- @Test public void recBufferIterate06()
- {
- RecordBuffer rb = make(3,5) ;
- Iterator<Record> iter = rb.iterator( null, intToRecord(1)) ;
- same(iter) ;
- }
-
- @Test public void recBufferIterate07()
- {
- RecordBuffer rb = make(3,5) ;
- Iterator<Record> iter = rb.iterator( null, intToRecord(2)) ;
- same(iter ) ;
- }
-
- @Test public void recBufferIterate08()
- {
- RecordBuffer rb = make(3,5) ;
- Iterator<Record> iter = rb.iterator( null, intToRecord(3)) ;
- same(iter,2 ) ;
- }
-
- @Test public void recBufferIterate09()
- {
- RecordBuffer rb = make(5,5) ;
- Iterator<Record> iter = rb.iterator( null, intToRecord(99)) ;
- same(iter, 2, 4, 6, 8, 10) ;
- }
-
- @Test public void recBufferIterate10()
- {
- RecordBuffer rb = make(5,5) ;
- Iterator<Record> iter = rb.iterator( intToRecord(4), intToRecord(8)) ;
- same(iter, 4, 6 ) ;
- }
-
- @Test public void recBufferIterate11()
- {
- RecordBuffer rb = make(5,5) ;
- Iterator<Record> iter = rb.iterator( intToRecord(3), intToRecord(9)) ;
- same(iter, 4, 6, 8 ) ;
- }
-
- // ---- Support
- private static void contains(RecordBuffer rb, int... vals)
- {
- assertEquals("Length mismatch: ", vals.length, rb.size()) ;
-
- for ( int i = 0 ; i < vals.length ; i++ )
- if ( vals[i] == -1 )
- assertTrue(rb.isClear(i)) ;
- else
- {
- Record r = RecordLib.intToRecord(vals[i]) ;
- Record r2 = rb.get(i) ;
- int x = RecordLib.recordToInt(r2) ;
- assertEquals("Value mismatch: ", vals[i], x) ;
- }
- }
-
- private static void same(Iterator<Record> iter, int... vals)
- {
- List<Integer> list = RecordLib.toIntList(iter) ;
- assertEquals("Length mismatch: ", vals.length, list.size()) ;
-
- for ( int i = 0 ; i < vals.length ; i++ )
- {
- int x = list.get(i) ;
- assertEquals("Value mismatch: ", vals[i], x) ;
- }
- }
-
-
- public int find(RecordBuffer rb, int v)
- {
- return rb.find(r(v)) ;
- }
-
- private static RecordBuffer make(int n, int len)
- {
- RecordBuffer rb = new RecordBuffer(recordFactory, len) ;
- for ( int i = 0 ; i < n ; i++ )
- {
- Record r = RecordLib.intToRecord(2*i+2) ;
- rb.add(r) ;
- }
- return rb ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestBinaryDataFile.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestBinaryDataFile.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestBinaryDataFile.java
deleted file mode 100644
index 1e68246..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestBinaryDataFile.java
+++ /dev/null
@@ -1,84 +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.dboe.base.file;
-
-import org.apache.jena.atlas.lib.StrUtils ;
-import org.junit.After ;
-import org.junit.Before ;
-import org.junit.Test ;
-import org.seaborne.dboe.base.file.BinaryDataFile ;
-import static org.junit.Assert.* ;
-
-public abstract class AbstractTestBinaryDataFile {
- private BinaryDataFile file ;
- protected abstract BinaryDataFile createBinaryDataFile() ;
-
- static final String stringData = "Hello world\n";
- static final byte[] data = StrUtils.asUTF8bytes(stringData) ;
-
- // Default action.
- protected void releaseBinaryDataFile(BinaryDataFile file) {
- file.close() ;
- }
-
- @Before public void before() {
- file = createBinaryDataFile() ;
- file.open();
- file.truncate(0) ;
- }
-
- @After public void after() {
- releaseBinaryDataFile(file) ;
- }
-
- @Test public void basic_open() {
- assertTrue(file.isOpen()) ;
- }
-
- @Test public void basic_open_close() {
- assertTrue(file.isOpen()) ;
- file.close() ;
- assertFalse(file.isOpen()) ;
- }
-
- @Test public void writeread_01() {
- assertEquals(0, file.length()) ;
- }
-
- @Test public void writeread_02() {
- assertEquals(0, file.length()) ;
- file.write(data);
- assertNotEquals(0, file.length()) ;
- assertEquals(data.length, file.length()) ;
- }
-
- @Test public void writeread_03() {
- long x = file.write(data);
- byte[] data2 = new byte[data.length+100] ;
- int x1 = file.read(x, data2) ;
- assertEquals(data.length, x1) ;
- int x2 = file.read(data.length, data2) ;
- assertEquals(-1, x2) ;
- }
-
-
-
-}
-
-
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestBlockAccessFixedSize.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestBlockAccessFixedSize.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestBlockAccessFixedSize.java
deleted file mode 100644
index 026e1ee..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestBlockAccessFixedSize.java
+++ /dev/null
@@ -1,102 +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.dboe.base.file;
-
-import static org.seaborne.dboe.test.BufferTestLib.sameValue ;
-import org.junit.Assert ;
-import org.junit.After ;
-import org.junit.Before ;
-import org.junit.Test ;
-import org.seaborne.dboe.base.block.Block ;
-import org.seaborne.dboe.base.file.BlockAccess ;
-import org.seaborne.dboe.base.file.FileException ;
-
-public abstract class AbstractTestBlockAccessFixedSize extends Assert
-{
- // Fixed block tests.
-
- int blkSize ;
-
- protected AbstractTestBlockAccessFixedSize(int blkSize)
- {
- this.blkSize = blkSize ;
- }
-
- protected abstract BlockAccess make() ;
- protected static Block data(BlockAccess file, int len)
- {
- Block b = file.allocate(len) ;
- for (int i = 0 ; i < len ; i++ )
- b.getByteBuffer().put((byte)(i&0xFF)) ;
- return b ;
- }
-
- private BlockAccess file ;
- @Before public void before() { file = make() ; }
- @After public void after() { file.close() ; }
-
- @Test public void fileaccess_01()
- {
- assertTrue(file.isEmpty()) ;
- }
-
- @Test public void fileaccess_02()
- {
- Block b = data(file, blkSize) ;
- file.write(b) ;
- }
-
- @Test public void fileaccess_03()
- {
- Block b1 = data(file, blkSize) ;
- file.write(b1) ;
- long x = b1.getId() ;
- Block b9 = file.read(x) ;
- assertNotSame(b1, b9) ;
- assertTrue(sameValue(b1, b9)) ;
- b9 = file.read(x) ;
- assertNotSame(b1, b9) ;
- assertTrue(sameValue(b1, b9)) ;
- }
-
- @Test public void fileaccess_04()
- {
- Block b1 = data(file, blkSize) ;
- Block b2 = data(file, blkSize) ;
- file.write(b1) ;
- file.write(b2) ;
-
- long x = b1.getId() ;
- Block b8 = file.read(b1.getId()) ;
- Block b9 = file.read(b1.getId()) ;
- assertNotSame(b8, b9) ;
- assertTrue(b8.getId() == b9.getId()) ;
- }
-
- @Test(expected=FileException.class)
- public void fileaccess_05()
- {
- Block b1 = data(file, 10) ;
- Block b2 = data(file, 20) ;
- file.write(b1) ;
-
- // Should not work. b2 not written.
- Block b2a = file.read(b2.getId()) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestBlockAccessVarSize.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestBlockAccessVarSize.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestBlockAccessVarSize.java
deleted file mode 100644
index 3cdbfa7..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestBlockAccessVarSize.java
+++ /dev/null
@@ -1,50 +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.dboe.base.file;
-
-import org.junit.Test ;
-import org.seaborne.dboe.base.block.Block ;
-import org.seaborne.dboe.base.file.BlockAccess ;
-import static org.seaborne.dboe.test.BufferTestLib.* ;
-
-public abstract class AbstractTestBlockAccessVarSize extends AbstractTestBlockAccessFixedSize
-{
- protected AbstractTestBlockAccessVarSize()
- {
- super(25) ;
- }
-
- @Test
- public void fileaccess_50()
- {
- BlockAccess file = make() ;
- Block b1 = data(file, 10) ;
- Block b2 = data(file, 20) ;
- file.write(b1) ;
- file.write(b2) ;
-
- Block b1a = file.read(b1.getId()) ;
- Block b2a = file.read(b2.getId()) ;
-
- assertNotSame(b1a, b1) ;
- assertNotSame(b2a, b2) ;
- sameValue(b1, b1a) ;
- sameValue(b2, b2a) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestChannel.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestChannel.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestChannel.java
deleted file mode 100644
index a2a8946..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/AbstractTestChannel.java
+++ /dev/null
@@ -1,145 +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.dboe.base.file;
-
-import java.nio.ByteBuffer ;
-
-import org.junit.Assert ;
-import org.junit.After ;
-import org.junit.Before ;
-import org.junit.Test ;
-import org.seaborne.dboe.base.file.BufferChannel ;
-
-public abstract class AbstractTestChannel extends Assert
-{
- protected abstract BufferChannel open() ;
-
- private BufferChannel store ;
- @Before public void before() { store = open() ; }
- @After public void after() { store.close() ; }
-
- static final int blkSize = 100 ;
-
- protected static ByteBuffer data(int len)
- {
- ByteBuffer b = ByteBuffer.allocate(len) ;
- for (int i = 0 ; i < len ; i++ )
- b.put((byte)(i&0xFF)) ;
- b.clear() ;
- return b ;
- }
-
- protected static boolean same(ByteBuffer bb1, ByteBuffer bb2)
- {
- if ( bb1.capacity() != bb2.capacity() ) return false ;
- bb1.clear() ;
- bb2.clear() ;
- for ( int i = 0 ; i < bb1.capacity() ; i++ )
- if ( bb1.get(i) != bb2.get(i) ) return false ;
- return true ;
- }
-
- @Test public void storage_01()
- {
- assertEquals(0, store.size()) ;
- }
-
- @Test public void storage_02()
- {
- ByteBuffer b = data(blkSize) ;
- store.write(b) ;
- long x = store.size() ;
- assertEquals(blkSize, x) ;
- }
-
- @Test public void storage_03()
- {
- ByteBuffer b1 = data(blkSize) ;
- long posn = store.position() ;
- store.write(b1) ;
- ByteBuffer b9 = ByteBuffer.allocate(blkSize) ;
- int r = store.read(b9, posn) ;
- assertEquals(blkSize, r) ;
- assertTrue(same(b1, b9)) ;
- }
-
- @Test public void storage_04()
- {
- ByteBuffer b1 = data(blkSize) ;
- ByteBuffer b2 = data(blkSize/2) ;
-
- store.write(b2, 0) ;
- store.write(b1, 0) ;
-
- assertEquals(blkSize, store.size()) ;
- ByteBuffer b9 = ByteBuffer.allocate(5) ;
- int z = store.read(b9) ;
- assertEquals(5, z) ;
- }
-
- @Test public void storage_05()
- {
- ByteBuffer b1 = data(blkSize) ;
- ByteBuffer b1a = ByteBuffer.allocate(blkSize) ;
- ByteBuffer b2 = data(blkSize/2) ;
- ByteBuffer b2a = ByteBuffer.allocate(blkSize/2) ;
- store.write(b1) ;
- store.write(b2) ;
- store.position(0) ;
- store.read(b1a) ;
- assertTrue(same(b1, b1a)) ;
- store.read(b2a) ;
- assertTrue(same(b2, b2a)) ;
- }
-
- @Test public void storage_06()
- {
- ByteBuffer b1 = data(blkSize) ;
- store.write(b1) ;
- store.truncate(0) ;
- assertEquals(0, store.size()) ;
- // Check for:
- // http://bugs.sun.com/view_bug.do?bug_id=6191269
- assertEquals(0, store.position()) ;
- }
-
- @Test public void storage_07()
- {
- ByteBuffer b1 = data(blkSize) ;
- store.write(b1) ;
- store.position(10) ;
- b1.rewind() ;
- store.write(b1) ;
- assertEquals(blkSize+10, store.size()) ;
- }
-
-
- @Test public void storage_08()
- {
- ByteBuffer b1 = data(blkSize) ;
- ByteBuffer b2 = data(blkSize) ;
- store.write(b1) ;
- store.write(b2) ;
- store.position(10) ;
- b1.rewind() ;
- store.write(b1) ;
- assertEquals(2*blkSize, store.size()) ;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TS_File.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TS_File.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TS_File.java
deleted file mode 100644
index 167490a..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TS_File.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.seaborne.dboe.base.file;
-
-import org.junit.runner.RunWith ;
-import org.junit.runners.Suite ;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
- TestMetaFile.class
- , TestSegmentedMemBuffer.class
- , TestChannelMem.class
- , TestChannelFile.class
-
- , TestBlockAccessMem.class
- , TestBlockAccessByteArray.class
- , TestBlockAccessDirect.class
- , TestBlockAccessMapped.class
-
- , TestBinaryDataMem.class
- , TestBinaryDataFileWriteBufferedMem.class
- , TestBinaryDataRAFInitial.class
- , TestBinaryDataRAF.class
- , TestBinaryDataFileWriteBufferedFile.class
-
- , TestProcessFileLock.class
-})
-
-
-public class TS_File
-{
- public static String FILE = "target/test-read-append-file" ;
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataFileWriteBufferedFile.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataFileWriteBufferedFile.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataFileWriteBufferedFile.java
deleted file mode 100644
index 991723c..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataFileWriteBufferedFile.java
+++ /dev/null
@@ -1,36 +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.dboe.base.file;
-
-import org.apache.jena.atlas.lib.FileOps ;
-import org.seaborne.dboe.base.file.BinaryDataFile ;
-import org.seaborne.dboe.base.file.BinaryDataFileRandomAccess ;
-import org.seaborne.dboe.base.file.BinaryDataFileWriteBuffered ;
-
-public class TestBinaryDataFileWriteBufferedFile extends AbstractTestBinaryDataFile {
- public static String FILE = TS_File.FILE ;
-
- @Override
- protected BinaryDataFile createBinaryDataFile() {
- FileOps.delete(FILE);
- BinaryDataFileRandomAccess file = new BinaryDataFileRandomAccess(FILE) ;
- return new BinaryDataFileWriteBuffered(file) ;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataFileWriteBufferedMem.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataFileWriteBufferedMem.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataFileWriteBufferedMem.java
deleted file mode 100644
index 6ea03bd..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataFileWriteBufferedMem.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.dboe.base.file;
-
-import org.seaborne.dboe.base.file.BinaryDataFile ;
-import org.seaborne.dboe.base.file.BinaryDataFileMem ;
-import org.seaborne.dboe.base.file.BinaryDataFileWriteBuffered ;
-
-public class TestBinaryDataFileWriteBufferedMem extends AbstractTestBinaryDataFile {
- @Override
- protected BinaryDataFile createBinaryDataFile() {
- BinaryDataFileMem file = new BinaryDataFileMem() ;
- return new BinaryDataFileWriteBuffered(file) ;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataMem.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataMem.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataMem.java
deleted file mode 100644
index 5700fe4..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataMem.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.dboe.base.file;
-
-import org.seaborne.dboe.base.file.BinaryDataFile ;
-import org.seaborne.dboe.base.file.BinaryDataFileMem ;
-
-public class TestBinaryDataMem extends AbstractTestBinaryDataFile {
-
- @Override
- protected BinaryDataFile createBinaryDataFile() {
- return new BinaryDataFileMem() ;
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataRAF.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataRAF.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataRAF.java
deleted file mode 100644
index 9d7faa3..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataRAF.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.dboe.base.file;
-
-import org.apache.jena.atlas.lib.FileOps ;
-import org.seaborne.dboe.base.file.BinaryDataFile ;
-import org.seaborne.dboe.base.file.BinaryDataFileRandomAccess ;
-
-public class TestBinaryDataRAF extends AbstractTestBinaryDataFile {
- public static String FILE = TS_File.FILE ;
-
- @Override
- protected BinaryDataFile createBinaryDataFile() {
- FileOps.delete(FILE);
- return new BinaryDataFileRandomAccess(FILE) ;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataRAFInitial.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataRAFInitial.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataRAFInitial.java
deleted file mode 100644
index 6ec007a..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBinaryDataRAFInitial.java
+++ /dev/null
@@ -1,58 +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.dboe.base.file;
-
-import org.apache.jena.atlas.RuntimeIOException ;
-import org.junit.Test ;
-import org.seaborne.dboe.base.file.BinaryDataFileRandomAccess ;
-import static org.junit.Assert.* ;
-
-// Additional tests that do not want the @Before/@After of AbstractTestBinaryDataFile
-public class TestBinaryDataRAFInitial {
- public static String FILE = TS_File.FILE ;
- private BinaryDataFileRandomAccess file ;
-
- @Test public void open_01() {
- file = new BinaryDataFileRandomAccess(FILE) ;
- assertFalse(file.isOpen()) ;
- file.open();
- assertTrue(file.isOpen()) ;
- file.close() ;
- assertFalse(file.isOpen()) ;
- }
-
- @Test (expected=RuntimeIOException.class)
- public void open_02() {
- file = new BinaryDataFileRandomAccess(FILE) ;
- file.open();
- file.close() ;
- file.sync();
- }
-
- @Test (expected=RuntimeIOException.class)
- public void open_03() {
- file = new BinaryDataFileRandomAccess(FILE) ;
- file.open();
- file.close() ;
- file.truncate(0);
- }
-
-
-}
-
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessByteArray.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessByteArray.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessByteArray.java
deleted file mode 100644
index e20be51..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessByteArray.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.dboe.base.file;
-
-import org.seaborne.dboe.base.file.BlockAccess ;
-import org.seaborne.dboe.base.file.BlockAccessByteArray ;
-
-public class TestBlockAccessByteArray extends AbstractTestBlockAccessVarSize
-{
-
- @Override
- protected BlockAccess make()
- {
- return new BlockAccessByteArray("test") ;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessDirect.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessDirect.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessDirect.java
deleted file mode 100644
index ccd4a4c..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessDirect.java
+++ /dev/null
@@ -1,45 +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.dboe.base.file;
-
-import org.apache.jena.atlas.lib.FileOps ;
-import org.junit.AfterClass ;
-import org.seaborne.dboe.ConfigTestDBOE ;
-import org.seaborne.dboe.base.file.BlockAccess ;
-import org.seaborne.dboe.base.file.BlockAccessDirect ;
-
-public class TestBlockAccessDirect extends AbstractTestBlockAccessFixedSize
-{
- static String filename = ConfigTestDBOE.getTestingDir()+"/test-file-access-direct" ;
-
- static final int BlockSize = 50 ;
- public TestBlockAccessDirect()
- {
- super(BlockSize) ;
- }
-
- @AfterClass public static void cleanup() { FileOps.deleteSilent(filename) ; }
-
- @Override
- protected BlockAccess make()
- {
- FileOps.deleteSilent(filename) ;
- return new BlockAccessDirect(filename, BlockSize) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessMapped.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessMapped.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessMapped.java
deleted file mode 100644
index cd77016..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessMapped.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.seaborne.dboe.base.file;
-
-import org.apache.jena.atlas.lib.FileOps ;
-import org.junit.AfterClass ;
-import org.seaborne.dboe.ConfigTestDBOE ;
-import org.seaborne.dboe.base.file.BlockAccess ;
-import org.seaborne.dboe.base.file.BlockAccessMapped ;
-
-public class TestBlockAccessMapped extends AbstractTestBlockAccessFixedSize
-{
- static String filename = ConfigTestDBOE.getTestingDir()+"/test-file-access-mapped" ;
-
- static final int BlockSize = 64 ;
- public TestBlockAccessMapped()
- {
- super(BlockSize) ;
- }
-
- @AfterClass public static void cleanup() { FileOps.deleteSilent(filename) ; }
-
- static int counter = 0 ;
-
- @Override
- protected BlockAccess make()
- {
- String fn = filename + "-"+(counter++) ;
- FileOps.deleteSilent(fn) ;
- return new BlockAccessMapped(fn, BlockSize) ;
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessMem.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessMem.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessMem.java
deleted file mode 100644
index 98de42e..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestBlockAccessMem.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.dboe.base.file;
-
-import org.seaborne.dboe.base.file.BlockAccess ;
-import org.seaborne.dboe.base.file.BlockAccessMem ;
-
-public class TestBlockAccessMem extends AbstractTestBlockAccessFixedSize
-{
- static final int BlockSize = 50 ;
- public TestBlockAccessMem()
- {
- super(BlockSize) ;
- }
-
- @Override
- protected BlockAccess make()
- {
- return new BlockAccessMem("test", BlockSize) ;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestChannelFile.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestChannelFile.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestChannelFile.java
deleted file mode 100644
index 09f999a..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestChannelFile.java
+++ /dev/null
@@ -1,39 +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.dboe.base.file;
-
-import org.apache.jena.atlas.lib.FileOps ;
-import org.junit.AfterClass ;
-import org.seaborne.dboe.ConfigTestDBOE ;
-import org.seaborne.dboe.base.file.BufferChannel ;
-import org.seaborne.dboe.base.file.BufferChannelFile ;
-
-public class TestChannelFile extends AbstractTestChannel
-{
- static String filename = ConfigTestDBOE.getTestingDir()+"/test-storage" ;
-
- @AfterClass public static void cleanup() { FileOps.deleteSilent(filename) ; }
-
- @Override
- protected BufferChannel open()
- {
- FileOps.deleteSilent(filename) ;
- return BufferChannelFile.create(filename) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestChannelMem.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestChannelMem.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestChannelMem.java
deleted file mode 100644
index eaaaec0..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestChannelMem.java
+++ /dev/null
@@ -1,35 +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.dboe.base.file;
-
-import org.seaborne.dboe.base.file.BufferChannel ;
-import org.seaborne.dboe.base.file.BufferChannelMem ;
-
-
-public class TestChannelMem extends AbstractTestChannel
-{
- static int counter = 0 ;
-
- @Override
- protected BufferChannel open()
- {
- return BufferChannelMem.create("Test-"+(counter++)) ;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestMetaFile.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestMetaFile.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestMetaFile.java
deleted file mode 100644
index 9d85d0a..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestMetaFile.java
+++ /dev/null
@@ -1,75 +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.dboe.base.file;
-
-import java.io.File ;
-
-import org.junit.Assert ;
-import org.junit.After ;
-import org.junit.Before ;
-import org.junit.Test ;
-import org.seaborne.dboe.ConfigTestDBOE ;
-import org.seaborne.dboe.base.file.MetaFile ;
-import org.seaborne.dboe.sys.Names ;
-
-public class TestMetaFile extends Assert
-{
- String testfile = null ;
- String testfileMeta = null ;
-
- @Before public void before()
- {
- testfile = ConfigTestDBOE.getTestingDir()+"/file" ;
- testfileMeta = ConfigTestDBOE.getTestingDir()+"/file."+Names.extMeta ;
- File f = new File(testfileMeta) ;
- f.delete() ;
- }
-
- @Test public void meta1()
- {
- clear() ;
- MetaFile f = new MetaFile("META", testfile) ;
- assertFalse(new File(testfileMeta).exists()) ;
- f.setProperty("key", "value") ;
- f.flush() ;
- assertTrue(new File(f.getFilename()).exists()) ;
- }
-
- @Test public void meta2()
- {
- clear() ;
- MetaFile f = new MetaFile("META", testfile) ;
- f.setProperty("test.value1", "1") ;
- f.flush();
- MetaFile f2 = new MetaFile("META", testfile) ;
- assertEquals("1", f2.getProperty("test.value1")) ;
- assertNull(f2.getProperty("test.value.other")) ;
- }
-
- // Test MetaBase
-
- @After public void afterClass()
- { clear() ; }
-
- private void clear()
- {
- File f = new File(testfileMeta) ;
- f.delete() ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestProcessFileLock.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestProcessFileLock.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestProcessFileLock.java
deleted file mode 100644
index 39b0652..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestProcessFileLock.java
+++ /dev/null
@@ -1,107 +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.dboe.base.file;
-
-import static org.junit.Assert.*;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.jena.atlas.lib.FileOps;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.seaborne.dboe.base.file.ProcessFileLock;
-import org.seaborne.dboe.sys.Names;
-
-public class TestProcessFileLock {
- // TestLocationLockStoreConnection
-
- private static final String DIR = "target/locktest";
- private static final String lockfile = DIR+"/"+Names.TDB_LOCK_FILE;
-
-
- @BeforeClass public static void beforeClass() {
- FileOps.ensureDir(DIR);
- }
-
- @Before public void beforeTest() {
- File f = new File(lockfile);
- try {
- f.delete();
- f.createNewFile();
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- @Test public void process_lock_1() {
- ProcessFileLock lock = ProcessFileLock.create(lockfile);
- String fn = new File(lockfile).getAbsolutePath();
- assertEquals(fn, lock.getPath().toString());
- }
-
- @Test public void process_lock_2() {
- ProcessFileLock lock1 = ProcessFileLock.create(lockfile);
- ProcessFileLock lock2 = ProcessFileLock.create(lockfile);
- assertSame(lock1, lock2);
- }
-
- @Test public void process_lock_3() {
- ProcessFileLock lock1 = ProcessFileLock.create(lockfile);
- ProcessFileLock.release(lock1);
- ProcessFileLock lock2 = ProcessFileLock.create(lockfile);
- assertNotSame(lock1, lock2);
- }
-
- @Test public void process_lock_4() {
- ProcessFileLock lock = ProcessFileLock.create(lockfile);
- assertFalse(lock.isLockedHere());
- lock.lockEx();
- assertTrue(lock.isLockedHere());
- lock.unlock();
- assertFalse(lock.isLockedHere());
- }
-
- @Test(expected=AlreadyLocked.class)
- public void process_lock_5() {
- ProcessFileLock lock = ProcessFileLock.create(lockfile);
- lock.lockEx();
- lock.lockEx();
- }
-
- @Test(expected=AlreadyLocked.class)
- public void process_lock_6() {
- ProcessFileLock lock = ProcessFileLock.create(lockfile);
- lock.lockEx();
- boolean b = lock.tryLock();
- assertFalse(b);
- }
-
- @Test(expected=AlreadyLocked.class)
- public void process_lock_7() {
- ProcessFileLock lock = ProcessFileLock.create(lockfile);
- lock.tryLock();
- lock.tryLock();
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestSegmentedMemBuffer.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestSegmentedMemBuffer.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestSegmentedMemBuffer.java
deleted file mode 100644
index 0c7829f..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/file/TestSegmentedMemBuffer.java
+++ /dev/null
@@ -1,159 +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.dboe.base.file;
-
-import java.nio.ByteBuffer ;
-import java.util.Arrays ;
-
-import org.junit.Assert ;
-import org.junit.Test ;
-
-public class TestSegmentedMemBuffer extends Assert {
- private static byte[] data1 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } ;
- private static byte[] data2 = { 10,11,12 } ;
-
- @Test public void membuffer_00() {
- SegmentedMemBuffer space = new SegmentedMemBuffer() ;
- assertTrue(space.isOpen()) ;
- assertEquals(0, space.length()) ;
- space.close() ;
- assertFalse(space.isOpen()) ;
- space.close() ;
- }
-
- @Test public void membuffer_01() {
- SegmentedMemBuffer space = new SegmentedMemBuffer() ;
- writeread1(space) ;
- }
-
- @Test public void membuffer_02() {
- SegmentedMemBuffer space = new SegmentedMemBuffer() ;
- writeread2(space) ;
- }
-
- @Test public void membuffer_03() {
- SegmentedMemBuffer space = new SegmentedMemBuffer() ;
- writeread1(space) ;
- space.truncate(0);
- writeread2(space) ;
- }
-
- @Test public void membuffer_11() {
- SegmentedMemBuffer space = new SegmentedMemBuffer(2) ;
- writeread1(space) ;
- }
-
- @Test public void membuffer_12() {
- SegmentedMemBuffer space = new SegmentedMemBuffer(2) ;
- writeread2(space) ;
- }
-
- @Test public void membuffer_13() {
- SegmentedMemBuffer space = new SegmentedMemBuffer(2) ;
- writeread1(space) ;
- space.truncate(0);
- writeread2(space) ;
- }
-
- @Test public void membuffer_21() {
- SegmentedMemBuffer space = new SegmentedMemBuffer() ;
- writeread1a(space) ;
- }
-
- @Test public void membuffer_22() {
- SegmentedMemBuffer space = new SegmentedMemBuffer() ;
- writeread2a(space) ;
- }
-
- @Test public void membuffer_23() {
- SegmentedMemBuffer space = new SegmentedMemBuffer() ;
- writeread1(space) ;
- space.truncate(0);
- writeread2a(space) ;
- }
-
- @Test public void membuffer_31() {
- SegmentedMemBuffer space = new SegmentedMemBuffer(2) ;
- writeread1a(space) ;
- }
-
- @Test public void membuffer_32() {
- SegmentedMemBuffer space = new SegmentedMemBuffer(2) ;
- writeread2(space) ;
- }
-
- @Test public void membuffer_33() {
- SegmentedMemBuffer space = new SegmentedMemBuffer(2) ;
- writeread1a(space) ;
- space.truncate(0);
- writeread2a(space) ;
- }
-
- private void writeread1(SegmentedMemBuffer space) {
- long x = space.length() ;
- space.write(x, data1) ;
- assertEquals(x+data1.length, space.length()) ;
- byte[] bytes2 = new byte[data1.length+10] ;
- int y = space.read(x, bytes2) ;
- assertEquals(data1.length, y) ;
- byte[] bytes3 = Arrays.copyOf(bytes2, y) ;
- assertArrayEquals(data1, bytes3);
- }
-
- private void writeread2(SegmentedMemBuffer space) {
- // Offset.
- space.write(0, data2) ;
- long x = data2.length ;
- space.write(x, data1) ;
- assertEquals(x+data1.length, space.length()) ;
- byte[] bytes2 = new byte[data1.length+10] ;
- int y = space.read(x, bytes2) ;
- assertEquals(data1.length, y) ;
- byte[] bytes3 = Arrays.copyOf(bytes2, y) ;
- assertArrayEquals(data1, bytes3);
- }
-
- private void writeread1a(SegmentedMemBuffer space) {
- long x = space.length() ;
- ByteBuffer bb1 = ByteBuffer.wrap(data1) ;
- space.write(x, bb1) ;
- assertEquals(x+data1.length, space.length()) ;
- ByteBuffer bb2 = ByteBuffer.allocate(data1.length) ;
- int y = space.read(x, bb2) ;
- assertEquals(data1.length, y) ;
- byte[] bytes3 = Arrays.copyOf(bb2.array(), y) ;
- assertArrayEquals(data1, bytes3);
- }
-
- private void writeread2a(SegmentedMemBuffer space) {
- // Offset.
- space.write(0, ByteBuffer.wrap(data2)) ;
- long x = data2.length ;
- ByteBuffer bb1 = ByteBuffer.wrap(data1) ;
- space.write(x, bb1) ;
- assertEquals(x+data1.length, space.length()) ;
- ByteBuffer bb2 = ByteBuffer.allocate(data1.length) ;
- int y = space.read(x, bb2) ;
- assertEquals(data1.length, y) ;
- byte[] bytes3 = Arrays.copyOf(bb2.array(), y) ;
- assertArrayEquals(data1, bytes3);
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/record/TS_Record.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/record/TS_Record.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/record/TS_Record.java
deleted file mode 100644
index 8b6a8e1..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/record/TS_Record.java
+++ /dev/null
@@ -1,35 +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.dboe.base.record;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.seaborne.dboe.base.buffer.TestPtrBuffer ;
-import org.seaborne.dboe.base.buffer.TestRecordBuffer ;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
- TestRecord.class ,
- TestPtrBuffer.class ,
- TestRecordBuffer.class
-})
-
-
-public class TS_Record
-{}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/record/TestRecord.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/record/TestRecord.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/record/TestRecord.java
deleted file mode 100644
index 9b9ddda..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/record/TestRecord.java
+++ /dev/null
@@ -1,78 +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.dboe.base.record;
-
-import static org.seaborne.dboe.test.RecordLib.intToRecord ;
-import static org.seaborne.dboe.test.RecordLib.recordToInt ;
-import org.junit.Assert ;
-import org.junit.Test;
-import org.seaborne.dboe.base.record.Record ;
-
-public class TestRecord extends Assert
-{
- static final public int RecLen = 4 ;
-
- @Test public void int1()
- {
- Record r = intToRecord(1234, 4) ;
- int v = recordToInt(r) ;
- assertEquals(v , 1234) ;
- }
-
- @Test public void int2()
- {
- // Negative numbers only work for length 4.
- Record r = intToRecord(-99, 4) ;
- int v = recordToInt(r) ;
- assertEquals(v , -99) ;
- }
-
- @Test public void record1()
- {
- Record r1 = intToRecord(1, RecLen) ;
- Record r2 = intToRecord(1, RecLen) ;
- assertTrue(Record.keyEQ(r1,r2)) ;
- assertTrue(Record.keyGE(r1,r2)) ;
- assertTrue(Record.keyLE(r1,r2)) ;
- assertFalse(Record.keyLT(r1,r2)) ;
- assertFalse(Record.keyGT(r1,r2)) ;
- }
-
- @Test public void record2()
- {
- Record r1 = intToRecord(1000, RecLen) ;
- Record r2 = intToRecord(2222, RecLen) ;
- assertFalse(Record.keyEQ(r1,r2)) ;
- assertFalse(Record.keyGE(r1,r2)) ;
- assertTrue(Record.keyLE(r1,r2)) ;
- assertTrue(Record.keyLT(r1,r2)) ;
- assertFalse(Record.keyGT(r1,r2)) ;
- }
-
- @Test public void record3()
- {
- Record r1 = intToRecord(1000, RecLen) ;
- Record r2 = intToRecord(0, RecLen) ;
- assertFalse(Record.keyEQ(r1,r2)) ;
- assertTrue(Record.keyGE(r1,r2)) ;
- assertFalse(Record.keyLE(r1,r2)) ;
- assertFalse(Record.keyLT(r1,r2)) ;
- assertTrue(Record.keyGT(r1,r2)) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/recordfile/TS_RecordFile.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/recordfile/TS_RecordFile.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/recordfile/TS_RecordFile.java
deleted file mode 100644
index 526694c..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/recordfile/TS_RecordFile.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.dboe.base.recordfile;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
- TestRecordBufferPage.class
-})
-
-public class TS_RecordFile
-{
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/recordfile/TestRecordBufferPage.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/recordfile/TestRecordBufferPage.java b/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/recordfile/TestRecordBufferPage.java
deleted file mode 100644
index c0147a4..0000000
--- a/jena-db/jena-dboe-base/src/test/java/org/seaborne/dboe/base/recordfile/TestRecordBufferPage.java
+++ /dev/null
@@ -1,125 +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.dboe.base.recordfile;
-
-import org.junit.Assert ;
-import org.junit.AfterClass ;
-import org.junit.BeforeClass ;
-import org.junit.Test ;
-import org.seaborne.dboe.base.block.BlockMgr ;
-import org.seaborne.dboe.base.block.BlockMgrFactory ;
-import org.seaborne.dboe.base.buffer.RecordBuffer ;
-import org.seaborne.dboe.base.record.Record ;
-import org.seaborne.dboe.base.record.RecordFactory ;
-import org.seaborne.dboe.base.recordbuffer.RecordBufferPage ;
-import org.seaborne.dboe.base.recordbuffer.RecordBufferPageMgr ;
-import org.seaborne.dboe.sys.SystemIndex ;
-
-public class TestRecordBufferPage extends Assert
-{
- // Testing: records are 2 bytes, 3 records per block.
-
- static final int TestRecordSize = 2 ; // Size, in bytes.
- static final int TestNumRecord = 3 ; // Size, in bytes.
- static RecordFactory factory = new RecordFactory(2, 0) ;
-
- static boolean originalNullOut ;
- @BeforeClass static public void beforeClass()
- {
- originalNullOut = SystemIndex.getNullOut() ;
- SystemIndex.setNullOut(true) ;
- }
-
- @AfterClass static public void afterClass()
- {
- SystemIndex.setNullOut(originalNullOut) ;
- }
-
- @Test public void recBufferPage01()
- {
- BlockMgr blkMgr = makeBlockMgr() ;
- blkMgr.beginUpdate() ;
- RecordBufferPageMgr rpm = new RecordBufferPageMgr(factory, blkMgr) ;
- RecordBufferPage page = rpm.create() ;
- fill(page.getRecordBuffer(), 10, 20, 30) ;
- assertEquals(10, get(page, 0)) ;
- assertEquals(20, get(page, 1)) ;
- assertEquals(30, get(page, 2)) ;
- rpm.release(page) ;
- blkMgr.endUpdate() ;
- }
-
- @Test public void recBufferPage02()
- {
- BlockMgr blkMgr = makeBlockMgr() ;
- blkMgr.beginUpdate() ;
- RecordBufferPageMgr rpm = new RecordBufferPageMgr(factory, blkMgr) ;
- int x = -99 ;
- {
- RecordBufferPage page1 = rpm.create() ;
- fill(page1.getRecordBuffer(), 10, 20, 30) ;
- x = page1.getId() ;
- rpm.put(page1) ;
- page1 = null ;
- }
- blkMgr.endUpdate() ;
- blkMgr.beginRead() ;
- {
- RecordBufferPage page2 = rpm.getRead(x) ;
- assertEquals(10, get(page2, 0)) ;
- assertEquals(20, get(page2, 1)) ;
- assertEquals(30, get(page2, 2)) ;
- rpm.release(page2) ;
- }
- blkMgr.endRead() ;
- }
-
-
- private static void fill(RecordBuffer rb, int ... nums)
- {
- for ( int num : nums )
- {
- Record rec = record( num );
- rb.add( rec );
- }
- }
-
- private static int get(RecordBufferPage rbp, int idx) { return get(rbp.getRecordBuffer(), idx) ; }
-
- private static int get(RecordBuffer rb, int idx)
- {
- Record r = rb.get(idx) ;
- int v = (r.getKey()[0])<<8 | ((r.getKey()[1])&0xFF) ;
- return v ;
- }
-
- private static Record record(int i)
- {
- byte b[] = new byte[]{
- (byte)((i>>8)&0xFF),
- (byte)(i&0xFF)} ;
- Record r = factory.create(b) ;
- return r ;
- }
-
- private static BlockMgr makeBlockMgr()
- {
- return BlockMgrFactory.createMem("RecordBuffer", RecordBufferPage.calcBlockSize(factory, TestNumRecord)) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-index-test/pom.xml
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-index-test/pom.xml b/jena-db/jena-dboe-index-test/pom.xml
index 292afa8..e02625e 100644
--- a/jena-db/jena-dboe-index-test/pom.xml
+++ b/jena-db/jena-dboe-index-test/pom.xml
@@ -41,6 +41,7 @@
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-cmds</artifactId>
+ <version>3.5.0-SNAPSHOT</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-index-test/src/main/java/org/apache/jena/dboe/index/TS_Index.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-index-test/src/main/java/org/apache/jena/dboe/index/TS_Index.java b/jena-db/jena-dboe-index-test/src/main/java/org/apache/jena/dboe/index/TS_Index.java
new file mode 100644
index 0000000..efd15c5
--- /dev/null
+++ b/jena-db/jena-dboe-index-test/src/main/java/org/apache/jena/dboe/index/TS_Index.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.dboe.index;
+
+import org.junit.runner.RunWith ;
+import org.junit.runners.Suite ;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {
+ TestIndexMem.class
+} )
+
+public class TS_Index
+{ }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-dboe-index-test/src/main/java/org/apache/jena/dboe/index/TestIndexMem.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-index-test/src/main/java/org/apache/jena/dboe/index/TestIndexMem.java b/jena-db/jena-dboe-index-test/src/main/java/org/apache/jena/dboe/index/TestIndexMem.java
new file mode 100644
index 0000000..16a77cc
--- /dev/null
+++ b/jena-db/jena-dboe-index-test/src/main/java/org/apache/jena/dboe/index/TestIndexMem.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.dboe.index;
+
+import org.apache.jena.dboe.base.record.RecordFactory;
+import org.apache.jena.dboe.index.Index;
+import org.apache.jena.dboe.index.IndexMap;
+import org.apache.jena.dboe.index.test.AbstractTestIndex;
+
+public class TestIndexMem extends AbstractTestIndex
+{
+ @Override
+ protected Index makeIndex(int kLen, int vLen)
+ {
+ RecordFactory rf = new RecordFactory(kLen, vLen) ;
+ return new IndexMap(rf) ;
+ }
+
+}