public virtual void Test5() { NeoDatis.Odb.Core.Layers.Layer3.Engine.IByteArrayConverter byteArrayConverter = NeoDatis.Odb.OdbConfiguration .GetCoreProvider().GetByteArrayConverter(); int size = 1000; NeoDatis.Odb.Core.Transaction.ISession session = new NeoDatis.Odb.Core.Mock.MockSession (NeoDatis.Odb.Test.ODBTest.Directory + "test2.neodatis"); NeoDatis.Odb.Core.Layers.Layer3.Engine.IFileSystemInterface fsi = new NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.LocalFileSystemInterface ("test", session, new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter(NeoDatis.Odb.Test.ODBTest .Directory + "test2.neodatis", true, null, null), false, NeoDatis.Odb.OdbConfiguration .GetDefaultBufferSizeForData()); NeoDatis.Odb.Impl.Core.Transaction.DefaultTransaction transaction = new NeoDatis.Odb.Impl.Core.Transaction.DefaultTransaction (session, fsi); transaction.SetArchiveLog(true); for (int i = 0; i < size; i++) { // 155 : to avoid protected zone transaction.ManageWriteAction(300 + i * 4, byteArrayConverter.IntToByteArray(i)); } // All write action were together so the transaction should have // appended all the bytes // in one WriteAction. As it as not been committed, the current // writeAction AssertEquals(0, transaction.GetWriteActions().Count); transaction.Commit(); DeleteBase("test2.neodatis"); DeleteBase(transaction.GetName()); }
public virtual void Test3() { NeoDatis.Odb.Core.Layers.Layer3.Engine.IByteArrayConverter byteArrayConverter = NeoDatis.Odb.OdbConfiguration .GetCoreProvider().GetByteArrayConverter(); int size = 1000; NeoDatis.Odb.Core.Transaction.ISession session = new NeoDatis.Odb.Core.Mock.MockSession (NeoDatis.Odb.Test.ODBTest.Directory + "test2.neodatis"); NeoDatis.Odb.Core.Layers.Layer3.Engine.IFileSystemInterface fsi = new NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.LocalFileSystemInterface ("test", session, new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter(NeoDatis.Odb.Test.ODBTest .Directory + "test2.neodatis", true, null, null), false, NeoDatis.Odb.OdbConfiguration .GetDefaultBufferSizeForData()); NeoDatis.Odb.Impl.Core.Transaction.DefaultTransaction transaction = new NeoDatis.Odb.Impl.Core.Transaction.DefaultTransaction (session, fsi); transaction.SetArchiveLog(true); for (int i = 0; i < size; i++) { // 155 : to avoid protected zone transaction.ManageWriteAction(300 + i * 4 * 2, byteArrayConverter.IntToByteArray( i)); } NeoDatis.Odb.Core.Transaction.IWriteAction wa1 = (NeoDatis.Odb.Core.Transaction.IWriteAction )transaction.GetWriteActions()[size - 2]; byte[] bytes = wa1.GetBytes(0); transaction.Commit(); long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); NeoDatis.Odb.Impl.Core.Transaction.DefaultTransaction transaction2 = NeoDatis.Odb.Impl.Core.Transaction.DefaultTransaction .Read(NeoDatis.Odb.Test.ODBTest.Directory + transaction.GetName()); long t = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs() - start; NeoDatis.Odb.Core.Transaction.IWriteAction wa2 = (NeoDatis.Odb.Core.Transaction.IWriteAction )transaction2.GetWriteActions()[size - 2]; AssertEquals(NeoDatis.Tool.DisplayUtility.ByteArrayToString(bytes), NeoDatis.Tool.DisplayUtility .ByteArrayToString(wa2.GetBytes(0))); AssertEquals(wa1.GetPosition(), wa2.GetPosition()); transaction2.Rollback(); fsi.Close(); DeleteBase("test2.neodatis"); DeleteBase(transaction.GetName()); }
/// <exception cref="System.Exception"></exception> public virtual void Test3() { NeoDatis.Odb.Core.Layers.Layer3.Engine.IByteArrayConverter byteArrayConverter = NeoDatis.Odb.OdbConfiguration .GetCoreProvider().GetByteArrayConverter(); int size = 1000; NeoDatis.Odb.Core.Transaction.ISession session = new NeoDatis.Odb.Core.Mock.MockSession (NeoDatis.Odb.Test.ODBTest.Directory + "test2.neodatis"); NeoDatis.Odb.Core.Layers.Layer3.Engine.IFileSystemInterface fsi = new NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.LocalFileSystemInterface ("test", session, new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter(NeoDatis.Odb.Test.ODBTest .Directory + "test2.neodatis", true, null, null), false, NeoDatis.Odb.OdbConfiguration .GetDefaultBufferSizeForData()); NeoDatis.Odb.Impl.Core.Transaction.DefaultTransaction transaction = new NeoDatis.Odb.Impl.Core.Transaction.DefaultTransaction (session, fsi); transaction.SetArchiveLog(true); for (int i = 0; i < size; i++) { // 155 : to avoid protected zone transaction.ManageWriteAction(300 + i * 4 * 2, byteArrayConverter.IntToByteArray( i)); } NeoDatis.Odb.Core.Transaction.IWriteAction wa1 = (NeoDatis.Odb.Core.Transaction.IWriteAction )transaction.GetWriteActions()[size - 2]; byte[] bytes = wa1.GetBytes(0); transaction.Commit(); long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); NeoDatis.Odb.Impl.Core.Transaction.DefaultTransaction transaction2 = NeoDatis.Odb.Impl.Core.Transaction.DefaultTransaction .Read(NeoDatis.Odb.Test.ODBTest.Directory + transaction.GetName()); long t = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs() - start; NeoDatis.Odb.Core.Transaction.IWriteAction wa2 = (NeoDatis.Odb.Core.Transaction.IWriteAction )transaction2.GetWriteActions()[size - 2]; AssertEquals(NeoDatis.Tool.DisplayUtility.ByteArrayToString(bytes), NeoDatis.Tool.DisplayUtility .ByteArrayToString(wa2.GetBytes(0))); AssertEquals(wa1.GetPosition(), wa2.GetPosition()); transaction2.Rollback(); fsi.Close(); DeleteBase("test2.neodatis"); DeleteBase(transaction.GetName()); }
/// <exception cref="System.Exception"></exception> public virtual void Test5() { NeoDatis.Odb.Core.Layers.Layer3.Engine.IByteArrayConverter byteArrayConverter = NeoDatis.Odb.OdbConfiguration .GetCoreProvider().GetByteArrayConverter(); int size = 1000; NeoDatis.Odb.Core.Transaction.ISession session = new NeoDatis.Odb.Core.Mock.MockSession (NeoDatis.Odb.Test.ODBTest.Directory + "test2.neodatis"); NeoDatis.Odb.Core.Layers.Layer3.Engine.IFileSystemInterface fsi = new NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.LocalFileSystemInterface ("test", session, new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter(NeoDatis.Odb.Test.ODBTest .Directory + "test2.neodatis", true, null, null), false, NeoDatis.Odb.OdbConfiguration .GetDefaultBufferSizeForData()); NeoDatis.Odb.Impl.Core.Transaction.DefaultTransaction transaction = new NeoDatis.Odb.Impl.Core.Transaction.DefaultTransaction (session, fsi); transaction.SetArchiveLog(true); for (int i = 0; i < size; i++) { // 155 : to avoid protected zone transaction.ManageWriteAction(300 + i * 4, byteArrayConverter.IntToByteArray(i)); } // All write action were together so the transaction should have // appended all the bytes // in one WriteAction. As it as not been committed, the current // writeAction AssertEquals(0, transaction.GetWriteActions().Count); transaction.Commit(); DeleteBase("test2.neodatis"); DeleteBase(transaction.GetName()); }