Package org.apache.isis.runtimes.dflt.remoting.common.data

Examples of org.apache.isis.runtimes.dflt.remoting.common.data.DummyEncodeableObjectData


    @Test
    public void testSetAssociationFailsWithNonCurrentTarget() {
        try {
            object.setOptimisticLock(new TestProxyVersion(2));
            final SetValueRequest request =
                new SetValueRequest(session, "name", movieData, new DummyEncodeableObjectData("name of movie"));
            server.setValue(request);
            fail();
        } catch (final ConcurrencyException expected) {
        }
    }
View Full Code Here


    @Test
    public void testSetAssociationFailsWhenInvisible() {
        nameField.setUpIsVisible(false);
        try {
            final SetValueRequest request =
                new SetValueRequest(session, "name", movieData, new DummyEncodeableObjectData("name of movie"));
            server.setValue(request);
            fail();
        } catch (final IsisException expected) {
            assertEquals("can't modify field as not visible or editable", expected.getMessage());
        }
View Full Code Here

    @Test
    public void testSetAssociationFailsWhenUnavailable() {
        nameField.setUpIsUnusableFor(object);
        try {
            final SetValueRequest request =
                new SetValueRequest(session, "name", movieData, new DummyEncodeableObjectData("test data"));
            server.setValue(request);
            fail();
        } catch (final IsisException expected) {
            assertEquals("can't modify field as not visible or editable", expected.getMessage());
        }
View Full Code Here

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

        final ObjectAdapter adapter = system.createPersistentTestObject(movie);
        adapter.changeState(ResolveState.RESOLVED);

        final DummyObjectData data =
            new DummyObjectData(adapter.getOid(), Movie.class.getName(), true, new TestProxyVersion(3));
        final DummyEncodeableObjectData name = new DummyEncodeableObjectData("ET", "java.lang.String");
        final DummyNullValue reference = new DummyNullValue(Person.class.getName());
        data.setFieldContent(new Data[] { reference, name });

        getTransactionManager().startTransaction();
        final ObjectAdapter object = encoder.decode(data);
View Full Code Here

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

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

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

TOP

Related Classes of org.apache.isis.runtimes.dflt.remoting.common.data.DummyEncodeableObjectData

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.