示例#1
0
        public virtual void Test1()
        {
            NeoDatis.Odb.Core.Transaction.ICache cache = NeoDatis.Odb.Impl.Core.Transaction.CacheFactory
                                                         .GetLocalCache(null, "test");
            string s1 = "ola1";
            string s2 = "ola2";
            string s3 = "ola3";

            cache.StartInsertingObjectWithOid(s1, NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                  (1), null);
            cache.StartInsertingObjectWithOid(s2, NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                  (2), null);
            cache.StartInsertingObjectWithOid(s3, NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                  (3), null);
            AssertTrue(cache.IdOfInsertingObject(s1) != NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
                       .NullObjectId);
            AssertTrue(cache.IdOfInsertingObject(s2) != NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
                       .NullObjectId);
            AssertTrue(cache.IdOfInsertingObject(s3) != NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
                       .NullObjectId);
            cache.EndInsertingObject(s3);
            cache.EndInsertingObject(s2);
            cache.EndInsertingObject(s1);
            AssertTrue(cache.IdOfInsertingObject(s1) == NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
                       .NullObjectId);
            AssertTrue(cache.IdOfInsertingObject(s2) == NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
                       .NullObjectId);
            AssertTrue(cache.IdOfInsertingObject(s3) == NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
                       .NullObjectId);
        }
示例#2
0
        /// <exception cref="System.IO.IOException"></exception>
        public virtual void Test2()
        {
            NeoDatis.Odb.Core.Transaction.ICache cache = NeoDatis.Odb.Impl.Core.Transaction.CacheFactory
                                                         .GetLocalCache(null, "temp");
            string s1 = "ola1";
            string s2 = "ola2";
            string s3 = "ola3";

            for (int i = 0; i < 1000 * 3; i += 3)
            {
                cache.StartInsertingObjectWithOid(s1, NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                      (i + 1), null);
                cache.StartInsertingObjectWithOid(s2, NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                      (i + 2), null);
                cache.StartInsertingObjectWithOid(s3, NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                      (i + 3), null);
            }
            AssertEquals(1000, cache.InsertingLevelOf(s1));
            AssertEquals(1000, cache.InsertingLevelOf(s2));
            AssertEquals(1000, cache.InsertingLevelOf(s3));
            for (int i = 0; i < 1000; i++)
            {
                cache.EndInsertingObject(s1);
                cache.EndInsertingObject(s2);
                cache.EndInsertingObject(s3);
            }
            AssertEquals(0, cache.InsertingLevelOf(s1));
            AssertEquals(0, cache.InsertingLevelOf(s2));
            AssertEquals(0, cache.InsertingLevelOf(s3));
            cache.StartInsertingObjectWithOid(s1, NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                  (1), null);
            cache.StartInsertingObjectWithOid(s1, NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                  (1), null);
            cache.StartInsertingObjectWithOid(s1, NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                  (1), null);
            cache.StartInsertingObjectWithOid(s2, NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                  (2), null);
            cache.StartInsertingObjectWithOid(s3, NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                  (3), null);
            AssertTrue(cache.IdOfInsertingObject(s1) != NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
                       .NullObjectId);
            AssertTrue(cache.IdOfInsertingObject(s2) != NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
                       .NullObjectId);
            AssertTrue(cache.IdOfInsertingObject(s3) != NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
                       .NullObjectId);
            cache.EndInsertingObject(s3);
            cache.EndInsertingObject(s2);
            cache.EndInsertingObject(s1);
            AssertTrue(cache.IdOfInsertingObject(s1) != NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
                       .NullObjectId);
            AssertTrue(cache.IdOfInsertingObject(s2) == NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
                       .NullObjectId);
            AssertTrue(cache.IdOfInsertingObject(s3) == NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
                       .NullObjectId);
        }