Package com.hazelcast.test

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


        String mapName = "mm";
        long key = 1L;
        String value = "value";
        String value2 = "value2";
        final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        HazelcastInstance instance1 = factory.newHazelcastInstance();
        HazelcastInstance instance2 = factory.newHazelcastInstance();

        CountingEntryListener<Object, Object> listener = new CountingEntryListener<Object, Object>();

        MultiMap<Object, Object> map = instance1.getMultiMap(mapName);
View Full Code Here


        long key = 1L;
        String value = "value";
        String value2 = "value2";
        final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        HazelcastInstance instance1 = factory.newHazelcastInstance();
        HazelcastInstance instance2 = factory.newHazelcastInstance();

        CountingEntryListener<Object, Object> listener = new CountingEntryListener<Object, Object>();

        MultiMap<Object, Object> map = instance1.getMultiMap(mapName);
        map.addEntryListener(listener, true);
View Full Code Here

        Long key = 1L;
        Long value = 1L;
        String mapName = "myMultimap";
        final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);

        HazelcastInstance instance1 = factory.newHazelcastInstance();
        HazelcastInstance instance2 = factory.newHazelcastInstance();

        for (int i=0; i<2; i++) {
            TransactionContext ctx1 = instance1.newTransactionContext();
            ctx1.beginTransaction();
View Full Code Here

        Long value = 1L;
        String mapName = "myMultimap";
        final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);

        HazelcastInstance instance1 = factory.newHazelcastInstance();
        HazelcastInstance instance2 = factory.newHazelcastInstance();

        for (int i=0; i<2; i++) {
            TransactionContext ctx1 = instance1.newTransactionContext();
            ctx1.beginTransaction();
            BaseMultiMap<Long, Long> txProfileTasks1 = ctx1.getMultiMap(mapName);
View Full Code Here

        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(nodeCount);
        final BlockingQueue<Integer> counts = new ArrayBlockingQueue<Integer>(nodeCount);
        final HazelcastInstance[] instances = new HazelcastInstance[nodeCount];

        for (int i = 0; i < nodeCount; i++) {
            instances[i] = factory.newHazelcastInstance(config);
        }

        final ExecutorService ex = Executors.newCachedThreadPool();
        try {
            for (int j = 0; j < nodeCount; j++) {
View Full Code Here

    }

    @Test
    public void testAddMigrationListener_whenListenerRegisteredTwice() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        HazelcastInstance hz1 = factory.newHazelcastInstance();
        PartitionService partitionService = hz1.getPartitionService();

        MigrationListener listener = mock(MigrationListener.class);

        String id1 = partitionService.addMigrationListener(listener);
View Full Code Here

    }

    @Test
    public void testRemoveMigrationListener() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        HazelcastInstance hz1 = factory.newHazelcastInstance();
        PartitionService partitionService = hz1.getPartitionService();

        MigrationListener listener = mock(MigrationListener.class);

        String id = partitionService.addMigrationListener(listener);
View Full Code Here

        boolean removed = partitionService.removeMigrationListener(id);

        assertTrue(removed);

        // now we add a member
        HazelcastInstance hz2 = factory.newHazelcastInstance();
        warmUpPartitions(hz1, hz2);

        // and verify that the listener isn't called.
        verify(listener, never()).migrationStarted(any(MigrationEvent.class));
    }
View Full Code Here

    @Test(expected = DistributedObjectDestroyedException.class)
    @ClientCompatibleTest
    public void testLatchDestroyed() throws Exception {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        HazelcastInstance hz1 = factory.newHazelcastInstance();
        HazelcastInstance hz2 = factory.newHazelcastInstance();
        final ICountDownLatch latch = hz1.getCountDownLatch("test");
        latch.trySetCount(2);

        new TestThread() {
View Full Code Here

    @Test(expected = DistributedObjectDestroyedException.class)
    @ClientCompatibleTest
    public void testLatchDestroyed() throws Exception {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        HazelcastInstance hz1 = factory.newHazelcastInstance();
        HazelcastInstance hz2 = factory.newHazelcastInstance();
        final ICountDownLatch latch = hz1.getCountDownLatch("test");
        latch.trySetCount(2);

        new TestThread() {
            public void doRun() throws Exception {
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.