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

Ben Wang bwang at jboss.com
Wed Sep 20 06:45:45 EDT 2006


  User: bwang   
  Date: 06/09/20 06:45:45

  Modified:    examples/PojoCache/non-annotated/src/test/examples 
                        StudentMaintTest.java
  Log:
  First update to repackage the distro into core, pojo, and all.
  
  Revision  Changes    Path
  1.3       +36 -33    JBossCache/examples/PojoCache/non-annotated/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/non-annotated/src/test/examples/StudentMaintTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- StudentMaintTest.java	27 Apr 2006 06:47:38 -0000	1.2
  +++ StudentMaintTest.java	20 Sep 2006 10:45:45 -0000	1.3
  @@ -1,8 +1,10 @@
   package test.examples;
   
   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.factories.XmlConfigurationParser;
  +import org.jboss.cache.config.Configuration;
  +import org.jboss.cache.pojo.PojoCacheFactory;
   import examples.Address;
   import examples.Course;
   //import examples.Person;
  @@ -34,19 +36,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;
      }
   
      /**
  @@ -92,19 +95,19 @@
      public void testPropagation() throws Exception {
         
         // Here we ask the pojo cache to manage mary_ and joe_
  -      cache1_.putObject("/students/54321", mary_);
  -      cache1_.putObject("/students/65432", joe_);
  -      cache1_.putObject("/courses/101", foo_);
  -      cache1_.putObject("/courses/401", bar_);
  +      cache1_.attach("students/54321", mary_);
  +      cache1_.attach("students/65432", joe_);
  +      cache1_.attach("courses/101", foo_);
  +      cache1_.attach("courses/401", bar_);
   
         // Output
         printStatus("Initial state for Mary", mary_);      
         printStatus("Initial state for Joe", joe_);
   
         // Retrieve the pojos from the Server #2
  -      Student mary2 = (Student) cache2_.getObject("/students/54321");
  -      Student joe2  = (Student) cache2_.getObject("/students/65432");
  -      Course  foo2  = (Course) cache2_.getObject("/courses/101");
  +      Student mary2 = (Student) cache2_.find("students/54321");
  +      Student joe2  = (Student) cache2_.find("students/65432");
  +      Course  foo2  = (Course) cache2_.find("courses/101");
   
         System.out.println("---------------------------------------------");
         System.out.println("Modified on Server #1");
  
  
  



More information about the jboss-cvs-commits mailing list