Examples of ReplicationQueue


Examples of org.apache.sling.replication.queue.ReplicationQueue

        when(context.getProperties()).thenReturn(properties);
        priorityPathDistributionStrategy.activate(context);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getPaths()).thenReturn(new String[]{"/apps/some/stuff"});
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);

        when(queueProvider.getQueue("agentName", "/apps")).thenReturn(queue);
        when(queue.add(any(ReplicationQueueItem.class))).thenReturn(true);
        boolean returnedState = priorityPathDistributionStrategy.add("agentName", replicationPackage, queueProvider);
        assertTrue(returnedState);
    }
View Full Code Here

Examples of org.apache.sling.replication.queue.ReplicationQueue

        when(context.getProperties()).thenReturn(properties);
        priorityPathDistributionStrategy.activate(context);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getPaths()).thenReturn(new String[]{"/etc"});
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);
        when(queueProvider.getDefaultQueue("agentName")).thenReturn(queue);
        when(queue.add(any(ReplicationQueueItem.class))).thenReturn(true);
        boolean returnedState = priorityPathDistributionStrategy.add("agentName", replicationPackage, queueProvider);
        assertTrue(returnedState);
    }
View Full Code Here

Examples of org.apache.sling.replication.queue.ReplicationQueue

        when(context.getProperties()).thenReturn(properties);
        priorityPathDistributionStrategy.activate(context);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getPaths()).thenReturn(new String[]{"/apps"});
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);

        when(queueProvider.getQueue("agentName", "/apps")).thenReturn(queue);
        when(queue.add(any(ReplicationQueueItem.class))).thenReturn(true);

        boolean returnedState = priorityPathDistributionStrategy.add("agentName", replicationPackage, queueProvider);
        assertTrue(returnedState);
    }
View Full Code Here

Examples of org.infinispan.remoting.ReplicationQueue

         }
      }
   }

   private static void clearReplicationQueues(Cache cache) {
      ReplicationQueue queue = TestingUtil.extractComponent(cache, ReplicationQueue.class);
      if (queue != null) queue.reset();
   }
View Full Code Here

Examples of org.infinispan.remoting.ReplicationQueue

               .replQueueInterval(config.clustering().async().replQueueInterval())
               .replQueueMaxElements(config.clustering().async().replQueueMaxElements())
               .useReplQueue(config.clustering().async().useReplQueue());


         ReplicationQueue replQueue = config.clustering().async().replQueue();
         if (replQueue != null) {
            legacy.clustering().async().replQueueClass(replQueue.getClass());
         }
      }

      if (config.clustering().hash().hash() != null) {
         legacy.clustering()
View Full Code Here

Examples of org.infinispan.remoting.ReplicationQueue

         }
      }
   }

   private static void clearReplicationQueues(Cache cache) {
      ReplicationQueue queue = TestingUtil.extractComponent(cache, ReplicationQueue.class);
      if (queue != null) queue.reset();
   }
View Full Code Here

Examples of org.infinispan.remoting.ReplicationQueue

      verifyInitialData(cache3);

      int count = writerThread.result();

      // Wait for the replication queue to be emptied
      final ReplicationQueue replQueue1 = cache1.getAdvancedCache().getComponentRegistry().getComponent(ReplicationQueue.class);
      eventually(new Condition() {
         @Override
         public boolean isSatisfied() throws Exception {
            return replQueue1.getElementsCount() == 0;
         }
      });

      // Wait a little longer, even the replication queue sends the commands asynchronously
      Thread.sleep(1000);
View Full Code Here

Examples of org.infinispan.remoting.ReplicationQueue

      EmbeddedCacheManager ecm = TestCacheManagerFactory.createCacheManager(GlobalConfiguration.getClusteredDefault(), cfg);
      return ecm;
   }

   public void testReplQueueImplType() {
      ReplicationQueue rq = TestingUtil.extractComponent(cache, ReplicationQueue.class);
      assert rq instanceof TestReplQueueClass;             
   }
View Full Code Here

Examples of org.infinispan.remoting.ReplicationQueue

         }
      }
   }

   private static void clearReplicationQueues(Cache cache) {
      ReplicationQueue queue = TestingUtil.extractComponent(cache, ReplicationQueue.class);
      if (queue != null) queue.reset();
   }
View Full Code Here

Examples of org.infinispan.remoting.ReplicationQueue

      Cache cache1 = cache(0, "replQueue");
      Cache cache2 = cache(1, "replQueue");
     
      //only place one element, queue size is 10.
      cache1.put("key", "value");
      ReplicationQueue replicationQueue = TestingUtil.extractComponent(cache1, ReplicationQueue.class);
      assert replicationQueue != null;
      assert replicationQueue.getElementsCount() == 1;
      assert cache2.get("key") == null;
      assert cache1.get("key").equals("value");

      ReplQueueTestScheduledExecutorFactory.command.run();

      //in next 5 secs, expect the replication to occur
      long start = System.currentTimeMillis();
      while (System.currentTimeMillis() - start < 5000) {
         if (cache2.get("key") != null) break;
         Thread.sleep(50);
      }
      assert cache2.get("key").equals("value");
      assert replicationQueue.getElementsCount() == 0;
   }
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.