Package com.hazelcast.test

Examples of com.hazelcast.test.TestHazelcastInstanceFactory


@Category(QuickTest.class)
public class InvocationTest extends HazelcastTestSupport {

    @Test
    public void whenPartitionTargetMemberDiesThenOperationSendToNewPartitionOwner() throws Exception {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        HazelcastInstance local = factory.newHazelcastInstance();
        HazelcastInstance remote = factory.newHazelcastInstance();
        warmUpPartitions(local, remote);

        Node localNode = getNode(local);
        OperationService service = localNode.nodeEngine.getOperationService();
        Operation op = new PartitionTargetOperation();
View Full Code Here


        f.get();
    }

    @Test
    public void whenTargetMemberDiesThenOperationAbortedWithMembersLeftException() throws Exception {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        HazelcastInstance local = factory.newHazelcastInstance();
        HazelcastInstance remote = factory.newHazelcastInstance();
        warmUpPartitions(local, remote);

        OperationService service = getNode(local).nodeEngine.getOperationService();
        Operation op = new TargetOperation();
        Address address = new Address(remote.getCluster().getLocalMember().getSocketAddress());
View Full Code Here

        MyServiceConfig configObject = new MyServiceConfig();
        MyService service = new MyService();
        config.getServicesConfig().addServiceConfig(new ServiceConfig().setEnabled(true)
                .setName("my-service").setConfigObject(configObject).setServiceImpl(service));

        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        factory.newHazelcastInstance(config);

        assertTrue(configObject == service.config);
    }
View Full Code Here

    @Test
    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

    private static SerializationService serializationService;

    @BeforeClass
    public static void setup() throws Exception {
        factory = new TestHazelcastInstanceFactory(2);
        hz1 = factory.newHazelcastInstance();
        hz2 = factory.newHazelcastInstance();

        Field original = HazelcastInstanceProxy.class.getDeclaredField("original");
        original.setAccessible(true);
View Full Code Here

     * ConcurrentModificationExceptions
     */
    @Test
    public void testIssue1882() {
        String mmName = "mm";
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        final Config config = new Config();
        final MultiMapConfig multiMapConfig = config.getMultiMapConfig(mmName);
        multiMapConfig.setValueCollectionType(MultiMapConfig.ValueCollectionType.LIST);
        final HazelcastInstance instance1 = factory.newHazelcastInstance(config);
        final HazelcastInstance instance2 = factory.newHazelcastInstance(config);
        final String key = generateKeyOwnedBy(instance1);

        final MultiMap<Object, Object> mm1 = instance1.getMultiMap("mm");
        mm1.put(key, 1);
        mm1.put(key, 2);
View Full Code Here

        Config config = new Config();
        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

    }


    @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

    }

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

        multiMap.get(null);
    }
View Full Code Here

        multiMap.get(null);
    }

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

        multiMap.put(null, "someVal");
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.test.TestHazelcastInstanceFactory

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.