Examples of SyncMessage


Examples of org.apache.cayenne.remote.SyncMessage

        // do most common messages first...
        if (message instanceof QueryMessage) {
            return channel.onQuery(null, ((QueryMessage) message).getQuery());
        }
        else if (message instanceof SyncMessage) {
            SyncMessage sync = (SyncMessage) message;
            return channel.onSync(null, sync.getSenderChanges(), sync.getType());
        }
        else if (message instanceof BootstrapMessage) {
            return channel.getEntityResolver().getClientEntityResolver();
        }
        else {
View Full Code Here

Examples of org.apache.cayenne.remote.SyncMessage

        // do most common messages first...
        if (message instanceof QueryMessage) {
            return channel.onQuery(null, ((QueryMessage) message).getQuery());
        }
        else if (message instanceof SyncMessage) {
            SyncMessage sync = (SyncMessage) message;
            return channel.onSync(null, sync.getSenderChanges(), sync.getType());
        }
        else if (message instanceof BootstrapMessage) {
            return channel.getEntityResolver().getClientEntityResolver();
        }
        else {
View Full Code Here

Examples of org.apache.cayenne.remote.SyncMessage

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());
        assertSame(diff, message.getSenderChanges());
    }
View Full Code Here

Examples of org.apache.cayenne.remote.SyncMessage

    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);
        assertTrue(d instanceof SyncMessage);

        SyncMessage ds = (SyncMessage) d;
        assertNull(ds.getSource());
        assertEquals(message.getType(), ds.getType());
        assertNotNull(ds.getSenderChanges());
    }
View Full Code Here

Examples of org.apache.cayenne.remote.SyncMessage

        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;
        try {
            new SyncMessage(source, bogusType, new CompoundDiff());
            fail("invalid type was allowed to go unnoticed...");
        }
        catch (IllegalArgumentException e) {

        }
View Full Code Here

Examples of org.sdnplatform.sync.thrift.SyncMessage

                m.setAuthScheme(org.sdnplatform.sync.thrift.
                                AuthScheme.CHALLENGE_RESPONSE);
                m.setAuthChallengeResponse(cr);
                break;
        }
        SyncMessage bsm = new SyncMessage(MessageType.HELLO);
        bsm.setHello(m);
        ctx.getChannel().write(bsm);
    }
View Full Code Here

Examples of org.sdnplatform.sync.thrift.SyncMessage

        // send an echo request
        EchoRequestMessage m = new EchoRequestMessage();
        AsyncMessageHeader header = new AsyncMessageHeader();
        header.setTransactionId(getTransactionId());
        m.setHeader(header);
        SyncMessage bsm = new SyncMessage(MessageType.ECHO_REQUEST);
        bsm.setEchoRequest(m);
        ctx.getChannel().write(bsm);
    }
View Full Code Here

Examples of org.sdnplatform.sync.thrift.SyncMessage

            if (getLocalNodeId() != null)
                m.setNodeId(getLocalNodeId());
            AsyncMessageHeader header = new AsyncMessageHeader();
            header.setTransactionId(getTransactionId());
            m.setHeader(header);
            SyncMessage bsm = new SyncMessage(MessageType.HELLO);
            bsm.setHello(m);

            AuthChallengeResponse reply = new AuthChallengeResponse();
            reply.setResponse(generateResponse(cr.getChallenge()));
            m.setAuthChallengeResponse(reply);
            channel.write(bsm);
View Full Code Here

Examples of org.sdnplatform.sync.thrift.SyncMessage

                                     Channel channel) {
        EchoReplyMessage m = new EchoReplyMessage();
        AsyncMessageHeader header = new AsyncMessageHeader();
        header.setTransactionId(request.getHeader().getTransactionId());
        m.setHeader(header);
        SyncMessage bsm = new SyncMessage(MessageType.ECHO_REPLY);
        bsm.setEchoReply(m);
        channel.write(bsm);
    }
View Full Code Here

Examples of org.sdnplatform.sync.thrift.SyncMessage

        em.setError(m);
        em.setType(type);
        AsyncMessageHeader header = new AsyncMessageHeader();
        header.setTransactionId(transactionId);
        em.setHeader(header);
        SyncMessage bsm = new SyncMessage(MessageType.ERROR);
        bsm.setError(em);
        return bsm;
    }
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.