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

Ben Wang bwang at jboss.com
Thu Sep 21 12:12:19 EDT 2006


  User: bwang   
  Date: 06/09/21 12:12:19

  Modified:    examples/PojoCache/sensor/src/test/propagation 
                        PropagationReplAopTest.java
  Log:
  Updated to 2.0 apis
  
  Revision  Changes    Path
  1.3       +15 -12    JBossCache/examples/PojoCache/sensor/src/test/propagation/PropagationReplAopTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PropagationReplAopTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/examples/PojoCache/sensor/src/test/propagation/PropagationReplAopTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- PropagationReplAopTest.java	27 Apr 2006 06:47:38 -0000	1.2
  +++ PropagationReplAopTest.java	21 Sep 2006 16:12:19 -0000	1.3
  @@ -1,8 +1,10 @@
   package test.propagation;
   
   import junit.framework.TestCase;
  -import org.jboss.cache.PropertyConfigurator;
  -import org.jboss.cache.aop.PojoCache;
  +import org.jboss.cache.pojo.PojoCache;
  +import org.jboss.cache.pojo.PojoCacheFactory;
  +import org.jboss.cache.config.Configuration;
  +import org.jboss.cache.factories.XmlConfigurationParser;
   import propagation.PropagationManager;
   import propagation.impl.PropagationManagerImpl;
   
  @@ -27,19 +29,20 @@
      }
   
      protected void tearDown() throws Exception {
  -      cache1_.remove("/");
  +      cache1_.getCache().remove("/");
         cache1_.stop();
         cache2_.stop();
      }
   
      private PojoCache createCache(String name) throws Exception {
  -      PojoCache tree = new PojoCache();
  -      PropertyConfigurator config = new PropertyConfigurator();   // configure the cache through injection
  -       // read in the replSync xml. Here we use synchronous mode replication.
  -      config.configure(tree, "META-INF/replSync-service.xml");
  -      tree.setClusterName(name); // We can set a different cluster group.
  -      tree.start(); // kick start the cache
  -      return tree;
  +      XmlConfigurationParser parser = new XmlConfigurationParser();
  +      Configuration conf = parser.parseFile("META-INF/replSync-service.xml");
  +      conf.setClusterName(name); // We can set a different cluster group.
  +      boolean toStart = true;
  +      PojoCache cache = PojoCacheFactory.createInstance(conf, toStart);
  +      // Or
  +//      PojoCache cache = PojoCacheFactory.createInstance("META-INF/replSync-service.xml", toStart);
  +      return cache;
      }
   
      /**
  @@ -83,13 +86,13 @@
   
      public void testPropagation() throws Exception {
         // Here we ask the pojo cache to manage pm
  -      cache1_.putObject("/monitor", pm_);
  +      cache1_.attach("monitor", pm_);
   
         // Output
         printStatus("Initial state", pm_);
   
         // Retrieve the pojo from the Server #2
  -      PropagationManager pm2 = (PropagationManager) cache2_.getObject("monitor");
  +      PropagationManager pm2 = (PropagationManager) cache2_.find("monitor");
   
         System.out.println("---------------------------------------------");
         System.out.println("Modified on Server #1");
  
  
  



More information about the jboss-cvs-commits mailing list