Search in sources :

Example 71 with IgniteClient

use of org.apache.ignite.client.IgniteClient in project ignite by apache.

the class BinaryArraySelfTest method testBinaryModeArray.

/**
 */
@Test
public void testBinaryModeArray() {
    putInBinaryGetRegular(srvCache);
    putInBinaryGetRegular(cliCache);
    try (IgniteClient thinClient = thinClient()) {
        putInBinaryGetRegular(new ClientCacheAdapter<>(thinClient.getOrCreateCache(DEFAULT_CACHE_NAME)));
    }
}
Also used : IgniteClient(org.apache.ignite.client.IgniteClient) Test(org.junit.Test)

Example 72 with IgniteClient

use of org.apache.ignite.client.IgniteClient in project ignite by apache.

the class BinaryArraySelfTest method testArrayFieldInKey.

/**
 */
@Test
public void testArrayFieldInKey() {
    doTestKeys(srvCache, TO_TEST_CLS);
    doTestKeys(cliCache, TO_TEST_CLS);
    try (IgniteClient thinClient = thinClient()) {
        doTestKeys(new ClientCacheAdapter<>(thinClient.getOrCreateCache(DEFAULT_CACHE_NAME)), TO_TEST_CLS);
    }
}
Also used : IgniteClient(org.apache.ignite.client.IgniteClient) Test(org.junit.Test)

Example 73 with IgniteClient

use of org.apache.ignite.client.IgniteClient in project ignite by apache.

the class ClientListenerMetricsTest method testClientListenerMetricsAccept.

/**
 * Check that valid connections and disconnections to the grid affect metrics.
 */
@Test
public void testClientListenerMetricsAccept() throws Exception {
    try (IgniteEx ignite = startGrid(0)) {
        MetricRegistry mreg = ignite.context().metric().registry(CLIENT_CONNECTOR_METRICS);
        checkConnectionsMetrics(mreg, 0, 0);
        IgniteClient client0 = Ignition.startClient(getClientConfiguration());
        checkConnectionsMetrics(mreg, 1, 1);
        client0.close();
        checkConnectionsMetrics(mreg, 1, 0);
        IgniteClient client1 = Ignition.startClient(getClientConfiguration());
        checkConnectionsMetrics(mreg, 2, 1);
        IgniteClient client2 = Ignition.startClient(getClientConfiguration());
        checkConnectionsMetrics(mreg, 3, 2);
        client1.close();
        checkConnectionsMetrics(mreg, 3, 1);
        client2.close();
        checkConnectionsMetrics(mreg, 3, 0);
    }
}
Also used : IgniteClient(org.apache.ignite.client.IgniteClient) IgniteEx(org.apache.ignite.internal.IgniteEx) MetricRegistry(org.apache.ignite.internal.processors.metric.MetricRegistry) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 74 with IgniteClient

use of org.apache.ignite.client.IgniteClient in project ignite by apache.

the class ClusterApiTest method testWalState.

/**
 * Test change WAL state for cache operation by thin client.
 */
@Test
public void testWalState() throws Exception {
    try (IgniteClient client = startClient(0)) {
        ClientCluster clientCluster = client.cluster();
        IgniteCluster igniteCluster = grid(0).cluster();
        igniteCluster.state(ClusterState.ACTIVE);
        grid(0).getOrCreateCache(DEFAULT_CACHE_NAME);
        igniteCluster.disableWal(DEFAULT_CACHE_NAME);
        // Check enable WAL operation.
        assertTrue(clientCluster.enableWal(DEFAULT_CACHE_NAME));
        assertTrue(clientCluster.isWalEnabled(DEFAULT_CACHE_NAME));
        assertTrue(igniteCluster.isWalEnabled(DEFAULT_CACHE_NAME));
        // Check enable WAL operation on already enabled WAL.
        assertFalse(clientCluster.enableWal(DEFAULT_CACHE_NAME));
        assertTrue(clientCluster.isWalEnabled(DEFAULT_CACHE_NAME));
        assertTrue(igniteCluster.isWalEnabled(DEFAULT_CACHE_NAME));
        // Check disable WAL operation.
        assertTrue(clientCluster.disableWal(DEFAULT_CACHE_NAME));
        assertFalse(clientCluster.isWalEnabled(DEFAULT_CACHE_NAME));
        assertFalse(igniteCluster.isWalEnabled(DEFAULT_CACHE_NAME));
        // Check disable WAL operation on already disabled WAL.
        assertFalse(clientCluster.disableWal(DEFAULT_CACHE_NAME));
        assertFalse(clientCluster.isWalEnabled(DEFAULT_CACHE_NAME));
        assertFalse(igniteCluster.isWalEnabled(DEFAULT_CACHE_NAME));
    }
}
Also used : IgniteClient(org.apache.ignite.client.IgniteClient) IgniteCluster(org.apache.ignite.IgniteCluster) ClientCluster(org.apache.ignite.client.ClientCluster) Test(org.junit.Test)

Example 75 with IgniteClient

use of org.apache.ignite.client.IgniteClient in project ignite by apache.

the class ComputeTaskTest method testExecuteWithCustomUserType.

/**
 * Test that custom user type can be returned by task.
 */
@Test
public void testExecuteWithCustomUserType() throws Exception {
    try (IgniteClient client = startClient(0)) {
        Person val = client.compute().execute(TestTaskCustomType.class.getName(), "person");
        assertEquals("person", val.getName());
    }
}
Also used : IgniteClient(org.apache.ignite.client.IgniteClient) Person(org.apache.ignite.client.Person) Test(org.junit.Test)

Aggregations

IgniteClient (org.apache.ignite.client.IgniteClient)106 Test (org.junit.Test)76 ClientConfiguration (org.apache.ignite.configuration.ClientConfiguration)43 ThinClientConfiguration (org.apache.ignite.configuration.ThinClientConfiguration)26 UUID (java.util.UUID)21 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)15 Ignite (org.apache.ignite.Ignite)14 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)14 HashSet (java.util.HashSet)13 T2 (org.apache.ignite.internal.util.typedef.T2)13 Set (java.util.Set)12 CountDownLatch (java.util.concurrent.CountDownLatch)12 ContinuousQuery (org.apache.ignite.cache.query.ContinuousQuery)12 List (java.util.List)10 BinaryObject (org.apache.ignite.binary.BinaryObject)10 GridTestUtils (org.apache.ignite.testframework.GridTestUtils)10 GridTestUtils.assertThrowsWithCause (org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause)10 Map (java.util.Map)9 Duration (javax.cache.expiry.Duration)9 ClientCacheConfiguration (org.apache.ignite.client.ClientCacheConfiguration)9