Package org.infinispan

Examples of org.infinispan.Cache.addListener()


   }

   public void testLoadingAndStoring() {
      Cache c = cm.getCache("no_passivation");
      TestListener l = new TestListener();
      c.addListener(l);

      assert l.loaded.isEmpty();
      assert l.activated.isEmpty();
      assert l.passivated.isEmpty();
View Full Code Here


   }

   public void testActivatingAndPassivating() {
      Cache c = cm.getCache("passivation");
      TestListener l = new TestListener();
      c.addListener(l);

      assert l.loaded.isEmpty();
      assert l.activated.isEmpty();
      assert l.passivated.isEmpty();
View Full Code Here

   public void testCallbackValues() throws Exception {
      Cache cache1 = cache(0, "replSync");
      cache(1, "replSync");
      MockListener l = new MockListener();
      cache1.addListener(l);
      try {
         Pojo pojo = new Pojo();
         cache1.put("key", pojo);
         assertTrue("recieved " + l.newValue.getClass().getName(), l.newValue instanceof Pojo);
         assertSerializationCounts(1, 0);
View Full Code Here

   public void testRemoteCallbackValues() throws Exception {
      Cache cache1 = cache(0, "replSync");
      Cache cache2 = cache(1, "replSync");
      MockListener l = new MockListener();
      cache2.addListener(l);
      try {
         Pojo pojo = new Pojo();
         // Mock listener will force deserialization on transport thread. Ignore this by setting b to false.
         pojo.b = false;
         cache1.put("key", pojo);
View Full Code Here

   public void testCallbackValues() throws Exception {
      Cache cache1 = cache(0, "replSync");
      cache(1, "replSync");
      MockListener l = new MockListener();
      cache1.addListener(l);
      try {
         Pojo pojo = new Pojo();
         cache1.put("key", pojo);
         assert l.newValue instanceof Pojo : "recieved " + l.newValue.getClass().getName();
         // +1 due to new marshallable checks
View Full Code Here

   public void testRemoteCallbackValues() throws Exception {
      Cache cache1 = cache(0, "replSync");
      Cache cache2 = cache(1, "replSync");
      MockListener l = new MockListener();
      cache2.addListener(l);
      try {
         Pojo pojo = new Pojo();
         // Mock listener will force deserialization on transport thread. Ignore this by setting b to false.
         pojo.b = false;
         cache1.put("key", pojo);
View Full Code Here

    Cache localContactCache = localManager.getCache( Contact.class.getName() );
    Cache localCollectionCache = localManager.getCache( Customer.class.getName() + ".contacts" );
    MyListener localListener = new MyListener( "local" );
    localCustomerCache.addListener( localListener );
    localContactCache.addListener( localListener );
    localCollectionCache.addListener( localListener );
    TransactionManager localTM = DualNodeJtaTransactionManagerImpl.getInstance( DualNodeTestCase.LOCAL );

    // Bind a listener to the "remote" cache
    CacheContainer remoteManager = ClusterAwareRegionFactory.getCacheManager( DualNodeTestCase.REMOTE );
    Cache remoteCustomerCache = remoteManager.getCache( Customer.class.getName() );
View Full Code Here

    Cache remoteContactCache = remoteManager.getCache( Contact.class.getName() );
    Cache remoteCollectionCache = remoteManager.getCache( Customer.class.getName() + ".contacts" );
    MyListener remoteListener = new MyListener( "remote" );
    remoteCustomerCache.addListener( remoteListener );
    remoteContactCache.addListener( remoteListener );
    remoteCollectionCache.addListener( remoteListener );
    TransactionManager remoteTM = DualNodeJtaTransactionManagerImpl.getInstance( DualNodeTestCase.REMOTE );

    SessionFactory localFactory = sessionFactory();
    SessionFactory remoteFactory = secondNodeEnvironment().getSessionFactory();
View Full Code Here

   }

   public void testLoadingAndStoring() {
      Cache c = cm.getCache("no_passivation");
      TestListener l = new TestListener();
      c.addListener(l);

      assert l.loaded.isEmpty();
      assert l.activated.isEmpty();
      assert l.passivated.isEmpty();
View Full Code Here

   }

   public void testActivatingAndPassivating() {
      Cache c = cm.getCache("passivation");
      TestListener l = new TestListener();
      c.addListener(l);

      assert l.loaded.isEmpty();
      assert l.activated.isEmpty();
      assert l.passivated.isEmpty();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.