Package com.orientechnologies.orient.test.domain.base

Examples of com.orientechnologies.orient.test.domain.base.CustomMethodFilterTestClass


  }

  @Test()
  public void testCustomMethodFilter() {
    OObjectEntityEnhancer.getInstance().registerClassMethodFilter(CustomMethodFilterTestClass.class, new CustomMethodFilter());
    CustomMethodFilterTestClass testClass = database.newInstance(CustomMethodFilterTestClass.class);
    testClass.setStandardField("testStandard");
    testClass.setUPPERCASEFIELD("testUpperCase");
    testClass.setTransientNotDefinedField("testTransient");
    Assert.assertNull(testClass.getStandardFieldAsList());
    Assert.assertNull(testClass.getStandardFieldAsMap());
    database.save(testClass);
    ORID rid = database.getIdentity(testClass);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    testClass = database.load(rid);
    Assert.assertEquals(testClass.getStandardField(), "testStandard");
    Assert.assertEquals(testClass.getUPPERCASEFIELD(), "testUpperCase");
    Assert.assertNull(testClass.getStandardFieldAsList());
    Assert.assertNull(testClass.getStandardFieldAsMap());
    ODocument doc = database.getRecordByUserObject(testClass, false);
    Assert.assertTrue(!doc.containsField("transientNotDefinedField"));
  }
View Full Code Here


  }

  @Test()
  public void testCustomMethodFilter() {
      OObjectEntityEnhancer.getInstance().registerClassMethodFilter(CustomMethodFilterTestClass.class, new CustomMethodFilter());
      CustomMethodFilterTestClass testClass = database.newInstance(CustomMethodFilterTestClass.class);
      testClass.setStandardField("testStandard");
      testClass.setUPPERCASEFIELD("testUpperCase");
      testClass.setTransientNotDefinedField("testTransient");
      Assert.assertNull(testClass.getStandardFieldAsList());
      Assert.assertNull(testClass.getStandardFieldAsMap());
      database.save(testClass);
      ORID rid = database.getIdentity(testClass);
      database.close();
      database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
      testClass = database.load(rid);
      Assert.assertEquals(testClass.getStandardField(), "testStandard");
      Assert.assertEquals(testClass.getUPPERCASEFIELD(), "testUpperCase");
      Assert.assertNull(testClass.getStandardFieldAsList());
      Assert.assertNull(testClass.getStandardFieldAsMap());
      ODocument doc = database.getRecordByUserObject(testClass, false);
      Assert.assertTrue(!doc.containsField("transientNotDefinedField"));
  }
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.test.domain.base.CustomMethodFilterTestClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.