Thread: [Joafip-svn] SF.net SVN: joafip:[2959] trunk/joafip-file/src
Brought to you by:
luc_peuvrier
|
From: <luc...@us...> - 2011-10-31 03:41:49
|
Revision: 2959
http://joafip.svn.sourceforge.net/joafip/?rev=2959&view=rev
Author: luc_peuvrier
Date: 2011-10-31 03:41:43 +0000 (Mon, 31 Oct 2011)
Log Message:
-----------
added close and open consistency on parallel random access file
Modified Paths:
--------------
trunk/joafip-file/src/main/java/net/sf/joafip/file/service/FileOutputStreamNIO.java
trunk/joafip-file/src/main/java/net/sf/joafip/file/service/IRandomAccessFile.java
trunk/joafip-file/src/test/java/net/sf/joafip/file/service/ParallelRandomAccessFileForTest.java
trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileProbeForTest.java
Modified: trunk/joafip-file/src/main/java/net/sf/joafip/file/service/FileOutputStreamNIO.java
===================================================================
--- trunk/joafip-file/src/main/java/net/sf/joafip/file/service/FileOutputStreamNIO.java 2011-10-31 03:40:12 UTC (rev 2958)
+++ trunk/joafip-file/src/main/java/net/sf/joafip/file/service/FileOutputStreamNIO.java 2011-10-31 03:41:43 UTC (rev 2959)
@@ -70,12 +70,12 @@
@Override
public void close() throws IOException {
writeBuffer();
- if (randomAccessFile.isOpen()) {
- try {
+ try {
+ if (randomAccessFile.isOpen()) {
randomAccessFile.close();
- } catch (FileIOException exception) {
- throw new IOException(exception);
}
+ } catch (FileIOException exception) {
+ throw new IOException(exception);
}
}
Modified: trunk/joafip-file/src/main/java/net/sf/joafip/file/service/IRandomAccessFile.java
===================================================================
--- trunk/joafip-file/src/main/java/net/sf/joafip/file/service/IRandomAccessFile.java 2011-10-31 03:40:12 UTC (rev 2958)
+++ trunk/joafip-file/src/main/java/net/sf/joafip/file/service/IRandomAccessFile.java 2011-10-31 03:41:43 UTC (rev 2959)
@@ -46,9 +46,9 @@
*/
void close() throws FileIOException;
- boolean isOpen();
+ boolean isOpen() throws FileIOException;
- boolean isClose();
+ boolean isClose() throws FileIOException;
/**
* flush all modification on disk
Modified: trunk/joafip-file/src/test/java/net/sf/joafip/file/service/ParallelRandomAccessFileForTest.java
===================================================================
--- trunk/joafip-file/src/test/java/net/sf/joafip/file/service/ParallelRandomAccessFileForTest.java 2011-10-31 03:40:12 UTC (rev 2958)
+++ trunk/joafip-file/src/test/java/net/sf/joafip/file/service/ParallelRandomAccessFileForTest.java 2011-10-31 03:41:43 UTC (rev 2959)
@@ -181,13 +181,30 @@
}
@Override
- public boolean isClose() {
- return randomFileDirect.isClose();
+ public boolean isClose() throws FileIOException {
+ final boolean close1 = randomFileDirect.isClose();
+ final boolean close2 = randomFileDirectNio.isClose();
+ final boolean close3 = randomFileReadWriteCache.isClose();
+ if (close1 != close2 || close1 != close3 || close2 != close3) {
+ throw HelperFileUtil.getInstance()
+ .fileIOException(
+ "close state error " + close1 + "," + close2 + ","
+ + close3, null, null);
+ }
+ return close1;
}
@Override
- public boolean isOpen() {
- return randomFileDirect.isOpen();
+ public boolean isOpen() throws FileIOException {
+ final boolean open1 = randomFileDirect.isOpen();
+ final boolean open2 = randomFileDirectNio.isOpen();
+ final boolean open3 = randomFileReadWriteCache.isOpen();
+ if (open1 != open2 || open1 != open3 || open2 != open3) {
+ throw HelperFileUtil.getInstance().fileIOException(
+ "close state error " + open1 + "," + open2 + "," + open3,
+ null, null);
+ }
+ return open1;
}
@Override
Modified: trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileProbeForTest.java
===================================================================
--- trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileProbeForTest.java 2011-10-31 03:40:12 UTC (rev 2958)
+++ trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileProbeForTest.java 2011-10-31 03:41:43 UTC (rev 2959)
@@ -152,12 +152,12 @@
}
@Override
- public boolean isClose() {
+ public boolean isClose() throws FileIOException {
return delegate.isClose();
}
@Override
- public boolean isOpen() {
+ public boolean isOpen() throws FileIOException {
return delegate.isOpen();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-31 03:41:49
|
Revision: 2959
http://joafip.svn.sourceforge.net/joafip/?rev=2959&view=rev
Author: luc_peuvrier
Date: 2011-10-31 03:41:43 +0000 (Mon, 31 Oct 2011)
Log Message:
-----------
added close and open consistency on parallel random access file
Modified Paths:
--------------
trunk/joafip-file/src/main/java/net/sf/joafip/file/service/FileOutputStreamNIO.java
trunk/joafip-file/src/main/java/net/sf/joafip/file/service/IRandomAccessFile.java
trunk/joafip-file/src/test/java/net/sf/joafip/file/service/ParallelRandomAccessFileForTest.java
trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileProbeForTest.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2012-05-01 20:02:49
|
Revision: 3057
http://joafip.svn.sourceforge.net/joafip/?rev=3057&view=rev
Author: luc_peuvrier
Date: 2012-05-01 20:02:42 +0000 (Tue, 01 May 2012)
Log Message:
-----------
javadoc update, clearCache no more public, must not be public
Modified Paths:
--------------
trunk/joafip-file/src/main/java/net/sf/joafip/file/entity/PageNode.java
trunk/joafip-file/src/main/java/net/sf/joafip/file/service/IRandomAccessFile.java
trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileDirect.java
trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileDirectNio.java
trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileReadWriteCache.java
trunk/joafip-file/src/test/java/net/sf/joafip/file/service/ParallelRandomAccessFileForTest.java
trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileProbeForTest.java
trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileReadWriteCacheTest.java
trunk/joafip-file/src/test/java/net/sf/joafip/file/service/TestRandomAccessFileCache.java
Added Paths:
-----------
trunk/joafip-file/src/test/java/net/sf/joafip/file/entity/FileAccessRecordForTests.java
Removed Paths:
-------------
trunk/joafip-file/src/test/java/net/sf/joafip/file/entity/FileAccessRecord.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2012-05-01 20:02:49
|
Revision: 3057
http://joafip.svn.sourceforge.net/joafip/?rev=3057&view=rev
Author: luc_peuvrier
Date: 2012-05-01 20:02:42 +0000 (Tue, 01 May 2012)
Log Message:
-----------
javadoc update, clearCache no more public, must not be public
Modified Paths:
--------------
trunk/joafip-file/src/main/java/net/sf/joafip/file/entity/PageNode.java
trunk/joafip-file/src/main/java/net/sf/joafip/file/service/IRandomAccessFile.java
trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileDirect.java
trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileDirectNio.java
trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileReadWriteCache.java
trunk/joafip-file/src/test/java/net/sf/joafip/file/service/ParallelRandomAccessFileForTest.java
trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileProbeForTest.java
trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileReadWriteCacheTest.java
trunk/joafip-file/src/test/java/net/sf/joafip/file/service/TestRandomAccessFileCache.java
Added Paths:
-----------
trunk/joafip-file/src/test/java/net/sf/joafip/file/entity/FileAccessRecordForTests.java
Removed Paths:
-------------
trunk/joafip-file/src/test/java/net/sf/joafip/file/entity/FileAccessRecord.java
Modified: trunk/joafip-file/src/main/java/net/sf/joafip/file/entity/PageNode.java
===================================================================
--- trunk/joafip-file/src/main/java/net/sf/joafip/file/entity/PageNode.java 2012-05-01 18:43:45 UTC (rev 3056)
+++ trunk/joafip-file/src/main/java/net/sf/joafip/file/entity/PageNode.java 2012-05-01 20:02:42 UTC (rev 3057)
@@ -44,7 +44,7 @@
/** previous page node, null if this is the first node */
public PageNode previous;
- /** next page node, null if this is the last node */
+ /** next free page node, null if this is the last node */
public PageNode next;
public PageNode(final byte[] data) { // NOPMD
Modified: trunk/joafip-file/src/main/java/net/sf/joafip/file/service/IRandomAccessFile.java
===================================================================
--- trunk/joafip-file/src/main/java/net/sf/joafip/file/service/IRandomAccessFile.java 2012-05-01 18:43:45 UTC (rev 3056)
+++ trunk/joafip-file/src/main/java/net/sf/joafip/file/service/IRandomAccessFile.java 2012-05-01 20:02:42 UTC (rev 3057)
@@ -86,14 +86,6 @@
void setLength(final long newSize) throws FileIOException;
/**
- * clear the cache<br>
- * this can be done independently to file opened state or closed<br>
- *
- * @throws FileIOException
- */
- void clearCache() throws FileIOException;
-
- /**
* make copy of this file in other file
*
* @param fileName
Modified: trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileDirect.java
===================================================================
--- trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileDirect.java 2012-05-01 18:43:45 UTC (rev 3056)
+++ trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileDirect.java 2012-05-01 20:02:42 UTC (rev 3057)
@@ -269,11 +269,6 @@
}
@Override
- public void clearCache() {
- // nothing to do
- }
-
- @Override
public void copy(final String fileName) throws FileIOException {
final long savedCurrentPositionInFile = currentPositionInFile;
if (opened) {
Modified: trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileDirectNio.java
===================================================================
--- trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileDirectNio.java 2012-05-01 18:43:45 UTC (rev 3056)
+++ trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileDirectNio.java 2012-05-01 20:02:42 UTC (rev 3057)
@@ -322,11 +322,6 @@
}
@Override
- public void clearCache() {
- // nothing to do
- }
-
- @Override
public void copy(final String fileName) throws FileIOException {
try {
if (opened) {
Modified: trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileReadWriteCache.java
===================================================================
--- trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileReadWriteCache.java 2012-05-01 18:43:45 UTC (rev 3056)
+++ trunk/joafip-file/src/main/java/net/sf/joafip/file/service/RandomAccessFileReadWriteCache.java 2012-05-01 20:02:42 UTC (rev 3057)
@@ -68,6 +68,7 @@
/** true if use read cache */
private boolean haveReadCache;// NOPMD
+ /** first free page node */
private PageNode freePageRootNode;
/** first of used page (less acceded) */
@@ -178,6 +179,7 @@
public void closeImpl() throws FileIOException {
writeModified();
randomAccessFileDelegate.close();
+ clearCache();
}
@Override
@@ -221,8 +223,8 @@
randomAccessFileDelegate.deleteIfExistsRenaming();
}
- @Override
- public void clearCache() {
+ // @Override
+ private void clearCache() {
cacheMap.clear();
while (usedPageFirstNode != null) {
freePage(usedPageFirstNode);
Deleted: trunk/joafip-file/src/test/java/net/sf/joafip/file/entity/FileAccessRecord.java
===================================================================
--- trunk/joafip-file/src/test/java/net/sf/joafip/file/entity/FileAccessRecord.java 2012-05-01 18:43:45 UTC (rev 3056)
+++ trunk/joafip-file/src/test/java/net/sf/joafip/file/entity/FileAccessRecord.java 2012-05-01 20:02:42 UTC (rev 3057)
@@ -1,56 +0,0 @@
-/*
- * Copyright 2010 Luc Peuvrier
- *
- * This file is a part of JOAFIP.
- *
- * JOAFIP is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License.
- *
- * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
- * Licensed under the LGPL License, Version 3, 29 June 2007 (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.gnu.org/licenses/lgpl.html
- *
- * JOAFIP is distributed in the hope that it will be useful, but
- * 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 net.sf.joafip.file.entity;
-
-import java.util.Arrays;
-
-/**
- *
- * @author luc peuvrier
- *
- */
-public class FileAccessRecord {
-
- private final long positionInFile;
-
- private final byte[] data;
-
- public FileAccessRecord(final long positionInFile, final byte[] data,
- final int offset, final int length) {
- super();
- this.positionInFile = positionInFile;
- this.data = Arrays.copyOfRange(data, offset, offset + length);
- }
-
- public long getPositionInFile() {
- return positionInFile;
- }
-
- public byte[] getData() {
- return data;// NOPMD
- }
-
- public String getStrData() {
- return new String(data);
- }
-}
Copied: trunk/joafip-file/src/test/java/net/sf/joafip/file/entity/FileAccessRecordForTests.java (from rev 3024, trunk/joafip-file/src/test/java/net/sf/joafip/file/entity/FileAccessRecord.java)
===================================================================
--- trunk/joafip-file/src/test/java/net/sf/joafip/file/entity/FileAccessRecordForTests.java (rev 0)
+++ trunk/joafip-file/src/test/java/net/sf/joafip/file/entity/FileAccessRecordForTests.java 2012-05-01 20:02:42 UTC (rev 3057)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2010 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (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.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * 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 net.sf.joafip.file.entity;
+
+import java.util.Arrays;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+public class FileAccessRecordForTests {
+
+ private final long positionInFile;
+
+ private final byte[] data;
+
+ public FileAccessRecordForTests(final long positionInFile,
+ final byte[] data, final int offset, final int length) {
+ super();
+ this.positionInFile = positionInFile;
+ this.data = Arrays.copyOfRange(data, offset, offset + length);
+ }
+
+ public long getPositionInFile() {
+ return positionInFile;
+ }
+
+ public byte[] getData() {
+ return data;// NOPMD
+ }
+
+ public String getStrData() {
+ return new String(data);
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("FileAccessRecordForTests [positionInFile=");
+ builder.append(positionInFile);
+ builder.append(", data.length=");
+ builder.append(data.length);
+ builder.append("]");
+ return builder.toString();
+ }
+}
Modified: trunk/joafip-file/src/test/java/net/sf/joafip/file/service/ParallelRandomAccessFileForTest.java
===================================================================
--- trunk/joafip-file/src/test/java/net/sf/joafip/file/service/ParallelRandomAccessFileForTest.java 2012-05-01 18:43:45 UTC (rev 3056)
+++ trunk/joafip-file/src/test/java/net/sf/joafip/file/service/ParallelRandomAccessFileForTest.java 2012-05-01 20:02:42 UTC (rev 3057)
@@ -75,13 +75,6 @@
}
@Override
- public void clearCache() throws FileIOException {
- randomFileDirect.clearCache();
- randomFileDirectNio.clearCache();
- randomFileReadWriteCache.clearCache();
- }
-
- @Override
public void deleteIfExists() throws FileIOException {
randomFileDirect.deleteIfExists();
randomFileDirectNio.deleteIfExists();
Modified: trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileProbeForTest.java
===================================================================
--- trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileProbeForTest.java 2012-05-01 18:43:45 UTC (rev 3056)
+++ trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileProbeForTest.java 2012-05-01 20:02:42 UTC (rev 3057)
@@ -27,7 +27,7 @@
import java.util.LinkedList;
import java.util.SortedMap;
-import net.sf.joafip.file.entity.FileAccessRecord;
+import net.sf.joafip.file.entity.FileAccessRecordForTests;
/**
* probe of read write operation
@@ -39,9 +39,9 @@
private final IRandomAccessFile delegate;
- private final Deque<FileAccessRecord> readLog = new LinkedList<FileAccessRecord>();
+ private final Deque<FileAccessRecordForTests> readLog = new LinkedList<FileAccessRecordForTests>();
- private final Deque<FileAccessRecord> writeLog = new LinkedList<FileAccessRecord>();
+ private final Deque<FileAccessRecordForTests> writeLog = new LinkedList<FileAccessRecordForTests>();
public RandomAccessFileProbeForTest(final File file) {
super();
@@ -58,7 +58,7 @@
final long positionInFile = delegate.currentPositionInFile();
final int read = delegate.read(data);
if (read > 0) {
- final FileAccessRecord fileAccessRecord = new FileAccessRecord(
+ final FileAccessRecordForTests fileAccessRecord = new FileAccessRecordForTests(
positionInFile, data, 0, data.length);
readLog.add(fileAccessRecord);
}
@@ -71,7 +71,7 @@
final long positionInFile = delegate.currentPositionInFile();
final int read = delegate.read(data, offset, length);
if (read > 0) {
- final FileAccessRecord fileAccessRecord = new FileAccessRecord(
+ final FileAccessRecordForTests fileAccessRecord = new FileAccessRecordForTests(
positionInFile, data, offset, length);
readLog.add(fileAccessRecord);
}
@@ -81,7 +81,7 @@
@Override
public void write(final byte[] data) throws FileIOException {
final long positionInFile = delegate.currentPositionInFile();
- final FileAccessRecord fileAccessRecord = new FileAccessRecord(
+ final FileAccessRecordForTests fileAccessRecord = new FileAccessRecordForTests(
positionInFile, data, 0, data.length);
delegate.write(data);
writeLog.add(fileAccessRecord);
@@ -91,7 +91,7 @@
public void write(final byte[] data, final int length)
throws FileIOException {
final long positionInFile = delegate.currentPositionInFile();
- final FileAccessRecord fileAccessRecord = new FileAccessRecord(
+ final FileAccessRecordForTests fileAccessRecord = new FileAccessRecordForTests(
positionInFile, data, 0, length);
delegate.write(data);
writeLog.add(fileAccessRecord);
@@ -101,7 +101,7 @@
public void write(final byte[] data, final int offset, final int length)
throws FileIOException {
final long positionInFile = delegate.currentPositionInFile();
- final FileAccessRecord fileAccessRecord = new FileAccessRecord(
+ final FileAccessRecordForTests fileAccessRecord = new FileAccessRecordForTests(
positionInFile, data, offset, length);
delegate.write(data);
writeLog.add(fileAccessRecord);
@@ -112,7 +112,7 @@
writeLog.clear();
}
- public FileAccessRecord pollFirstRead() {
+ public FileAccessRecordForTests pollFirstRead() {
return readLog.pollFirst();
}
@@ -120,7 +120,7 @@
return readLog.size();
}
- public FileAccessRecord pollFirstWrote() {
+ public FileAccessRecordForTests pollFirstWrote() {
return writeLog.pollFirst();
}
@@ -128,6 +128,15 @@
return writeLog.size();
}
+ public String readLogToString() {
+ final StringBuilder stringBuilder = new StringBuilder();
+ for (FileAccessRecordForTests fileAccessRecord : readLog) {
+ stringBuilder.append(fileAccessRecord.toString());
+ stringBuilder.append('\n');
+ }
+ return stringBuilder.toString();
+ }
+
@Override
public void seek(final long positionInFile) throws FileIOException {
delegate.seek(positionInFile);
@@ -139,11 +148,6 @@
}
@Override
- public void clearCache() throws FileIOException {
- delegate.clearCache();
- }
-
- @Override
public void close() throws FileIOException {
delegate.close();
}
Modified: trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileReadWriteCacheTest.java
===================================================================
--- trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileReadWriteCacheTest.java 2012-05-01 18:43:45 UTC (rev 3056)
+++ trunk/joafip-file/src/test/java/net/sf/joafip/file/service/RandomAccessFileReadWriteCacheTest.java 2012-05-01 20:02:42 UTC (rev 3057)
@@ -29,7 +29,7 @@
import net.sf.joafip.DoNotTransform;
import net.sf.joafip.NotStorableClass;
import net.sf.joafip.TestException;
-import net.sf.joafip.file.entity.FileAccessRecord;
+import net.sf.joafip.file.entity.FileAccessRecordForTests;
import net.sf.joafip.logger.JoafipLogger;
/**
@@ -138,7 +138,7 @@
// check page 0 wrote
assertEquals(BAD_READ_ACCESS, 0, probe.readLogSize());
assertEquals(BAD_WRITE_ACCESS, 1, probe.writeLogSize());
- FileAccessRecord record = probe.pollFirstWrote();
+ FileAccessRecordForTests record = probe.pollFirstWrote();
assertNotNull("must write at 3*PAGE_SIZE", record);
assertEquals(BAD_POSITION_IN_FILE, 3 * PAGE_SIZE,
record.getPositionInFile());
@@ -197,10 +197,20 @@
+ randomFileAccess.getPageSet().toString());
}
- assertEquals(BAD_READ_ACCESS, 2, probe.readLogSize());
+ assertEquals(BAD_READ_ACCESS + '\n' + probe.readLogToString(), 5,
+ probe.readLogSize());
assertEquals(BAD_WRITE_ACCESS, 0, probe.writeLogSize());
record = probe.pollFirstRead();
+ assertEquals(BAD_POSITION_IN_FILE, 0 * PAGE_SIZE,
+ record.getPositionInFile());
+ record = probe.pollFirstRead();
+ assertEquals(BAD_POSITION_IN_FILE, 1 * PAGE_SIZE,
+ record.getPositionInFile());
+ record = probe.pollFirstRead();
+ assertEquals(BAD_POSITION_IN_FILE, 2 * PAGE_SIZE,
+ record.getPositionInFile());
+ record = probe.pollFirstRead();
assertEquals(BAD_POSITION_IN_FILE, 3 * PAGE_SIZE,
record.getPositionInFile());
assertEquals(BAD_DATA, createStrPageData('3'), record.getStrData());
Modified: trunk/joafip-file/src/test/java/net/sf/joafip/file/service/TestRandomAccessFileCache.java
===================================================================
--- trunk/joafip-file/src/test/java/net/sf/joafip/file/service/TestRandomAccessFileCache.java 2012-05-01 18:43:45 UTC (rev 3056)
+++ trunk/joafip-file/src/test/java/net/sf/joafip/file/service/TestRandomAccessFileCache.java 2012-05-01 20:02:42 UTC (rev 3057)
@@ -94,7 +94,7 @@
public void testWroteInFile() throws FileIOException {
writeData();
fileCache.close();
- fileCache.clearCache();
+ // fileCache.clearCache();
fileCache.open();
assertWroteReading();
}
@@ -102,7 +102,7 @@
public void testRandomBlock() throws FileIOException {
writeData();
fileCache.close();
- fileCache.clearCache();
+ // fileCache.clearCache();
fileCache.open();
writeBlock(25, 200);
@@ -133,7 +133,7 @@
}
fileCache.flush();
fileCache.close();
- fileCache.clearCache();
+ // fileCache.clearCache();
/*
* change value in first page, when read enough to activate old page
@@ -150,7 +150,7 @@
}
fileCache.flush();
fileCache.close();
- fileCache.clearCache();
+ // fileCache.clearCache();
/*
* check if first page wrote
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|