Examples of TestProxyOid


Examples of org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyOid

        adapter = new PojoAdapter(domainObject, new TestProxyOid(1));
        adapter.setOptimisticLock(new TestProxyVersion());
    }

    public void testOid() {
        assertEquals(new TestProxyOid(1), adapter.getOid());
    }
View Full Code Here

Examples of org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyOid

    protected void setUp() throws Exception {
        super.setUp();
    }

    public void testRecreateTransientAdapter() {
        final Oid oid = new TestProxyOid(13, false);
        final Object object = new TestPojo();
        final ObjectAdapter adapter = getAdapterManagerTestSupport().testCreateTransient(object, oid);
        assertEquals(oid, adapter.getOid());
        assertEquals(object, adapter.getObject());
        assertEquals(ResolveState.TRANSIENT, adapter.getResolveState());
View Full Code Here

Examples of org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyOid

        assertEquals(ResolveState.TRANSIENT, adapter.getResolveState());
        assertEquals(null, adapter.getVersion());
    }

    public void testRecreatePersistentAdapter() {
        final Oid oid = new TestProxyOid(15, true);
        final Object object = new TestPojo();
        final ObjectAdapter adapter = getAdapterManagerPersist().recreateRootAdapter(oid, object);
        assertEquals(oid, adapter.getOid());
        assertEquals(object, adapter.getObject());
        assertEquals(ResolveState.GHOST, adapter.getResolveState());
View Full Code Here

Examples of org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyOid

        resetIdentityMap();
    }

    public void testGetObjectByOidWhenEmpty() {
        final ObjectSpecification spec = system.getSpecification(TestPojo.class);
        final Oid oid = new TestProxyOid(10, true);
        try {
            store.getObject(oid, spec);
            fail();
        } catch (final ObjectNotFoundException expected) {
        }
View Full Code Here

Examples of org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyOid

    }

    @Test
    public void testRestoreCreatesNewAdapter() {
        final DummyObjectData data =
            new DummyObjectData(new TestProxyOid(5, true), Movie.class.getName(), true, new TestProxyVersion(3));
        final DummyEncodeableObjectData name = new DummyEncodeableObjectData("ET", "java.lang.String");
        final DummyNullValue reference = new DummyNullValue(Person.class.getName());
        // note - the order of the fields is by name, not the order that are defined in the specification
        data.setFieldContent(new Data[] { reference, name });

        final ObjectAdapter object = encoder.decode(data);

        assertTrue(object.getObject() instanceof Movie);

        final Movie movie = (Movie) object.getObject();
        assertEquals("ET", movie.getName());
        assertEquals(new TestProxyOid(5, true), object.getOid());
        assertEquals(new TestProxyVersion(3), object.getVersion());

    }
View Full Code Here

Examples of org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyOid

    }

    @Test
    public void testRestoreCreatesNewAdapterInUnresolvedState() {
        final DummyObjectData data =
            new DummyObjectData(new TestProxyOid(5, true), Movie.class.getName(), false, new TestProxyVersion(3));

        final ObjectAdapter object = encoder.decode(data);

        assertTrue(object.getObject() instanceof Movie);

        assertEquals(new TestProxyOid(5, true), object.getOid());
        assertEquals(null, object.getVersion());
    }
View Full Code Here

Examples of org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyOid

        assertEquals(new TestProxyVersion(1), object.getVersion());
    }

    @Test
    public void testRestoreTransientObject() {
        final DummyObjectData movieData = new DummyObjectData(new TestProxyOid(-1), Movie.class.getName(), true, null);
        final NullData directorData = new DummyNullValue(Person.class.getName());
        final DummyEncodeableObjectData nameData = new DummyEncodeableObjectData("Star Wars", String.class.getName());
        movieData.setFieldContent(new Data[] { directorData, nameData });

        final ObjectAdapter object = encoder.decode(movieData);
        final Movie movie = (Movie) object.getObject();

        assertEquals(movie, object.getObject());
        assertEquals(new TestProxyOid(-1), object.getOid());
        assertEquals(ResolveState.TRANSIENT, object.getResolveState());
        assertEquals(null, object.getVersion());

    }
View Full Code Here

Examples of org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyOid

        });
    }

    public void testRecreateEmptyCollection() {
        final TestProxyOid collectionOid = new TestProxyOid(123);
        final ReferenceData[] elementData = null;
        final CollectionData data =
            new DummyCollectionData(collectionOid, Vector.class.getName(), TestPojo.class.getName(), elementData,
                new TestProxyVersion());
View Full Code Here

Examples of org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyOid

        assertEquals(0, facet.size(adapter));
    }

    public void testRecreateCollection() {
        final ReferenceData elements[] = new ObjectData[2];
        final TestProxyOid element0Oid = new TestProxyOid(345, true);
        elements[0] = new DummyObjectData(element0Oid, TestPojo.class.getName(), false, new TestProxyVersion(3));
        final TestProxyOid element1Oid = new TestProxyOid(678, true);
        elements[1] = new DummyObjectData(element1Oid, TestPojo.class.getName(), false, new TestProxyVersion(7));

        final TestProxyOid collectionOid = new TestProxyOid(123);
        final CollectionData data =
            new DummyCollectionData(collectionOid, Vector.class.getName(), TestPojo.class.getName(), elements,
                new TestProxyVersion());

        final ObjectAdapter adapter = deserializer.deserialize(data);

        final Vector restoredCollection = (Vector) adapter.getObject();
        assertEquals(2, restoredCollection.size());

        final CollectionFacet facet = adapter.getSpecification().getFacet(CollectionFacet.class);
        final Enumeration elements2 = facet.elements(adapter);
        final ObjectAdapter element0 = (ObjectAdapter) elements2.nextElement();
        final ObjectAdapter element2 = (ObjectAdapter) elements2.nextElement();

        assertNotNull(element0.getObject());
        assertNotNull(element2.getObject());

        assertEquals(TestPojo.class, element0.getObject().getClass());
        assertEquals(TestPojo.class, element2.getObject().getClass());

        assertEquals(new TestProxyOid(678, true), element2.getOid());
        assertEquals(new TestProxyOid(345, true), element0.getOid());

        // version not set as there is no field data for elements
        // assertEquals(new DummyVersion(3), adapter.elementAt(0).getVersion());
        // assertEquals(new DummyVersion(7), adapter.elementAt(1).getVersion());
    }
View Full Code Here

Examples of org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyOid

            assertTrue(e.getMessage().startsWith("Response out of sequence"));
        }
    }

    public void testClearAssociation() {
        final DummyIdentityData target = new DummyIdentityData(new TestProxyOid(1), "class 1", null);
        final DummyIdentityData associate = new DummyIdentityData(new TestProxyOid(2), "class 2", null);
        final ClearAssociationRequest request = new ClearAssociationRequest(session, "fieldname", target, associate);
        serverFacade.clearAssociation(request);
        final ObjectData[] data = new ObjectData[2];
        control.setReturnValue(new ClearAssociationResponse(data));
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.