Package org.hibernate.test.cache.infinispan.functional.classloader

Examples of org.hibernate.test.cache.infinispan.functional.classloader.Account


      Integer id = new Integer(1);
      dao0.createAccount(dao0.getSmith(), id, new Integer(5), DualNodeTestCase.LOCAL);

      // Basic sanity check
      Account acct1 = dao1.getAccount(id);
      assertNotNull(acct1);
      assertEquals(DualNodeTestCase.LOCAL, acct1.getBranch());

      // This dao's session factory isn't caching, so cache won't see this change
      dao1.updateAccountBranch(id, DualNodeTestCase.REMOTE);

      // dao1's session doesn't touch the cache,
      // so reading from dao0 should show a stale value from the cache
      // (we check to confirm the cache is used)
      Account acct0 = dao0.getAccount(id);
      assertNotNull(acct0);
      assertEquals(DualNodeTestCase.LOCAL, acct0.getBranch());
      log.debug("Contents when re-reading from local: " + TestingUtil.printCache(localCache));

      // Now call session.refresh and confirm we get the correct value
      acct0 = dao0.getAccountWithRefresh(id);
      assertNotNull(acct0);
      assertEquals(DualNodeTestCase.REMOTE, acct0.getBranch());
      log.debug("Contents after refreshing in remote: " + TestingUtil.printCache(localCache));

      // Double check with a brand new session, in case the other session
      // for some reason bypassed the 2nd level cache
      ClassLoaderTestDAO dao0A = new ClassLoaderTestDAO(localFactory, localTM);
      Account acct0A = dao0A.getAccount(id);
      assertNotNull(acct0A);
      assertEquals(DualNodeTestCase.REMOTE, acct0A.getBranch());
      log.debug("Contents after creating a new session: " + TestingUtil.printCache(localCache));
   }
View Full Code Here


//      ClassLoader cl = Thread.currentThread().getContextClassLoader();
//      Thread.currentThread().setContextClassLoader(cl.getParent());
//      log.info("TCCL is " + cl.getParent());

      Account acct = new Account();
      acct.setAccountHolder(new AccountHolder());
      region.getCacheAdapter().withFlags(FlagAdapter.FORCE_SYNCHRONOUS).put(acct, "boo");

//      region.put(acct, "boo");
//
//      region.evictAll();
View Full Code Here

//      ClassLoader cl = Thread.currentThread().getContextClassLoader();
//      Thread.currentThread().setContextClassLoader(cl.getParent());
//      log.info("TCCL is " + cl.getParent());

      Account acct = new Account();
      acct.setAccountHolder(new AccountHolder());
      region.getCache().withFlags(Flag.FORCE_SYNCHRONOUS).put(acct, "boo");

//      region.put(acct, "boo");
//
//      region.evictAll();
View Full Code Here

//      ClassLoader cl = Thread.currentThread().getContextClassLoader();
//      Thread.currentThread().setContextClassLoader(cl.getParent());
//      log.info("TCCL is " + cl.getParent());

      Account acct = new Account();
      acct.setAccountHolder(new AccountHolder());
      region.getCache().withFlags(Flag.FORCE_SYNCHRONOUS).put(acct, "boo");

//      region.put(acct, "boo");
//
//      region.evictAll();
View Full Code Here

    Integer id = new Integer( 1 );
    dao0.createAccount( dao0.getSmith(), id, new Integer( 5 ), DualNodeTestCase.LOCAL );

    // Basic sanity check
    Account acct1 = dao1.getAccount( id );
    assertNotNull( acct1 );
    assertEquals( DualNodeTestCase.LOCAL, acct1.getBranch() );

    // This dao's session factory isn't caching, so cache won't see this change
    dao1.updateAccountBranch( id, DualNodeTestCase.REMOTE );

    // dao1's session doesn't touch the cache,
    // so reading from dao0 should show a stale value from the cache
    // (we check to confirm the cache is used)
    Account acct0 = dao0.getAccount( id );
    assertNotNull( acct0 );
    assertEquals( DualNodeTestCase.LOCAL, acct0.getBranch() );
    log.debug( "Contents when re-reading from local: " + TestingUtil.printCache( localCache ) );

    // Now call session.refresh and confirm we get the correct value
    acct0 = dao0.getAccountWithRefresh( id );
    assertNotNull( acct0 );
    assertEquals( DualNodeTestCase.REMOTE, acct0.getBranch() );
    log.debug( "Contents after refreshing in remote: " + TestingUtil.printCache( localCache ) );

    // Double check with a brand new session, in case the other session
    // for some reason bypassed the 2nd level cache
    ClassLoaderTestDAO dao0A = new ClassLoaderTestDAO( localFactory, localTM );
    Account acct0A = dao0A.getAccount( id );
    assertNotNull( acct0A );
    assertEquals( DualNodeTestCase.REMOTE, acct0A.getBranch() );
    log.debug( "Contents after creating a new session: " + TestingUtil.printCache( localCache ) );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.test.cache.infinispan.functional.classloader.Account

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.