Package org.apache.isis.runtimes.dflt.runtime.testsystem

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


            }

            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));
                return directorData;
            }

            private void distributionShouldExecuteClientActionForBothChangedObjects(final DummyObjectData movieData,
                final DummyObjectData directorData) {
                // final ObjectData[] changes = new ObjectData[] { movieData, directorData };
                // final int[] types = new int[] { ClientTransactionEvent.CHANGE, ClientTransactionEvent.CHANGE };

                one(mockDistribution).executeClientAction(with(any(ExecuteClientActionRequest.class)));

                final Version[] versionUpdates = new Version[] { new TestProxyVersion(5), new TestProxyVersion(9) };
                will(returnValue(new ExecuteClientActionResponse(new ObjectData[] { movieData, directorData },
                    versionUpdates, new ObjectData[0])));
            }
        });
        // TODO: should look inside the request object and ensure:
        // with(equalTo(session)),
        // with(equalTo(changes)),
        // with(equalTo(types)),

        transactionManager.startTransaction();
        persistenceSessionProxy.objectChanged(movieAdapter);
        persistenceSessionProxy.objectChanged(directorAdapter);
        transactionManager.endTransaction();

        assertEquals(new TestProxyVersion(5), movieAdapter.getVersion());
        assertEquals(new TestProxyVersion(9), directorAdapter.getVersion());
    }
View Full Code Here


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

                will(returnValue(new ExecuteClientActionResponse(new ReferenceData[] { updateData }, null,
View Full Code Here

TOP

Related Classes of org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyVersion

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.