[Joafip-svn] SF.net SVN: joafip:[3019] trunk
Brought to you by:
luc_peuvrier
|
From: <luc...@us...> - 2012-04-19 01:10:34
|
Revision: 3019
http://joafip.svn.sourceforge.net/joafip/?rev=3019&view=rev
Author: luc_peuvrier
Date: 2012-04-19 01:10:23 +0000 (Thu, 19 Apr 2012)
Log Message:
-----------
bad package changed
Modified Paths:
--------------
trunk/joafip-testsuite/src/main/java/net/sf/joafip/kvstore/record/entity/KVRecordEntityTests.java
Added Paths:
-----------
trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/
trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/
trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/
trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/RecordForTest.java
trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/TestAbstractFileStorable.java
trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/TestDataRecordIdentifier.java
trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/TestMarshall.java
trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/service/
Removed Paths:
-------------
trunk/joafip-kvstore/src/test/java/net/sf/joafip/heapfile/
Copied: trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/RecordForTest.java (from rev 3018, trunk/joafip-kvstore/src/test/java/net/sf/joafip/heapfile/record/entity/RecordForTest.java)
===================================================================
--- trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/RecordForTest.java (rev 0)
+++ trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/RecordForTest.java 2012-04-19 01:10:23 UTC (rev 3019)
@@ -0,0 +1,114 @@
+package net.sf.joafip.kvstore.record.entity;
+
+/*
+ * Copyright 2012 Luc Peuvrier
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+import net.sf.joafip.kvstore.record.service.IHeapElementManager;
+import net.sf.joafip.kvstore.entity.AbstractFileStorable;
+import net.sf.joafip.kvstore.service.HeapException;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+public class RecordForTest extends AbstractFileStorable {
+
+ private final int recordSize;
+
+ private int value;
+
+ public RecordForTest(final IHeapElementManager heapElementManager,
+ final long positionInFile, final int recordSize) {
+ super(heapElementManager.getFileForStorable(), positionInFile);
+ this.recordSize = recordSize;
+ }
+
+ @Override
+ public long getPreviousRecordPositionInFile() throws HeapException {
+ throw new HeapException("unsupported");
+ }
+
+ @Override
+ public int getRecordSize() throws HeapException {
+ return recordSize;
+ }
+
+ @Override
+ protected int toMarshallSize() throws HeapException {
+ return 8;// integer vale and integer crc32
+ }
+
+ @Override
+ protected void valueChangedAction() throws HeapException {
+ // no implementation
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+ public void setValue(final int value) throws HeapException {
+ this.value = value;
+ setValueIsChangedValueToSave();
+ }
+
+ @Override
+ protected void unmarshallImpl() throws HeapException {
+ readFileToIoBuffer(8);
+ value = readInteger();
+ readAndCheckCrc32();
+ }
+
+ @Override
+ protected void marshallImpl() throws HeapException {
+ writeInteger(value);
+ writeCrc32();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + recordSize;
+ result = prime * result + value;
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ RecordForTest other = (RecordForTest) obj;
+ if (recordSize != other.recordSize)
+ return false;
+ if (value != other.value)
+ return false;
+ return true;
+ }
+}
Copied: trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/TestAbstractFileStorable.java (from rev 3018, trunk/joafip-kvstore/src/test/java/net/sf/joafip/heapfile/record/entity/TestAbstractFileStorable.java)
===================================================================
--- trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/TestAbstractFileStorable.java (rev 0)
+++ trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/TestAbstractFileStorable.java 2012-04-19 01:10:23 UTC (rev 3019)
@@ -0,0 +1,215 @@
+/*
+ * Copyright 2007 Luc Peuvrier
+ *
+ * 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
+ *
+ * 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.kvstore.record.entity;
+
+import java.io.File;
+
+import net.sf.joafip.AbstractCommonDeleteFileTestCase;
+import net.sf.joafip.DoNotTransform;
+import net.sf.joafip.NotStorableClass;
+import net.sf.joafip.TestConstant;
+import net.sf.joafip.TestException;
+import net.sf.joafip.kvstore.entity.AbstractFileStorable;
+import net.sf.joafip.kvstore.service.FileForStorable;
+import net.sf.joafip.kvstore.service.HeapException;
+
+@NotStorableClass
+@DoNotTransform
+public class TestAbstractFileStorable extends AbstractCommonDeleteFileTestCase {// NOPMD
+
+ private String fileName;
+
+ private static final String DATA1 = "abcdefghijkl";
+
+ private static final String DATA2 = "0123456789abcdefghijkl";
+
+ @NotStorableClass
+ private class Storable extends AbstractFileStorable {
+
+ public byte data[]; // NOPMD
+
+ public int dataSize; // NOPMD
+
+ public Storable(final FileForStorable fileForStorable,
+ final long positionInFile) {
+ super(fileForStorable, positionInFile);
+ }
+
+ @Override
+ protected void valueChangedAction() throws HeapException {
+ // no implementation
+ }
+
+ @Override
+ protected int toMarshallSize() throws HeapException {
+ return dataSize + 4;
+ }
+
+ @Override
+ protected void unmarshallImpl() throws HeapException {
+ readFileToIoBuffer(dataSize + 4);// +4 for crc32
+ data = readBytes(dataSize);
+ readAndCheckCrc32();
+ logger.info("wrote crc32 " + getCrc32() + " pos=" + positionInFile);
+ }
+
+ @Override
+ protected void marshallImpl() throws HeapException {
+ writeBytes(data);
+ writeCrc32();
+ logger.info("wrote crc32 " + getCrc32() + " pos=" + positionInFile);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {// NOPMD hascode not needed
+ boolean equals;
+ if (obj == null) {
+ equals = false;
+ } else if (obj instanceof Storable) {
+ final Storable storable = (Storable) obj;
+ equals = positionInFile == storable.positionInFile;
+ if (equals) {
+ equals = data.length == storable.data.length;
+ }
+ for (int index = 0; equals && index < data.length; index++) {
+ equals = data[index] == storable.data[index];
+ }
+ } else {
+ equals = false;
+ }
+ return equals;
+ }
+
+ @Override
+ public long getPreviousRecordPositionInFile() throws HeapException {
+ throw new HeapException("unsupported");
+ }
+
+ @Override
+ public int getRecordSize() throws HeapException {
+ throw new HeapException("unsupported");
+ }
+ };
+
+ private Storable storableIn1; // NOPMD
+
+ private Storable storableOut1; // NOPMD
+
+ private Storable storableIn2; // NOPMD
+
+ private Storable storableOut2; // NOPMD
+
+ private FileForStorable fileForStorable; // NOPMD
+
+ public TestAbstractFileStorable() throws TestException {
+ super();
+ }
+
+ public TestAbstractFileStorable(final String name) throws TestException {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {// NOPMD inherit test case
+ super.setUp();
+ fileName = TestConstant.getWinRamDiskRuntimeDir() + File.separator
+ + "test.dat";
+ fileForStorable = new FileForStorable(fileName, 1, 0);
+ /* length = DATA1.length() + 4 */
+ storableIn1 = new Storable(fileForStorable, 0);
+ /* length= DATA1.length() + 4 */
+ storableOut1 = new Storable(fileForStorable, 0);
+ storableOut1.setValueIsChangedValueToSave();
+ /* length= DATA2.length() + 4 : +4 for crc32 */
+ storableIn2 = new Storable(fileForStorable, DATA1.length() + 4);
+ /* length= DATA2.length() + 4 : +4 for crc32 */
+ storableOut2 = new Storable(fileForStorable, DATA1.length() + 4);
+ storableOut2.setValueIsChangedValueToSave();
+ }
+
+ protected void tearDown() throws Exception {// NOPMD
+ try {
+ fileForStorable.close();
+ } catch (Throwable throwable) {// NOPMD
+ // ignore error
+ }
+ fileForStorable = null;// NOPMD
+ storableIn1 = null;// NOPMD
+ storableOut1 = null;// NOPMD
+ storableIn2 = null;// NOPMD
+ storableOut2 = null;// NOPMD
+ super.tearDown();
+ }
+
+ public void testInOut1() throws HeapException {// NOPMD assertion in outIn
+ new File(fileName).delete();
+ outIn();
+ }
+
+ public void testInOut2() throws HeapException {// NOPMD assertion in out in
+ new File(fileName).delete();
+ output();
+ input();
+ }
+
+ private void outIn() throws HeapException {
+ output();
+ input();
+ assertEquals("in1 must be equals to out1", storableIn1, storableOut1);
+ assertEquals("in2 must be equals to out2", storableIn2, storableOut2);
+ }
+
+ /**
+ * @throws HeapException
+ * @throws FileCorruptedException
+ */
+ private void input() throws HeapException {
+ storableIn1.dataSize = DATA1.length();
+ storableIn2.dataSize = DATA2.length();
+
+ fileForStorable.open();
+ // fileForStorable.readStorable(storableIn2);
+ storableIn2.readFromFile();
+ // fileForStorable.readStorable(storableIn1);
+ storableIn1.readFromFile();
+ fileForStorable.close();
+ }
+
+ /**
+ * @throws HeapException
+ * @throws FileCorruptedException
+ */
+ private void output() throws HeapException {
+ storableOut1.data = DATA1.getBytes();
+ storableOut1.dataSize = DATA1.length();
+
+ fileForStorable.open();
+ // fileForStorable.writeStorable(storableOut1);
+ storableOut1.writeToFile();
+ fileForStorable.close();
+
+ storableOut2.data = DATA2.getBytes();
+ storableOut2.dataSize = DATA2.length();
+
+ fileForStorable.open();
+ // fileForStorable.writeStorable(storableOut2);
+ storableOut2.writeToFile();
+ // long fileSize = fileForStorable.getFileSize();
+ fileForStorable.close();
+ // because of cache can not test that
+ // assertEquals(DATA1.length() + DATA2.length(), fileSize);
+ }
+}
Copied: trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/TestDataRecordIdentifier.java (from rev 3018, trunk/joafip-kvstore/src/test/java/net/sf/joafip/heapfile/record/entity/TestDataRecordIdentifier.java)
===================================================================
--- trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/TestDataRecordIdentifier.java (rev 0)
+++ trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/TestDataRecordIdentifier.java 2012-04-19 01:10:23 UTC (rev 3019)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2008 Luc Peuvrier
+ *
+ * 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
+ *
+ * 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.kvstore.record.entity;
+
+import net.sf.joafip.AbstractJoafipCommonTestCase;
+import net.sf.joafip.DoNotTransform;
+import net.sf.joafip.NotStorableClass;
+import net.sf.joafip.TestException;
+import net.sf.joafip.kvstore.record.entity.DataRecordIdentifier;
+
+@NotStorableClass
+@DoNotTransform
+public class TestDataRecordIdentifier extends AbstractJoafipCommonTestCase {
+
+ public TestDataRecordIdentifier() throws TestException {
+ super();
+ }
+
+ public TestDataRecordIdentifier(final String name) throws TestException {
+ super(name);
+ }
+
+ public void testSmall() {
+ final DataRecordIdentifier identifier0 = new DataRecordIdentifier(0);
+
+ assertEquals("id0 long1 must be 0", 0, identifier0.value);
+
+ final DataRecordIdentifier identifier1 = new DataRecordIdentifier(1);
+
+ assertEquals("id1 long1 must be 1", 1, identifier1.value);
+
+ final DataRecordIdentifier identifier0Bis = new DataRecordIdentifier(0);
+
+ assertEquals("id0 must be equals to itself", identifier0, identifier0);
+ assertEquals("id0 and id0bis must be equals", identifier0,
+ identifier0Bis);
+ assertEquals("id0 must be equals to itself thru compareTo", 0,
+ identifier0.compareTo(identifier0));
+ assertEquals("id0 and id0bis must be equals compareTo", 0,
+ identifier0.compareTo(identifier0Bis));
+ assertEquals("id0 and id0bis must be equals compareTo", 0,
+ identifier0Bis.compareTo(identifier0));
+ assertTrue("id0 must be less than id1",
+ identifier0.compareTo(identifier1) < 0);
+ assertTrue("id1 must be greater than id0",
+ identifier1.compareTo(identifier0) > 0);
+ }
+
+ public void testIncremente() {
+ final DataRecordIdentifier identifier = new DataRecordIdentifier(0);
+ final DataRecordIdentifier nextIdentifier = new DataRecordIdentifier(
+ identifier);
+ assertCompareWithNext(identifier, nextIdentifier);
+ final DataRecordIdentifier expectedNext = new DataRecordIdentifier(1);
+ assertEquals("not expected", expectedNext, nextIdentifier);
+ }
+
+ private void assertCompareWithNext(final DataRecordIdentifier identifier,
+ final DataRecordIdentifier nextIdentifier) {
+ assertTrue("id must be less than next",
+ identifier.compareTo(nextIdentifier) < 0);
+ assertTrue("next must be greater than id",
+ nextIdentifier.compareTo(identifier) > 0);
+ }
+}
Copied: trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/TestMarshall.java (from rev 3018, trunk/joafip-kvstore/src/test/java/net/sf/joafip/heapfile/record/entity/TestMarshall.java)
===================================================================
--- trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/TestMarshall.java (rev 0)
+++ trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/record/entity/TestMarshall.java 2012-04-19 01:10:23 UTC (rev 3019)
@@ -0,0 +1,223 @@
+/*
+ * Copyright 2007 Luc Peuvrier
+ *
+ * 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
+ *
+ * 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.kvstore.record.entity;
+
+import java.io.File;
+
+import net.sf.joafip.AbstractCommonDeleteFileTestCase;
+import net.sf.joafip.DoNotTransform;
+import net.sf.joafip.NotStorableClass;
+import net.sf.joafip.TestConstant;
+import net.sf.joafip.TestException;
+import net.sf.joafip.kvstore.entity.AbstractFileStorable;
+import net.sf.joafip.kvstore.service.FileForStorable;
+import net.sf.joafip.kvstore.service.HeapException;
+
+@NotStorableClass
+@DoNotTransform
+public class TestMarshall extends AbstractCommonDeleteFileTestCase {// NOPMD
+
+ @NotStorableClass
+ private class Marshallizable extends AbstractFileStorable {
+
+ public Marshallizable(final FileForStorable fileForStorable) {
+ /* length=8 + 4 + 1 + 4 : 1 long + 1 integer + 1 boolean + 1 integer */
+ super(fileForStorable, 0/* , 8 + 4 + 1 + 4 *//*
+ * 1 long + 1 integer +
+ * 1 boolean + 1 integer
+ */);
+ }
+
+ @Override
+ protected void valueChangedAction() throws HeapException {
+ // no implementation
+ }
+
+ public long longValue;
+
+ public int intValue; // NOPMD
+
+ public boolean booleanValue; // NOPMD
+
+ @Override
+ protected int toMarshallSize() throws HeapException {
+ return 8 + 4 + 1 + 4;
+ }
+
+ @Override
+ protected void marshallImpl() throws HeapException {
+ writeLong(longValue);
+ writeInteger(intValue);
+ writeBoolean(booleanValue);
+ writeCrc32();
+ }
+
+ @Override
+ protected void unmarshallImpl() throws HeapException {
+ readFileToIoBuffer(8 + 4 + 1 + 4);
+ longValue = readLong();
+ intValue = readInteger();
+ booleanValue = readBoolean();
+ readAndCheckCrc32();
+ }
+
+ @Override
+ public long getPreviousRecordPositionInFile() throws HeapException {
+ throw new HeapException("unsupported");
+ }
+
+ @Override
+ public int getRecordSize() throws HeapException {
+ throw new HeapException("unsupported");
+ }
+ };
+
+ private Marshallizable fileStorableForWrite; // NOPMD
+
+ private FileForStorable fileForStorable; // NOPMD
+
+ public TestMarshall() throws TestException {
+ super();
+ }
+
+ public TestMarshall(final String name) throws TestException {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {// NOPMD inherit test case
+ super.setUp();
+ fileForStorable = new FileForStorable(
+ TestConstant.getWinRamDiskRuntimeDir() + File.separator
+ + "test.dat", 1, 0);
+ }
+
+ protected void tearDown() throws Exception {// NOPMD inherit test case
+ try {
+ if (fileForStorable.isOpened()) {
+ fileForStorable.close();
+ }
+ } catch (Throwable throwable) {// NOPMD ignore all errors
+ /* ignore error */
+ }
+ fileStorableForWrite = null;// NOPMD
+ fileForStorable = null;// NOPMD
+ super.tearDown();
+ }
+
+ public void testInOut() throws HeapException {
+ fileStorableForWrite = new Marshallizable(fileForStorable);
+ assertTrue("must be in state just created",
+ fileStorableForWrite.isJustCreated());
+ assertFalse("must be in state value not changed",
+ fileStorableForWrite.isValueChangedToSave());
+ fileStorableForWrite.longValue = 0;
+ fileStorableForWrite.intValue = 0;
+ fileStorableForWrite.booleanValue = false;
+ fileStorableForWrite.setValueIsChangedValueToSave();
+ assertFalse("must not be in state just created",
+ fileStorableForWrite.isJustCreated());
+ assertTrue("must be in state value changed",
+ fileStorableForWrite.isValueChangedToSave());
+ check();
+
+ fileStorableForWrite = new Marshallizable(fileForStorable);
+ fileStorableForWrite.longValue = 0xff;
+ fileStorableForWrite.intValue = 0xff;
+ fileStorableForWrite.booleanValue = true;
+ fileStorableForWrite.setValueIsChangedValueToSave();
+ check();
+
+ fileStorableForWrite = new Marshallizable(fileForStorable);
+ fileStorableForWrite.longValue = 0xff00;
+ fileStorableForWrite.intValue = 0xff00;
+ fileStorableForWrite.booleanValue = false;
+ fileStorableForWrite.setValueIsChangedValueToSave();
+ check();
+
+ fileStorableForWrite = new Marshallizable(fileForStorable);
+ fileStorableForWrite.longValue = 0xff0000;
+ fileStorableForWrite.intValue = 0xff0000;
+ fileStorableForWrite.booleanValue = true;
+ fileStorableForWrite.setValueIsChangedValueToSave();
+ check();
+
+ fileStorableForWrite = new Marshallizable(fileForStorable);
+ fileStorableForWrite.longValue = 0xff000000;
+ fileStorableForWrite.intValue = 0xff000000;
+ fileStorableForWrite.booleanValue = false;
+ fileStorableForWrite.setValueIsChangedValueToSave();
+ check();
+
+ fileStorableForWrite = new Marshallizable(fileForStorable);
+ fileStorableForWrite.longValue = 0xff00000000L;
+ fileStorableForWrite.intValue = 0xff00ff00;
+ fileStorableForWrite.booleanValue = true;
+ fileStorableForWrite.setValueIsChangedValueToSave();
+ check();
+
+ fileStorableForWrite.longValue = 0xff0000000000L;
+ fileStorableForWrite.intValue = 0x00ff00ff;
+ fileStorableForWrite.booleanValue = false;
+ fileStorableForWrite.setValueIsChangedValueToSave();
+ check();
+
+ fileStorableForWrite.longValue = 0xff000000000000L;
+ fileStorableForWrite.intValue = 0xf0f0f0f0;
+ fileStorableForWrite.booleanValue = false;
+ fileStorableForWrite.setValueIsChangedValueToSave();
+ check();
+
+ fileStorableForWrite.longValue = 0xff00000000000000L;
+ fileStorableForWrite.intValue = 0x0f0f0f0f;
+ fileStorableForWrite.booleanValue = true;
+ fileStorableForWrite.setValueIsChangedValueToSave();
+ check();
+
+ fileStorableForWrite.longValue = 0xff00ff00ff00ff00L;
+ fileStorableForWrite.intValue = 0xffffffff;
+ fileStorableForWrite.booleanValue = false;
+ fileStorableForWrite.setValueIsChangedValueToSave();
+ check();
+ }
+
+ /**
+ * @throws HeapException
+ * @throws FileCorruptedException
+ *
+ */
+ private void check() throws HeapException {
+ final Marshallizable fileStorableForRead;
+ fileForStorable.open();
+ fileStorableForWrite.writeToFile(/* fileForStorable */);
+ assertFalse("must not be in state value changed since just wrote",
+ fileStorableForWrite.isValueChangedToSave());
+ fileStorableForRead = new Marshallizable(fileForStorable);
+ fileStorableForRead.readFromFile(/* fileForStorable */);
+ assertFalse("must be in state just created",
+ fileStorableForRead.isJustCreated());
+ assertFalse("must not be in state value changed",
+ fileStorableForRead.isValueChangedToSave());
+ fileForStorable.close();
+ assertEquals("wrote and read long value must be equals",
+ fileStorableForWrite.longValue, fileStorableForRead.longValue);
+ assertEquals("wrote and read int value must be equals",
+ fileStorableForWrite.intValue, fileStorableForRead.intValue);
+ assertEquals("wrote and read boolean value must be equals",
+ fileStorableForWrite.booleanValue,
+ fileStorableForRead.booleanValue);
+ }
+}
Modified: trunk/joafip-testsuite/src/main/java/net/sf/joafip/kvstore/record/entity/KVRecordEntityTests.java
===================================================================
--- trunk/joafip-testsuite/src/main/java/net/sf/joafip/kvstore/record/entity/KVRecordEntityTests.java 2012-04-18 08:49:04 UTC (rev 3018)
+++ trunk/joafip-testsuite/src/main/java/net/sf/joafip/kvstore/record/entity/KVRecordEntityTests.java 2012-04-19 01:10:23 UTC (rev 3019)
@@ -19,9 +19,6 @@
import junit.framework.Test;
import junit.framework.TestSuite;
import net.sf.joafip.NotStorableClass;
-import net.sf.joafip.heapfile.record.entity.TestAbstractFileStorable;
-import net.sf.joafip.heapfile.record.entity.TestDataRecordIdentifier;
-import net.sf.joafip.heapfile.record.entity.TestMarshall;
@NotStorableClass
public class KVRecordEntityTests {// NOPMD
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|