Package org.jboss.cache.loader

Examples of org.jboss.cache.loader.SamplePojo


      mgr.begin();

      assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());

      SamplePojo pojo = new SamplePojo(21, "test");

      cache.put("/one/two", "key1", pojo);

      mgr.rollback();
View Full Code Here


      mgr.begin();

      assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());

      SamplePojo pojo = new SamplePojo(21, "test");

      cache.put("/one/two", "key1", pojo);

      mgr.commit();
View Full Code Here

      mgr.begin();
      Transaction tx = mgr.getTransaction();
      assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());

      SamplePojo pojo = new SamplePojo(21, "test");

      cache.put("/one/two", "key1", pojo);

      mgr.suspend();

      assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());

      assertNull(mgr.getTransaction());

      mgr.begin();

      SamplePojo pojo2 = new SamplePojo(22, "test2");

      cache.put("/one/two", "key1", pojo2);

      mgr.commit();
View Full Code Here

      mgr.begin();

      assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());

      SamplePojo pojo = new SamplePojo(21, "test");

      cache.put("/one/two", "key1", pojo);

      mgr.commit();
View Full Code Here

      mgr.begin();

      assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());

      SamplePojo pojo = new SamplePojo(21, "test");

      cache.put("/one/two", "key1", pojo);

      mgr.commit();
View Full Code Here

      mgr.begin();
      Transaction tx = mgr.getTransaction();
      assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());

      SamplePojo pojo = new SamplePojo(21, "test");

      cache.put("/one/two", "key1", pojo);

      mgr.suspend();

      assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());

      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
      TransactionTable table = cache.getTransactionTable();
      OptimisticTransactionContext entry = (OptimisticTransactionContext) table
            .get(gtx);


      assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
      assertNull(mgr.getTransaction());

      mgr.begin();

      SamplePojo pojo2 = new SamplePojo(22, "test2");

      cache2.put("/one/two", "key1", pojo2);

      mgr.commit();
View Full Code Here

   }

   public void testGetKeyValIsolationTransaction() throws Exception
   {
      SamplePojo pojo1 = new SamplePojo(21, "test-1");
      SamplePojo pojo2 = new SamplePojo(21, "test-2");

      CacheSPI<Object, Object> cache = createCacheWithListener();

      TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
      assertNull(mgr.getTransaction());
View Full Code Here

      mgr.begin();

      assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());

      SamplePojo pojo = new SamplePojo(21, "test");

      cache.put("/one/two", "key1", pojo);

      mgr.commit();
View Full Code Here

   {
      CacheSPI<Object, Object> cache = cacheTL.get();
      CacheLoader loader = loaderTL.get();

      Fqn fqn = Fqn.fromString("/mypojo");
      SamplePojo pojo = new SamplePojo(39, "Hany");
      pojo.getHobbies().add("Running");
      pojo.getHobbies().add("Beerathlon");
      pojo.getHobbies().add("Triathlon");
      cache.put(fqn, 322649, pojo);// put in memory
      addDelay();
      assertNotNull(cache.get(fqn, 322649));// get from memory
      cache.evict(fqn, false);// passivate node
      try
      {
         assertTrue(loader.exists(fqn));
      }
      catch (Exception e)
      {
         fail(e.toString());
      }
      SamplePojo pojo2 = (SamplePojo) cache.get(fqn, 322649);// activate node
      try
      {
         assertFalse(loader.exists(fqn));
      }
      catch (Exception e)
      {
         fail(e.toString());
      }
      assertNotNull(pojo2);
      assertEquals(39, pojo2.getAge());
      assertEquals("Hany", pojo2.getName());
      assertEquals(3, pojo2.getHobbies().size());
   }
View Full Code Here

      mgr.begin();
      Transaction tx = mgr.getTransaction();

      setupTransactions(cache, tx);

      SamplePojo pojo = new SamplePojo(21, "test");
      Map temp = new HashMap();
      temp.put("key1", pojo);
      cache.put("/one/two", temp);

View Full Code Here

TOP

Related Classes of org.jboss.cache.loader.SamplePojo

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.