Package com.hazelcast.test

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


        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 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();
View Full Code Here

    @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

        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);
View Full Code Here

        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

public class ExecutorTest extends HazelcastTestSupport {

    @Test
    public void submitToAllMembers_WithStatefulCallable() throws Exception {
        final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        HazelcastInstance instance1 = factory.newHazelcastInstance();
        factory.newHazelcastInstance();
        IExecutorService executorService = instance1.getExecutorService(randomString());

        MyTask myTask = new MyTask();
        final CountDownLatch completedLatch = new CountDownLatch(1);
View Full Code Here

    @Test
    public void submitToAllMembers_WithStatefulCallable() throws Exception {
        final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        HazelcastInstance instance1 = factory.newHazelcastInstance();
        factory.newHazelcastInstance();
        IExecutorService executorService = instance1.getExecutorService(randomString());

        MyTask myTask = new MyTask();
        final CountDownLatch completedLatch = new CountDownLatch(1);
        final AtomicBoolean failed = new AtomicBoolean();
View Full Code Here

        String serviceName = TestInitializingObjectService.NAME;
        String objectName = "test-object";

        HazelcastInstance[] instances = new HazelcastInstance[nodeCount];
        for (int i = 0; i < instances.length; i++) {
            instances[i] = factory.newHazelcastInstance(config);
            TestInitializingObject obj2 = instances[i].getDistributedObject(serviceName, objectName);
            assertTrue(obj2.init.get());
            Assert.assertFalse(obj2.error);
        }
    }
View Full Code Here

        String serviceName = TestInitializingObjectService.NAME;
        String objectName = "test-object";

        HazelcastInstance[] instances = new HazelcastInstance[nodeCount];
        for (int i = 0; i < instances.length; i++) {
            instances[i] = factory.newHazelcastInstance(config);
            instances[i].getDistributedObject(serviceName, objectName);
        }

        for (int i = 0; i < nodeCount; i++) {
            Node node = TestUtil.getNode(instances[i]);
View Full Code Here

        );

        String serviceName = FailingInitializingObjectService.NAME;
        String objectName = "test-object";

        HazelcastInstance hz = factory.newHazelcastInstance(config);
        hz.getDistributedObject(serviceName, objectName);
    }

    @Test
    public void testFailingInitialization_whenGetProxyCalledByMultipleThreads() {
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.