Package org.structr.core.entity

Examples of org.structr.core.entity.TestEight


   
    try {

// ##################################### test creation callbacks
     
      TestEight test = null;
     
      try (final Tx tx = app.tx()) {

        test = app.create(TestEight.class, new NodeAttribute(TestEight.testProperty, 123));
        tx.success();
      }
     
      // only the creation methods should have been called now!
      assertTrue("onCreationTimestamp should be != 0", test.getOnCreationTimestamp() != 0L);
      assertEquals("onModificationTimestamp should be == 0", 0L, test.getOnModificationTimestamp());
      assertEquals("onDeletionTimestamp should be == 0", 0L, test.getOnDeletionTimestamp());
     
      // only the creation methods should have been called now!
      assertTrue("afterCreationTimestamp should be != 0", test.getAfterCreationTimestamp() != 0L);
      assertEquals("afterModificationTimestamp should be == 0", 0L, test.getAfterModificationTimestamp());


// ##################################### test modification callbacks
     
     
      // reset timestamps
      test.resetTimestamps();
     
      try (final Tx tx = app.tx()) {
        test.setProperty(TestEight.testProperty, 234);
        tx.success();
      }

      // only the modification methods should have been called now!
      assertEquals("onCreationTimestamp should be == 0", 0L, test.getOnCreationTimestamp());
      assertTrue("onModificationTimestamp should be != 0", test.getOnModificationTimestamp() != 0L);
      assertEquals("onDeletionTimestamp should be == 0", 0L, test.getOnDeletionTimestamp());
     
      // only the modification methods should have been called now!
      assertEquals("afterCreationTimestamp should be == 0", 0L, test.getAfterCreationTimestamp());
      assertTrue("afterModificationTimestamp should be != 0", test.getAfterModificationTimestamp() != 0L);

     
// ##################################### test non-modifying set operation
     
      // reset timestamps
      test.resetTimestamps();
     
      try (final Tx tx = app.tx()) {
        test.setProperty(TestEight.testProperty, 234);
        tx.success();
      }

      // only the creation methods should have been called now!
      assertEquals("onCreationTimestamp should be == 0", 0L, test.getOnCreationTimestamp());
      assertEquals("onModificationTimestamp should be == 0", 0L, test.getOnModificationTimestamp());
      assertEquals("onDeletionTimestamp should be == 0", 0L, test.getOnDeletionTimestamp());
     
      // only the creation methods should have been called now!
      assertEquals("afterCreationTimestamp should be == 0", 0L, test.getAfterCreationTimestamp());
      assertEquals("afterModificationTimestamp should be == 0", 0L, test.getAfterModificationTimestamp());

     
     
// ##################################### test deletion
     
      // reset timestamps
      test.resetTimestamps();
     
      try (final Tx tx = app.tx()) {
        app.delete(test);
        tx.success();
      }

      // only the creation methods should have been called now!
      assertEquals("onCreationTimestamp should be == 0", 0L, test.getOnCreationTimestamp());
      assertEquals("onModificationTimestamp should be == 0", 0L, test.getOnModificationTimestamp());
      assertTrue("onDeletionTimestamp should be != 0", test.getOnDeletionTimestamp() != 0L);
     
      // only the creation methods should have been called now!
      assertEquals("afterCreationTimestamp should be == 0", 0L, test.getAfterCreationTimestamp());
      assertEquals("afterModificationTimestamp should be == 0", 0L, test.getAfterModificationTimestamp());
     
     
     
    } catch (FrameworkException ex) {
     
View Full Code Here

TOP

Related Classes of org.structr.core.entity.TestEight

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.