PageRenderTime 17ms CodeModel.GetById 6ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/hazelcast/src/test/java/com/hazelcast/core/UnresolvedIssues.java

https://bitbucket.org/gabral6_gmailcom/hazelcast
Java | 120 lines | 86 code | 9 blank | 25 comment | 3 complexity | 7a9737323bc6c474c6ea4490fbdd50bb MD5 | raw file
  1/*
  2 * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
  3 *
  4 * Licensed under the Apache License, Version 2.0 (the "License");
  5 * you may not use this file except in compliance with the License.
  6 * You may obtain a copy of the License at
  7 *
  8 * http://www.apache.org/licenses/LICENSE-2.0
  9 *
 10 * Unless required by applicable law or agreed to in writing, software
 11 * distributed under the License is distributed on an "AS IS" BASIS,
 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13 * See the License for the specific language governing permissions and
 14 * limitations under the License.
 15 */
 16
 17package com.hazelcast.core;
 18
 19import com.hazelcast.config.XmlConfigBuilder;
 20import com.hazelcast.impl.GroupProperties;
 21import com.hazelcast.impl.TestUtil;
 22import org.junit.After;
 23import org.junit.Before;
 24import org.junit.Ignore;
 25import org.junit.Test;
 26import org.junit.runner.RunWith;
 27
 28import static org.junit.Assert.*;
 29
 30/**
 31 * UnresolvedIssues is a set of unit test for known issues
 32 */
 33@RunWith(com.hazelcast.util.RandomBlockJUnit4ClassRunner.class)
 34public class UnresolvedIssues extends TestUtil {
 35
 36    @Before
 37    @After
 38    public void init() throws Exception {
 39        System.setProperty(GroupProperties.PROP_WAIT_SECONDS_BEFORE_JOIN, "1");
 40        Hazelcast.shutdownAll();
 41    }
 42
 43    @Ignore
 44    @Test
 45    public void issue371NearCachePutGetRemove() throws Exception {
 46        // looks like passed ok
 47        final HazelcastInstance hz = Hazelcast.newHazelcastInstance(new XmlConfigBuilder(ClassLoader.getSystemResourceAsStream("hazelcast-issue371.xml")).build());
 48        IMap<Object, Object> cache = hz.getMap("ipp-2nd-level-cache-near");
 49        assertNotNull(cache);
 50        Object value = cache.get("my-key");
 51        assertNull(value);
 52        value = cache.put("my-key", "my-value");
 53        assertNull(value);
 54        value = cache.get("my-key");
 55        assertEquals("my-value", value);
 56        value = cache.remove("my-key");
 57        assertEquals("my-value", value);
 58        value = cache.get("my-key");
 59        assertNull(value);
 60    }
 61
 62    @Ignore
 63    @Test
 64    public void issue371NearCachePutContainsNonexistentKey() throws Exception {
 65        // looks like passed ok
 66        final HazelcastInstance hz = Hazelcast.newHazelcastInstance(new XmlConfigBuilder(ClassLoader.getSystemResourceAsStream("hazelcast-issue371.xml")).build());
 67        IMap<Object, Object> cache = hz.getMap("ipp-2nd-level-cache-near");
 68        assertNotNull(cache);
 69        Object value = cache.get("my-key");
 70        assertNull(value);
 71        boolean foundKey = cache.containsKey("my-key");
 72        assertFalse(foundKey);
 73        value = cache.remove("my-key");
 74        assertNull(value);
 75        value = cache.get("my-key");
 76        assertNull(value);
 77    }
 78
 79    @Ignore
 80    @Test
 81    public void issue371NearCachePutContainsExistentKey() throws Exception {
 82        // hangs on, issue: 
 83        // java.lang.IllegalStateException: Removed CacheEntry cannot be null
 84        // at com.hazelcast.impl.MapNearCache.invalidate(MapNearCache.java:181)
 85        final HazelcastInstance hz = Hazelcast.newHazelcastInstance(new XmlConfigBuilder(ClassLoader.getSystemResourceAsStream("hazelcast-issue371.xml")).build());
 86        IMap<Object, Object> cache = hz.getMap("ipp-2nd-level-cache-near");
 87        assertNotNull(cache);
 88        Object value = cache.get("my-key");
 89        assertNull(value);
 90        value = cache.put("my-key", "my-value");
 91        assertNull(value);
 92        boolean foundKey = cache.containsKey("my-key");
 93        assertTrue(foundKey);
 94        value = cache.remove("my-key");
 95        assertEquals("my-value", value);
 96        value = cache.get("my-key");
 97        assertNull(value);
 98    }
 99
100    @Ignore
101    @Test
102    public void issue386() {
103        // this passes now!!
104        HazelcastInstance h1 = Hazelcast.newHazelcastInstance(null);
105//        HazelcastInstance h2 = Hazelcast.newHazelcastInstance(null);
106        IMap map = h1.getMap("default");
107        int maxLoopCount = 10000000;
108        for (int count = 0; count < maxLoopCount; count++) {
109            if (count % 10000 == 0) {
110                System.out.println("lock " + count);
111            }
112            String o = Integer.toString(count);
113            map.lock(o);
114            try {
115            } finally {
116                map.unlock(o);
117            }
118        }
119    }
120}