You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/04/27 01:17:16 UTC
[04/16] incubator-geode git commit: Updating and fixing tests
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParserJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParserJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParserJUnitTest.java
index 5a4f7b3..b02c7b3 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParserJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParserJUnitTest.java
@@ -34,7 +34,6 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
/**
* Test cases for {@link CacheXmlParser}.
- *
*
* @since 8.1
*/
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlVersionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlVersionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlVersionJUnitTest.java
index a51ce2b..15f3161 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlVersionJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlVersionJUnitTest.java
@@ -25,7 +25,6 @@ import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.test.junit.categories.UnitTest;
/**
- *
* @since 8.1
*/
@Category(UnitTest.class)
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/GeodeEntityResolverJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/GeodeEntityResolverJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/GeodeEntityResolverJUnitTest.java
index 2fef8b3..a5431e7 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/GeodeEntityResolverJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/GeodeEntityResolverJUnitTest.java
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.gemstone.gemfire.internal.cache.xmlcache;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
import org.junit.Before;
import org.junit.experimental.categories.Category;
import org.xml.sax.EntityResolver;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
/**
* Unit test for {@link GeodeEntityResolver} and
* {@link DefaultEntityResolver2}.
@@ -38,10 +38,12 @@ public class GeodeEntityResolverJUnitTest extends AbstractEntityResolverTest {
entityResolver = new GeodeEntityResolver();
}
+ @Override
public EntityResolver getEntityResolver() {
return entityResolver;
}
+ @Override
public String getSystemId() {
return systemId;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/PivotalEntityResolverJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/PivotalEntityResolverJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/PivotalEntityResolverJUnitTest.java
index ce4941e..182e81c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/PivotalEntityResolverJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/xmlcache/PivotalEntityResolverJUnitTest.java
@@ -14,18 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.gemstone.gemfire.internal.cache.xmlcache;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
import org.junit.Before;
import org.junit.experimental.categories.Category;
import org.xml.sax.EntityResolver;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
/**
* Unit test for {@link PivotalEntityResolver} and
* {@link DefaultEntityResolver2}.
- *
*
* @since 8.1
*/
@@ -41,10 +40,12 @@ public class PivotalEntityResolverJUnitTest extends AbstractEntityResolverTest {
entityResolver = new PivotalEntityResolver();
}
+ @Override
public EntityResolver getEntityResolver() {
return entityResolver;
}
+ @Override
public String getSystemId() {
return systemId;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/jndi/ContextJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jndi/ContextJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jndi/ContextJUnitTest.java
index 2fe0518..6a2545a 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jndi/ContextJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jndi/ContextJUnitTest.java
@@ -16,8 +16,9 @@
*/
package com.gemstone.gemfire.internal.jndi;
-import java.util.Hashtable;
+import static org.junit.Assert.*;
+import java.util.Hashtable;
import javax.naming.Binding;
import javax.naming.Context;
import javax.naming.ContextNotEmptyException;
@@ -28,20 +29,18 @@ import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.NoPermissionException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.test.junit.categories.UnitTest;
-import junit.framework.TestCase;
-
-//import com.gemstone.gemfire.internal.jndi.InitialContextFactoryImpl;
-
/**
* Tests all basic methods of ContextImpl.
- *
*/
@Category(UnitTest.class)
-public class ContextJUnitTest extends TestCase {
+public class ContextJUnitTest {
private Context initialCtx;
@@ -50,65 +49,47 @@ public class ContextJUnitTest extends TestCase {
private Context envCtx;
private Context datasourceCtx;
-
- public ContextJUnitTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- // InitialContextFactoryImpl impl = new InitialContextFactoryImpl();
- // impl.setAsInitial();
+
+ @Before
+ public void setUp() throws Exception {
Hashtable table = new Hashtable();
- table
- .put(
- Context.INITIAL_CONTEXT_FACTORY,
- "com.gemstone.gemfire.internal.jndi.InitialContextFactoryImpl");
- // table.put(Context.URL_PKG_PREFIXES,
- // "com.gemstone.gemfire.internal.jndi");
+ table.put(Context.INITIAL_CONTEXT_FACTORY, "com.gemstone.gemfire.internal.jndi.InitialContextFactoryImpl");
initialCtx = new InitialContext(table);
initialCtx.bind("java:gf/env/datasource/oracle", "a");
gfCtx = (Context) initialCtx.lookup("java:gf");
envCtx = (Context) gfCtx.lookup("env");
datasourceCtx = (Context) envCtx.lookup("datasource");
}
-
- protected void tearDown() throws Exception {
-
+
+ @After
+ public void tearDown() throws Exception {
clearContext(initialCtx);
datasourceCtx = null;
envCtx = null;
gfCtx = null;
initialCtx = null;
- //InitialContextFactoryImpl.revertSetAsInitial();
}
/**
* Removes all entries from the specified context, including subcontexts.
*
- * @param context context ot clear
+ * @param context context to clear
*/
- private void clearContext(Context context)
- throws NamingException {
-
- for (NamingEnumeration e = context.listBindings(""); e
- .hasMoreElements();) {
+ private void clearContext(Context context) throws NamingException {
+ for (NamingEnumeration e = context.listBindings(""); e.hasMoreElements();) {
Binding binding = (Binding) e.nextElement();
if (binding.getObject() instanceof Context) {
clearContext((Context) binding.getObject());
}
context.unbind(binding.getName());
}
-
}
- /*
+ /**
* Tests inability to create duplicate subcontexts.
- *
- * @throws NamingException
*/
- public void testSubcontextCreationOfDuplicates()
- throws NamingException {
-
+ @Test
+ public void testSubcontextCreationOfDuplicates() throws NamingException {
// Try to create duplicate subcontext
try {
initialCtx.createSubcontext("java:gf");
@@ -125,14 +106,11 @@ public class ContextJUnitTest extends TestCase {
}
}
- /*
+ /**
* Tests inability to destroy non empty subcontexts.
- *
- * @throws NamingException
*/
- public void testSubcontextNonEmptyDestruction()
- throws NamingException {
-
+ @Test
+ public void testSubcontextNonEmptyDestruction() throws Exception {
// Bind some object in ejb subcontext
datasourceCtx.bind("Test", "Object");
// Attempt to destroy any subcontext
@@ -157,14 +135,11 @@ public class ContextJUnitTest extends TestCase {
}
}
- /*
+ /**
* Tests ability to destroy empty subcontexts.
- *
- * @throws NamingException
*/
- public void testSubcontextDestruction()
- throws NamingException {
-
+ @Test
+ public void testSubcontextDestruction() throws Exception {
// Create three new subcontexts
datasourceCtx.createSubcontext("sub1");
datasourceCtx.createSubcontext("sub2");
@@ -195,13 +170,11 @@ public class ContextJUnitTest extends TestCase {
}
}
- /*
- * Tests inability to invoke methods on destroyed subcontexts. @throws
- * NamingException
+ /**
+ * Tests inability to invoke methods on destroyed subcontexts.
*/
- public void testSubcontextInvokingMethodsOnDestroyedContext()
- throws NamingException {
-
+ @Test
+ public void testSubcontextInvokingMethodsOnDestroyedContext() throws Exception {
//Create subcontext and destroy it.
Context sub = datasourceCtx.createSubcontext("sub4");
initialCtx
@@ -258,11 +231,11 @@ public class ContextJUnitTest extends TestCase {
}
}
- /*
- * Tests ability to bind name to object. @throws NamingException
+ /**
+ * Tests ability to bind name to object.
*/
- public void testBindLookup() throws NamingException {
-
+ @Test
+ public void testBindLookup() throws Exception {
Object obj1 = new String("Object1");
Object obj2 = new String("Object2");
Object obj3 = new String("Object3");
@@ -271,8 +244,7 @@ public class ContextJUnitTest extends TestCase {
initialCtx.bind("java:gf/env/sub23", null);
initialCtx.bind("java:gf/env/sub24", obj2);
// Bind to subcontexts that do not exist
- initialCtx.bind("java:gf/env/datasource/sub25/sub26",
- obj3);
+ initialCtx.bind("java:gf/env/datasource/sub25/sub26", obj3);
// Try to lookup
assertNull(datasourceCtx.lookup("sub21"));
@@ -282,11 +254,11 @@ public class ContextJUnitTest extends TestCase {
assertSame(datasourceCtx.lookup("sub25/sub26"), obj3);
}
- /*
- * Tests ability to unbind names. @throws NamingException
+ /**
+ * Tests ability to unbind names.
*/
- public void testUnbind() throws NamingException {
-
+ @Test
+ public void testUnbind() throws Exception {
envCtx.bind("sub31", null);
gfCtx.bind("env/ejb/sub32", new String("UnbindObject"));
// Unbind
@@ -320,45 +292,37 @@ public class ContextJUnitTest extends TestCase {
}
}
- /*
+ /**
* Tests ability to list bindings for a context - specified by name through
* object reference.
- *
- * @throws NamingException
*/
- public void testListBindings() throws NamingException {
-
+ @Test
+ public void testListBindings() throws Exception {
gfCtx.bind("env/datasource/sub41", "ListBindings1");
envCtx.bind("sub42", "ListBindings2");
datasourceCtx.bind("sub43", null);
// Verify bindings for context specified by reference
- verifyListBindings(envCtx, "", "ListBindings1",
- "ListBindings2");
+ verifyListBindings(envCtx, "", "ListBindings1", "ListBindings2");
// Verify bindings for context specified by name
- verifyListBindings(initialCtx, "java:gf/env",
- "ListBindings1", "ListBindings2");
+ verifyListBindings(initialCtx, "java:gf/env", "ListBindings1", "ListBindings2");
}
- private void verifyListBindings(Context c, String name,
- Object obj1, Object obj2) throws NamingException {
-
+ private void verifyListBindings(Context c, String name, Object obj1, Object obj2) throws NamingException {
boolean datasourceFoundFlg = false;
boolean o2FoundFlg = false;
boolean datasourceO1FoundFlg = false;
boolean datasourceNullFoundFlg = false;
// List bindings for the specified context
- for (NamingEnumeration en = c.listBindings(name); en
- .hasMore();) {
+ for (NamingEnumeration en = c.listBindings(name); en.hasMore();) {
Binding b = (Binding) en.next();
if (b.getName().equals("datasource")) {
assertEquals(b.getObject(), datasourceCtx);
datasourceFoundFlg = true;
Context nextCon = (Context) b.getObject();
- for (NamingEnumeration en1 = nextCon
- .listBindings(""); en1.hasMore();) {
+ for (NamingEnumeration en1 = nextCon.listBindings(""); en1.hasMore();) {
Binding b1 = (Binding) en1.next();
if (b1.getName().equals("sub41")) {
assertEquals(b1.getObject(), obj1);
@@ -376,12 +340,12 @@ public class ContextJUnitTest extends TestCase {
o2FoundFlg = true;
}
}
- if (!(datasourceFoundFlg && o2FoundFlg
- && datasourceO1FoundFlg && datasourceNullFoundFlg)) {
+ if (!(datasourceFoundFlg && o2FoundFlg && datasourceO1FoundFlg && datasourceNullFoundFlg)) {
fail();
}
}
-
+
+ @Test
public void testCompositeName() throws Exception {
ContextImpl c = new ContextImpl();
Object o = new Object();
@@ -389,9 +353,9 @@ public class ContextJUnitTest extends TestCase {
c.rebind("/a/b/c/", o);
assertEquals(c.lookup("a/b/c"), o);
assertEquals(c.lookup("///a/b/c///"), o);
-
}
-
+
+ @Test
public void testLookup() throws Exception {
ContextImpl ctx = new ContextImpl();
Object obj = new Object();
@@ -400,14 +364,13 @@ public class ContextJUnitTest extends TestCase {
ctx.bind("a", obj);
assertEquals(obj, ctx.lookup("a"));
-
}
- /*
+ /**
* Tests "getCompositeName" method
*/
+ @Test
public void testGetCompositeName() throws Exception {
-
ContextImpl ctx = new ContextImpl();
ctx.rebind("a/b/c/d", new Object());
@@ -418,15 +381,13 @@ public class ContextJUnitTest extends TestCase {
subCtx = (ContextImpl) ctx.lookup("a/b/c");
assertEquals("a/b/c", subCtx.getCompoundStringName());
-
}
- /*
- * Tests substitution of '.' with '/' when parsing string names. @throws
- * NamingException
+ /**
+ * Tests substitution of '.' with '/' when parsing string names.
*/
- public void testTwoSeparatorNames()
- throws NamingException {
+ @Test
+ public void testTwoSeparatorNames() throws Exception {
ContextImpl ctx = new ContextImpl();
Object obj = new Object();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogServiceJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogServiceJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogServiceJUnitTest.java
index ea2a1e9..e0c6972 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogServiceJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogServiceJUnitTest.java
@@ -38,7 +38,6 @@ import junitparams.Parameters;
/**
* Unit tests for LogService
- *
*/
@Category(UnitTest.class)
@RunWith(JUnitParamsRunner.class)
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/SortLogFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/SortLogFileJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/SortLogFileJUnitTest.java
index 24002f9..c8966da 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/SortLogFileJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/SortLogFileJUnitTest.java
@@ -29,6 +29,7 @@ import java.io.StringWriter;
import java.util.Date;
import java.util.Random;
+import org.junit.Test;
import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.LogWriter;
@@ -37,7 +38,6 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
/**
* Tests the functionality of the {@link SortLogFile} program.
*
- *
* @since 3.0
*/
@Category(UnitTest.class)
@@ -48,8 +48,8 @@ public class SortLogFileJUnitTest {
* order. Then it sorts the log file and asserts that the entries
* are sorted order.
*/
- @org.junit.Test
- public void testRandomLog() throws IOException {
+ @Test
+ public void testRandomLog() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintWriter pw = new PrintWriter(new OutputStreamWriter(baos), true);
LogWriter logger = new RandomLogWriter(pw);
@@ -105,6 +105,7 @@ public class SortLogFileJUnitTest {
* Ignores <code>date</code> and returns the timestamp for a
* random date.
*/
+ @Override
protected String formatDate(Date date) {
long time = date.getTime() + (random.nextInt(100000) * 1000);
date = new Date(time);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/AlertAppenderJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/AlertAppenderJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/AlertAppenderJUnitTest.java
index a1d5e9d..eb0fea3 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/AlertAppenderJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/AlertAppenderJUnitTest.java
@@ -44,7 +44,6 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
/**
* Tests the AlertAppender.
- *
*/
@Category(UnitTest.class)
public class AlertAppenderJUnitTest {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LocalizedMessageJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LocalizedMessageJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LocalizedMessageJUnitTest.java
index 5c41ae0..603abf3 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LocalizedMessageJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LocalizedMessageJUnitTest.java
@@ -30,7 +30,6 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
/**
* Tests for LocalizedMessage which bridges our StringId LocalizedStrings for
* Log4J2 usage.
- *
*/
@Category(UnitTest.class)
public class LocalizedMessageJUnitTest {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterAppenderJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterAppenderJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterAppenderJUnitTest.java
index 58abcc8..4a485d8 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterAppenderJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterAppenderJUnitTest.java
@@ -40,7 +40,6 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
/**
* Tests the LogWriterAppender.
- *
*/
@Category(UnitTest.class)
public class LogWriterAppenderJUnitTest {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/DataTypeJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/DataTypeJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/DataTypeJUnitTest.java
index fe176e0..00ad891 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/DataTypeJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/DataTypeJUnitTest.java
@@ -16,7 +16,9 @@
*/
package com.gemstone.gemfire.internal.offheap;
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
import java.io.ByteArrayOutputStream;
import java.io.DataInput;
@@ -49,12 +51,10 @@ import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.*;
-import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
import com.gemstone.gemfire.DataSerializer;
import com.gemstone.gemfire.Instantiator;
@@ -93,6 +93,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("com.gemstone.gemfire.internal.DataSerializableFixedID:" + ReplyMessage.class.getName(), type);
}
+
@Test
public void testDataSerializableFixedIDShort() throws IOException {
DataSerializableFixedID value = new ShutdownAllResponse();
@@ -103,14 +104,15 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("com.gemstone.gemfire.internal.DataSerializableFixedID:" + ShutdownAllResponse.class.getName(), type);
}
+
@Test
public void testDataSerializableFixedIDInt() throws IOException, ClassNotFoundException {
Integer someDSFIDInt = new Integer(1);
-
+
PowerMockito.mockStatic(DSFIDFactory.class);
when(DSFIDFactory.create(eq(someDSFIDInt), any())).thenReturn(someDSFIDInt);
DSFIDFactory.create(someDSFIDInt, null);
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
DataSerializer.writeByte(DSCODE.DS_FIXED_ID_INT, out);
@@ -119,6 +121,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("com.gemstone.gemfire.internal.DataSerializableFixedID:" + Integer.class.getName(), type);
}
+
@Test
public void testDataSerializableFixedIDClass() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -129,6 +132,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("com.gemstone.gemfire.internal.DataSerializableFixedID:" + Integer.class.getName(), type);
}
+
@Test
public void testNull() throws IOException {
Object value = null;
@@ -139,6 +143,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("null", type);
}
+
@Test
public void testString() throws IOException {
String value = "this is a string";
@@ -149,6 +154,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.String", type);
}
+
@Test
public void testNullString() throws IOException {
String value = null;
@@ -159,6 +165,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.String", type);
}
+
@Test
public void testClass() throws IOException {
Class<?> value = String.class;
@@ -169,9 +176,10 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Class", type);
}
+
@Test
public void testDate() throws IOException {
- Date value = new Date();
+ Date value = new Date();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
DataSerializer.writeObject(value, out); // NOT writeDate
@@ -179,6 +187,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.Date", type);
}
+
@Test
public void testFile() throws IOException {
File value = new File("tmp");
@@ -189,6 +198,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.io.File", type);
}
+
@Test
public void testInetAddress() throws IOException {
InetAddress value = InetAddress.getLocalHost();
@@ -199,6 +209,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.net.InetAddress", type);
}
+
@Test
public void testBoolean() throws IOException {
Boolean value = Boolean.TRUE;
@@ -209,6 +220,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Boolean", type);
}
+
@Test
public void testCharacter() throws IOException {
Character value = Character.valueOf('c');
@@ -219,9 +231,10 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Character", type);
}
+
@Test
public void testByte() throws IOException {
- Byte value = Byte.valueOf((byte)0);
+ Byte value = Byte.valueOf((byte) 0);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
DataSerializer.writeObject(value, out);
@@ -229,9 +242,10 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Byte", type);
}
+
@Test
public void testShort() throws IOException {
- Short value = Short.valueOf((short)1);
+ Short value = Short.valueOf((short) 1);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
DataSerializer.writeObject(value, out);
@@ -239,6 +253,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Short", type);
}
+
@Test
public void testInteger() throws IOException {
Integer value = Integer.valueOf(1);
@@ -249,6 +264,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Integer", type);
}
+
@Test
public void testLong() throws IOException {
Long value = Long.valueOf(1);
@@ -259,9 +275,10 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Long", type);
}
+
@Test
public void testFloat() throws IOException {
- Float value = Float.valueOf((float)1.0);
+ Float value = Float.valueOf((float) 1.0);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
DataSerializer.writeObject(value, out);
@@ -269,9 +286,10 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Float", type);
}
+
@Test
public void testDouble() throws IOException {
- Double value = Double.valueOf((double)1.0);
+ Double value = Double.valueOf((double) 1.0);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
DataSerializer.writeObject(value, out);
@@ -279,6 +297,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Double", type);
}
+
@Test
public void testByteArray() throws IOException {
byte[] value = new byte[10];
@@ -289,6 +308,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("byte[]", type);
}
+
@Test
public void testByteArrays() throws IOException {
byte[][] value = new byte[1][1];
@@ -299,6 +319,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("byte[][]", type);
}
+
@Test
public void testShortArray() throws IOException {
short[] value = new short[1];
@@ -309,6 +330,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("short[]", type);
}
+
@Test
public void testStringArray() throws IOException {
String[] value = new String[1];
@@ -319,6 +341,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.String[]", type);
}
+
@Test
public void testIntArray() throws IOException {
int[] value = new int[1];
@@ -329,6 +352,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("int[]", type);
}
+
@Test
public void testFloatArray() throws IOException {
float[] value = new float[1];
@@ -339,6 +363,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("float[]", type);
}
+
@Test
public void testLongArray() throws IOException {
long[] value = new long[1];
@@ -349,6 +374,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("long[]", type);
}
+
@Test
public void testDoubleArray() throws IOException {
double[] value = new double[1];
@@ -359,6 +385,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("double[]", type);
}
+
@Test
public void testBooleanArray() throws IOException {
boolean[] value = new boolean[1];
@@ -369,6 +396,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("boolean[]", type);
}
+
@Test
public void testCharArray() throws IOException {
char[] value = new char[1];
@@ -379,6 +407,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("char[]", type);
}
+
@Test
public void testObjectArray() throws IOException {
Object[] value = new Object[1];
@@ -389,6 +418,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Object[]", type);
}
+
@Test
public void testArrayList() throws IOException {
ArrayList<Object> value = new ArrayList<Object>();
@@ -399,6 +429,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.ArrayList", type);
}
+
@Test
public void testLinkedList() throws IOException {
LinkedList<Object> value = new LinkedList<Object>();
@@ -409,6 +440,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.LinkedList", type);
}
+
@Test
public void testHashSet() throws IOException {
HashSet<Object> value = new HashSet<Object>();
@@ -419,6 +451,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.HashSet", type);
}
+
@Test
public void testLinkedHashSet() throws IOException {
LinkedHashSet<Object> value = new LinkedHashSet<Object>();
@@ -429,9 +462,10 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.LinkedHashSet", type);
}
+
@Test
public void testHashMap() throws IOException {
- HashMap<Object,Object> value = new HashMap<Object,Object>();
+ HashMap<Object, Object> value = new HashMap<Object, Object>();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
DataSerializer.writeObject(value, out);
@@ -439,9 +473,10 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.HashMap", type);
}
+
@Test
public void testIdentityHashMap() throws IOException {
- IdentityHashMap<Object,Object> value = new IdentityHashMap<Object,Object>();
+ IdentityHashMap<Object, Object> value = new IdentityHashMap<Object, Object>();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
DataSerializer.writeObject(value, out);
@@ -449,9 +484,10 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.IdentityHashMap", type);
}
+
@Test
public void testHashtable() throws IOException {
- Hashtable<Object,Object> value = new Hashtable<Object,Object>();
+ Hashtable<Object, Object> value = new Hashtable<Object, Object>();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
DataSerializer.writeObject(value, out);
@@ -459,9 +495,10 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.Hashtable", type);
}
+
@Test
public void testConcurrentHashMap() throws IOException { // java.io.Serializable (broken)
- ConcurrentHashMap<Object,Object> value = new ConcurrentHashMap<Object,Object>();
+ ConcurrentHashMap<Object, Object> value = new ConcurrentHashMap<Object, Object>();
value.put("key1", "value1");
value.put("key2", "value2");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -472,6 +509,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.io.Serializable:java.util.concurrent.ConcurrentHashMap", type);
}
+
@Test
public void testProperties() throws IOException {
Properties value = new Properties();
@@ -482,10 +520,11 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.Properties", type);
}
+
@Test
public void testTimeUnit() throws IOException {
final EnumSet<TimeUnit> optimizedTimeUnits = EnumSet.range(TimeUnit.NANOSECONDS, TimeUnit.SECONDS);
- for (TimeUnit v: TimeUnit.values()) {
+ for (TimeUnit v : TimeUnit.values()) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
DataSerializer.writeObject(v, out);
@@ -498,6 +537,7 @@ public class DataTypeJUnitTest {
}
}
}
+
@Test
public void testVector() throws IOException {
Vector<Object> value = new Vector<Object>();
@@ -508,6 +548,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.Vector", type);
}
+
@Test
public void testStack() throws IOException {
Stack<Object> value = new Stack<Object>();
@@ -518,9 +559,10 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.Stack", type);
}
+
@Test
public void testTreeMap() throws IOException {
- TreeMap<Object,Object> value = new TreeMap<Object,Object>();
+ TreeMap<Object, Object> value = new TreeMap<Object, Object>();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
DataSerializer.writeObject(value, out);
@@ -528,6 +570,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.TreeMap", type);
}
+
@Test
public void testTreeSet() throws IOException {
TreeSet<Object> value = new TreeSet<Object>();
@@ -538,6 +581,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.TreeSet", type);
}
+
@Test
public void testBooleanType() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -547,6 +591,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Boolean.class", type);
}
+
@Test
public void testCharacterType() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -556,6 +601,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Character.class", type);
}
+
@Test
public void testByteType() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -565,6 +611,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Byte.class", type);
}
+
@Test
public void testShortType() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -574,6 +621,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Short.class", type);
}
+
@Test
public void testIntegerType() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -583,6 +631,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Integer.class", type);
}
+
@Test
public void testLongType() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -592,6 +641,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Long.class", type);
}
+
@Test
public void testFloatType() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -601,6 +651,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Float.class", type);
}
+
@Test
public void testDoubleType() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -610,6 +661,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Double.class", type);
}
+
@Test
public void testVoidType() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -619,6 +671,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.lang.Void.class", type);
}
+
//TODO: these tests have to corrected once USER_CLASS, USER_CLASS_2, USER_CLASS_4 are implemented.
@Test
public void getDataTypeShouldReturnUserClass() throws IOException {
@@ -631,6 +684,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertThat(type).isEqualTo("DataSerializer: with Id:" + someUserClassId);
}
+
@Test
public void getDataTypeShouldReturnUserClass2() throws IOException {
short someUserClass2Id = 1;
@@ -642,6 +696,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertThat(type).isEqualTo("DataSerializer: with Id:" + someUserClass2Id);
}
+
@Test
public void getDataTypeShouldReturnUserClass4() throws IOException {
int someUserClass4Id = 1;
@@ -653,72 +708,76 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertThat(type).isEqualTo("DataSerializer: with Id:" + someUserClass4Id);
}
+
@Test
public void getDataTypeShouldReturnUserDataSeriazliable() throws IOException {
Instantiator mockInstantiator = PowerMockito.mock(Instantiator.class);
doReturn(CustId.class).when(mockInstantiator).getInstantiatedClass();
mockInstantiator.getInstantiatedClass();
-
+
int someClassId = 1;
-
+
PowerMockito.mockStatic(InternalInstantiator.class);
when(InternalInstantiator.getClassId(mockInstantiator.getClass())).thenReturn(someClassId);
when(InternalInstantiator.getInstantiator(someClassId)).thenReturn(mockInstantiator);
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
out.writeByte(DSCODE.USER_DATA_SERIALIZABLE);
out.writeByte(someClassId);
-
+
byte[] bytes = baos.toByteArray();
String type = DataType.getDataType(bytes);
-
+
assertThat(type).isEqualTo("com.gemstone.gemfire.Instantiator:com.gemstone.gemfire.internal.cache.execute.data.CustId");
}
+
@Test
public void getDataTypeShouldReturnUserDataSeriazliable2() throws IOException {
Instantiator mockInstantiator = PowerMockito.mock(Instantiator.class);
doReturn(CustId.class).when(mockInstantiator).getInstantiatedClass();
mockInstantiator.getInstantiatedClass();
-
+
int someClassId = 1;
-
+
PowerMockito.mockStatic(InternalInstantiator.class);
when(InternalInstantiator.getClassId(mockInstantiator.getClass())).thenReturn(someClassId);
when(InternalInstantiator.getInstantiator(someClassId)).thenReturn(mockInstantiator);
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
out.writeByte(DSCODE.USER_DATA_SERIALIZABLE_2);
out.writeShort(someClassId);
-
+
byte[] bytes = baos.toByteArray();
String type = DataType.getDataType(bytes);
-
+
assertThat(type).isEqualTo("com.gemstone.gemfire.Instantiator:com.gemstone.gemfire.internal.cache.execute.data.CustId");
}
+
@Test
public void getDataTypeShouldReturnUserDataSeriazliable4() throws IOException {
Instantiator mockInstantiator = PowerMockito.mock(Instantiator.class);
doReturn(CustId.class).when(mockInstantiator).getInstantiatedClass();
mockInstantiator.getInstantiatedClass();
-
+
int someClassId = 1;
-
+
PowerMockito.mockStatic(InternalInstantiator.class);
when(InternalInstantiator.getClassId(mockInstantiator.getClass())).thenReturn(someClassId);
when(InternalInstantiator.getInstantiator(someClassId)).thenReturn(mockInstantiator);
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
out.writeByte(DSCODE.USER_DATA_SERIALIZABLE_4);
out.writeInt(someClassId);
-
+
byte[] bytes = baos.toByteArray();
String type = DataType.getDataType(bytes);
-
+
assertThat(type).isEqualTo("com.gemstone.gemfire.Instantiator:com.gemstone.gemfire.internal.cache.execute.data.CustId");
}
+
@Test
public void testDataSerializable() throws IOException {
DataSerializableImpl value = new DataSerializableImpl(new Random());
@@ -729,6 +788,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("com.gemstone.gemfire.DataSerializable:" + DataSerializableImpl.class.getName(), type);
}
+
@Test
public void testSerializable() throws IOException {
SerializableClass value = new SerializableClass();
@@ -739,9 +799,11 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.io.Serializable:" + SerializableClass.class.getName(), type);
}
+
@SuppressWarnings("serial")
public static class SerializableClass implements Serializable {
}
+
@Test
public void getDataTypeShouldReturnPDXType() throws IOException {
int somePdxTypeInt = 1;
@@ -766,11 +828,12 @@ public class DataTypeJUnitTest {
assertThat(type).isEqualTo("com.gemstone.gemfire.pdx.PdxInstance:PDXType");
}
+
@Test
public void getDataTypeShouldReturnUnknownIfPDXTypeIsNull() throws IOException {
int somePdxTypeInt = 1;
PdxType somePdxType = null;
-
+
TypeRegistry mockTypeRegistry = mock(TypeRegistry.class);
when(mockTypeRegistry.getType(somePdxTypeInt)).thenReturn(somePdxType);
@@ -787,8 +850,9 @@ public class DataTypeJUnitTest {
byte[] bytes = baos.toByteArray();
String type = DataType.getDataType(bytes);
- assertThat(type).isEqualTo("com.gemstone.gemfire.pdx.PdxInstance: unknown id="+somePdxTypeInt);
+ assertThat(type).isEqualTo("com.gemstone.gemfire.pdx.PdxInstance: unknown id=" + somePdxTypeInt);
}
+
@Test
public void getDataTypeShouldReturnPDXRegistryClosedForPDXTypeWhenCacheIsClosed() throws IOException {
int somePdxTypeInt = 1;
@@ -805,6 +869,7 @@ public class DataTypeJUnitTest {
assertThat(type).isEqualTo("com.gemstone.gemfire.pdx.PdxInstance:PdxRegistryClosed");
}
+
@Test
public void getDataTypeShouldReturnPDXEnumType() throws IOException {
int somePdxEnumId = 1;
@@ -829,6 +894,7 @@ public class DataTypeJUnitTest {
assertThat(type).isEqualTo("PdxRegistry/java.lang.Enum:PDXENUM");
}
+
@Test
public void getDataTypeShouldReturnPDXRegistryClosedForEnumTypeWhenCacheIsClosed() throws IOException {
int someArrayLength = 1;
@@ -845,6 +911,7 @@ public class DataTypeJUnitTest {
assertThat(type).isEqualTo("PdxRegistry/java.lang.Enum:PdxRegistryClosed");
}
+
@Test
public void getDataTypeShouldReturnGemfireEnum() throws IOException {
PowerMockito.mockStatic(DataSerializer.class);
@@ -858,6 +925,7 @@ public class DataTypeJUnitTest {
assertThat(type).isEqualTo("java.lang.Enum:GEMFIRE_ENUM");
}
+
// TODO:PDX_INLINE_ENUM
@Test
public void testBigInteger() throws IOException {
@@ -869,6 +937,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.math.BigInteger", type);
}
+
@Test
public void testBigDecimal() throws IOException {
BigDecimal value = BigDecimal.ZERO;
@@ -879,6 +948,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.math.BigDecimal", type);
}
+
@Test
public void testUUID() throws IOException {
UUID value = new UUID(Long.MAX_VALUE, Long.MIN_VALUE);
@@ -889,6 +959,7 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.util.UUID", type);
}
+
@Test
public void testSQLTimestamp() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -898,10 +969,11 @@ public class DataTypeJUnitTest {
String type = DataType.getDataType(bytes);
assertEquals("java.sql.Timestamp", type);
}
+
@Test
public void testUnknownHeaderType() throws IOException {
byte unknownType = 0;
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
out.writeByte(unknownType);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/DisconnectingOutOfOffHeapMemoryListenerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/DisconnectingOutOfOffHeapMemoryListenerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/DisconnectingOutOfOffHeapMemoryListenerJUnitTest.java
index 671a2b5..8e48863 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/DisconnectingOutOfOffHeapMemoryListenerJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/DisconnectingOutOfOffHeapMemoryListenerJUnitTest.java
@@ -32,6 +32,7 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class DisconnectingOutOfOffHeapMemoryListenerJUnitTest {
+
@Rule
public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
@@ -81,6 +82,7 @@ public class DisconnectingOutOfOffHeapMemoryListenerJUnitTest {
listener.outOfOffHeapMemory(ex);
verify(dm).setRootCause(ex);
}
+
@Test
public void setRootCauseNotCalledWhenGetRootCauseReturnsNonNull() {
DisconnectingOutOfOffHeapMemoryListener listener = new DisconnectingOutOfOffHeapMemoryListener(ids);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java
index 28ff3ac..75eb73a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java
@@ -38,6 +38,7 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class FreeListManagerTest {
+
static {
ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/LifecycleListenerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/LifecycleListenerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/LifecycleListenerJUnitTest.java
index 71d33ab..1582d31 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/LifecycleListenerJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/LifecycleListenerJUnitTest.java
@@ -35,10 +35,10 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
/**
* Tests LifecycleListener
- *
*/
@Category(UnitTest.class)
public class LifecycleListenerJUnitTest {
+
@Rule
public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorJUnitTest.java
index 582e8b9..4ed83bf 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorJUnitTest.java
@@ -36,12 +36,14 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class MemoryAllocatorJUnitTest {
+
@Rule
public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
private static int round(int multiple, int v) {
return ((v+multiple-1)/multiple)*multiple;
}
+
@Test
public void testNullGetAllocator() {
try {
@@ -50,6 +52,7 @@ public class MemoryAllocatorJUnitTest {
} catch (CacheClosedException expected) {
}
}
+
@Test
public void testConstructor() {
try {
@@ -58,6 +61,7 @@ public class MemoryAllocatorJUnitTest {
} catch (IllegalArgumentException expected) {
}
}
+
@Test
public void testCreate() {
System.setProperty(MemoryAllocatorImpl.FREE_OFF_HEAP_MEMORY_PROPERTY, "false");
@@ -149,6 +153,7 @@ public class MemoryAllocatorJUnitTest {
assertTrue(stats.isClosed());
}
}
+
@Test
public void testBasics() {
int BATCH_SIZE = 1;
@@ -254,6 +259,7 @@ public class MemoryAllocatorJUnitTest {
MemoryAllocatorImpl.debugLog("test debug log", false);
MemoryAllocatorImpl.debugLog("test debug log", true);
}
+
@Test
public void testGetLostChunks() {
SlabImpl slab = new SlabImpl(1024*1024);
@@ -264,6 +270,7 @@ public class MemoryAllocatorJUnitTest {
MemoryAllocatorImpl.freeOffHeapMemory();
}
}
+
@Test
public void testFindSlab() {
final int SLAB_SIZE = 1024*1024;
@@ -286,6 +293,7 @@ public class MemoryAllocatorJUnitTest {
MemoryAllocatorImpl.freeOffHeapMemory();
}
}
+
@Test
public void testValidateAddressAndSize() {
final int SLAB_SIZE = 1024*1024;
@@ -323,6 +331,7 @@ public class MemoryAllocatorJUnitTest {
MemoryAllocatorImpl.freeOffHeapMemory();
}
}
+
@Test
public void testMemoryInspection() {
final int SLAB_SIZE = 1024*1024;
@@ -504,6 +513,7 @@ public class MemoryAllocatorJUnitTest {
long expectedMemoryUsage;
boolean memoryUsageEventReceived;
+
@Test
public void testUsageEventListener() {
final int perObjectOverhead = OffHeapStoredObject.HEADER_SIZE;
@@ -551,6 +561,7 @@ public class MemoryAllocatorJUnitTest {
MemoryAllocatorImpl.freeOffHeapMemory();
}
}
+
private void checkMcs(ArrayList<StoredObject> mcs) {
for (StoredObject mc: mcs) {
assertEquals(8+8, mc.getSize());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java
index f0563ad..b998e40 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java
@@ -59,7 +59,8 @@ public class MemoryBlockNodeJUnitTest {
ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
}
- @Rule public final ProvideSystemProperty myPropertyHasMyValue = new ProvideSystemProperty("gemfire.OFF_HEAP_DO_EXPENSIVE_VALIDATION", "true");
+ @Rule
+ public final ProvideSystemProperty myPropertyHasMyValue = new ProvideSystemProperty("gemfire.OFF_HEAP_DO_EXPENSIVE_VALIDATION", "true");
@Rule
public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryInspectorImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryInspectorImplJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryInspectorImplJUnitTest.java
index b3eb01c..60fa8fc 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryInspectorImplJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryInspectorImplJUnitTest.java
@@ -27,14 +27,12 @@ import java.util.List;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
-
-/**
- * Created by sbawaskar on 1/15/16.
- */
@Category(UnitTest.class)
public class MemoryInspectorImplJUnitTest {
+
private FreeListManager freeList;
private MemoryInspector inspector;
+
@Before
public void setUp() {
this.freeList = mock(FreeListManager.class);
@@ -55,6 +53,7 @@ public class MemoryInspectorImplJUnitTest {
public void getAllocatedBlocksBeforeCreateSnapshotReturnsEmptyList() {
assertTrue(inspector.getAllocatedBlocks().isEmpty());
}
+
@Test
public void getFirstBlockBeforeCreateSnapshotReturnsNull() {
assertNull(inspector.getFirstBlock());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapHelperJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapHelperJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapHelperJUnitTest.java
index 595e132..7881b08 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapHelperJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapHelperJUnitTest.java
@@ -31,8 +31,6 @@ import com.gemstone.gemfire.internal.cache.EntryEventImpl;
import com.gemstone.gemfire.internal.cache.VMCachedDeserializable;
import com.gemstone.gemfire.test.junit.categories.UnitTest;
-/**
- */
@Category(UnitTest.class)
public class OffHeapHelperJUnitTest extends AbstractStoredObjectTestBase {
@@ -47,7 +45,6 @@ public class OffHeapHelperJUnitTest extends AbstractStoredObjectTestBase {
OffHeapMemoryStats stats = mock(OffHeapMemoryStats.class);
ma = MemoryAllocatorImpl.create(ooohml, stats, 3, OffHeapStorage.MIN_SLAB_SIZE * 3, OffHeapStorage.MIN_SLAB_SIZE);
-
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStorageJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStorageJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStorageJUnitTest.java
index 77b1d8d..0d643f1 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStorageJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStorageJUnitTest.java
@@ -40,6 +40,7 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class OffHeapStorageJUnitTest {
+
@Rule
public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
@@ -58,19 +59,23 @@ public class OffHeapStorageJUnitTest {
public void testParseOffHeapMemorySizeNegative() {
assertEquals(0, OffHeapStorage.parseOffHeapMemorySize("-1"));
}
+
@Test
public void testParseOffHeapMemorySizeNull() {
assertEquals(0, OffHeapStorage.parseOffHeapMemorySize(null));
}
+
@Test
public void testParseOffHeapMemorySizeEmpty() {
assertEquals(0, OffHeapStorage.parseOffHeapMemorySize(""));
}
+
@Test
public void testParseOffHeapMemorySizeBytes() {
assertEquals(MEGABYTE, OffHeapStorage.parseOffHeapMemorySize("1"));
assertEquals(Integer.MAX_VALUE * MEGABYTE, OffHeapStorage.parseOffHeapMemorySize("" + Integer.MAX_VALUE));
}
+
@Test
public void testParseOffHeapMemorySizeKiloBytes() {
try {
@@ -80,32 +85,35 @@ public class OffHeapStorageJUnitTest {
// Expected
}
}
+
@Test
public void testParseOffHeapMemorySizeMegaBytes() {
assertEquals(MEGABYTE, OffHeapStorage.parseOffHeapMemorySize("1m"));
assertEquals(Integer.MAX_VALUE * MEGABYTE, OffHeapStorage.parseOffHeapMemorySize("" + Integer.MAX_VALUE + "m"));
}
+
@Test
public void testParseOffHeapMemorySizeGigaBytes() {
assertEquals(GIGABYTE, OffHeapStorage.parseOffHeapMemorySize("1g"));
assertEquals(Integer.MAX_VALUE * GIGABYTE, OffHeapStorage.parseOffHeapMemorySize("" + Integer.MAX_VALUE + "g"));
}
+
@Test
public void testCalcMaxSlabSize() {
assertEquals(100, OffHeapStorage.calcMaxSlabSize(100L));
assertEquals(Integer.MAX_VALUE, OffHeapStorage.calcMaxSlabSize(Long.MAX_VALUE));
try {
System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "99");
- assertEquals(99*1024*1024, OffHeapStorage.calcMaxSlabSize(100L*1024*1024));
+ assertEquals(99 * 1024 * 1024, OffHeapStorage.calcMaxSlabSize(100L * 1024 * 1024));
assertEquals(88, OffHeapStorage.calcMaxSlabSize(88));
System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "88m");
- assertEquals(88*1024*1024, OffHeapStorage.calcMaxSlabSize(100L*1024*1024));
+ assertEquals(88 * 1024 * 1024, OffHeapStorage.calcMaxSlabSize(100L * 1024 * 1024));
System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "77M");
- assertEquals(77*1024*1024, OffHeapStorage.calcMaxSlabSize(100L*1024*1024));
+ assertEquals(77 * 1024 * 1024, OffHeapStorage.calcMaxSlabSize(100L * 1024 * 1024));
System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "1g");
- assertEquals(1*1024*1024*1024, OffHeapStorage.calcMaxSlabSize(2L*1024*1024*1024));
+ assertEquals(1 * 1024 * 1024 * 1024, OffHeapStorage.calcMaxSlabSize(2L * 1024 * 1024 * 1024));
System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "1G");
- assertEquals(1L*1024*1024*1024, OffHeapStorage.calcMaxSlabSize(2L*1024*1024*1024+1));
+ assertEquals(1L * 1024 * 1024 * 1024, OffHeapStorage.calcMaxSlabSize(2L * 1024 * 1024 * 1024 + 1));
System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "foobarG");
try {
OffHeapStorage.calcMaxSlabSize(100);
@@ -119,34 +127,38 @@ public class OffHeapStorageJUnitTest {
System.clearProperty("gemfire.OFF_HEAP_SLAB_SIZE");
}
}
+
@Test
public void createOffHeapStorageReturnsNullIfForceLocator() {
System.setProperty(InternalLocator.FORCE_LOCATOR_DM_TYPE, "true");
assertEquals(null, OffHeapStorage.createOffHeapStorage(null, 1, null));
}
+
@Test
public void createOffHeapStorageReturnsNullIfMemorySizeIsZero() {
assertEquals(null, OffHeapStorage.createOffHeapStorage(null, 0, null));
}
+
@Test
public void exceptionIfSlabCountTooSmall() {
StatisticsFactory statsFactory = mock(StatisticsFactory.class);
try {
- OffHeapStorage.createOffHeapStorage(statsFactory, OffHeapStorage.MIN_SLAB_SIZE-1, null);
+ OffHeapStorage.createOffHeapStorage(statsFactory, OffHeapStorage.MIN_SLAB_SIZE - 1, null);
} catch (IllegalArgumentException expected) {
- expected.getMessage().equals("The amount of off heap memory must be at least " + OffHeapStorage.MIN_SLAB_SIZE + " but it was set to " + (OffHeapStorage.MIN_SLAB_SIZE-1));
+ expected.getMessage().equals("The amount of off heap memory must be at least " + OffHeapStorage.MIN_SLAB_SIZE + " but it was set to " + (OffHeapStorage.MIN_SLAB_SIZE - 1));
}
}
+
@Test
public void exceptionIfDistributedSystemNull() {
StatisticsFactory statsFactory = mock(StatisticsFactory.class);
try {
- OffHeapStorage.createOffHeapStorage(statsFactory, OffHeapStorage.MIN_SLAB_SIZE, (DistributedSystem)null);
+ OffHeapStorage.createOffHeapStorage(statsFactory, OffHeapStorage.MIN_SLAB_SIZE, (DistributedSystem) null);
} catch (IllegalArgumentException expected) {
expected.getMessage().equals("InternalDistributedSystem is null");
}
}
-
+
@Test
public void createOffHeapStorageWorks() {
StatisticsFactory localStatsFactory = new LocalStatisticsFactory(null);
@@ -160,30 +172,30 @@ public class OffHeapStorageJUnitTest {
public void testCreateOffHeapStorage() {
StatisticsFactory localStatsFactory = new LocalStatisticsFactory(null);
OutOfOffHeapMemoryListener ooohml = mock(OutOfOffHeapMemoryListener.class);
- MemoryAllocator ma = OffHeapStorage.basicCreateOffHeapStorage(localStatsFactory, 1024*1024, ooohml);
+ MemoryAllocator ma = OffHeapStorage.basicCreateOffHeapStorage(localStatsFactory, 1024 * 1024, ooohml);
try {
OffHeapMemoryStats stats = ma.getStats();
assertNotNull(stats.getStats());
- assertEquals(1024*1024, stats.getFreeMemory());
- assertEquals(1024*1024, stats.getMaxMemory());
+ assertEquals(1024 * 1024, stats.getFreeMemory());
+ assertEquals(1024 * 1024, stats.getMaxMemory());
assertEquals(0, stats.getUsedMemory());
assertEquals(0, stats.getDefragmentations());
assertEquals(0, stats.getDefragmentationTime());
assertEquals(0, stats.getFragmentation());
assertEquals(1, stats.getFragments());
- assertEquals(1024*1024, stats.getLargestFragment());
+ assertEquals(1024 * 1024, stats.getLargestFragment());
assertEquals(0, stats.getObjects());
assertEquals(0, stats.getReads());
stats.incFreeMemory(100);
- assertEquals(1024*1024+100, stats.getFreeMemory());
+ assertEquals(1024 * 1024 + 100, stats.getFreeMemory());
stats.incFreeMemory(-100);
- assertEquals(1024*1024, stats.getFreeMemory());
+ assertEquals(1024 * 1024, stats.getFreeMemory());
stats.incMaxMemory(100);
- assertEquals(1024*1024+100, stats.getMaxMemory());
+ assertEquals(1024 * 1024 + 100, stats.getMaxMemory());
stats.incMaxMemory(-100);
- assertEquals(1024*1024, stats.getMaxMemory());
+ assertEquals(1024 * 1024, stats.getMaxMemory());
stats.incUsedMemory(100);
assertEquals(100, stats.getUsedMemory());
@@ -210,8 +222,8 @@ public class OffHeapStorageJUnitTest {
stats.setLargestFragment(100);
assertEquals(100, stats.getLargestFragment());
- stats.setLargestFragment(1024*1024);
- assertEquals(1024*1024, stats.getLargestFragment());
+ stats.setLargestFragment(1024 * 1024);
+ assertEquals(1024 * 1024, stats.getLargestFragment());
boolean originalEnableClockStats = DistributionStats.enableClockStats;
DistributionStats.enableClockStats = true;
@@ -245,14 +257,14 @@ public class OffHeapStorageJUnitTest {
OutOfOffHeapMemoryException ex = null;
try {
- ma.allocate(1024*1024+1);
+ ma.allocate(1024 * 1024 + 1);
fail("expected OutOfOffHeapMemoryException");
} catch (OutOfOffHeapMemoryException expected) {
ex = expected;
}
verify(ooohml).outOfOffHeapMemory(ex);
try {
- ma.allocate(1024*1024+1);
+ ma.allocate(1024 * 1024 + 1);
fail("expected OutOfOffHeapMemoryException");
} catch (OutOfOffHeapMemoryException expected) {
ex = expected;
@@ -268,16 +280,17 @@ public class OffHeapStorageJUnitTest {
}
}
}
+
@Test
public void testCalcSlabCount() {
final long MSS = OffHeapStorage.MIN_SLAB_SIZE;
- assertEquals(100, OffHeapStorage.calcSlabCount(MSS*4, MSS*4*100));
- assertEquals(100, OffHeapStorage.calcSlabCount(MSS*4, (MSS*4*100) + (MSS-1)));
- assertEquals(101, OffHeapStorage.calcSlabCount(MSS*4, (MSS*4*100) + MSS));
+ assertEquals(100, OffHeapStorage.calcSlabCount(MSS * 4, MSS * 4 * 100));
+ assertEquals(100, OffHeapStorage.calcSlabCount(MSS * 4, (MSS * 4 * 100) + (MSS - 1)));
+ assertEquals(101, OffHeapStorage.calcSlabCount(MSS * 4, (MSS * 4 * 100) + MSS));
assertEquals(Integer.MAX_VALUE, OffHeapStorage.calcSlabCount(MSS, MSS * Integer.MAX_VALUE));
- assertEquals(Integer.MAX_VALUE, OffHeapStorage.calcSlabCount(MSS, (MSS * Integer.MAX_VALUE) + MSS-1));
+ assertEquals(Integer.MAX_VALUE, OffHeapStorage.calcSlabCount(MSS, (MSS * Integer.MAX_VALUE) + MSS - 1));
try {
- OffHeapStorage.calcSlabCount(MSS, (((long)MSS) * Integer.MAX_VALUE) + MSS);
+ OffHeapStorage.calcSlabCount(MSS, (((long) MSS) * Integer.MAX_VALUE) + MSS);
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectAddressStackJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectAddressStackJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectAddressStackJUnitTest.java
index 1d19854..8e7f5b6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectAddressStackJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectAddressStackJUnitTest.java
@@ -34,6 +34,7 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class OffHeapStoredObjectAddressStackJUnitTest {
+
static {
ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectJUnitTest.java
index 85c8d4c..0d7ea27 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectJUnitTest.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.gemstone.gemfire.internal.offheap;
import static org.assertj.core.api.Assertions.assertThat;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectSliceJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectSliceJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectSliceJUnitTest.java
index 1b5bf26..2974d1a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectSliceJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectSliceJUnitTest.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.gemstone.gemfire.internal.offheap;
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectWithHeapFormJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectWithHeapFormJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectWithHeapFormJUnitTest.java
index a763e76..8d7f49e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectWithHeapFormJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectWithHeapFormJUnitTest.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.gemstone.gemfire.internal.offheap;
import static org.junit.Assert.assertArrayEquals;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TinyMemoryBlockJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TinyMemoryBlockJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TinyMemoryBlockJUnitTest.java
index 681bec0..c9c9b1f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TinyMemoryBlockJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TinyMemoryBlockJUnitTest.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.gemstone.gemfire.internal.offheap;
import static org.junit.Assert.*;