Examples of newInstances()


Examples of com.hazelcast.test.TestHazelcastInstanceFactory.newInstances()

    @Test
    public void testAddRollBack() throws Exception {
        final String setName = randomString();
        final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        final HazelcastInstance instance = factory.newInstances()[0];
        final ISet<String> set = instance.getSet(setName);
        set.add(ELEMENT);

        final TransactionContext context = instance.newTransactionContext();
        context.beginTransaction();
View Full Code Here

Examples of com.hazelcast.test.TestHazelcastInstanceFactory.newInstances()

    @Test
    public void testExecuteMultipleNode() throws InterruptedException, ExecutionException {
        final int k = simpleTestNodeCount;
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(k);
        final HazelcastInstance[] instances = factory.newInstances(new Config());
        for (int i = 0; i < k; i++) {
            final IExecutorService service = instances[i].getExecutorService("testExecuteMultipleNode");
            final String script = "hazelcast.getAtomicLong('count').incrementAndGet();";
            final int rand = new Random().nextInt(100);
            final Future<Integer> future = service.submit(new ScriptRunnable(script, null), rand);
View Full Code Here

Examples of com.hazelcast.test.TestHazelcastInstanceFactory.newInstances()

    @Test
    public void testSubmitToKeyOwnerRunnable() throws InterruptedException {
        final int k = simpleTestNodeCount;
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(k);
        final HazelcastInstance[] instances = factory.newInstances(new Config());
        final AtomicInteger count = new AtomicInteger(0);
        final CountDownLatch latch = new CountDownLatch(k);
        final ExecutionCallback callback = new ExecutionCallback() {
            public void onResponse(Object response) {
                if (response == null) {
View Full Code Here

Examples of com.hazelcast.test.TestHazelcastInstanceFactory.newInstances()

    public void testWaitingIndefinitely() throws InterruptedException {
        final Config config = new Config();
        config.setProperty(GroupProperties.PROP_OPERATION_CALL_TIMEOUT_MILLIS, "2000");

        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        final HazelcastInstance[] instances = factory.newInstances(config);

        // need to warm-up partitions,
        // since waiting for lock backup can take up to 5 seconds
        // and that may cause OperationTimeoutException with "No response for 4000 ms" error.
        warmUpPartitions(instances);
View Full Code Here

Examples of com.hazelcast.test.TestHazelcastInstanceFactory.newInstances()

        final String name = "defMM";
        config.getMultiMapConfig(name).setValueCollectionType(MultiMapConfig.ValueCollectionType.SET);

        final int insCount = 4;
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(insCount);
        final HazelcastInstance[] instances = factory.newInstances(config);

        assertTrue(getMultiMap(instances, name).put("key1", "key1_value1"));
        assertTrue(getMultiMap(instances, name).put("key1", "key1_value2"));

        assertTrue(getMultiMap(instances, name).put("key2", "key2_value1"));
View Full Code Here

Examples of com.hazelcast.test.TestHazelcastInstanceFactory.newInstances()


    @Test
    public void testContainsKey() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        MultiMap multiMap = getMultiMap(factory.newInstances(), randomString());
        System.out.println("test = " + multiMap.containsKey("test"));
        multiMap.put("test","test");
        System.out.println("test = " + multiMap.containsKey("test"));
        multiMap.remove("test");
        System.out.println("test = " + multiMap.containsKey("test"));
View Full Code Here

Examples of com.hazelcast.test.TestHazelcastInstanceFactory.newInstances()

    }

    @Test(expected = NullPointerException.class)
    public void testGet_whenNullKey() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        MultiMap multiMap = getMultiMap(factory.newInstances(), randomString());

        multiMap.get(null);
    }

    @Test(expected = NullPointerException.class)
View Full Code Here

Examples of com.hazelcast.test.TestHazelcastInstanceFactory.newInstances()

    }

    @Test(expected = NullPointerException.class)
    public void testPut_whenNullKey() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        MultiMap multiMap = getMultiMap(factory.newInstances(), randomString());

        multiMap.put(null, "someVal");
    }

    @Test(expected = NullPointerException.class)
View Full Code Here

Examples of com.hazelcast.test.TestHazelcastInstanceFactory.newInstances()

    }

    @Test(expected = NullPointerException.class)
    public void testPut_whenNullValue() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        MultiMap multiMap = getMultiMap(factory.newInstances(), randomString());

        multiMap.put("someVal", null);
    }

    @Test(expected = NullPointerException.class)
View Full Code Here

Examples of com.hazelcast.test.TestHazelcastInstanceFactory.newInstances()

    }

    @Test(expected = NullPointerException.class)
    public void testLock_whenNullKey() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        MultiMap multiMap = getMultiMap(factory.newInstances(), randomString());

        multiMap.lock(null);
    }

    @Test(expected = NullPointerException.class)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.