Search in sources :

Example 1 with OLazyObjectSetInterface

use of com.orientechnologies.orient.core.db.object.OLazyObjectSetInterface in project orientdb by orientechnologies.

the class CRUDObjectPhysicalTest method checkLazyLoadingOff.

@Test(dependsOnMethods = "createLinked")
public void checkLazyLoadingOff() {
    database.setLazyLoading(false);
    for (Profile obj : database.browseClass(Profile.class).setFetchPlan("*:1")) {
        Assert.assertTrue(!(obj.getFollowings() instanceof OLazyObjectSetInterface) || ((OLazyObjectSetInterface<Profile>) obj.getFollowings()).isConverted());
        Assert.assertTrue(!(obj.getFollowers() instanceof OLazyObjectSetInterface) || ((OLazyObjectSetInterface<Profile>) obj.getFollowers()).isConverted());
        if (obj.getNick().equals("Neo")) {
            Assert.assertEquals(obj.getFollowers().size(), 0);
            Assert.assertEquals(obj.getFollowings().size(), 2);
        } else if (obj.getNick().equals("Morpheus") || obj.getNick().equals("Trinity")) {
            Assert.assertEquals(obj.getFollowings().size(), 0);
            Assert.assertEquals(obj.getFollowers().size(), 1);
            Assert.assertTrue(obj.getFollowers().iterator().next() instanceof Profile);
        }
    }
}
Also used : Profile(com.orientechnologies.orient.test.domain.whiz.Profile) OLazyObjectSetInterface(com.orientechnologies.orient.core.db.object.OLazyObjectSetInterface) Test(org.testng.annotations.Test)

Example 2 with OLazyObjectSetInterface

use of com.orientechnologies.orient.core.db.object.OLazyObjectSetInterface in project orientdb by orientechnologies.

the class CRUDObjectPhysicalTestSchemaFull method checkLazyLoadingOff.

@Test(dependsOnMethods = "createLinked")
public void checkLazyLoadingOff() {
    database.setLazyLoading(false);
    for (Profile obj : database.browseClass(Profile.class).setFetchPlan("*:1")) {
        Assert.assertTrue(!(obj.getFollowings() instanceof OLazyObjectSetInterface) || ((OLazyObjectSetInterface<Profile>) obj.getFollowings()).isConverted());
        Assert.assertTrue(!(obj.getFollowers() instanceof OLazyObjectSetInterface) || ((OLazyObjectSetInterface<Profile>) obj.getFollowers()).isConverted());
        if (obj.getNick().equals("Neo")) {
            Assert.assertEquals(obj.getFollowers().size(), 0);
            Assert.assertEquals(obj.getFollowings().size(), 2);
        } else if (obj.getNick().equals("Morpheus") || obj.getNick().equals("Trinity")) {
            Assert.assertEquals(obj.getFollowings().size(), 0);
            Assert.assertEquals(obj.getFollowers().size(), 1);
            Assert.assertTrue(obj.getFollowers().iterator().next() instanceof Profile);
        }
    }
}
Also used : Profile(com.orientechnologies.orient.test.domain.whiz.Profile) OLazyObjectSetInterface(com.orientechnologies.orient.core.db.object.OLazyObjectSetInterface) Test(org.testng.annotations.Test)

Aggregations

OLazyObjectSetInterface (com.orientechnologies.orient.core.db.object.OLazyObjectSetInterface)2 Profile (com.orientechnologies.orient.test.domain.whiz.Profile)2 Test (org.testng.annotations.Test)2