Package org.jboss.cache.aop.test

Examples of org.jboss.cache.aop.test.Gadget


   }

   public void testTransientAnnotation() throws Exception
   {
      log_.info("testTransientAnnotation() ....");
      Gadget ga = new Gadget();
      ga.setName("Printer");
      Resource res = new Resource();
      res.setName("Inet");
      res.setConnection("Eth0");
      ga.setResource(res);

      cache_.putObject("/gadget", ga);
      Object obj = cache_.getObject("/gadget");
      assertEquals(ga, obj);

      Gadget ga1 = (Gadget)cache1_.getObject("/gadget");
      assertEquals("Name is ", ga.getName(), ga1.getName());

      assertNotNull("Resource should not be null on cache1 ", ga.getResource());
      assertNull("Resource should be null", ga1.getResource());
   }
View Full Code Here


   }

   public void testSeriazableAnnotation() throws Exception
   {
      log_.info("testSerializableAnnotation() ....");
      Gadget ga = new Gadget();
      ga.setName("Printer");
      SpecialAddress addr = new SpecialAddress();
      addr.setAddr("10.1.2.2");
      ga.setAddr(addr);

      cache_.putObject("/gadget", ga);
      Object obj = cache_.getObject("/gadget");
      assertEquals(ga, obj);

      Gadget ga1 = (Gadget)cache1_.getObject("/gadget");
      assertEquals("Name is ", ga.getName(), ga1.getName());

      SpecialAddress addr1 = (SpecialAddress)ga1.getAddr();
      addr1.setAddr("5152967326");

      assertNotSame("Special address should not be updated: ", addr1.getAddr(), addr.getAddr());

      ga1.setAddr(addr1);
      assertEquals("Special address should be the same", ga.getAddr().getAddr(), ga1.getAddr().getAddr());

   }
View Full Code Here

   }

   public void testSeriazableAnnotationWithRelationship() throws Exception
   {
      log_.info("testSerializableAnnotationWithRelationship() ....");
      Gadget ga = new Gadget();
      ga.setName("Printer");
      SpecialAddress addr = new SpecialAddress();
      addr.setAddr("10.1.2.2");
      ga.setAddr(addr);

      cache_.putObject("/gadget1", ga);
      Object obj = cache_.getObject("/gadget1");
      assertEquals(ga, obj);

      Gadget ga2 = new Gadget();
      ga2.setName("Fax");
      ga2.setAddr(addr);
      cache_.putObject("/gadget2", ga2);

      ga = (Gadget)cache1_.getObject("/gadget1");
      ga2 = (Gadget)cache1_.getObject("/gadget2");
      assertTrue("Sepcial address should be the same ", ga.getAddr() == ga2.getAddr());
   }
View Full Code Here

   }

   public void testTransientAnnotation() throws Exception
   {
      log_.info("testTransientAnnotation() ....");
      Gadget ga = new Gadget();
      ga.setName("Printer");
      Resource res = new Resource();
      res.setName("Inet");
      res.setConnection("Eth0");
      ga.setResource(res);

      cache_.putObject("/gadget", ga);
      Object obj = cache_.getObject("/gadget");
      assertEquals(ga, obj);

      Gadget ga1 = (Gadget)cache1_.getObject("/gadget");
      assertEquals("Name is ", ga.getName(), ga1.getName());

      assertNotNull("Resource should not be null on cache1 ", ga.getResource());
      assertNull("Resource should be null", ga1.getResource());
   }
View Full Code Here

   }

   public void testSeriazableAnnotation() throws Exception
   {
      log_.info("testSerializableAnnotation() ....");
      Gadget ga = new Gadget();
      ga.setName("Printer");
      SpecialAddress addr = new SpecialAddress();
      addr.setAddr("10.1.2.2");
      ga.setAddr(addr);

      cache_.putObject("/gadget", ga);
      Object obj = cache_.getObject("/gadget");
      assertEquals(ga, obj);

      Gadget ga1 = (Gadget)cache1_.getObject("/gadget");
      assertEquals("Name is ", ga.getName(), ga1.getName());

      SpecialAddress addr1 = (SpecialAddress)ga1.getAddr();
      addr1.setAddr("5152967326");

      assertNotSame("Special address should not be updated: ", addr1.getAddr(), addr.getAddr());

      ga1.setAddr(addr1);
      assertEquals("Special address should be the same", ga.getAddr().getAddr(), ga1.getAddr().getAddr());

   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.aop.test.Gadget

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.