Search in sources :

Example 1 with TestObject

use of org.apache.ignite.internal.processors.cache.eviction.paged.TestObject in project ignite by apache.

the class ThinClientPermissionCheckTest method testCacheEntryEviction.

/**
 * Tests that the eviction of a cache entry does not require any special permissions from the user who adds the
 * entry.
 */
@Test
public void testCacheEntryEviction() throws Exception {
    try (IgniteClient client = startClient(CLIENT_PUT)) {
        ClientCache<Object, Object> cache = client.cache(EVICTION_TEST_CACHE);
        int entrySize = 4 * (1 << 10);
        int entriesCnt = 2 * EVICTION_TEST_DATA_REGION_SIZE / entrySize;
        for (int i = 0; i < entriesCnt; i++) cache.put(i, new TestObject(entrySize / 4));
        for (Ignite ignite : G.allGrids()) {
            Set<Integer> insertedKeys = IntStream.range(0, entriesCnt).boxed().collect(Collectors.toSet());
            assertTrue(ignite.cache(EVICTION_TEST_CACHE).getAll(insertedKeys).size() < entriesCnt);
        }
    }
}
Also used : IgniteClient(org.apache.ignite.client.IgniteClient) TestObject(org.apache.ignite.internal.processors.cache.eviction.paged.TestObject) TestObject(org.apache.ignite.internal.processors.cache.eviction.paged.TestObject) Ignite(org.apache.ignite.Ignite) AbstractSecurityTest(org.apache.ignite.internal.processors.security.AbstractSecurityTest) Test(org.junit.Test)

Aggregations

Ignite (org.apache.ignite.Ignite)1 IgniteClient (org.apache.ignite.client.IgniteClient)1 TestObject (org.apache.ignite.internal.processors.cache.eviction.paged.TestObject)1 AbstractSecurityTest (org.apache.ignite.internal.processors.security.AbstractSecurityTest)1 Test (org.junit.Test)1