Search in sources :

Example 6 with DiscoveryCustomMessage

use of org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage in project ignite by apache.

the class GridCacheBinaryObjectMetadataExchangeMultinodeTest method startDeafClient.

/**
     * Starts client node that skips <b>MetadataUpdateProposedMessage</b> and <b>MetadataUpdateAcceptedMessage</b>
     * messages.
     *
     * @param clientName name of client node.
     */
private Ignite startDeafClient(String clientName) throws Exception {
    clientMode = true;
    applyDiscoveryHook = true;
    discoveryHook = new DiscoveryHook() {

        @Override
        public void handleDiscoveryMessage(DiscoverySpiCustomMessage msg) {
            DiscoveryCustomMessage customMsg = msg == null ? null : (DiscoveryCustomMessage) IgniteUtils.field(msg, "delegate");
            if (customMsg instanceof MetadataUpdateProposedMessage) {
                if (((MetadataUpdateProposedMessage) customMsg).typeId() == BINARY_TYPE_ID)
                    GridTestUtils.setFieldValue(customMsg, "typeId", 1);
            } else if (customMsg instanceof MetadataUpdateAcceptedMessage) {
                if (((MetadataUpdateAcceptedMessage) customMsg).typeId() == BINARY_TYPE_ID)
                    GridTestUtils.setFieldValue(customMsg, "typeId", 1);
            }
        }
    };
    Ignite client = startGrid(clientName);
    clientMode = false;
    applyDiscoveryHook = false;
    return client;
}
Also used : DiscoverySpiCustomMessage(org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage) Ignite(org.apache.ignite.Ignite) DiscoveryCustomMessage(org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage) DiscoveryHook(org.apache.ignite.testframework.GridTestUtils.DiscoveryHook)

Aggregations

DiscoveryCustomMessage (org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage)6 DiscoverySpiCustomMessage (org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage)3 DiscoveryHook (org.apache.ignite.testframework.GridTestUtils.DiscoveryHook)3 IgniteEx (org.apache.ignite.internal.IgniteEx)2 DiscoveryCustomEvent (org.apache.ignite.internal.events.DiscoveryCustomEvent)2 StartFullSnapshotAckDiscoveryMessage (org.apache.ignite.internal.pagemem.snapshot.StartFullSnapshotAckDiscoveryMessage)2 Map (java.util.Map)1 UUID (java.util.UUID)1 AssertionFailedError (junit.framework.AssertionFailedError)1 Ignite (org.apache.ignite.Ignite)1 BinaryObject (org.apache.ignite.binary.BinaryObject)1 ContinuousQuery (org.apache.ignite.cache.query.ContinuousQuery)1 ClusterGroup (org.apache.ignite.cluster.ClusterGroup)1 ClusterNode (org.apache.ignite.cluster.ClusterNode)1 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)1 IgniteInterruptedCheckedException (org.apache.ignite.internal.IgniteInterruptedCheckedException)1 IgniteNeedReconnectException (org.apache.ignite.internal.IgniteNeedReconnectException)1 AffinityTopologyVersion (org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion)1 DynamicCacheChangeBatch (org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch)1 DynamicCacheDescriptor (org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor)1