Examples of TestProxyOid


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());

        final ObjectAdapter adapter = deserializer.deserialize(data);
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

    @Test
    public void testFindInstances() throws Exception {

        // The remote interface is asked for instances, which are returned as
        // data objects
        final DummyObjectData instanceData = new DummyObjectData(new TestProxyOid(12, true), Movie.class.getName(), true, new TestProxyVersion(3));

        // The data then needs to be decoded into the ObjectAdapter
        final TestProxyAdapter dummyObjectAdapter = new TestProxyAdapter();
        // new DummyOid(12, true), ResolveState.GHOST, "test");
        dummyObjectAdapter.setupObject(new Movie());
View Full Code Here

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

    @Ignore("need to get working after refactoring")
    @Test
    public void testResolveImmediately() throws Exception {

        final TestProxyAdapter object = new TestProxyAdapter();
        object.setupOid(new TestProxyOid(5));
        object.setupResolveState(ResolveState.GHOST);

        final IdentityData identityData = new DummyReferenceData();
        final ObjectData objectData = new DummyObjectData();
        final ResolveObjectRequest request = new ResolveObjectRequest(session, identityData);
View Full Code Here

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

                final DummyObjectData directorData = encoderShouldCreateGraphForChangedDirector(directorAdapter);
                distributionShouldExecuteClientActionForBothChangedObjects(movieData, directorData);
            }

            private DummyObjectData encoderShouldCreateGraphForChangedMovie(final TestProxyAdapter movieAdapter) {
                final DummyObjectData movieData = new DummyObjectData(new TestProxyOid(12, true), Movie.class.getName(), true, new TestProxyVersion(4));
                final DummyEncodeableObjectData expectedMovieName = new DummyEncodeableObjectData("War of the Worlds", String.class.getName());
                final DummyReferenceData expectedDirectorRef = new DummyReferenceData(new TestProxyOid(14, true), Person.class.getName(), new TestProxyVersion(8));
                movieData.setFieldContent(new Data[] { expectedDirectorRef, expectedMovieName });

                one(mockEncoder).encodeGraphForChangedObject(movieAdapter, new KnownObjectsRequest());
                will(returnValue(movieData));
                return movieData;
            }

            private DummyObjectData encoderShouldCreateGraphForChangedDirector(final TestProxyAdapter directorAdapter) {
                final DummyObjectData directorData = new DummyObjectData(new TestProxyOid(14, true), Person.class.getName(), true, new TestProxyVersion(8));
                final DummyEncodeableObjectData expectedDirectorName = new DummyEncodeableObjectData("Unknown", String.class.getName());
                directorData.setFieldContent(new Data[] { expectedDirectorName });

                one(mockEncoder).encodeGraphForChangedObject(directorAdapter, new KnownObjectsRequest());
                will(returnValue(directorData));
View Full Code Here

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

    @Test
    public void testClientSideActionWhereTransientObjectMadePersistent() throws Exception {

        final ObjectAdapter transientObject = system.createTransientTestObject();

        final TestProxyOid previousOid = (TestProxyOid) transientObject.getOid();
        final DummyObjectData movieData = new DummyObjectData(previousOid, 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 });

        mockery.checking(new Expectations() {
            {
                // this returns results data with new oid and version
                final TestProxyOid newOid = new TestProxyOid(123, true);
                newOid.setupPrevious(previousOid);
                final DummyReferenceData updateData = new DummyReferenceData(newOid, "type", new TestProxyVersion(456));

                // the server is called with data (movieData) for the object to
                // be persisted
                one(mockDistribution).executeClientAction(with(any(ExecuteClientActionRequest.class)));
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

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

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        domainObject = new TestPojo();
        adapter = new PojoAdapter(domainObject, new TestProxyOid(1));
        adapter.setOptimisticLock(new TestProxyVersion());
    }
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.