Examples of Eembeddable


Examples of com.avaje.tests.model.embedded.Eembeddable

    EntityBean eb = (EntityBean)emain;
    EntityBeanIntercept ebi = eb._ebean_getIntercept();

    emain.setId(1);
    emain.setName("foo");
    Eembeddable embeddable = setEmbeddedBean(emain, "bar");
    setEmbeddedLoaded(embeddable);
   
    // sets loaded state so follow setters are deemed as changes to the bean
    ebi.setLoaded();
   
    emain.setName("changedFoo");
   
    DefaultBeanState beanState = new DefaultBeanState(eb);
   
    Set<String> changedProps = beanState.getChangedProps();
    Assert.assertEquals(1, changedProps.size());
    Assert.assertTrue(changedProps.contains("name"));
   
    Map<String, ValuePair> dirtyValues = beanState.getDirtyValues();
    Assert.assertEquals(1, dirtyValues.size());
    Assert.assertTrue(dirtyValues.keySet().contains("name"));
   
    ValuePair valuePair = dirtyValues.get("name");
    Assert.assertNotNull(valuePair);
    Assert.assertEquals("changedFoo",valuePair.getNewValue());
    Assert.assertEquals("foo",valuePair.getOldValue());
   
    Eembeddable embeddableRead = emain.getEmbeddable();
    embeddableRead.setDescription("embChanged");
   
    Set<String> changedProps2 = beanState.getChangedProps();
    Assert.assertEquals(2, changedProps2.size());
    Assert.assertTrue(changedProps2.contains("name"));
    Assert.assertTrue(changedProps2.contains("embeddable.description"));
View Full Code Here

Examples of com.avaje.tests.model.embedded.Eembeddable

    EntityBean eb = (EntityBean)emain;
    EntityBeanIntercept ebi = eb._ebean_getIntercept();

    emain.setId(1);
    emain.setName("foo");
    Eembeddable embeddable = setEmbeddedBean(emain, "bar");
    setEmbeddedLoaded(embeddable);
   
    // sets loaded state so follow setters are deemed as changes to the bean
    ebi.setLoaded();
   
    emain.setName("changedFoo");

    Assert.assertSame(embeddable, emain.getEmbeddable());

    Eembeddable embeddable2 = setEmbeddedBean(emain, "changeEmbeddedInstance");
    Assert.assertSame(embeddable2, emain.getEmbeddable());
    Assert.assertNotSame(embeddable, emain.getEmbeddable());
   
   
    DefaultBeanState beanState = new DefaultBeanState(eb);
View Full Code Here

Examples of com.avaje.tests.model.embedded.Eembeddable

  }
 

  private Eembeddable setEmbeddedBean(EMain emain, String description) {
   
    Eembeddable embeddable = new Eembeddable();
    embeddable.setDescription(description);
   
    emain.setEmbeddable(embeddable);
   
    EntityBean owner = (EntityBean)emain;
    EntityBeanIntercept ebi= owner._ebean_getIntercept();
View Full Code Here

Examples of com.avaje.tests.model.embedded.Eembeddable

    Ebean.save(testBean);

    EMain partialBean = Ebean.find(EMain.class).select("version").setId(testBean.getId()).findUnique();
   
    logger.info(" -- invoke lazy loading of embedded bean");
    Eembeddable embeddable = partialBean.getEmbeddable();
    embeddable.setDescription("modified description");
   
    logger.info(" -- update bean");
    Ebean.save(partialBean);
   
  }
View Full Code Here

Examples of com.avaje.tests.model.embedded.Eembeddable

  public void testSetViaNewEmbedded() {
   
    EMain emain1 = createEMain();
    EMain emain2 = createEMain();
   
    Eembeddable embeddable = new Eembeddable();
    embeddable.setDescription("baz");
    emain2.setEmbeddable(embeddable);
   
  
    Map<String, ValuePair> diff = diffHelp.diff(emain1, emain2, emainDesc);
    Assert.assertEquals(1, diff.size());
View Full Code Here

Examples of com.avaje.tests.model.embedded.Eembeddable

   
    EMain emain = new EMain();
    emain.setName("foo");
    emain.setVersion(13l);
   
    Eembeddable embeddable = new Eembeddable();
    embeddable.setDescription("bar");
    emain.setEmbeddable(embeddable);
   
    return emain;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.