/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. package com.hazelcast.core;
  17. import com.hazelcast.config.XmlConfigBuilder;
  18. import com.hazelcast.impl.GroupProperties;
  19. import com.hazelcast.impl.TestUtil;
  20. import org.junit.After;
  21. import org.junit.Before;
  22. import org.junit.Ignore;
  23. import org.junit.Test;
  24. import org.junit.runner.RunWith;
  25. import static org.junit.Assert.*;
  26. /**
  27. * UnresolvedIssues is a set of unit test for known issues
  28. */
  29. @RunWith(com.hazelcast.util.RandomBlockJUnit4ClassRunner.class)
  30. public class UnresolvedIssues extends TestUtil {
  31. @Before
  32. @After
  33. public void init() throws Exception {
  34. System.setProperty(GroupProperties.PROP_WAIT_SECONDS_BEFORE_JOIN, "1");
  35. Hazelcast.shutdownAll();
  36. }
  37. @Ignore
  38. @Test
  39. public void issue371NearCachePutGetRemove() throws Exception {
  40. // looks like passed ok
  41. final HazelcastInstance hz = Hazelcast.newHazelcastInstance(new XmlConfigBuilder(ClassLoader.getSystemResourceAsStream("hazelcast-issue371.xml")).build());
  42. IMap<Object, Object> cache = hz.getMap("ipp-2nd-level-cache-near");
  43. assertNotNull(cache);
  44. Object value = cache.get("my-key");
  45. assertNull(value);
  46. value = cache.put("my-key", "my-value");
  47. assertNull(value);
  48. value = cache.get("my-key");
  49. assertEquals("my-value", value);
  50. value = cache.remove("my-key");
  51. assertEquals("my-value", value);
  52. value = cache.get("my-key");
  53. assertNull(value);
  54. }
  55. @Ignore
  56. @Test
  57. public void issue371NearCachePutContainsNonexistentKey() throws Exception {
  58. // looks like passed ok
  59. final HazelcastInstance hz = Hazelcast.newHazelcastInstance(new XmlConfigBuilder(ClassLoader.getSystemResourceAsStream("hazelcast-issue371.xml")).build());
  60. IMap<Object, Object> cache = hz.getMap("ipp-2nd-level-cache-near");
  61. assertNotNull(cache);
  62. Object value = cache.get("my-key");
  63. assertNull(value);
  64. boolean foundKey = cache.containsKey("my-key");
  65. assertFalse(foundKey);
  66. value = cache.remove("my-key");
  67. assertNull(value);
  68. value = cache.get("my-key");
  69. assertNull(value);
  70. }
  71. @Ignore
  72. @Test
  73. public void issue371NearCachePutContainsExistentKey() throws Exception {
  74. // hangs on, issue:
  75. // java.lang.IllegalStateException: Removed CacheEntry cannot be null
  76. // at com.hazelcast.impl.MapNearCache.invalidate(MapNearCache.java:181)
  77. final HazelcastInstance hz = Hazelcast.newHazelcastInstance(new XmlConfigBuilder(ClassLoader.getSystemResourceAsStream("hazelcast-issue371.xml")).build());
  78. IMap<Object, Object> cache = hz.getMap("ipp-2nd-level-cache-near");
  79. assertNotNull(cache);
  80. Object value = cache.get("my-key");
  81. assertNull(value);
  82. value = cache.put("my-key", "my-value");
  83. assertNull(value);
  84. boolean foundKey = cache.containsKey("my-key");
  85. assertTrue(foundKey);
  86. value = cache.remove("my-key");
  87. assertEquals("my-value", value);
  88. value = cache.get("my-key");
  89. assertNull(value);
  90. }
  91. @Ignore
  92. @Test
  93. public void issue386() {
  94. // this passes now!!
  95. HazelcastInstance h1 = Hazelcast.newHazelcastInstance(null);
  96. // HazelcastInstance h2 = Hazelcast.newHazelcastInstance(null);
  97. IMap map = h1.getMap("default");
  98. int maxLoopCount = 10000000;
  99. for (int count = 0; count < maxLoopCount; count++) {
  100. if (count % 10000 == 0) {
  101. System.out.println("lock " + count);
  102. }
  103. String o = Integer.toString(count);
  104. map.lock(o);
  105. try {
  106. } finally {
  107. map.unlock(o);
  108. }
  109. }
  110. }
  111. }