Package org.apache.cayenne

Examples of org.apache.cayenne.MockObjectContext


import org.apache.cayenne.remote.hessian.service.HessianUtil;

public class SyncMessageTest extends TestCase {

    public void testConstructor() {
        ObjectContext source = new MockObjectContext();
        GraphDiff diff = new CompoundDiff();
        SyncMessage message = new SyncMessage(source, DataChannel.FLUSH_NOCASCADE_SYNC, diff);

        assertSame(source, message.getSource());
        assertEquals(DataChannel.FLUSH_NOCASCADE_SYNC, message.getType());
View Full Code Here


        assertSame(diff, message.getSenderChanges());
    }

    public void testHessianSerialization() throws Exception {
        // id must be a serializable object; source doesn't have to be
        ObjectContext source = new MockObjectContext();
        GraphDiff diff = new NodeCreateOperation("id-string");
        SyncMessage message = new SyncMessage(source, DataChannel.FLUSH_NOCASCADE_SYNC, diff);

        Object d = HessianUtil.cloneViaClientServerSerialization(message, new EntityResolver());
        assertNotNull(d);
View Full Code Here

        assertEquals(message.getType(), ds.getType());
        assertNotNull(ds.getSenderChanges());
    }

    public void testConstructorInvalid() {
        ObjectContext source = new MockObjectContext();
        new SyncMessage(source, DataChannel.FLUSH_NOCASCADE_SYNC, new CompoundDiff());
        new SyncMessage(source, DataChannel.FLUSH_CASCADE_SYNC, new CompoundDiff());
        new SyncMessage(null, DataChannel.ROLLBACK_CASCADE_SYNC, new CompoundDiff());

        int bogusType = 45678;
View Full Code Here

TOP

Related Classes of org.apache.cayenne.MockObjectContext

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.