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 2011/05/29 22:55:52 UTC
svn commit: r1128950 - in /incubator/jena:
Experimental/TxTDB/trunk/src-dev/tx/
Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/
Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/
Experimental/TxTDB/trunk/s...
Author: andy
Date: Sun May 29 20:55:51 2011
New Revision: 1128950
URL: http://svn.apache.org/viewvc?rev=1128950&view=rev
Log: (empty)
Added:
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/BlockLib.java (with props)
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/AbstractTestObjectFile.java (with props)
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/AbstractTestStringFile.java (contents, props changed)
- copied, changed from r1128376, incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestStringFile.java
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TS_ObjectFile.java (with props)
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileDisk.java (with props)
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileDiskBuffering.java (with props)
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileMem.java (with props)
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestStringFileDisk.java (contents, props changed)
- copied, changed from r1128376, incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestStringFileDisk.java
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestStringFileMem.java (contents, props changed)
- copied, changed from r1128376, incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestStringFileMem.java
Removed:
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestStringFile.java
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestStringFileDisk.java
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestStringFileMem.java
Modified:
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/NodeTableJournal.java
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/ObjectFileTrans.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessBase.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessByteArray.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessMem.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelFile.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelMem.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFile.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileMem.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileSink.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileWrapper.java
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestBlockAccessFixedSize.java
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestBlockAccessVarSize.java
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestChannel.java
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TS_File.java
incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/atlas/junit/BaseTest.java
Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java Sun May 29 20:55:51 2011
@@ -3,14 +3,15 @@ package tx;
public class DevTx
{
- // BlockMgrJournal
- // FileRefs : builtin names<->numbers
+ // Sort out alloc/complete in storage. Does not have to adjacent pairs.
+ // ** ObjectFileStorage does not include a length.
- // ObjectFile is "just" BlockAccess with different preallocate.
- // Delete.
+ // check test cases.
- // NodeTable over Journal.
- // NodeTable to have "do everything except write" operation.
+ // ObjectFile
+ // ObjectFile over BufferChannel -- "storeage"
+ // Hide current mem-based one.
+ // Append only with replay.
// One transaction dataset - reuse. Pool?
// Record BlockMgrs, BlockMgrTx.reset
Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/NodeTableJournal.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/NodeTableJournal.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/NodeTableJournal.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/NodeTableJournal.java Sun May 29 20:55:51 2011
@@ -23,6 +23,12 @@ import com.hp.hpl.jena.tdb.store.NodeId
public class NodeTableJournal implements NodeTable
{
+ // Becomes extends NodeTableNative.
+ // Uses a second ObjectFile as the journal for write ahead.
+ // Write name of this to Journal.
+ // Transaction commit is now two sync's, not one.
+
+
private final Journal journal ;
private final NodeTable other ;
@@ -41,9 +47,16 @@ public class NodeTableJournal implements
// OR do everything but write - return (id,bytes) that would be written (sans length)
+// @Override
+// public NodeId preallocate(Node node, NodeId last)
+// {
+// return null ;
+// }
+
@Override
public NodeId getAllocateNodeId(Node node)
{
+ // ????????????
return null ;
}
@@ -85,6 +98,8 @@ public class NodeTableJournal implements
@Override
public void close() { }
+
+
}
/*
Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/ObjectFileTrans.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/ObjectFileTrans.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/ObjectFileTrans.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/ObjectFileTrans.java Sun May 29 20:55:51 2011
@@ -10,6 +10,7 @@ import java.nio.ByteBuffer ;
import java.util.Iterator ;
import org.openjena.atlas.lib.Pair ;
+import org.openjena.atlas.logging.Log ;
import tx.journal.Journal ;
import com.hp.hpl.jena.tdb.base.block.Block ;
@@ -19,62 +20,125 @@ public class ObjectFileTrans implements
{
private final Journal journal ;
private final ObjectFile other ;
+ private long startAlloc ;
private long alloc ;
-
- // Objects aren't huge - a block per object and the file ref overhead is a bit much.
+ private boolean passthrough = false ;
+ private final ObjectFile base ;
- public ObjectFileTrans(Journal journal, ObjectFile other)
+ public ObjectFileTrans(Journal journal, ObjectFile base, ObjectFile other)
{
+ // The other object file must use the same allocation policy.
this.journal = journal ;
+ this.base = base ;
this.other = other ;
- this.alloc = other.length() ;
+ this.alloc = base.length() ;
+ this.startAlloc = base.length() ;
}
-
- @Override
- public void sync()
- {}
+ public void begin() { passthrough = false ; }
+ public void commit() { append() ; base.sync() ; other.reposition(0) ; passthrough = true ; }
+ public void abort() { other.reposition(0) ; }
+
+ /** Copy from the temporary file to the real file */
+ private void append()
+ {
+ // We could write directly to the real file if:
+ // we record the truncate point needed for an abort
+ // manage partial final writes
+ // deny the existence of nodes after the transaction mark.
+ // Later - stay simple for now.
+
+ // Truncate/position the ObjectFile.
+ base.reposition(startAlloc) ;
+
+ Iterator<Pair<Long, ByteBuffer>> iter = other.all() ;
+ for ( ; iter.hasNext() ; )
+ {
+ Pair<Long, ByteBuffer> p = iter.next() ;
+ long x = base.write(p.getRight()) ;
+ if ( p.getLeft()+startAlloc != x )
+ Log.fatal(this, "Expected id of "+p.getLeft()+startAlloc+", got an id of "+x) ;
+ }
+ }
+
+ public void setPassthrough(boolean v) { passthrough = v ; }
+
@Override
- public void close()
- {}
+ public void reposition(long id)
+ {
+ if ( passthrough ) { base.reposition(id) ; return ; }
+ if ( id > startAlloc )
+ {
+ other.reposition(id-startAlloc) ;
+ return ;
+ }
+
+ other.reposition(0) ;
+ base.reposition(id) ;
+ startAlloc = id ;
+ alloc = id ;
+ }
@Override
public Block allocWrite(int maxBytes)
{
- ByteBuffer bb = ByteBuffer.allocate(maxBytes) ;
- // Allocation in ObjectFile.other?
- return null ;
+ if ( passthrough ) return base.allocWrite(maxBytes) ;
+ Block block = other.allocWrite(maxBytes) ;
+ block = new Block(block.getId()+startAlloc, block.getByteBuffer()) ;
+ return block ;
}
@Override
- public void completeWrite(Block buffer)
+ public void completeWrite(Block block)
{
+ if ( passthrough ) { base.completeWrite(block) ; return ; }
+ block = new Block(block.getId()-startAlloc, block.getByteBuffer()) ;
+ other.completeWrite(block) ;
}
@Override
public long write(ByteBuffer buffer)
{
- return 0 ;
+ if ( passthrough ) { return base.write(buffer) ; }
+ // Write to auxillary
+ long x = other.write(buffer) ;
+ return alloc+x ;
}
@Override
public ByteBuffer read(long id)
{
- return null ;
+ if ( passthrough ) { return base.read(id) ; }
+ if ( id < startAlloc )
+ return base.read(id) ;
+ return other.read(id-startAlloc) ;
}
@Override
public long length()
{
- return 0 ;
+ if ( passthrough ) { return base.length() ; }
+ return startAlloc+other.length() ;
}
@Override
public Iterator<Pair<Long, ByteBuffer>> all()
{
+ if ( passthrough ) { return base.all() ; }
return null ;
}
+ @Override
+ public void sync()
+ {
+ if ( passthrough ) { base.sync() ; return ; }
+ }
+
+ @Override
+ public void close()
+ {
+ if ( passthrough ) { base.close() ; return ; }
+ }
}
/*
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java Sun May 29 20:55:51 2011
@@ -11,10 +11,14 @@ import org.openjena.atlas.lib.Sync ;
import com.hp.hpl.jena.tdb.base.block.Block ;
-/** Interface to concrete storage.
- * This is wrapped in a BlockMgrAccess to provide a higher level abstraction.
- * BufferChannels are a separate lower-level, interface to storage.
- * @see BufferChannel
+/**
+ * Interface to concrete storage - read and write Blocks, addressed by id.
+ * Suitable for memory mapped I/O (returns
+ * internally allocated space for read, not provided from outside; write() can
+ * insist the block written comes from allocate()). This is wrapped in a
+ * BlockMgrAccess to provide a higher level abstraction.
+ *
+ * @see BufferChannel
*/
public interface BlockAccess extends Sync, Closeable
{
@@ -26,7 +30,7 @@ public interface BlockAccess extends Syn
public boolean isEmpty() ;
- public boolean valid(int id) ;
+ public boolean valid(long id) ;
}
/*
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessBase.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessBase.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessBase.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessBase.java Sun May 29 20:55:51 2011
@@ -83,7 +83,7 @@ public abstract class BlockAccessBase im
@Override
final synchronized
- public boolean valid(int id)
+ public boolean valid(long id)
{
// Access to numFileBlocks not synchronized - it's only a check
if ( id >= numFileBlocks )
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessByteArray.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessByteArray.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessByteArray.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessByteArray.java Sun May 29 20:55:51 2011
@@ -86,7 +86,7 @@ public class BlockAccessByteArray implem
}
@Override
- public boolean valid(int id)
+ public boolean valid(long id)
{
return ( id >= 0 && id < length ) ;
}
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessMem.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessMem.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessMem.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccessMem.java Sun May 29 20:55:51 2011
@@ -82,7 +82,7 @@ public class BlockAccessMem implements B
}
@Override
- public boolean valid(int id)
+ public boolean valid(long id)
{
return id >= 0 && id < blocks.size() ;
}
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java Sun May 29 20:55:51 2011
@@ -7,14 +7,26 @@
package com.hp.hpl.jena.tdb.base.file;
import java.nio.ByteBuffer ;
+import java.nio.channels.FileChannel ;
import org.openjena.atlas.lib.Closeable ;
import org.openjena.atlas.lib.Sync ;
/** Interface to storage : a simplified version of FileChannel.
- * This also enables use to implement memory-backed versions.
+ * Read and write bytes, passed via ByteBuffers, addressed
+ * by file location.
+ *
+ * Not suitable for memory mapped I/O - no allocation from the
+ * I/O resource but instead reads into storage provided outside
+ * and writes from storage provided outside.
+ *
+ * Does not insert size of ByteBuffer - size of ByteBuffer passed to
+ * read controls the number of bytes read.
+ *
+ * Having our own abstraction enables us to implement memory-backed versions.
* @see BlockAccess
+ * @see FileChannel
*/
public interface BufferChannel extends Sync, Closeable
{
@@ -46,9 +58,13 @@ public interface BufferChannel extends S
* loc must be within 0 to length - writing at length is append */
public int write(ByteBuffer buffer, long loc) ;
+ /** Truncate the file.
+ * @see FileChannel#truncate(long)
+ */
+ public void truncate(long size) ;
+
/** Length of storage, in bytes.*/
public long size() ;
-
}
/*
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelFile.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelFile.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelFile.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelFile.java Sun May 29 20:55:51 2011
@@ -36,6 +36,13 @@ public class BufferChannelFile implement
}
@Override
+ public void truncate(long length)
+ {
+ try { file.channel.truncate(length) ; }
+ catch (IOException e) { IO.exception(e) ; }
+ }
+
+ @Override
public int read(ByteBuffer buffer)
{
try { return file.channel.read(buffer) ; }
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelMem.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelMem.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelMem.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelMem.java Sun May 29 20:55:51 2011
@@ -13,7 +13,7 @@ import com.hp.hpl.jena.tdb.base.StorageE
public class BufferChannelMem implements BufferChannel
{
private ByteBuffer bytes ; // Position is our file position.
- private long length ; // Bytes in use: 0 to length-1
+ //private long length ; // Bytes in use: 0 to length-1 -- NO -- Use Bytes.limit()
private String name ;
private static int INIT_SIZE = 1024 ;
private static int INC_SIZE = 1024 ;
@@ -21,7 +21,7 @@ public class BufferChannelMem implements
public BufferChannelMem(String name)
{
bytes = ByteBuffer.allocate(1024) ;
- length = 0 ;
+ bytes.limit(0) ;
this.name = name ;
}
@@ -63,7 +63,7 @@ public class BufferChannelMem implements
public int read(ByteBuffer buffer, long loc)
{
checkIfClosed() ;
- if ( loc < 0 || loc > length )
+ if ( loc < 0 || loc >= buffer.limit() )
throw new StorageException("Out of range: "+loc) ;
int x = buffer.position() ;
bytes.position((int)loc) ;
@@ -79,40 +79,62 @@ public class BufferChannelMem implements
int len = buffer.limit()-buffer.position() ;
int posn = bytes.position() ;
- if ( len > bytes.remaining() )
+ int freespace = bytes.capacity() - bytes.position() ;
+
+ if ( len > freespace )
{
- int inc = len-bytes.remaining() ;
+ int inc = len-freespace ;
inc += INC_SIZE ;
ByteBuffer bb2 = ByteBuffer.allocate(bytes.capacity()+inc) ;
- bytes.clear() ;
+ bytes.position(0) ;
// Copy contents.
- bb2.put(bytes) ;
+ bb2.put(bytes) ; // From 0 to limit.
bytes.position(posn) ;
}
+
+ if ( bytes.limit() < posn+len )
+ bytes.limit(posn+len) ;
+
bytes.put(buffer) ;
- length = Math.max(length, posn+len) ;
return len ;
}
+ // Invert : write(ByteBuffer) = write(ByteBuffer,posn)
@Override
public int write(ByteBuffer buffer, long loc)
{
checkIfClosed() ;
- if ( loc < 0 || loc > length )
+ if ( loc < 0 || loc > bytes.limit() )
+ // Can write at loc = bytes()
throw new StorageException("Out of range: "+loc) ;
int x = bytes.position() ;
bytes.position((int)loc) ;
int len = write(buffer) ;
bytes.position(x) ;
- length = Math.max(length, loc+len) ;
return len ;
}
+
+ @Override
+ public void truncate(long size)
+ {
+ checkIfClosed() ;
+ int x = (int) size ;
+
+ if ( x < 0 )
+ throw new StorageException("Out of range: "+size) ;
+ if ( x > bytes.limit() )
+ return ;
+
+ if ( bytes.position() > x )
+ bytes.position(x) ;
+ bytes.limit(x) ;
+ }
@Override
public long size()
{
checkIfClosed() ;
- return length ;
+ return bytes.limit() ;
}
@Override
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFile.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFile.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFile.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFile.java Sun May 29 20:55:51 2011
@@ -26,7 +26,7 @@ public interface ObjectFile extends Sync
public static final String type = "object" ;
/** Allocate space for a write - pass this buffer to completeWrite */
- public Block allocWrite(int maxBytes) ;
+ public Block allocWrite(int bytesSpace) ;
/** Announce that a write is complete (buffer must come from allocWrite) - return the accessor number */
public void completeWrite(Block buffer) ;
@@ -40,6 +40,12 @@ public interface ObjectFile extends Sync
/** Length, in units used by read/write for ids */
public long length() ;
+ /** Reset the "append" point; may only be moved earlier.
+ * The new position must correspond to a position returned by
+ * {@link #write(ByteBuffer)} or an id in a {@link Block Block} from {@link #completeWrite(Block)}
+ */
+ public void reposition(long id) ;
+
/** All the bytebuffers - debugging aid */
public Iterator<Pair<Long, ByteBuffer>> all() ;
}
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileMem.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileMem.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileMem.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileMem.java Sun May 29 20:55:51 2011
@@ -82,11 +82,11 @@ public class ObjectFileMem implements Ob
@Override
- public Block allocWrite(int maxBytes)
+ public Block allocWrite(int bytesSpace)
{
long id = buffers.size() ;
buffers.add(null) ;
- return new Block(id, ByteBuffer.allocate(maxBytes)) ;
+ return new Block(id, ByteBuffer.allocate(bytesSpace)) ;
}
@Override
@@ -98,6 +98,18 @@ public class ObjectFileMem implements Ob
}
@Override
+ public void reposition(long id)
+ {
+ int newSize = (int)id ;
+ if ( newSize < 0 || newSize >= buffers.size() )
+ throw new StorageException() ;
+ List<ByteBuffer> buffers2 = new ArrayList<ByteBuffer>(newSize) ;
+ for ( int i =0 ; i < id ; i++ )
+ buffers2.add(buffers.get(newSize)) ;
+ buffers = buffers2 ;
+ }
+
+ @Override
public Iterator<Pair<Long, ByteBuffer>> all()
{
int N = buffers.size() ;
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileSink.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileSink.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileSink.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileSink.java Sun May 29 20:55:51 2011
@@ -54,6 +54,10 @@ public class ObjectFileSink implements O
}
@Override
+ public void reposition(long id)
+ { this.id = (id-1) ; }
+
+ @Override
public void sync()
{}
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java Sun May 29 20:55:51 2011
@@ -45,8 +45,8 @@ public class ObjectFileStorage implement
private final ByteBuffer writeBuffer ;
private int bufferSize ;
- private final BufferChannel file ; // Access to storage
- private long filesize ; // Size of on-disk.
+ private final BufferChannel file ; // Access to storage
+ private long filesize ; // Size of on-disk.
// Two-step write - alloc, write
private boolean inAllocWrite = true ;
@@ -71,36 +71,42 @@ public class ObjectFileStorage implement
{
inAllocWrite = false ;
int len = bb.limit() - bb.position() ;
+ int spaceNeeded = len + SizeOfInt ;
- if ( writeBuffer.limit()+len > writeBuffer.capacity() )
+ if ( writeBuffer.position()+spaceNeeded > writeBuffer.capacity() )
// No room - flush.
flushOutputBuffer() ;
- if ( writeBuffer.limit()+len > writeBuffer.capacity() )
+ if ( writeBuffer.position()+spaceNeeded > writeBuffer.capacity() )
{
long x = rawWrite(bb) ;
return x ;
}
+ long loc = writeBuffer.position() ;
+ writeBuffer.putInt(len) ;
writeBuffer.put(bb) ;
- return len ;
+ return loc ;
}
private long rawWrite(ByteBuffer bb)
{
- long location = filesize ;
- int x = file.write(bb, location) ;
+ int len = bb.limit() - bb.position() ;
+ lengthBuffer.rewind() ;
+ lengthBuffer.putInt(len) ;
+ lengthBuffer.flip() ;
+ long location = file.position() ;
+ file.write(lengthBuffer, location) ;
long loc2 = location+SizeOfInt ;
- x += file.write(bb, loc2) ;
+ int x = file.write(bb, loc2) ;
filesize = filesize+x ;
return location ;
-
}
@Override
- public Block allocWrite(int maxBytes)
+ public Block allocWrite(int bytesSpace)
{
// Include space for length.
- int spaceRequired = maxBytes + SizeOfInt ;
+ int spaceRequired = bytesSpace + SizeOfInt ;
// Find space.
if ( spaceRequired > writeBuffer.remaining() )
flushOutputBuffer() ;
@@ -109,7 +115,7 @@ public class ObjectFileStorage implement
{
// Too big. have flushed buffering.
inAllocWrite = true ;
- ByteBuffer bb = ByteBuffer.allocate(spaceRequired) ;
+ ByteBuffer bb = ByteBuffer.allocate(bytesSpace) ;
allocBlock = new Block(filesize, bb) ;
allocLocation = -1 ;
return allocBlock ;
@@ -122,6 +128,7 @@ public class ObjectFileStorage implement
allocLocation = filesize+start ;
// Slice it.
+ writeBuffer.putInt(bytesSpace) ;
writeBuffer.position(start + SizeOfInt) ;
writeBuffer.limit(start+spaceRequired) ;
ByteBuffer bb = writeBuffer.slice() ;
@@ -161,6 +168,8 @@ public class ObjectFileStorage implement
private void flushOutputBuffer()
{
+ //if ( writeBuffer.position() == 0 ) return ;
+
long location = filesize ;
writeBuffer.flip();
int x = file.write(writeBuffer) ;
@@ -168,6 +177,15 @@ public class ObjectFileStorage implement
writeBuffer.clear() ;
}
+ @Override
+ public void reposition(long id)
+ {
+ if ( id < 0 || id > filesize )
+ throw new IllegalArgumentException("reposition: Bad location: "+id) ;
+ flushOutputBuffer() ;
+ file.truncate(id) ;
+ filesize = id ;
+ }
@Override
public ByteBuffer read(long loc)
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileWrapper.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileWrapper.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileWrapper.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileWrapper.java Sun May 29 20:55:51 2011
@@ -32,6 +32,9 @@ public class ObjectFileWrapper implement
@Override
public long write(ByteBuffer buffer) { return other.write(buffer) ; }
+
+ @Override
+ public void reposition(long id) { other.reposition(id) ; }
@Override
public ByteBuffer read(long id) { return other.read(id) ; }
Added: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/BlockLib.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/BlockLib.java?rev=1128950&view=auto
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/BlockLib.java (added)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/BlockLib.java Sun May 29 20:55:51 2011
@@ -0,0 +1,78 @@
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ * [See end of file]
+ */
+
+package com.hp.hpl.jena.tdb.base;
+
+import java.nio.ByteBuffer ;
+
+import com.hp.hpl.jena.tdb.base.block.Block ;
+
+public class BlockLib
+{
+ public static boolean sameValue(Block block1, Block block2)
+ {
+ if ( block1.getId() != block2.getId()) return false ;
+ ByteBuffer bb1 = block1.getByteBuffer() ;
+ ByteBuffer bb2 = block2.getByteBuffer() ;
+
+ if ( bb1.capacity() != bb2.capacity() ) return false ;
+
+ for ( int i = 0 ; i < bb1.capacity() ; i++ )
+ if ( bb1.get(i) != bb2.get(i) ) return false ;
+ return true ;
+ }
+
+ public static boolean sameValue(ByteBuffer bb1, ByteBuffer bb2)
+ {
+ if ( bb1.capacity() != bb2.capacity() ) return false ;
+
+ int posn1 = bb1.position();
+ int limit1 = bb1.limit();
+ int posn2 = bb2.position();
+ int limit2 = bb2.limit();
+
+ bb1.clear() ;
+ bb2.clear() ;
+
+ try {
+ for ( int i = 0 ; i < bb1.capacity() ; i++ )
+ if ( bb1.get(i) != bb2.get(i) ) return false ;
+ return true ;
+ } finally {
+ bb1.position(posn1) ;
+ bb1.limit(limit1) ;
+ bb2.position(posn2) ;
+ bb2.limit(limit2) ;
+ }
+ }
+}
+
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
\ No newline at end of file
Propchange: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/BlockLib.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestBlockAccessFixedSize.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestBlockAccessFixedSize.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestBlockAccessFixedSize.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestBlockAccessFixedSize.java Sun May 29 20:55:51 2011
@@ -6,8 +6,7 @@
package com.hp.hpl.jena.tdb.base.file;
-import java.nio.ByteBuffer ;
-
+import static com.hp.hpl.jena.tdb.base.BlockLib.sameValue ;
import org.junit.Test ;
import org.openjena.atlas.junit.BaseTest ;
@@ -32,19 +31,6 @@ public abstract class AbstractTestBlockA
b.getByteBuffer().put((byte)(i&0xFF)) ;
return b ;
}
-
- protected static boolean sameValue(Block block1, Block block2)
- {
- if ( block1.getId() != block2.getId()) return false ;
- ByteBuffer bb1 = block1.getByteBuffer() ;
- ByteBuffer bb2 = block2.getByteBuffer() ;
-
- if ( bb1.capacity() != bb2.capacity() ) return false ;
-
- for ( int i = 0 ; i < bb1.capacity() ; i++ )
- if ( bb1.get(i) != bb2.get(i) ) return false ;
- return true ;
- }
@Test public void fileaccess_01()
{
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestBlockAccessVarSize.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestBlockAccessVarSize.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestBlockAccessVarSize.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestBlockAccessVarSize.java Sun May 29 20:55:51 2011
@@ -10,6 +10,7 @@ import org.junit.Test ;
import com.hp.hpl.jena.tdb.base.block.Block ;
+import static com.hp.hpl.jena.tdb.base.BlockLib.* ;
public abstract class AbstractTestBlockAccessVarSize extends AbstractTestBlockAccessFixedSize
{
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestChannel.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestChannel.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestChannel.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestChannel.java Sun May 29 20:55:51 2011
@@ -96,6 +96,40 @@ public abstract class AbstractTestChanne
assertTrue(same(b2, b2a)) ;
}
+ @Test public void storage_06()
+ {
+ BufferChannel store = make() ;
+ ByteBuffer b1 = data(blkSize) ;
+ store.write(b1) ;
+ store.truncate(0) ;
+ assertEquals(0, store.size()) ;
+ }
+
+ @Test public void storage_07()
+ {
+ BufferChannel store = make() ;
+ 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()
+ {
+ BufferChannel store = make() ;
+ 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()) ;
+ }
+
}
/*
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TS_File.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TS_File.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TS_File.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TS_File.java Sun May 29 20:55:51 2011
@@ -7,16 +7,14 @@
package com.hp.hpl.jena.tdb.base.file;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import org.junit.runner.RunWith ;
+import org.junit.runners.Suite ;
@RunWith(Suite.class)
@Suite.SuiteClasses( {
TestMetaFile.class
, TestChannelMem.class
, TestChannelFile.class
- , TestStringFileMem.class
- , TestStringFileDisk.class
, TestBlockAccessMem.class
, TestBlockAccessByteArray.class
, TestBlockAccessDirect.class
Added: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/AbstractTestObjectFile.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/AbstractTestObjectFile.java?rev=1128950&view=auto
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/AbstractTestObjectFile.java (added)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/AbstractTestObjectFile.java Sun May 29 20:55:51 2011
@@ -0,0 +1,156 @@
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ * [See end of file]
+ */
+
+package com.hp.hpl.jena.tdb.base.objectfile;
+
+import java.nio.ByteBuffer ;
+
+import com.hp.hpl.jena.tdb.base.block.Block ;
+
+import org.junit.Test ;
+import org.openjena.atlas.junit.BaseTest ;
+
+import static com.hp.hpl.jena.tdb.base.BlockLib.* ;
+
+public abstract class AbstractTestObjectFile extends BaseTest
+{
+ @Test public void objectfile_01()
+ {
+ ObjectFile file = make() ;
+ assertEquals(0, file.length()) ;
+ }
+
+ @Test public void objectfile_02()
+ {
+ ObjectFile file = make() ;
+ Block block = file.allocWrite(10) ;
+ fill(block.getByteBuffer()) ;
+ file.completeWrite(block) ;
+ long x1 = block.getId() ;
+ assertEquals(0, x1) ;
+
+ ByteBuffer bb = file.read(x1) ;
+
+ // position
+
+ assertTrue(sameValue(block.getByteBuffer(), bb)) ;
+
+ }
+
+ @Test public void objectfile_03()
+ {
+ ObjectFile file = make() ;
+ ByteBuffer bb = ByteBuffer.allocate(10) ;
+ fill(bb) ;
+ long x1 = file.write(bb) ;
+ assertEquals(0, x1) ;
+ }
+
+ @Test public void objectfile_04()
+ {
+ ObjectFile file = make() ;
+
+ Block block1 = file.allocWrite(10) ;
+ fill(block1.getByteBuffer()) ;
+ file.completeWrite(block1) ;
+
+ Block block2 = file.allocWrite(20) ;
+ fill(block2.getByteBuffer()) ;
+ file.completeWrite(block2) ;
+
+ long x1 = block1.getId() ;
+ long x2 = block2.getId() ;
+
+ assertFalse(x1 == x2) ;
+
+ }
+
+ @Test public void objectfile_05()
+ {
+ ObjectFile file = make() ;
+ ByteBuffer bb1 = ByteBuffer.allocate(10) ;
+ fill(bb1) ;
+
+ ByteBuffer bb2 = ByteBuffer.allocate(20) ;
+ fill(bb2) ;
+ long x1 = file.write(bb1) ;
+ long x2 = file.write(bb2) ;
+
+ assertFalse(x1 == x2) ;
+ }
+
+ @Test public void objectfile_06()
+ {
+ ObjectFile file = make() ;
+ ByteBuffer bb1 = ByteBuffer.allocate(10) ;
+ fill(bb1) ;
+
+ ByteBuffer bb2 = ByteBuffer.allocate(20) ;
+ fill(bb2) ;
+
+ long x1 = file.write(bb1) ;
+ long x2 = file.write(bb2) ;
+
+ ByteBuffer bb1a = file.read(x1) ;
+ ByteBuffer bb2a = file.read(x2) ;
+ assertNotSame(bb1a, bb2a) ;
+ assertTrue(sameValue(bb1, bb1a)) ;
+ assertTrue(sameValue(bb2, bb2a)) ;
+ }
+
+ // Oversized writes.
+
+ @Test public void objectfile_07()
+ {
+
+ }
+
+ @Test public void objectfile_08()
+ {}
+
+ @Test public void objectfile_09()
+ {}
+
+ @Test public void objectfile_10()
+ {}
+
+ public static void fill(ByteBuffer byteBuffer)
+ {
+ int len = byteBuffer.remaining() ;
+ for ( int i = 0 ; i < len ; i++ )
+ byteBuffer.put((byte)(i&0xFF)) ;
+ byteBuffer.rewind() ;
+ }
+
+ protected abstract ObjectFile make() ;
+}
+
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
\ No newline at end of file
Propchange: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/AbstractTestObjectFile.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/AbstractTestStringFile.java (from r1128376, incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestStringFile.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/AbstractTestStringFile.java?p2=incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/AbstractTestStringFile.java&p1=incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestStringFile.java&r1=1128376&r2=1128950&rev=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestStringFile.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/AbstractTestStringFile.java Sun May 29 20:55:51 2011
@@ -4,7 +4,7 @@
* [See end of file]
*/
-package com.hp.hpl.jena.tdb.base.file;
+package com.hp.hpl.jena.tdb.base.objectfile;
import org.junit.After ;
import org.junit.Before ;
Propchange: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/AbstractTestStringFile.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TS_ObjectFile.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TS_ObjectFile.java?rev=1128950&view=auto
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TS_ObjectFile.java (added)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TS_ObjectFile.java Sun May 29 20:55:51 2011
@@ -0,0 +1,49 @@
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ * [See end of file]
+ */
+
+package com.hp.hpl.jena.tdb.base.objectfile;
+
+import org.junit.runner.RunWith ;
+import org.junit.runners.Suite ;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {
+ TestObjectFileMem.class
+ , TestObjectFileDisk.class
+ , TestObjectFileDiskBuffering.class
+ , TestStringFileMem.class
+ , TestStringFileDisk.class
+})
+
+public class TS_ObjectFile
+{ }
+
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
\ No newline at end of file
Propchange: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TS_ObjectFile.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileDisk.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileDisk.java?rev=1128950&view=auto
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileDisk.java (added)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileDisk.java Sun May 29 20:55:51 2011
@@ -0,0 +1,56 @@
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ * [See end of file]
+ */
+
+package com.hp.hpl.jena.tdb.base.objectfile;
+
+import org.junit.AfterClass ;
+import org.openjena.atlas.lib.FileOps ;
+
+import com.hp.hpl.jena.tdb.ConfigTest ;
+import com.hp.hpl.jena.tdb.base.file.BufferChannel ;
+import com.hp.hpl.jena.tdb.base.file.BufferChannelFile ;
+
+public class TestObjectFileDisk extends AbstractTestObjectFile
+{
+ static String filename = ConfigTest.getTestingDir()+"/test-objectfile" ;
+
+ @AfterClass public static void cleanup() { FileOps.deleteSilent(filename) ; }
+
+ @Override
+ protected ObjectFile make()
+ {
+ FileOps.deleteSilent(filename) ;
+ BufferChannel chan = new BufferChannelFile(filename) ;
+ return new ObjectFileStorage(chan) ;
+ }
+}
+
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
\ No newline at end of file
Propchange: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileDisk.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileDiskBuffering.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileDiskBuffering.java?rev=1128950&view=auto
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileDiskBuffering.java (added)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileDiskBuffering.java Sun May 29 20:55:51 2011
@@ -0,0 +1,120 @@
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ * [See end of file]
+ */
+
+package com.hp.hpl.jena.tdb.base.objectfile;
+
+import java.nio.ByteBuffer ;
+
+import org.junit.AfterClass ;
+import org.junit.Test ;
+import org.openjena.atlas.junit.BaseTest ;
+import org.openjena.atlas.lib.FileOps ;
+
+import com.hp.hpl.jena.tdb.ConfigTest ;
+import com.hp.hpl.jena.tdb.base.block.Block ;
+import com.hp.hpl.jena.tdb.base.file.BufferChannel ;
+import com.hp.hpl.jena.tdb.base.file.BufferChannelFile ;
+
+import static com.hp.hpl.jena.tdb.base.BlockLib.* ;
+import static com.hp.hpl.jena.tdb.base.objectfile.AbstractTestObjectFile.fill ;
+
+public class TestObjectFileDiskBuffering extends BaseTest
+{
+ static String filename = ConfigTest.getTestingDir()+"/test-objectfile" ;
+
+ @AfterClass public static void cleanup() { FileOps.deleteSilent(filename) ; }
+
+ protected ObjectFile make(int bufferSize)
+ {
+ FileOps.deleteSilent(filename) ;
+ BufferChannel chan = new BufferChannelFile(filename) ;
+ return new ObjectFileStorage(chan, bufferSize) ;
+ }
+
+ private void write(int sizeOfBuffer, int... sizes)
+ {
+ ObjectFile file = make(sizeOfBuffer) ;
+ int N = sizes.length ;
+ ByteBuffer bb[] = new ByteBuffer[N] ;
+ long loc[] = new long[N] ;
+ ByteBuffer read[] = new ByteBuffer[N] ;
+
+ for ( int i = 0 ; i < N ; i++ )
+ {
+ bb[i] = ByteBuffer.allocate(sizes[i]) ;
+ fill(bb[i]) ;
+ loc[i] = file.write(bb[i]) ;
+ }
+
+ for ( int i = 0 ; i < N ; i++ )
+ {
+ read[i] = file.read(loc[i]) ;
+ assertNotSame(bb[i], read[i]) ;
+ sameValue(bb[i], read[i]) ;
+ }
+ }
+
+ private void writePrealloc(int sizeOfBuffer, int... sizes)
+ {
+ ObjectFile file = make(sizeOfBuffer) ;
+ int N = sizes.length ;
+ Block blocks[] = new Block[N] ;
+ ByteBuffer read[] = new ByteBuffer[N] ;
+
+ for ( int i = 0 ; i < N ; i++ )
+ {
+ blocks[i] = file.allocWrite(sizes[i]) ;
+ fill(blocks[i].getByteBuffer()) ;
+ file.completeWrite(blocks[i]) ;
+ }
+
+ for ( int i = 0 ; i < N ; i++ )
+ {
+ read[i] = file.read(blocks[i].getId()) ;
+ assertNotSame(blocks[i].getByteBuffer(), read[i]) ;
+ sameValue(blocks[i].getByteBuffer(), read[i]) ;
+ }
+ }
+
+
+ @Test public void objectfile_50() { write(5, 10) ; }
+ @Test public void objectfile_51() { writePrealloc(5, 10) ; }
+ @Test public void objectfile_52() { write(12, 10) ; }
+ @Test public void objectfile_53() { writePrealloc(12, 10) ; }
+ @Test public void objectfile_54() { write(12, 10, 8) ; } // 10 is too big
+ @Test public void objectfile_55() { writePrealloc(12, 10, 8) ; } // 10 is too big
+ @Test public void objectfile_56() { write(12, 6, 10) ; }
+ @Test public void objectfile_57() { writePrealloc(12, 6, 10) ; }
+ @Test public void objectfile_58() { write(20, 6, 10, 5) ; }
+ @Test public void objectfile_59() { writePrealloc(20, 6, 10, 5) ; }
+}
+
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
\ No newline at end of file
Propchange: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileDiskBuffering.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileMem.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileMem.java?rev=1128950&view=auto
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileMem.java (added)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileMem.java Sun May 29 20:55:51 2011
@@ -0,0 +1,45 @@
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ * [See end of file]
+ */
+
+package com.hp.hpl.jena.tdb.base.objectfile;
+
+public class TestObjectFileMem extends AbstractTestObjectFile
+{
+
+ @Override
+ protected ObjectFile make()
+ {
+ return new ObjectFileMem() ;
+ }
+
+}
+
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
\ No newline at end of file
Propchange: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestObjectFileMem.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestStringFileDisk.java (from r1128376, incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestStringFileDisk.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestStringFileDisk.java?p2=incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestStringFileDisk.java&p1=incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestStringFileDisk.java&r1=1128376&r2=1128950&rev=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestStringFileDisk.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestStringFileDisk.java Sun May 29 20:55:51 2011
@@ -5,12 +5,14 @@
* [See end of file]
*/
-package com.hp.hpl.jena.tdb.base.file;
+package com.hp.hpl.jena.tdb.base.objectfile;
import static org.openjena.atlas.lib.FileOps.clearDirectory ;
import org.openjena.atlas.lib.FileOps ;
import com.hp.hpl.jena.tdb.ConfigTest ;
+import com.hp.hpl.jena.tdb.base.file.FileFactory ;
+import com.hp.hpl.jena.tdb.base.file.Location ;
import com.hp.hpl.jena.tdb.base.objectfile.StringFile ;
public class TestStringFileDisk extends AbstractTestStringFile
Propchange: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestStringFileDisk.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestStringFileMem.java (from r1128376, incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestStringFileMem.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestStringFileMem.java?p2=incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestStringFileMem.java&p1=incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestStringFileMem.java&r1=1128376&r2=1128950&rev=1128950&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestStringFileMem.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestStringFileMem.java Sun May 29 20:55:51 2011
@@ -4,8 +4,9 @@
* [See end of file]
*/
-package com.hp.hpl.jena.tdb.base.file;
+package com.hp.hpl.jena.tdb.base.objectfile;
+import com.hp.hpl.jena.tdb.base.file.FileFactory ;
import com.hp.hpl.jena.tdb.base.objectfile.StringFile ;
public class TestStringFileMem extends AbstractTestStringFile
Propchange: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/objectfile/TestStringFileMem.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/atlas/junit/BaseTest.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/atlas/junit/BaseTest.java?rev=1128950&r1=1128949&r2=1128950&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/atlas/junit/BaseTest.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/atlas/junit/BaseTest.java Sun May 29 20:55:51 2011
@@ -19,6 +19,11 @@ public class BaseTest extends Assert
{
assertFalse(msg, a.equals(b)) ;
}
+
+ public static void assertNotEquals(long a, long b)
+ {
+ assertFalse(a == b ) ;
+ }
}
/*