[jboss-cvs] JBossCache/examples/PojoCache/passivation/src/test/examples ...

Jason Thomas Greene jgreene at jboss.com
Thu Aug 2 02:52:01 EDT 2007


  User: jgreene 
  Date: 07/08/02 02:52:01

  Modified:    examples/PojoCache/passivation/src/test/examples 
                        StudentMaintTest.java
  Log:
  fix examples
  
  Revision  Changes    Path
  1.4       +17 -65    JBossCache/examples/PojoCache/passivation/src/test/examples/StudentMaintTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: StudentMaintTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/examples/PojoCache/passivation/src/test/examples/StudentMaintTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- StudentMaintTest.java	5 Jan 2007 01:02:00 -0000	1.3
  +++ StudentMaintTest.java	2 Aug 2007 06:52:01 -0000	1.4
  @@ -5,7 +5,8 @@
   import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.pojo.PojoCacheFactory;
  -import org.jboss.cache.CacheListener;
  +import org.jboss.cache.notifications.annotation.*;
  +import org.jboss.cache.notifications.event.*;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.CacheSPI;
   import org.jgroups.View;
  @@ -37,11 +38,11 @@
      private PojoCache cache2_;
   
      protected void setUp() throws Exception {
  -      cache1_ = createCache("TestCluster");
  +      cache1_ = createCache("TestCluster", "");
         listener_ = new MyCacheListener();
         cache1_.getCache().addCacheListener(listener_);
   
  -      cache2_ = createCache("TestCluster");
  +      cache2_ = createCache("TestCluster", "2");
         init();
      }
   
  @@ -51,10 +52,10 @@
         cache2_.stop();
      }
   
  -   private PojoCache createCache(String name) throws Exception {
  +   private PojoCache createCache(String name, String suffix) throws Exception {
         XmlConfigurationParser parser = new XmlConfigurationParser();
         // This is PojoCache passivation configuration. Key is there is only one global region.
  -      Configuration conf = parser.parseFile("META-INF/pojocache-passivation-service.xml");
  +      Configuration conf = parser.parseFile("META-INF/pojocache-passivation-service" + suffix + ".xml");
         conf.setClusterName(name); // We can set a different cluster group.
         boolean toStart = true;
         PojoCache cache = PojoCacheFactory.createCache(conf, toStart);
  @@ -172,7 +173,8 @@
         smTest.tearDown();
      }
   
  -   public class MyCacheListener implements CacheListener
  +   @CacheListener
  +   public static class MyCacheListener
      {
         int activationCounter = 0;
         int passivationCounter = 0;
  @@ -193,74 +195,24 @@
            passivationCounter = 0;
         }
   
  -
  -      public void nodeCreated(Fqn fqn, boolean pre, boolean isLocal)
  -      {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void nodeModified(Fqn fqn, boolean pre, boolean isLocal, ModificationType modType, Map<Object, Object> data)
  -      {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void nodeRemoved(Fqn fqn, boolean pre, boolean isLocal, Map<Object, Object> data)
  -      {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void nodeVisited(Fqn fqn, boolean pre)
  -      {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void nodeEvicted(Fqn fqn, boolean pre, boolean isLocal)
  -      {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void nodeLoaded(Fqn fqn, boolean pre, Map<Object, Object> data)
  +      @NodeActivated
  +      public void nodeActivated(NodeActivatedEvent event)
         {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void nodeMoved(Fqn from, Fqn to, boolean pre, boolean isLocal)
  -      {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void nodeActivated(Fqn fqn, boolean pre)
  -      {
  -         if(!pre)
  +         if(! event.isPre())
            {
  -            System.out.println("nodeActivated: fqn - " +fqn);
  +            System.out.println("nodeActivated: fqn - " + event.getFqn());
               activationCounter++;
            }
         }
   
  -      public void nodePassivated(Fqn fqn, boolean pre)
  +      @NodePassivated
  +      public void nodePassivated(NodePassivatedEvent event)
         {
  -         if(pre)
  +         if(! event.isPre())
            {
  -            System.out.println("nodePassivated: fqn - " +fqn);
  +            System.out.println("nodePassivated: fqn - " + event.getFqn());
               passivationCounter++;
            }
         }
  -
  -      public void cacheStarted(CacheSPI cache)
  -      {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void cacheStopped(CacheSPI cache)
  -      {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void viewChange(View new_view)
  -      {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
      }
   }
  
  
  



More information about the jboss-cvs-commits mailing list