Package org.apache.isis.core.tck.dom.refs

Examples of org.apache.isis.core.tck.dom.refs.UnidirReferencedEntity


        iswf.commitTran();

        iswf.bounceSystem();
       
        iswf.beginTran();
        UnidirReferencedEntity referencedEntity1 = referencedRepo.list().get(0);
        UnidirReferencedEntity referencedEntity2 = referencedRepo.list().get(1);
       
        UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
        referencingEntity1.setName("Referencing 1");
        referencingEntity1.setReferenced(referencedEntity1);
       
View Full Code Here


    @Test
    public void persistAGraphOfObjects() throws Exception {
       
        iswf.beginTran();
        UnidirReferencedEntity referencedEntity1 = referencedRepo.newEntity();
        referencedEntity1.setName("Referenced 1");
        UnidirReferencedEntity referencedEntity2 = referencedRepo.newEntity();
        referencedEntity2.setName("Referenced 2");

        UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
        referencingEntity1.setName("Referencing 1");
        referencingEntity1.setReferenced(referencedEntity1);
        UnidirReferencingEntity referencingEntity2 = referencingRepo.newEntity();
View Full Code Here

    @Test
    public void persist_then_update() throws Exception {
       
        iswf.beginTran();
        UnidirReferencedEntity referencedEntity1 = referencedRepo.newEntity();
        referencedEntity1.setName("Referenced 1");
        UnidirReferencedEntity referencedEntity2 = referencedRepo.newEntity();
        referencedEntity2.setName("Referenced 2");

        UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
        referencingEntity1.setName("Referencing 1");
        referencingEntity1.setReferenced(referencedEntity1);
        UnidirReferencingEntity referencingEntity2 = referencingRepo.newEntity();
View Full Code Here

    @Test
    public void persist_then_update_using_persistentAdapterFor() throws Exception {
       
        iswf.beginTran();
        UnidirReferencedEntity referencedEntity1 = referencedRepo.newEntity();
        referencedEntity1.setName("Referenced 1");
        UnidirReferencedEntity referencedEntity2 = referencedRepo.newEntity();
        referencedEntity2.setName("Referenced 2");

        UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
        referencingEntity1.setName("Referencing 1");
        referencingEntity1.setReferenced(referencedEntity1);
        UnidirReferencingEntity referencingEntity2 = referencingRepo.newEntity();
        referencingEntity2.setName("Referencing 2");
        referencingEntity2.setReferenced(referencedEntity1);
        UnidirReferencingEntity referencingEntity3 = referencingRepo.newEntity();
        referencingEntity3.setName("Referencing 3");
        referencingEntity3.setReferenced(referencedEntity2);

        iswf.commitTran();

        TypedOid referencingOid2 = (TypedOid) iswf.adapterFor(referencingEntity2).getOid();

        TypedOid referencedOid1 = (TypedOid) iswf.adapterFor(referencedEntity1).getOid();
        TypedOid referencedOid2 = (TypedOid) iswf.adapterFor(referencedEntity2).getOid();


        // when ...
        iswf.bounceSystem();
       
        iswf.beginTran();

        ObjectAdapter referencingAdapter2 = iswf.getPersistor().loadObject(referencingOid2);
        referencingEntity2 = (UnidirReferencingEntity) referencingAdapter2.getObject();
       
    UnidirReferencedEntity referenced = referencingEntity2.getReferenced();
   
    ObjectAdapter referencedAdapter1 = iswf.getAdapterManager().adapterFor(referencedOid1);
    assertThat(referenced, is(referencedAdapter1.getObject()));

        // ...switch to refer to other
View Full Code Here

    @Test
    public void persist_then_update_using_persistentAdapterFor() throws Exception {
       
        iswf.beginTran();
        UnidirReferencedEntity referencedEntity1 = referencedRepo.newEntity();
        referencedEntity1.setName("Referenced 1");
        UnidirReferencedEntity referencedEntity2 = referencedRepo.newEntity();
        referencedEntity2.setName("Referenced 2");

        UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
        referencingEntity1.setName("Referencing 1");
        referencingEntity1.setReferenced(referencedEntity1);
        UnidirReferencingEntity referencingEntity2 = referencingRepo.newEntity();
        referencingEntity2.setName("Referencing 2");
        referencingEntity2.setReferenced(referencedEntity1);
        UnidirReferencingEntity referencingEntity3 = referencingRepo.newEntity();
        referencingEntity3.setName("Referencing 3");
        referencingEntity3.setReferenced(referencedEntity2);

        iswf.commitTran();

        TypedOid referencingOid2 = (TypedOid) iswf.adapterFor(referencingEntity2).getOid();

        TypedOid referencedOid1 = (TypedOid) iswf.adapterFor(referencedEntity1).getOid();
        TypedOid referencedOid2 = (TypedOid) iswf.adapterFor(referencedEntity2).getOid();


        // when ...
        iswf.bounceSystem();
       
        iswf.beginTran();

        ObjectAdapter referencingAdapter2 = iswf.getAdapterManager().adapterFor(referencingOid2);
        referencingEntity2 = (UnidirReferencingEntity) referencingAdapter2.getObject();
       
    UnidirReferencedEntity referenced = referencingEntity2.getReferenced();
   
    ObjectAdapter referencedAdapter1 = iswf.getAdapterManager().adapterFor(referencedOid1);
    assertThat(referenced, is(referencedAdapter1.getObject()));

        // ...switch to refer to other
View Full Code Here

        iswf.commitTran();

        iswf.bounceSystem();
       
        iswf.beginTran();
        UnidirReferencedEntity referencedEntity1 = referencedRepo.list().get(0);
       
        UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
        referencingEntity1.setName("Referencing 1");
        referencingEntity1.setReferenced(referencedEntity1);
       
        iswf.commitTran();
       
        iswf.bounceSystem();
       
        iswf.beginTran();
        List<UnidirReferencingEntity> list = referencingRepo.list();
        referencingEntity1 = list.get(0);
       
        assertThat(referencingEntity1.referenced, is(nullValue())); // lazy loading
        UnidirReferencedEntity referenced = referencingEntity1.getReferenced();
        ObjectAdapter referencedAdapter = iswf.adapterFor(referenced);
        assertThat(referencedAdapter.getResolveState(), is(ResolveState.RESOLVED));
        assertThat(referenced, is(not(nullValue())));
       
        iswf.commitTran();
View Full Code Here

TOP

Related Classes of org.apache.isis.core.tck.dom.refs.UnidirReferencedEntity

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.