Package com.hazelcast.core

Examples of com.hazelcast.core.ISet


    }

    //    ======================== contains - containsAll ==========================
    @Test
    public void testContains() {
        ISet set = newSet();
        set.add("item1");
        assertTrue(set.contains("item1"));
    }
View Full Code Here


        assertTrue(set.contains("item1"));
    }

    @Test
    public void testContains_whenEmpty() {
        ISet set = newSet();
        assertFalse(set.contains("notExist"));
    }
View Full Code Here

        assertFalse(set.contains("notExist"));
    }

    @Test
    public void testContains_whenNotContains() {
        ISet set = newSet();
        set.add("item1");
        assertFalse(set.contains("notExist"));
    }
View Full Code Here

        assertFalse(set.contains("notExist"));
    }

    @Test
    public void testContainsAll() {
        ISet set = newSet();
        Set contains = new HashSet();

        contains.add("item1");
        contains.add("item2");
        for (int i = 1; i <= 10; i++) {
            set.add("item" + i);
            contains.add("item" + i);
        }
        assertTrue(set.containsAll(contains));
    }
View Full Code Here

        assertTrue(set.containsAll(contains));
    }

    @Test
    public void testContainsAll_whenSetNotContains() {
        ISet set = newSet();

        Set contains = new HashSet();
        contains.add("item1");
        contains.add("item100");
        for (int i = 1; i <= 10; i++) {
            set.add("item" + i);
            contains.add("item" + i);
        }
        assertFalse(set.containsAll(contains));

    }
View Full Code Here

    @Test
    public void testAdd_withinTxn() throws Exception {
        final String element = "item1";
        final String setName = randomString();
        final ISet set = client.getSet(setName);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();

        final TransactionalSet<Object> txnSet = context.getSet(setName);
View Full Code Here

    @Test
    public void testSetSizeAfterAdd_withinTxn() throws Exception {
        final String element = "item1";
        final String setName = randomString();
        final ISet set = client.getSet(setName);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();

        final TransactionalSet<Object> txnSet = context.getSet(setName);
        txnSet.add(element);

        context.commitTransaction();

        assertEquals(1, set.size());
    }
View Full Code Here

    @Test
    public void testRemove_withinTxn() throws Exception {
        final String element = "item1";
        final String setName = randomString();
        final ISet set = client.getSet(setName);
        set.add(element);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();

        final TransactionalSet<Object> txnSet = context.getSet(setName);
View Full Code Here

    @Test
    public void testSetSizeAfterRemove_withinTxn() throws Exception {
        final String element = "item1";
        final String setName = randomString();
        final ISet set = client.getSet(setName);
        set.add(element);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();

        final TransactionalSet<Object> txnSet = context.getSet(setName);
        txnSet.remove(element);

        context.commitTransaction();

        assertEquals(0, set.size());
    }
View Full Code Here

    @Test
    public void testAddExistingElement_withinTxn() throws Exception {
        final String element = "item1";
        final String setName = randomString();
        final ISet set = client.getSet(setName);
        set.add(element);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();

        final TransactionalSet<Object> txnSet = context.getSet(setName);
        assertFalse(txnSet.add(element));

        context.commitTransaction();
        assertEquals(1,set.size());
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.core.ISet

Copyright © 2018 www.massapicom. 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.