/// <exception cref="System.Exception"></exception>
        public virtual void Conc(IExtObjectContainer oc)
        {
            IObjectSet os = oc.Query(typeof(InvalidUUIDTestCase));

            if (os.Count == 0)
            {
                // already deleted by other threads
                return;
            }
            Assert.AreEqual(1, os.Count);
            InvalidUUIDTestCase iu     = (InvalidUUIDTestCase)os.Next();
            Db4oUUID            myUuid = oc.GetObjectInfo(iu).GetUUID();

            Assert.IsNotNull(myUuid);
            byte[] mySignature = myUuid.GetSignaturePart();
            long   myLong      = myUuid.GetLongPart();
            long   unknownLong = long.MaxValue - 100;

            byte[]   unknownSignature     = new byte[] { 1, 2, 4, 99, 33, 22 };
            Db4oUUID unknownLongPart      = new Db4oUUID(unknownLong, mySignature);
            Db4oUUID unknownSignaturePart = new Db4oUUID(myLong, unknownSignature);
            Db4oUUID unknownBoth          = new Db4oUUID(unknownLong, unknownSignature);

            Assert.IsNull(oc.GetByUUID(unknownLongPart));
            Assert.IsNull(oc.GetByUUID(unknownSignaturePart));
            Assert.IsNull(oc.GetByUUID(unknownBoth));
            Assert.IsNull(oc.GetByUUID(unknownLongPart));
            Thread.Sleep(500);
            oc.Delete(iu);
            oc.Commit();
            Assert.IsNull(oc.GetByUUID(myUuid));
        }
        /// <summary>
        /// Converts to string.
        /// </summary>
        /// <param name="UUID">The UUID.</param>
        /// <returns></returns>
        public static string ConvertToString(this Db4oUUID UUID)
        {
            if (UUID == null)
            {
                return(null);
            }

            return(String.Format("{0}|{1}",
                                 UUID.GetLongPart()
                                 , ByteArrayToString(UUID.GetSignaturePart())));
        }
        public virtual void TestTimeStamp()
        {
            IQuery q = NewItemQuery();

            q.Descend("name").Constrain("one");
            UUIDTestCase.Item item = (UUIDTestCase.Item)q.Execute().Next();
            Db4oUUID          uuid = Uuid(item);
            long longPart          = uuid.GetLongPart();
            long creationTime      = TimeStampIdGenerator.IdToMilliseconds(longPart);

            Assert.IsGreaterOrEqual(storeStartTime, creationTime);
            Assert.IsSmallerOrEqual(storeEndTime, creationTime);
        }
        /// <exception cref="System.Exception"></exception>
        public virtual void Test()
        {
            Db4oUUID uuidBeforeDefragment = SingleItemUUID();

            byte[] signatureBeforeDefragment = uuidBeforeDefragment.GetSignaturePart();
            long   longPartBeforeDefragment  = uuidBeforeDefragment.GetLongPart();

            Defragment();
            Db4oUUID uuidAfterDefragment = SingleItemUUID();

            byte[] signatureAfterDefragment = uuidAfterDefragment.GetSignaturePart();
            long   longPartAfterDefragment  = uuidAfterDefragment.GetLongPart();

            ArrayAssert.AreEqual(signatureBeforeDefragment, signatureAfterDefragment);
            Assert.AreEqual(longPartBeforeDefragment, longPartAfterDefragment);
        }
        public string GetUUID()
        {
            try
            {
                IObjectInfo objInfo = objectContainer.Ext().GetObjectInfo(m_genObject);
                if (objInfo != null)
                {
                    Db4oUUID uuid = objInfo.GetUUID();
                    return(uuid != null?uuid.GetLongPart().ToString() : "NA");
                }

                return("NA");
            }
            catch (Exception oEx)
            {
                LoggingHelper.HandleException(oEx);
                return("NA");
            }
        }
Beispiel #6
0
 public DrsUUIDImpl(Db4oUUID db4oUUID) : this(db4oUUID.GetSignaturePart(), db4oUUID
                                              .GetLongPart())
 {
 }