[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/pojo/event ...
Manik Surtani
manik at jboss.org
Wed May 23 06:28:53 EDT 2007
User: msurtani
Date: 07/05/23 06:28:53
Modified: tests/functional/org/jboss/cache/pojo/event MapTest.java
LocalTest.java ListTest.java SetTest.java
Log:
Initiated a bunch of performance fixes, including replacing CopyOnWriteArraySets with org.jboss.cache.util.concurrent.ConcurrentHashSet.
Also ran an imports optimiser on the code base - there were a lot of unused imports floating about.
Revision Changes Path
1.4 +13 -13 JBossCache/tests/functional/org/jboss/cache/pojo/event/MapTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MapTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/event/MapTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- MapTest.java 23 Apr 2007 13:09:21 -0000 1.3
+++ MapTest.java 23 May 2007 10:28:53 -0000 1.4
@@ -7,8 +7,8 @@
package org.jboss.cache.pojo.event;
-import junit.framework.TestCase;
import junit.framework.Test;
+import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -23,15 +23,13 @@
import org.jboss.cache.pojo.notification.MapModifyNotification;
import org.jboss.cache.pojo.notification.Notification;
import org.jboss.cache.pojo.notification.SetModifyNotification;
-import org.jboss.cache.pojo.test.Person;
import org.jboss.cache.pojo.test.Address;
+import org.jboss.cache.pojo.test.Person;
import java.util.HashMap;
import java.util.Map;
-import java.lang.reflect.Field;
/**
- *
* @author Ben Wang
*/
@@ -84,8 +82,8 @@
MapTest.MyListener listener = new MapTest.MyListener();
cache_.addListener(listener);
Map map = new HashMap();
- map.put("test1","test1");
- map.put("test2","test2");
+ map.put("test1", "test1");
+ map.put("test2", "test2");
cache_.attach("a", map);
assertNull("Exception should be null but " + MapTest.ex1_, MapTest.ex1_);
assertTrue("pre-attach event is not emitted", MapTest.pre_);
@@ -93,7 +91,7 @@
// If not a POJO just a String, we should not emit the event.
assertEquals("Total number of event is ", 2, MapTest.counter_);
- map = (Map)cache_.find("a");
+ map = (Map) cache_.find("a");
map.remove("test2");
map.put("test3", "test3");
assertNull("Exception should be null but " + MapTest.ex1_, MapTest.ex1_);
@@ -148,7 +146,7 @@
assertEquals("Total number of event is ", 6, MapTest.counter_);
listener.reset();
- map = (Map)cache_.find("a");
+ map = (Map) cache_.find("a");
map.remove("2");
Address addr3 = new Address();
@@ -241,7 +239,7 @@
assertEquals("Total number of event is ", 6, MapTest.counter_);
listener.reset();
- map = (Map)cache_.find("a");
+ map = (Map) cache_.find("a");
map.remove("2");
Address addr3 = new Address();
@@ -296,7 +294,8 @@
{
MapTest.pre_ = true;
MapTest.counter_++;
- } else
+ }
+ else
{
MapTest.post_ = true;
MapTest.counter_++;
@@ -309,7 +308,8 @@
{
MapTest.pre_ = true;
MapTest.counter_++;
- } else
+ }
+ else
{
MapTest.post_ = true;
MapTest.counter_++;
1.4 +12 -12 JBossCache/tests/functional/org/jboss/cache/pojo/event/LocalTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: LocalTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/event/LocalTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- LocalTest.java 23 Apr 2007 13:09:21 -0000 1.3
+++ LocalTest.java 23 May 2007 10:28:53 -0000 1.4
@@ -7,8 +7,8 @@
package org.jboss.cache.pojo.event;
-import junit.framework.TestCase;
import junit.framework.Test;
+import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -23,10 +23,8 @@
import org.jboss.cache.pojo.notification.MapModifyNotification;
import org.jboss.cache.pojo.notification.Notification;
import org.jboss.cache.pojo.notification.SetModifyNotification;
-import org.jboss.cache.pojo.test.Person;
import org.jboss.cache.pojo.test.Address;
-
-import java.lang.reflect.Field;
+import org.jboss.cache.pojo.test.Person;
/**
* Additional basic tests
@@ -86,7 +84,7 @@
MyListener listener = new MyListener();
cache_.addListener(listener);
cache_.attach("/a", test);
- assertNull("Exception should be null but " +ex1_, ex1_);
+ assertNull("Exception should be null but " + ex1_, ex1_);
assertTrue("pre-attach event is not emitted", pre_);
assertTrue("post-attach event is not emitted", post_);
assertEquals("Total number of event is ", 2, counter_);
@@ -105,7 +103,7 @@
MyListener listener = new MyListener();
cache_.addListener(listener);
cache_.attach("/a", test);
- assertNull("Exception should be null but " +ex1_, ex1_);
+ assertNull("Exception should be null but " + ex1_, ex1_);
assertTrue("pre-attach event is not emitted", pre_);
assertTrue("post-attach event is not emitted", post_);
@@ -122,13 +120,13 @@
MyListener listener = new MyListener();
cache_.addListener(listener);
cache_.attach("/a", test);
- assertNull("Exception should be null but " +ex1_, ex1_);
+ assertNull("Exception should be null but " + ex1_, ex1_);
assertTrue("pre-attach event is not emitted", pre_);
assertTrue("post-attach event is not emitted", post_);
reset();
cache_.detach("/a");
- assertNull("Exception should be null but " +ex1_, ex1_);
+ assertNull("Exception should be null but " + ex1_, ex1_);
assertTrue("pre-detach event is not emitted", pre_);
assertTrue("post-detach event is not emitted", post_);
cache_.removeListener(listener);
@@ -188,7 +186,8 @@
{
LocalTest.pre_ = true;
LocalTest.counter_++;
- } else
+ }
+ else
{
LocalTest.post_ = true;
LocalTest.counter_++;
@@ -201,7 +200,8 @@
{
LocalTest.pre_ = true;
LocalTest.counter_++;
- } else
+ }
+ else
{
LocalTest.post_ = true;
LocalTest.counter_++;
1.4 +11 -11 JBossCache/tests/functional/org/jboss/cache/pojo/event/ListTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ListTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/event/ListTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- ListTest.java 23 Apr 2007 13:09:21 -0000 1.3
+++ ListTest.java 23 May 2007 10:28:53 -0000 1.4
@@ -7,12 +7,9 @@
package org.jboss.cache.pojo.event;
-import java.util.ArrayList;
-
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.pojo.PojoCache;
@@ -29,8 +26,9 @@
import org.jboss.cache.pojo.test.Address;
import org.jboss.cache.pojo.test.Person;
+import java.util.ArrayList;
+
/**
- *
* @author Ben Wang
*/
@@ -92,7 +90,7 @@
// If not a POJO just a String, we should not emit the event.
assertEquals("Total number of event is ", 2, ListTest.counter_);
- list = (ArrayList)cache_.find("a");
+ list = (ArrayList) cache_.find("a");
list.remove("test2");
list.add("test3");
assertNull("Exception should be null but " + ListTest.ex1_, ListTest.ex1_);
@@ -147,7 +145,7 @@
assertEquals("Total number of event is ", 6, ListTest.counter_);
listener.reset();
- list = (ArrayList)cache_.find("a");
+ list = (ArrayList) cache_.find("a");
list.remove(addr2);
Address addr3 = new Address();
@@ -241,7 +239,7 @@
assertEquals("Total number of event is ", 6, ListTest.counter_);
listener.reset();
- list = (ArrayList)cache_.find("a");
+ list = (ArrayList) cache_.find("a");
list.remove(addr2);
Address addr3 = new Address();
@@ -296,7 +294,8 @@
{
ListTest.pre_ = true;
ListTest.counter_++;
- } else
+ }
+ else
{
ListTest.post_ = true;
ListTest.counter_++;
@@ -309,7 +308,8 @@
{
ListTest.pre_ = true;
ListTest.counter_++;
- } else
+ }
+ else
{
ListTest.post_ = true;
ListTest.counter_++;
1.4 +12 -12 JBossCache/tests/functional/org/jboss/cache/pojo/event/SetTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SetTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/event/SetTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- SetTest.java 23 Apr 2007 13:09:21 -0000 1.3
+++ SetTest.java 23 May 2007 10:28:53 -0000 1.4
@@ -7,8 +7,8 @@
package org.jboss.cache.pojo.event;
-import junit.framework.TestCase;
import junit.framework.Test;
+import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -23,15 +23,13 @@
import org.jboss.cache.pojo.notification.MapModifyNotification;
import org.jboss.cache.pojo.notification.Notification;
import org.jboss.cache.pojo.notification.SetModifyNotification;
-import org.jboss.cache.pojo.test.Person;
import org.jboss.cache.pojo.test.Address;
+import org.jboss.cache.pojo.test.Person;
-import java.util.Set;
import java.util.HashSet;
-import java.lang.reflect.Field;
+import java.util.Set;
/**
- *
* @author Ben Wang
*/
@@ -93,7 +91,7 @@
// If not a POJO just a String, we should not emit the event.
assertEquals("Total number of event is ", 2, SetTest.counter_);
- set = (Set)cache_.find("a");
+ set = (Set) cache_.find("a");
set.remove("test2");
set.add("test3");
assertNull("Exception should be null but " + SetTest.ex1_, SetTest.ex1_);
@@ -148,7 +146,7 @@
assertEquals("Total number of event is ", 6, SetTest.counter_);
listener.reset();
- set = (Set)cache_.find("a");
+ set = (Set) cache_.find("a");
set.remove(addr2);
Address addr3 = new Address();
@@ -242,7 +240,7 @@
assertEquals("Total number of event is ", 6, SetTest.counter_);
listener.reset();
- set = (Set)cache_.find("a");
+ set = (Set) cache_.find("a");
set.remove(addr2);
Address addr3 = new Address();
@@ -298,7 +296,8 @@
{
SetTest.pre_ = true;
SetTest.counter_++;
- } else
+ }
+ else
{
SetTest.post_ = true;
SetTest.counter_++;
@@ -311,7 +310,8 @@
{
SetTest.pre_ = true;
SetTest.counter_++;
- } else
+ }
+ else
{
SetTest.post_ = true;
SetTest.counter_++;
More information about the jboss-cvs-commits
mailing list