public void TestIntrospectWithNull2() { const string dbName = "TestIntrospectWithNull2.odb"; DeleteBase(dbName); var odb = OdbFactory.Open(dbName); var user = new User("olivier smadja", "*****@*****.**", null); IObjectInfoComparator comparator = new ObjectInfoComparator(); var storageEngine = ((global::NDatabase.Odb)odb).GetStorageEngine(); var instanceInfo = (NonNativeObjectInfo) new ObjectIntrospector(storageEngine.GetClassInfoProvider()).GetMetaRepresentation(user, true, null, new InstrumentationCallbackForStore(null, false)); // Sets attributes offsets - this is normally done by reading then from // disk, but in this junit, // we must set them manually var offsets = new[] {1L, 2L, 3L}; var ids = new[] {1, 2, 3}; instanceInfo.GetHeader().SetAttributesIdentification(offsets); instanceInfo.GetHeader().SetAttributesIds(ids); instanceInfo.GetHeader().SetOid(OIDFactory.BuildObjectOID(1)); var nnoiProfile = (NonNativeObjectInfo) instanceInfo.GetAttributeValueFromId(3); nnoiProfile.SetOid(OIDFactory.BuildObjectOID(2)); user.SetProfile(new Profile("pname")); var instanceInfo3 = (NonNativeObjectInfo) new ObjectIntrospector(storageEngine.GetClassInfoProvider()).GetMetaRepresentation(user, true, null, new InstrumentationCallbackForStore(null, false)); instanceInfo3.GetHeader().SetAttributesIdentification(offsets); instanceInfo3.GetHeader().SetAttributesIds(ids); instanceInfo3.GetHeader().SetOid(OIDFactory.BuildObjectOID(1)); nnoiProfile = (NonNativeObjectInfo) instanceInfo3.GetAttributeValueFromId(3); nnoiProfile.SetOid(OIDFactory.BuildObjectOID(2)); AssertTrue(comparator.HasChanged(instanceInfo, instanceInfo3)); AssertEquals(1, comparator.GetNbChanges()); odb.Close(); }
public void TestCompareCollection8() { const string dbName = "introspectortest8.odb"; DeleteBase(dbName); var odb = OdbFactory.Open(dbName); var function = new VO.Login.Function("login"); var profile = new Profile("operator", function); var user = new User("olivier smadja", "*****@*****.**", profile); IObjectInfoComparator comparator = new ObjectInfoComparator(); var storageEngine = ((global::NDatabase.Odb)odb).GetStorageEngine(); var instanceInfo = (NonNativeObjectInfo) new ObjectIntrospector(storageEngine.GetClassInfoProvider()).GetMetaRepresentation(user, true, null, new InstrumentationCallbackForStore(null, false)); // Sets attributes offsets - this is normally done by reading then from // disk, but in this junit, // we must set them manually var offsets = new[] {1L, 2L, 3L}; var ids = new[] {1, 2, 3}; instanceInfo.GetHeader().SetAttributesIdentification(offsets); instanceInfo.GetHeader().SetAttributesIds(ids); user.SetProfile(null); var instanceInfo3 = (NonNativeObjectInfo) new ObjectIntrospector(storageEngine.GetClassInfoProvider()).GetMetaRepresentation(user, true, null, new InstrumentationCallbackForStore(null, false)); AssertTrue(comparator.HasChanged(instanceInfo, instanceInfo3)); AssertEquals(1, comparator.GetNbChanges()); odb.Close(); }