From jbosscache-commits at lists.jboss.org Wed Feb 4 12:33:49 2009 Content-Type: multipart/mixed; boundary="===============2478636136785197486==" MIME-Version: 1.0 From: jbosscache-commits at lists.jboss.org To: jbosscache-commits at lists.jboss.org Subject: [jbosscache-commits] JBoss Cache SVN: r7644 - in core/trunk/src: main/java/org/jboss/cache/interceptors and 3 other directories. Date: Wed, 04 Feb 2009 12:33:49 -0500 Message-ID: --===============2478636136785197486== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jason.greene(a)jboss.com Date: 2009-02-04 12:33:49 -0500 (Wed, 04 Feb 2009) New Revision: 7644 Modified: core/trunk/src/main/java/org/jboss/cache/config/Option.java core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java core/trunk/src/test/java/org/jboss/cache/marshall/VersionAwareMarshaller= Test.java core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest= .java Log: Revert 7635, 7643 and 7642 Modified: core/trunk/src/main/java/org/jboss/cache/config/Option.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/trunk/src/main/java/org/jboss/cache/config/Option.java 2009-02-04 = 17:01:56 UTC (rev 7643) +++ core/trunk/src/main/java/org/jboss/cache/config/Option.java 2009-02-04 = 17:33:49 UTC (rev 7644) @@ -27,7 +27,6 @@ * Used to override characteristics of specific calls to the cache. The j= avadocs of each of the setters below detail functionality and behaviour. * * @author Manik Surtani (manik = AT jboss DOT org) - * @author Galder Zamarren= o * @since 1.3.0 */ public class Option implements Cloneable @@ -50,7 +49,6 @@ = private int lockAcquisitionTimeout =3D -1; private boolean suppressPersistence; - private boolean suppressEventNotification; = /** * @since 1.4.0 @@ -272,8 +270,6 @@ ", skipDataGravitation=3D" + skipDataGravitation + ", forceAsynchronous=3D" + forceAsynchronous + ", forceSynchronous=3D" + forceSynchronous + - ", suppressPersistence=3D" + suppressPersistence + - ", suppressEventNotification=3D" + suppressEventNotification + '}'; } = @@ -324,7 +320,6 @@ if (forceSynchronous !=3D option.forceSynchronous) return false; if (lockAcquisitionTimeout !=3D option.lockAcquisitionTimeout) retur= n false; if (suppressPersistence !=3D option.suppressPersistence) return fals= e; - if (suppressEventNotification !=3D option.suppressEventNotification)= return false; return true; } = @@ -343,7 +338,6 @@ result =3D 29 * result + (forceSynchronous ? 0 : 1); result =3D 29 * result + (lockAcquisitionTimeout); result =3D 29 * result + (suppressPersistence ? 0 : 1); - result =3D 29 * result + (suppressEventNotification ? 0 : 1); return result; } = @@ -363,7 +357,6 @@ this.forceSynchronous =3D false; this.lockAcquisitionTimeout =3D -1; this.suppressPersistence =3D false; - this.suppressEventNotification =3D false; } = /** @@ -482,29 +475,4 @@ { this.suppressPersistence =3D suppressPersistence; } - = - /** - * Get whether event notifications for this invocation will be supprese= d. By = - * default is false which means that corresponding events are sent depe= nding = - * on the type of invocation. - * = - * @return true, if event notification will be suppressed for this invo= cation. - */ - public boolean isSuppressEventNotification() - { - return suppressEventNotification; - } - - /** - * Set whether event notifications should be suppressed for this partic= ular - * cache or transaction invocation. = - * = - * @param suppressEventNotification true if event notifica= tion = - * should be skipped; false if ev= ents - * should be notified if there're any listener= s. - */ - public void setSuppressEventNotification(boolean suppressEventNotificat= ion) - { - this.suppressEventNotification =3D suppressEventNotification; - } } Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxIntercept= or.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.jav= a 2009-02-04 17:01:56 UTC (rev 7643) +++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.jav= a 2009-02-04 17:33:49 UTC (rev 7644) @@ -74,7 +74,6 @@ * * @author Manik Surtani (manik = AT jboss DOT org) * @author Steve Woodcock (stevew(a)= jofti.com) - * @author Galder Zamarren= o */ public class TxInterceptor extends BaseTransactionalContextInterceptor { @@ -922,9 +921,6 @@ { // this should ideally be set in beforeCompletion(), after = compacting the list. if (modifications =3D=3D null) modifications =3D transactio= nContext.getModifications(); -// Option transactionalOptions =3D transactionContext.getOpt= ion(); -// Option originalOptions =3D ctx.getOptionOverrides(); -// transactionalOptions.setSuppressEventNotification(origina= lOptions.isSuppressEventNotification()); = ctx.setOptionOverrides(transactionContext.getOption()); } if (tx !=3D null) transactions.remove(tx); @@ -1055,7 +1051,6 @@ // set any transaction wide options as current for this thread, c= aching original options that would then be reset originalOptions =3D ctx.getOptionOverrides(); transactionalOptions =3D transactionContext.getOption(); -// transactionalOptions.setSuppressEventNotification(originalOptio= ns.isSuppressEventNotification()); ctx.setOptionOverrides(transactionalOptions); = try Modified: core/trunk/src/main/java/org/jboss/cache/notifications/NotifierIm= pl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.jav= a 2009-02-04 17:01:56 UTC (rev 7643) +++ core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.jav= a 2009-02-04 17:33:49 UTC (rev 7644) @@ -64,7 +64,6 @@ * Helper class that handles all notifications to registered listeners. * * @author Manik Surtani (manik = AT jboss DOT org) - * @author Galder Zamarren= o */ @NonVolatile public class NotifierImpl implements Notifier @@ -308,7 +307,7 @@ = public void notifyNodeCreated(Fqn fqn, boolean pre, InvocationContext c= tx) { - if (!nodeCreatedListeners.isEmpty() && !ctx.getOptionOverrides().isS= uppressEventNotification()) + if (!nodeCreatedListeners.isEmpty()) { boolean originLocal =3D ctx.isOriginLocal(); Transaction tx =3D ctx.getTransaction(); @@ -327,7 +326,7 @@ = public void notifyNodeModified(Fqn fqn, boolean pre, NodeModifiedEvent.= ModificationType modificationType, Map data, InvocationContext ctx) { - if (!nodeModifiedListeners.isEmpty() && !ctx.getOptionOverrides().is= SuppressEventNotification()) + if (!nodeModifiedListeners.isEmpty()) { boolean originLocal =3D ctx.isOriginLocal(); Map dataCopy =3D copy(data, useMarshalledValueMaps); @@ -354,7 +353,7 @@ = public void notifyNodeRemoved(Fqn fqn, boolean pre, Map data, Invocatio= nContext ctx) { - if (!nodeRemovedListeners.isEmpty() && !ctx.getOptionOverrides().isS= uppressEventNotification()) + if (!nodeRemovedListeners.isEmpty()) { boolean originLocal =3D ctx.isOriginLocal(); Map dataCopy =3D copy(data, useMarshalledValueMaps); @@ -375,7 +374,7 @@ = public void notifyNodeVisited(Fqn fqn, boolean pre, InvocationContext c= tx) { - if (!nodeVisitedListeners.isEmpty() && !ctx.getOptionOverrides().isS= uppressEventNotification()) + if (!nodeVisitedListeners.isEmpty()) { Transaction tx =3D ctx.getTransaction(); InvocationContext backup =3D resetInvocationContext(ctx); @@ -392,7 +391,7 @@ = public void notifyNodeMoved(Fqn originalFqn, Fqn newFqn, boolean pre, I= nvocationContext ctx) { - if (!nodeMovedListeners.isEmpty() && !ctx.getOptionOverrides().isSup= pressEventNotification()) + if (!nodeMovedListeners.isEmpty()) { boolean originLocal =3D ctx.isOriginLocal(); Transaction tx =3D ctx.getTransaction(); @@ -412,7 +411,7 @@ = public void notifyNodeEvicted(final Fqn fqn, final boolean pre, Invocat= ionContext ctx) { - if (!nodeEvictedListeners.isEmpty() && !ctx.getOptionOverrides().isS= uppressEventNotification()) + if (!nodeEvictedListeners.isEmpty()) { final boolean originLocal =3D ctx.isOriginLocal(); Transaction tx =3D ctx.getTransaction(); @@ -431,7 +430,7 @@ = public void notifyNodeInvalidated(final Fqn fqn, final boolean pre, Inv= ocationContext ctx) { - if (!nodeInvalidatedListeners.isEmpty() && !ctx.getOptionOverrides()= .isSuppressEventNotification()) + if (!nodeInvalidatedListeners.isEmpty()) { final boolean originLocal =3D ctx.isOriginLocal(); Transaction tx =3D ctx.getTransaction(); @@ -450,7 +449,7 @@ = public void notifyNodeLoaded(Fqn fqn, boolean pre, Map data, Invocation= Context ctx) { - if (!nodeLoadedListeners.isEmpty() && !ctx.getOptionOverrides().isSu= ppressEventNotification()) + if (!nodeLoadedListeners.isEmpty()) { boolean originLocal =3D ctx.isOriginLocal(); Map dataCopy =3D copy(data, useMarshalledValueMaps); @@ -471,7 +470,7 @@ = public void notifyNodeActivated(Fqn fqn, boolean pre, Map data, Invocat= ionContext ctx) { - if (!nodeActivatedListeners.isEmpty() && !ctx.getOptionOverrides().i= sSuppressEventNotification()) + if (!nodeActivatedListeners.isEmpty()) { boolean originLocal =3D ctx.isOriginLocal(); Map dataCopy =3D copy(data, useMarshalledValueMaps); @@ -492,7 +491,7 @@ = public void notifyNodePassivated(Fqn fqn, boolean pre, Map data, Invoca= tionContext ctx) { - if (!nodePassivatedListeners.isEmpty() && !ctx.getOptionOverrides().= isSuppressEventNotification()) + if (!nodePassivatedListeners.isEmpty()) { Map dataCopy =3D copy(data, useMarshalledValueMaps); Transaction tx =3D ctx.getTransaction(); @@ -568,7 +567,7 @@ = public void notifyTransactionCompleted(Transaction transaction, boolean= successful, InvocationContext ctx) { - if (!transactionCompletedListeners.isEmpty() && !ctx.getOptionOverri= des().isSuppressEventNotification()) + if (!transactionCompletedListeners.isEmpty()) { boolean isOriginLocal =3D ctx.isOriginLocal(); InvocationContext backup =3D resetInvocationContext(ctx); @@ -585,7 +584,7 @@ = public void notifyTransactionRegistered(Transaction transaction, Invoca= tionContext ctx) { - if (!transactionRegisteredListeners.isEmpty() && !ctx.getOptionOverr= ides().isSuppressEventNotification()) + if (!transactionRegisteredListeners.isEmpty()) { boolean isOriginLocal =3D ctx.isOriginLocal(); InvocationContext backup =3D resetInvocationContext(ctx); Modified: core/trunk/src/test/java/org/jboss/cache/marshall/VersionAwareMar= shallerTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/trunk/src/test/java/org/jboss/cache/marshall/VersionAwareMarshalle= rTest.java 2009-02-04 17:01:56 UTC (rev 7643) +++ core/trunk/src/test/java/org/jboss/cache/marshall/VersionAwareMarshalle= rTest.java 2009-02-04 17:33:49 UTC (rev 7644) @@ -78,7 +78,7 @@ = byte[] bytes =3D marshaller.objectToByteBuffer("Hello"); ObjectInputStream in =3D new MarshalledValueInputStream(new ByteArra= yInputStream(bytes)); - assertEquals("Version header short should be '31'", 31, in.readShort= ()); + assertEquals("Version header short should be '30'", 30, in.readShort= ()); } = public void testVersionHeader210() throws Exception Modified: core/trunk/src/test/java/org/jboss/cache/notifications/CacheListe= nerTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTes= t.java 2009-02-04 17:01:56 UTC (rev 7643) +++ core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTes= t.java 2009-02-04 17:33:49 UTC (rev 7644) @@ -12,7 +12,6 @@ import org.jboss.cache.Fqn; import org.jboss.cache.Node; import org.jboss.cache.config.Configuration; -import org.jboss.cache.config.Option; import org.jboss.cache.lock.IsolationLevel; import org.jboss.cache.notifications.event.Event; import static org.jboss.cache.notifications.event.Event.Type.*; @@ -39,7 +38,6 @@ * exercises the new CacheListener annotation. * * @since 2.0.0 - * @author Galder Zamarren= o */ @Test(groups =3D "functional", sequential =3D true, testName =3D "notifica= tions.CacheListenerTest") public class CacheListenerTest @@ -70,7 +68,6 @@ @AfterMethod(alwaysRun =3D true) public void tearDown() throws Exception { - clearSuppressEventNotification(); Transaction t =3D tm.getTransaction(); if (t !=3D null) tm.rollback(); @@ -81,53 +78,32 @@ = // simple tests first = - public void testCreation() + public void testCreation() throws Exception { - creation(false); - eventLog.events.clear(); - creation(true); - } - = - protected void creation(boolean supressEventNotification) - { assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); - if (supressEventNotification) - { - setSuppressEventNotification(); - } cache.put(fqn, "key", "value"); Map data =3D new HashMap(); data.put("key", "value"); = //expected List expected =3D new ArrayList(); - if (!supressEventNotification) + if (optLocking) + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, false, null, TRANSACTION_REGISTERED)); + expected.add(new EventImpl(true, cache, null, null, fqn, null, true,= null, false, null, NODE_CREATED)); + expected.add(new EventImpl(false, cache, null, null, fqn, null, true= , null, false, null, NODE_CREATED)); + expected.add(new EventImpl(true, cache, PUT_DATA, Collections.emptyM= ap(), fqn, null, true, null, false, null, NODE_MODIFIED)); + expected.add(new EventImpl(false, cache, PUT_DATA, data, fqn, null, = true, null, false, null, NODE_MODIFIED)); + if (optLocking) { - if (optLocking) - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(true, cache, null, null, fqn, null, tr= ue, null, false, null, NODE_CREATED)); - expected.add(new EventImpl(false, cache, null, null, fqn, null, t= rue, null, false, null, NODE_CREATED)); - expected.add(new EventImpl(true, cache, PUT_DATA, Collections.emp= tyMap(), fqn, null, true, null, false, null, NODE_MODIFIED)); - expected.add(new EventImpl(false, cache, PUT_DATA, data, fqn, nul= l, true, null, false, null, NODE_MODIFIED)); - if (optLocking) - { - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, true, null, TRANSACTION_COMPLETED)); - eventLog.scrubImplicitTransactions(); - } = + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, true, null, TRANSACTION_COMPLETED)); + eventLog.scrubImplicitTransactions(); } assertEquals(expected, eventLog.events); - assertEquals("value", cache.get(fqn, "key")); = + assertEquals("value", cache.get(fqn, "key")); } = - public void testOnlyModification() + public void testOnlyModification() throws Exception { - onlyModification(false); - eventLog.events.clear(); - onlyModification(true); - } - = - protected void onlyModification(boolean supressEventNotification) - { assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); cache.put(fqn, "key", "value"); Map oldData =3D new HashMap(); @@ -138,42 +114,28 @@ assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); = // modify existing node - if (supressEventNotification) - { - setSuppressEventNotification(); - } cache.put(fqn, "key", "value2"); Map newData =3D new HashMap(); newData.put("key", "value2"); = //expected List expected =3D new ArrayList(); - if (!supressEventNotification) + if (optLocking) + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, false, null, TRANSACTION_REGISTERED)); + expected.add(new EventImpl(true, cache, PUT_DATA, oldData, fqn, null= , true, null, false, null, NODE_MODIFIED)); + expected.add(new EventImpl(false, cache, PUT_DATA, newData, fqn, nul= l, true, null, false, null, NODE_MODIFIED)); + if (optLocking) { - if (optLocking) - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(true, cache, PUT_DATA, oldData, fqn, n= ull, true, null, false, null, NODE_MODIFIED)); - expected.add(new EventImpl(false, cache, PUT_DATA, newData, fqn, = null, true, null, false, null, NODE_MODIFIED)); - if (optLocking) - { - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, true, null, TRANSACTION_COMPLETED)); - eventLog.scrubImplicitTransactions(); - } + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, true, null, TRANSACTION_COMPLETED)); + eventLog.scrubImplicitTransactions(); } = assertEquals(expected.size(), eventLog.events.size()); assertEquals(expected, eventLog.events); } = - public void testOnlyRemoval() + public void testOnlyRemoval() throws Exception { - onlyRemoval(false); - eventLog.events.clear(); - onlyRemoval(true); - } - = - protected void onlyRemoval(boolean supressEventNotification) - { assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); cache.put(fqn, "key", "value"); Map oldData =3D new HashMap(); @@ -186,25 +148,18 @@ assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); = // modify existing node - if (supressEventNotification) - { - setSuppressEventNotification(); - } = cache.removeNode(fqn); = //expected List expected =3D new ArrayList(); - if (!supressEventNotification) + if (optLocking) + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, false, null, TRANSACTION_REGISTERED)); + expected.add(new EventImpl(true, cache, null, oldData, fqn, null, tr= ue, null, false, null, NODE_REMOVED)); + expected.add(new EventImpl(false, cache, null, null, fqn, null, true= , null, false, null, NODE_REMOVED)); + if (optLocking) { - if (optLocking) - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(true, cache, null, oldData, fqn, null,= true, null, false, null, NODE_REMOVED)); - expected.add(new EventImpl(false, cache, null, null, fqn, null, t= rue, null, false, null, NODE_REMOVED)); - if (optLocking) - { - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, true, null, TRANSACTION_COMPLETED)); - eventLog.scrubImplicitTransactions(); - } = + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, true, null, TRANSACTION_COMPLETED)); + eventLog.scrubImplicitTransactions(); } = assertEquals(expected, eventLog.events); @@ -213,42 +168,22 @@ assertNull("Should be null", cache.getRoot().getChild(fqn)); } = - public void testNonexistentRemove() + public void testNonexistentRemove() throws Exception { - nonexistentRemove(false); - eventLog.events.clear(); - nonexistentRemove(true); - } - = - protected void nonexistentRemove(boolean supressEventNotification) - { - if (supressEventNotification) - { - setSuppressEventNotification(); - } cache.removeNode("/does/not/exist"); List expected =3D new ArrayList(); - if (!supressEventNotification) + + if (optLocking) { - if (optLocking) - { - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, true, null, TRANSACTION_COMPLETED)); - eventLog.scrubImplicitTransactions(); - } + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, false, null, TRANSACTION_REGISTERED)); + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, true, null, TRANSACTION_COMPLETED)); + eventLog.scrubImplicitTransactions(); } assertEquals(expected, eventLog.events); } = - public void testRemoveData() + public void testRemoveData() throws Exception { - removeData(false); - eventLog.events.clear(); - removeData(true); - } - = - protected void removeData(boolean supressEventNotification) - { assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); cache.put(fqn, "key", "value"); cache.put(fqn, "key2", "value2"); @@ -261,10 +196,6 @@ assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); = // modify existing node - if (supressEventNotification) - { - setSuppressEventNotification(); - } = cache.remove(fqn, "key2"); Map removedData =3D new HashMap(); removedData.put("key2", "value2"); @@ -272,17 +203,14 @@ //expected List expected =3D new ArrayList(); = - if (!supressEventNotification) + if (optLocking) + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, false, null, TRANSACTION_REGISTERED)); + expected.add(new EventImpl(true, cache, REMOVE_DATA, oldData, fqn, n= ull, true, null, false, null, NODE_MODIFIED)); + expected.add(new EventImpl(false, cache, REMOVE_DATA, removedData, f= qn, null, true, null, false, null, NODE_MODIFIED)); + if (optLocking) { - if (optLocking) - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(true, cache, REMOVE_DATA, oldData, fqn= , null, true, null, false, null, NODE_MODIFIED)); - expected.add(new EventImpl(false, cache, REMOVE_DATA, removedData= , fqn, null, true, null, false, null, NODE_MODIFIED)); - if (optLocking) - { - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, true, null, TRANSACTION_COMPLETED)); - eventLog.scrubImplicitTransactions(); - } + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, true, null, TRANSACTION_COMPLETED)); + eventLog.scrubImplicitTransactions(); } = assertEquals(expected, eventLog.events); @@ -290,13 +218,6 @@ = public void testPutMap() throws Exception { - putMap(false); - eventLog.events.clear(); - putMap(true); = - } - = - protected void putMap(boolean supressEventNotification) - { assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); Map oldData =3D new HashMap(); oldData.put("key", "value"); @@ -307,27 +228,20 @@ assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); = // modify existing node - if (supressEventNotification) - { - setSuppressEventNotification(); - } = cache.put(fqn, oldData); = //expected List expected =3D new ArrayList(); - if (!supressEventNotification) - { = - if (optLocking) - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(true, cache, null, null, fqn, null, tr= ue, null, false, null, NODE_CREATED)); - expected.add(new EventImpl(false, cache, null, null, fqn, null, t= rue, null, false, null, NODE_CREATED)); - expected.add(new EventImpl(true, cache, PUT_MAP, Collections.empt= yMap(), fqn, null, true, null, false, null, NODE_MODIFIED)); - expected.add(new EventImpl(false, cache, PUT_MAP, oldData, fqn, n= ull, true, null, false, null, NODE_MODIFIED)); - if (optLocking) - { - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, true, null, TRANSACTION_COMPLETED)); - eventLog.scrubImplicitTransactions(); - } + if (optLocking) + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, false, null, TRANSACTION_REGISTERED)); + expected.add(new EventImpl(true, cache, null, null, fqn, null, true,= null, false, null, NODE_CREATED)); + expected.add(new EventImpl(false, cache, null, null, fqn, null, true= , null, false, null, NODE_CREATED)); + expected.add(new EventImpl(true, cache, PUT_MAP, Collections.emptyMa= p(), fqn, null, true, null, false, null, NODE_MODIFIED)); + expected.add(new EventImpl(false, cache, PUT_MAP, oldData, fqn, null= , true, null, false, null, NODE_MODIFIED)); + if (optLocking) + { + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, true, null, TRANSACTION_COMPLETED)); + eventLog.scrubImplicitTransactions(); } = assertEquals(expected, eventLog.events); @@ -335,13 +249,6 @@ = public void testMove() { - move(false); - eventLog.events.clear(); - move(true); = - } - = - protected void move(boolean supressEventNotification) - { assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); Fqn newParent =3D Fqn.fromString("/a"); cache.put(fqn, "key", "value"); @@ -352,26 +259,19 @@ eventLog.events.clear();// clear events assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); = - if (supressEventNotification) - { - setSuppressEventNotification(); - } cache.move(n1.getFqn(), n2.getFqn()); //expected Fqn newFqn =3D Fqn.fromRelativeElements(newParent, fqn.getLastElemen= t()); List expected =3D new ArrayList(); = - if (!supressEventNotification) - { = - if (optLocking) - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(true, cache, null, null, fqn, null, tr= ue, newFqn, false, null, NODE_MOVED)); - expected.add(new EventImpl(false, cache, null, null, fqn, null, t= rue, newFqn, false, null, NODE_MOVED)); - if (optLocking) - { - expected.add(new EventImpl(false, cache, null, null, null, nul= l, true, null, true, null, TRANSACTION_COMPLETED)); - eventLog.scrubImplicitTransactions(); - } + if (optLocking) + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, false, null, TRANSACTION_REGISTERED)); + expected.add(new EventImpl(true, cache, null, null, fqn, null, true,= newFqn, false, null, NODE_MOVED)); + expected.add(new EventImpl(false, cache, null, null, fqn, null, true= , newFqn, false, null, NODE_MOVED)); + if (optLocking) + { + expected.add(new EventImpl(false, cache, null, null, null, null, = true, null, true, null, TRANSACTION_COMPLETED)); + eventLog.scrubImplicitTransactions(); } = assertEquals(expected, eventLog.events); @@ -381,138 +281,63 @@ = public void testTxNonexistentRemove() throws Exception { - txNonexistentRemove(false); - eventLog.events.clear(); -// txNonexistentRemove(true); - } - - protected void txNonexistentRemove(boolean supressEventNotification) th= rows Exception - { - if (supressEventNotification) - { - setSuppressEventNotification(); - } = tm.begin(); Transaction tx =3D tm.getTransaction(); cache.removeNode("/does/not/exist"); - if (supressEventNotification) - { - setSuppressEventNotification(); - } = tm.commit(); List expected =3D new ArrayList(); - if (!supressEventNotification) - { = - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, true, null, TRANSACTION_COMPLETED)); - } + expected.add(new EventImpl(false, cache, null, null, null, tx, true,= null, false, null, TRANSACTION_REGISTERED)); + expected.add(new EventImpl(false, cache, null, null, null, tx, true,= null, true, null, TRANSACTION_COMPLETED)); assertEquals(expected, eventLog.events); } - = + public void testTxCreationCommit() throws Exception { - txCreationCommit(false); - eventLog.events.clear(); -// txCreationCommit(true); - } - = - protected void txCreationCommit(boolean supressEventNotification) throw= s Exception - { assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); - if (supressEventNotification) - { - setSuppressEventNotification(); - } tm.begin(); Transaction tx =3D tm.getTransaction(); - if (supressEventNotification) - { - setSuppressEventNotification(); - } cache.put(fqn, "key", "value"); //expected Map data =3D new HashMap(); data.put("key", "value"); List expected =3D new ArrayList(); = - if (!supressEventNotification) - { = - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(true, cache, null, null, fqn, tx, true= , null, false, null, NODE_CREATED)); - expected.add(new EventImpl(false, cache, null, null, fqn, tx, tru= e, null, false, null, NODE_CREATED)); - expected.add(new EventImpl(true, cache, PUT_DATA, Collections.emp= tyMap(), fqn, tx, true, null, false, null, NODE_MODIFIED)); - expected.add(new EventImpl(false, cache, PUT_DATA, data, fqn, tx,= true, null, false, null, NODE_MODIFIED)); - } + expected.add(new EventImpl(false, cache, null, null, null, tx, true,= null, false, null, TRANSACTION_REGISTERED)); + expected.add(new EventImpl(true, cache, null, null, fqn, tx, true, n= ull, false, null, NODE_CREATED)); + expected.add(new EventImpl(false, cache, null, null, fqn, tx, true, = null, false, null, NODE_CREATED)); + expected.add(new EventImpl(true, cache, PUT_DATA, Collections.emptyM= ap(), fqn, tx, true, null, false, null, NODE_MODIFIED)); + expected.add(new EventImpl(false, cache, PUT_DATA, data, fqn, tx, tr= ue, null, false, null, NODE_MODIFIED)); assertEquals(expected, eventLog.events); - if (supressEventNotification) - { - setSuppressEventNotification(); - } tm.commit(); - if (!supressEventNotification) - { = - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, true, null, TRANSACTION_COMPLETED)); - } + expected.add(new EventImpl(false, cache, null, null, null, tx, true,= null, true, null, TRANSACTION_COMPLETED)); assertEquals(expected, eventLog.events); assertEquals("value", cache.get(fqn, "key")); } = public void testTxCreationRollback() throws Exception { - txCreationRollback(false); - eventLog.events.clear(); -// txCreationRollback(true); - } - = - protected void txCreationRollback(boolean supressEventNotification) thr= ows Exception - { assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); - if (supressEventNotification) - { - setSuppressEventNotification(); - } = tm.begin(); Transaction tx =3D tm.getTransaction(); - if (supressEventNotification) - { - setSuppressEventNotification(); - } = cache.put(fqn, "key", "value"); //expected Map data =3D new HashMap(); data.put("key", "value"); List expected =3D new ArrayList(); - if (!supressEventNotification) - { = - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(true, cache, null, null, fqn, tx, true= , null, false, null, NODE_CREATED)); - expected.add(new EventImpl(false, cache, null, null, fqn, tx, tru= e, null, false, null, NODE_CREATED)); - expected.add(new EventImpl(true, cache, PUT_DATA, Collections.emp= tyMap(), fqn, tx, true, null, false, null, NODE_MODIFIED)); - expected.add(new EventImpl(false, cache, PUT_DATA, data, fqn, tx,= true, null, false, null, NODE_MODIFIED)); - } + expected.add(new EventImpl(false, cache, null, null, null, tx, true,= null, false, null, TRANSACTION_REGISTERED)); + expected.add(new EventImpl(true, cache, null, null, fqn, tx, true, n= ull, false, null, NODE_CREATED)); + expected.add(new EventImpl(false, cache, null, null, fqn, tx, true, = null, false, null, NODE_CREATED)); + expected.add(new EventImpl(true, cache, PUT_DATA, Collections.emptyM= ap(), fqn, tx, true, null, false, null, NODE_MODIFIED)); + expected.add(new EventImpl(false, cache, PUT_DATA, data, fqn, tx, tr= ue, null, false, null, NODE_MODIFIED)); = assertEquals(expected, eventLog.events); - if (supressEventNotification) - { - setSuppressEventNotification(); - } = tm.rollback(); - if (!supressEventNotification) - { = - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, false, null, TRANSACTION_COMPLETED)); - } - assertEquals(expected, eventLog.events); = + expected.add(new EventImpl(false, cache, null, null, null, tx, true,= null, false, null, TRANSACTION_COMPLETED)); + assertEquals(expected, eventLog.events); } = public void testTxOnlyModification() throws Exception { - txOnlyModification(false); - eventLog.events.clear(); -// txOnlyModification(true); - } - = - protected void txOnlyModification(boolean supressEventNotification) thr= ows Exception - { assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); cache.put(fqn, "key", "value"); Map oldData =3D new HashMap(); @@ -523,51 +348,26 @@ assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); = // modify existing node - if (supressEventNotification) - { - setSuppressEventNotification(); - } = tm.begin(); Transaction tx =3D tm.getTransaction(); - if (supressEventNotification) - { - setSuppressEventNotification(); - } = cache.put(fqn, "key", "value2"); Map newData =3D new HashMap(); newData.put("key", "value2"); = //expected List expected =3D new ArrayList(); - if (!supressEventNotification) - { = - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(true, cache, PUT_DATA, oldData, fqn, t= x, true, null, false, null, NODE_MODIFIED)); - expected.add(new EventImpl(false, cache, PUT_DATA, newData, fqn, = tx, true, null, false, null, NODE_MODIFIED)); - } + expected.add(new EventImpl(false, cache, null, null, null, tx, true,= null, false, null, TRANSACTION_REGISTERED)); + expected.add(new EventImpl(true, cache, PUT_DATA, oldData, fqn, tx, = true, null, false, null, NODE_MODIFIED)); + expected.add(new EventImpl(false, cache, PUT_DATA, newData, fqn, tx,= true, null, false, null, NODE_MODIFIED)); = assertEquals(expected, eventLog.events); - if (supressEventNotification) - { - setSuppressEventNotification(); - } = tm.commit(); - if (!supressEventNotification) - { = - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, true, null, TRANSACTION_COMPLETED)); - } + expected.add(new EventImpl(false, cache, null, null, null, tx, true,= null, true, null, TRANSACTION_COMPLETED)); assertEquals(expected, eventLog.events); - } = + } = public void testTxOnlyRemoval() throws Exception { - txOnlyRemoval(false); - eventLog.events.clear(); -// txOnlyRemoval(true); - } - - protected void txOnlyRemoval(boolean supressEventNotification) throws E= xception - { assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); cache.put(fqn, "key", "value"); Map oldData =3D new HashMap(); @@ -580,36 +380,19 @@ assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); = // modify existing node - if (supressEventNotification) - { - setSuppressEventNotification(); - } = tm.begin(); Transaction tx =3D tm.getTransaction(); - if (supressEventNotification) - { - setSuppressEventNotification(); - } = cache.removeNode(fqn); //expected List expected =3D new ArrayList(); - if (!supressEventNotification) - { = - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(true, cache, null, oldData, fqn, tx, t= rue, null, false, null, NODE_REMOVED)); - expected.add(new EventImpl(false, cache, null, null, fqn, tx, tru= e, null, false, null, NODE_REMOVED)); - } = + expected.add(new EventImpl(false, cache, null, null, null, tx, true,= null, false, null, TRANSACTION_REGISTERED)); + expected.add(new EventImpl(true, cache, null, oldData, fqn, tx, true= , null, false, null, NODE_REMOVED)); + expected.add(new EventImpl(false, cache, null, null, fqn, tx, true, = null, false, null, NODE_REMOVED)); + assertEquals(expected, eventLog.events); - if (supressEventNotification) - { - setSuppressEventNotification(); - } tm.commit(); - if (!supressEventNotification) - { = - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, true, null, TRANSACTION_COMPLETED)); - } + expected.add(new EventImpl(false, cache, null, null, null, tx, true,= null, true, null, TRANSACTION_COMPLETED)); assertEquals(expected, eventLog.events); // test that the node has in fact been removed. assertNull("Should be null", cache.getRoot().getChild(fqn)); @@ -617,13 +400,6 @@ = public void testTxRemoveData() throws Exception { - txRemoveData(false); - eventLog.events.clear(); -// txRemoveData(true); - } - = - protected void txRemoveData(boolean supressEventNotification) throws Ex= ception - { assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); cache.put(fqn, "key", "value"); cache.put(fqn, "key2", "value2"); @@ -636,38 +412,20 @@ assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); = // modify existing node - if (supressEventNotification) - { - setSuppressEventNotification(); - } = tm.begin(); Transaction tx =3D tm.getTransaction(); - if (supressEventNotification) - { - setSuppressEventNotification(); - } = cache.remove(fqn, "key2"); Map removedData =3D new HashMap(); removedData.put("key2", "value2"); = //expected List expected =3D new ArrayList(); - if (!supressEventNotification) - { = - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(true, cache, REMOVE_DATA, oldData, fqn= , tx, true, null, false, null, NODE_MODIFIED)); - expected.add(new EventImpl(false, cache, REMOVE_DATA, removedData= , fqn, tx, true, null, false, null, NODE_MODIFIED)); - } + expected.add(new EventImpl(false, cache, null, null, null, tx, true,= null, false, null, TRANSACTION_REGISTERED)); + expected.add(new EventImpl(true, cache, REMOVE_DATA, oldData, fqn, t= x, true, null, false, null, NODE_MODIFIED)); + expected.add(new EventImpl(false, cache, REMOVE_DATA, removedData, f= qn, tx, true, null, false, null, NODE_MODIFIED)); = - if (supressEventNotification) - { - setSuppressEventNotification(); - } tm.commit(); - if (!supressEventNotification) - { = - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, true, null, TRANSACTION_COMPLETED)); - } + expected.add(new EventImpl(false, cache, null, null, null, tx, true,= null, true, null, TRANSACTION_COMPLETED)); assertEquals(expected, eventLog.events); = assertEquals(expected, eventLog.events); @@ -700,64 +458,4 @@ expected.add(new EventImpl(false, cache, null, null, null, tx, true,= null, true, null, TRANSACTION_COMPLETED)); assertEquals(expected, eventLog.events); } - = - protected void txMove(boolean supressEventNotification) throws Exception - { - assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); - Fqn newParent =3D Fqn.fromString("/a"); - cache.put(fqn, "key", "value"); - cache.put(newParent, "key", "value"); - - Node n1 =3D cache.getRoot().getChild(fqn); - Node n2 =3D cache.getRoot().getChild(newParent); - eventLog.events.clear();// clear events - assertEquals("Event log should be empty", Collections.emptyList(), e= ventLog.events); - - if (supressEventNotification) - { - setSuppressEventNotification(); - } - tm.begin(); - Transaction tx =3D tm.getTransaction(); - if (supressEventNotification) - { - setSuppressEventNotification(); - } = - cache.move(n1.getFqn(), n2.getFqn()); - //expected - Fqn newFqn =3D Fqn.fromRelativeElements(newParent, fqn.getLastElemen= t()); - List expected =3D new ArrayList(); - if (!supressEventNotification) - { = - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, false, null, TRANSACTION_REGISTERED)); - expected.add(new EventImpl(true, cache, null, null, fqn, tx, true= , newFqn, false, null, NODE_MOVED)); - expected.add(new EventImpl(false, cache, null, null, fqn, tx, tru= e, newFqn, false, null, NODE_MOVED)); - } - - assertEquals(expected, eventLog.events); - if (supressEventNotification) - { - setSuppressEventNotification(); - } - tm.commit(); - if (!supressEventNotification) - { = - expected.add(new EventImpl(false, cache, null, null, null, tx, tr= ue, null, true, null, TRANSACTION_COMPLETED)); - } - assertEquals(expected, eventLog.events); - } - = - protected void setSuppressEventNotification() - { - Option option =3D new Option(); - option.setSuppressEventNotification(true); - cache.getInvocationContext().setOptionOverrides(option); = - } - = - protected void clearSuppressEventNotification() - { - Option option =3D new Option(); - option.setSuppressEventNotification(false); - cache.getInvocationContext().setOptionOverrides(option); = - } } --===============2478636136785197486==--