Package models

Examples of models.LifeCycle$Child


        assertTrue(LifeCycle.q("foo", "bar").count() == 0);
    }
   
    @Test
    public void testExceptionsinBatchLifeCycleMethods() {
        LifeCycle lc0 = new LifeCycle();
        lc0.foo = "bar";
        lc0.bar = "order";
        lc0.save();
       
        LifeCycle lc1 = new LifeCycle();
        lc1.foo = "foo";
        lc1.bar = "order";
        lc1.save();
       
        MorphiaQuery q = LifeCycle.q("bar", "order");
        LifeCycle.batchDeleteFail = true;
        try {
            q.delete();
View Full Code Here


        LifeCycle.reset();
    }
   
    @Test
    public void testLifeCycle() {
        LifeCycle lc = new LifeCycle();
        lc.foo = "bar";
        lc.bar = "xx";
       
        lc.save();
       
        t("bar", OnAdd.class, 1);
        t("bar", Added.class, 1);
        t("bar2", OnAdd.class, 1);
        t("bar", Object.class, 2);
       
        lc.bar = "yy";
        lc.save();
       
        t("bar", OnAdd.class, 1);
        t("bar", OnUpdate.class, 1);
        t("bar", Updated.class, 1);
        t("bar2", OnUpdate.class, 1);
        t("bar", Object.class, 4);
       
        lc.bar = "zz";
        lc.save();
       
        t("bar", OnAdd.class, 1);
        t("bar", OnUpdate.class, 2);
        t("bar", Updated.class, 2);
        t("bar2", OnUpdate.class, 2);
        t("bar", Object.class, 6);
       
        lc = LifeCycle.q("foo", "bar").get();
        t("bar", OnAdd.class, 1);
        t("bar", OnUpdate.class, 2);
        t("bar", Updated.class, 2);
        t("bar2", OnUpdate.class, 2);
        t("foo", OnLoad.class, 1);
        t("bar", Loaded.class, 1);
        t("bar", Object.class, 7);
        t("foo", Object.class, 1);
       
        lc.delete();
        t("bar", OnAdd.class, 1);
        t("bar", OnUpdate.class, 2);
        t("bar", Updated.class, 2);
        t("bar2", OnUpdate.class, 2);
        t("bar", OnDelete.class, 1);
View Full Code Here

        t("bar", Object.class, 9);
    }
   
    @Test
    public void testBatchDelete() {
        LifeCycle lc0 = new LifeCycle();
        lc0.foo = "bar";
        lc0.bar = "order";
        lc0.save();
       
        LifeCycle lc1 = new LifeCycle();
        lc1.foo = "foo";
        lc1.bar = "order";
        lc1.save();
       
        LifeCycle.q("bar", "order").delete();
       
        t("foobar", OnBatchDelete.class, 2);
        t("foobar", BatchDeleted.class, 2);
View Full Code Here

        t("foobar", BatchDeleted.class, 2);
    }
   
    @Test
    public void testExceptionsinLifeCycleMethods() {
        LifeCycle lc = new LifeCycle();
        lc.foo = "bar";
        lc.bar = "xx";
       
        lc.addFail = true;
        try {
            lc.save();
        } catch (Exception e) {
            // ignore
        }
        assertTrue(lc.isNew());
        lc.addFail = false;
       
        lc.addedFail = true;
        try {
            lc.save();
            assertFalse(true);
        } catch (Exception e) {
            // ignore
        }
        assertFalse(lc.isNew());
        lc.addedFail = false;
       
        lc.bar = "yy";
        lc.updateFail = true;
        try {
            lc.save();
        } catch (Exception e) {
            // ignore
        }
        LifeCycle lc1 = LifeCycle.q("foo", "bar").get();
        assertFalse(lc1.bar.equals(lc.bar));
        lc.updateFail = false;
       
        lc.updatedFail = true;
        try {
            lc.save();
            assertFalse(true);
        } catch (Exception e) {
            // ignore
        }
        lc1 = LifeCycle.q("foo", "bar").get();
        assertEquals(lc1.bar, lc.bar);
        lc.updatedFail = false;
       
        LifeCycle.loadFail = true;
        LifeCycle lc2 = null;
        try {
            lc2 = LifeCycle.q("foo", "bar").get();
        } catch (Exception e) {
            // ignore
        }
View Full Code Here

  @Test
  public void testCircularDependencyPojos() {
    Parent parent = factory.manufacturePojo(Parent.class);
    Assert.assertNotNull("The parent pojo cannot be null!", parent);

    Child child = parent.getChild();
    Assert.assertNotNull("The child pojo cannot be null!", child);
  }
View Full Code Here

TOP

Related Classes of models.LifeCycle$Child

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.