Examples of TestProxyVersion


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

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

        final Vector restoredCollection = (Vector) adapter.getObject();
        assertEquals(0, restoredCollection.size());
View Full Code Here

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

    }

    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());
View Full Code Here

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

    }

    @Test
    public void testSetAssociationFailsWithNonCurrentTarget() {
        // version should be different, causing concurrency exception
        movieAdapter.setOptimisticLock(new TestProxyVersion(6));
        try {
            final SetAssociationRequest request =
                new SetAssociationRequest(authenticationSession, "director", movieData, personData);
            server.setAssociation(request);
            fail();
View Full Code Here

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

    }

    @Test
    public void testSetAssociationFailsWithNonCurrentAssociate() {
        // version should be different, causing concurrency exception
        personAdapter.setOptimisticLock(new TestProxyVersion(6));
        try {
            final SetAssociationRequest request =
                new SetAssociationRequest(authenticationSession, "director", movieData, personData);
            server.setAssociation(request);
            fail();
View Full Code Here

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

    public void testLookedUpObjectHasDifferentVersion() {
        final ObjectAdapter object = system.createPersistentTestObject();
        final String id = context.mapObject(object);
        // change version on the object being passed back
        object.setOptimisticLock(new TestProxyVersion(5));
        context.getMappedObject(id);
        assertEquals("Reloaded object " + object.titleString(), context.getMessage(1));
    }
View Full Code Here

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

    @Test
    public void testExecuteClientActionWhereObjectChanged() {
        final ObjectAdapter adapter = system.createPersistentTestObject();

        final DummyObjectData data = new DummyObjectData(adapter.getOid(), "none", true, new TestProxyVersion(1));

        // prepare the update data to return
        mockery.checking(new Expectations() {
            {
                one(mockEncoder).decode(data, new KnownObjectsRequest());
                will(returnValue(adapter));

            }
        });

        // results returned in their own container
        final ExecuteClientActionResponse results =
            new ExecuteClientActionResponse(new ObjectData[0], new Version[0], null);
        mockery.checking(new Expectations() {
            {
                one(mockEncoder).encodeClientActionResult(with(equalTo(new ReferenceData[1])),
                    with(equalTo(new Version[] { new TestProxyVersion(2) })), with(equalTo(new ObjectData[0])));
                will(returnValue(results));
            }
        });

        final ExecuteClientActionRequest request =
            new ExecuteClientActionRequest(session, new ReferenceData[] { data },
                new int[] { ClientTransactionEvent.CHANGE });
        // don't start xactn here, since within call.
        final ExecuteClientActionResponse result = server.executeClientAction(request);
        final ObjectAdapter object =
            IsisContext.getPersistenceSession().loadObject(adapter.getOid(), adapter.getSpecification());

        assertEquals(new TestProxyVersion(2), object.getVersion());

        assertEquals(results, result);
    }
View Full Code Here

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

    @Test
    public void testExecuteClientActionWhereObjectMadePersistent() {
        final ObjectAdapter adapter = system.createTransientTestObject();

        final DummyObjectData data = new DummyObjectData(adapter.getOid(), "none", true, new TestProxyVersion(1));

        // restore the object on the server
        mockery.checking(new Expectations() {
            {
                one(mockEncoder).decode(data, new KnownObjectsRequest());
                will(returnValue(adapter));

                one(mockEncoder).encodeIdentityData(adapter);
                will(returnValue(null));
            }
        });

        // return results
        final ExecuteClientActionResponse results =
            new ExecuteClientActionResponse(new ObjectData[0], new Version[0], new ObjectData[0]);
        mockery.checking(new Expectations() {
            {
                one(mockEncoder).encodeClientActionResult(with(equalTo(new ReferenceData[1])),
                    with(equalTo(new Version[1])), with(equalTo(new ObjectData[0])));
                will(returnValue(results));
            }
        });

        // don't start xactn here, since within call.

        final ExecuteClientActionRequest request =
            new ExecuteClientActionRequest(session, new ReferenceData[] { data },
                new int[] { ClientTransactionEvent.ADD });
        final ExecuteClientActionResponse response = server.executeClientAction(request);

        final ObjectAdapter object =
            IsisContext.getPersistenceSession().loadObject(adapter.getOid(), adapter.getSpecification());

        assertEquals(results, response);
        assertEquals(adapter, object);
        assertEquals(new TestProxyVersion(1), object.getVersion());
    }
View Full Code Here

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

    }

    @Test
    public void testExecuteClientActionFailsWithConcurrencyError() {
        final ObjectAdapter adapter = system.createPersistentTestObject();
        adapter.setOptimisticLock(new TestProxyVersion(7));

        final Oid oid = adapter.getOid();
        final DummyIdentityData identityData =
            new DummyIdentityData(oid, TestProxyAdapter.class.getName(), new TestProxyVersion(6));

        try {
            final ExecuteClientActionRequest request =
                new ExecuteClientActionRequest(new TestProxySession(), new ReferenceData[] { identityData },
                    new int[] { ClientTransactionEvent.DELETE });
View Full Code Here

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

    public void testExecuteClientActionWhereObjectDeleted() {
        final ObjectAdapter adapter = system.createPersistentTestObject();

        final Oid oid = adapter.getOid();
        final DummyIdentityData identityData =
            new DummyIdentityData(oid, TestProxyAdapter.class.getName(), new TestProxyVersion(1));

        // return results
        final ExecuteClientActionResponse results =
            new ExecuteClientActionResponse(new ObjectData[0], new Version[0], null);
        mockery.checking(new Expectations() {
View Full Code Here

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

    @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
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.