Search in sources :

Example 96 with ClientInvocation

use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.

the class ClientSchemaService method sendAllSchemas.

public void sendAllSchemas() {
    if (schemas.isEmpty()) {
        if (logger.isFinestEnabled()) {
            logger.finest("There is no schema to send to the cluster");
        }
        return;
    }
    if (logger.isFinestEnabled()) {
        logger.finest("Sending schemas to the cluster " + schemas);
    }
    ClientMessage clientMessage = ClientSendAllSchemasCodec.encodeRequest(new ArrayList<>(schemas.values()));
    ClientInvocation invocation = new ClientInvocation(client, clientMessage, SERVICE_NAME);
    invocation.invokeUrgent().joinInternal();
}
Also used : ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 97 with ClientInvocation

use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.

the class MCMessageTasksTest method test_sqlMappingDdl_existingMap.

@Test
public void test_sqlMappingDdl_existingMap() throws Exception {
    String name = randomMapName();
    instance().getMap(name).put(1, "value-1");
    ClientInvocation invocation = new ClientInvocation(getClientImpl(), SqlMappingDdlCodec.encodeRequest(name), null);
    ClientDelegatingFuture<String> future = new ClientDelegatingFuture<>(invocation.invoke(), getClientImpl().getSerializationService(), SqlMappingDdlCodec::decodeResponse);
    String response = future.get(ASSERT_TRUE_EVENTUALLY_TIMEOUT, SECONDS);
    assertStartsWith("CREATE MAPPING \"" + name + "\"", response);
}
Also used : ClientDelegatingFuture(com.hazelcast.client.impl.ClientDelegatingFuture) ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) SqlMappingDdlCodec(com.hazelcast.client.impl.protocol.codec.SqlMappingDdlCodec) Test(org.junit.Test)

Example 98 with ClientInvocation

use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.

the class MCMessageTasksTest method test_sqlMappingDdl_nonExistingMap.

@Test
public void test_sqlMappingDdl_nonExistingMap() throws Exception {
    ClientInvocation invocation = new ClientInvocation(getClientImpl(), SqlMappingDdlCodec.encodeRequest(randomMapName()), null);
    ClientDelegatingFuture<String> future = new ClientDelegatingFuture<>(invocation.invoke(), getClientImpl().getSerializationService(), SqlMappingDdlCodec::decodeResponse);
    String response = future.get(ASSERT_TRUE_EVENTUALLY_TIMEOUT, SECONDS);
    assertNull(response);
}
Also used : ClientDelegatingFuture(com.hazelcast.client.impl.ClientDelegatingFuture) ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) SqlMappingDdlCodec(com.hazelcast.client.impl.protocol.codec.SqlMappingDdlCodec) Test(org.junit.Test)

Example 99 with ClientInvocation

use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.

the class MCMessageTasksTest method testGetMapConfigMessageTask.

@Test
public void testGetMapConfigMessageTask() throws Exception {
    ClientInvocation invocation = new ClientInvocation(getClientImpl(), MCGetMapConfigCodec.encodeRequest(randomString()), null);
    ClientDelegatingFuture<MCGetMapConfigCodec.ResponseParameters> future = new ClientDelegatingFuture<>(invocation.invoke(), getClientImpl().getSerializationService(), MCGetMapConfigCodec::decodeResponse);
    MCGetMapConfigCodec.ResponseParameters response = future.get(ASSERT_TRUE_EVENTUALLY_TIMEOUT, SECONDS);
    assertFalse(response.readBackupData);
}
Also used : ClientDelegatingFuture(com.hazelcast.client.impl.ClientDelegatingFuture) MCGetMapConfigCodec(com.hazelcast.client.impl.protocol.codec.MCGetMapConfigCodec) ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 100 with ClientInvocation

use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.

the class MCMessageTasksTest method testGetClusterMetadataMessageTask.

@Test
public void testGetClusterMetadataMessageTask() throws Exception {
    ClientInvocation invocation = new ClientInvocation(getClientImpl(), MCGetClusterMetadataCodec.encodeRequest(), null);
    ClientDelegatingFuture<MCGetClusterMetadataCodec.ResponseParameters> future = new ClientDelegatingFuture<>(invocation.invoke(), getClientImpl().getSerializationService(), MCGetClusterMetadataCodec::decodeResponse);
    MCGetClusterMetadataCodec.ResponseParameters response = future.get(ASSERT_TRUE_EVENTUALLY_TIMEOUT, SECONDS);
    assertTrue(response.clusterTime > 0);
    assertEquals(0, response.currentState);
    assertEquals(BuildInfoProvider.getBuildInfo().getVersion(), response.memberVersion);
    assertNull(response.jetVersion);
}
Also used : ClientDelegatingFuture(com.hazelcast.client.impl.ClientDelegatingFuture) ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) MCGetClusterMetadataCodec(com.hazelcast.client.impl.protocol.codec.MCGetClusterMetadataCodec) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

ClientInvocation (com.hazelcast.client.impl.spi.impl.ClientInvocation)129 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)97 ClientDelegatingFuture (com.hazelcast.client.impl.ClientDelegatingFuture)54 ClientInvocationFuture (com.hazelcast.client.impl.spi.impl.ClientInvocationFuture)51 Test (org.junit.Test)23 Data (com.hazelcast.internal.serialization.Data)22 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)19 QuickTest (com.hazelcast.test.annotation.QuickTest)19 UUID (java.util.UUID)18 HazelcastClientInstanceImpl (com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl)16 Future (java.util.concurrent.Future)13 UuidUtil.newUnsecureUUID (com.hazelcast.internal.util.UuidUtil.newUnsecureUUID)9 ArrayList (java.util.ArrayList)9 Nonnull (javax.annotation.Nonnull)9 ExecutionException (java.util.concurrent.ExecutionException)8 InternalCompletableFuture (com.hazelcast.spi.impl.InternalCompletableFuture)7 Collection (java.util.Collection)6 List (java.util.List)6 Map (java.util.Map)6 TimeUnit (java.util.concurrent.TimeUnit)6