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

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


    @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


        adapter.changeState(ResolveState.TRANSIENT);
        assertEquals(ResolveState.TRANSIENT, adapter.getResolveState());
    }

    public void testVersion() throws Exception {
        assertEquals(new TestProxyVersion(), adapter.getVersion());
    }
View Full Code Here

        assertEquals(new TestProxyVersion(), adapter.getVersion());
    }

    public void testVersionConflict() throws Exception {
        try {
            adapter.checkLock(new TestProxyVersion(2));
            fail();
        } catch (final ConcurrencyException expected) {
        }
    }
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);

        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

        system.init();

        adapter = system.createPersistentTestObject();
        oid = adapter.getOid();

        targetData = new DummyIdentityData(oid, TestProxyAdapter.class.getName(), new TestProxyVersion(1));
        parameterData = new ReferenceData[] {};
        final TestProxySpecification proxySpecification = (TestProxySpecification) adapter.getSpecification();

        mockAction = mockery.mock(ObjectAction.class);
        proxySpecification.setupAction(mockAction);
View Full Code Here

    }

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

        final Movie movie = new Movie();
        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);
        getTransactionManager().endTransaction();

        assertEquals(new TestProxyVersion(3), object.getVersion());
        assertEquals("ET", movie.getName());
        assertEquals(movie, object.getObject());
    }
View Full Code Here

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

        final DummyObjectData data =
            new DummyObjectData(adapter.getOid(), Movie.class.getName(), false, new TestProxyVersion(3));

        final ObjectAdapter object = encoder.decode(data);

        assertEquals(movie, object.getObject());
        assertEquals(new TestProxyVersion(1), object.getVersion());
    }
View Full Code Here

        final TestProxySpecification spec = (TestProxySpecification) object.getSpecification();
        nameField = new TestProxyAssociation("name", system.getSpecification(String.class));
        spec.setupFields(Arrays.asList((ObjectAssociation) nameField));

        movieData = new DummyReferenceData(object.getOid(), "none", new TestProxyVersion(1));

    }
View Full Code Here

    }

    @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

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.