Package org.infinispan.configuration.cache

Examples of org.infinispan.configuration.cache.TakeOfflineConfiguration


            ", failureCount=" + failureCount +
            '}';
   }

   public void amend(Integer afterFailures, Long minTimeToWait) {
      TakeOfflineConfiguration existing = getTakeOffline();
      int newAfterFailures = afterFailures == null ? existing.afterFailures() : afterFailures;
      long newMinTieToWait = minTimeToWait == null ? existing.minTimeToWait() : minTimeToWait;
      TakeOfflineConfiguration newConfig = new TakeOfflineConfiguration(newAfterFailures, newMinTieToWait);
      amend(newConfig);
   }
View Full Code Here


      assertEquals(admin("LON", 0).siteStatus("NYC"), XSiteAdminOperations.ONLINE);
      assertEquals(admin("LON", 1).siteStatus("NYC"), XSiteAdminOperations.ONLINE);

      BackupSenderImpl bs = backupSender("LON", 0);
      OfflineStatus offlineStatus = bs.getOfflineStatus("NYC");
      assertEquals(offlineStatus.getTakeOffline(), new TakeOfflineConfiguration(0, 0));

      assertEquals(XSiteAdminOperations.SUCCESS, admin("LON", 1).amendTakeOffline("NYC", 7, 12));
      assertEquals(offlineStatus.getTakeOffline(), new TakeOfflineConfiguration(7, 12));

      assertEquals(XSiteAdminOperations.SUCCESS, admin("LON", 1).setTakeOfflineAfterFailures("NYC", 8));
      assertEquals(offlineStatus.getTakeOffline(), new TakeOfflineConfiguration(8, 12));

      assertEquals(XSiteAdminOperations.SUCCESS, admin("LON", 1).setTakeOfflineMinTimeToWait("NYC", 13));
      assertEquals(offlineStatus.getTakeOffline(), new TakeOfflineConfiguration(8, 13));

      assertEquals(admin("LON", 0).getTakeOfflineAfterFailures("NYC"), "8");
      assertEquals(admin("LON", 0).getTakeOfflineMinTimeToWait("NYC"), "13");
      assertEquals(admin("LON", 1).getTakeOfflineAfterFailures("NYC"), "8");
      assertEquals(admin("LON", 1).getTakeOfflineMinTimeToWait("NYC"), "13");
View Full Code Here

*/
@Test (groups = "xsite, functional", testName = "xsite.offline.OfflineStatusTest")
public class OfflineStatusTest extends AbstractInfinispanTest {

   public void timeBasedTakeOffline() {
      final OfflineStatus offlineStatus = new OfflineStatus(new TakeOfflineConfiguration(10, 3000));

      assert !offlineStatus.isOffline();
      for (int i = 0; i < 9; i++) {
         offlineStatus.updateOnCommunicationFailure(now());
      }
View Full Code Here

      assert offlineStatus.isOffline();
      assert offlineStatus.minTimeHasElapsed();
   }

   public void testFailureBasedOnly() throws Throwable {
      final OfflineStatus offlineStatus = new OfflineStatus(new TakeOfflineConfiguration(10, 0));
      test(offlineStatus);
      offlineStatus.reset();
      test(offlineStatus);
   }
View Full Code Here

            ", failureCount=" + failureCount +
            '}';
   }

   public void amend(Integer afterFailures, Long minTimeToWait) {
      TakeOfflineConfiguration existing = getTakeOffline();
      int newAfterFailures = afterFailures == null ? existing.afterFailures() : afterFailures;
      long newMinTieToWait = minTimeToWait == null ? existing.minTimeToWait() : minTimeToWait;
      TakeOfflineConfiguration newConfig = new TakeOfflineConfiguration(newAfterFailures, newMinTieToWait);
      amend(newConfig);
   }
View Full Code Here

   public void testNoBackupFor() {
      Configuration dcc = cacheManager.getCacheConfiguration("noBackupFor");
      assertEquals(1, dcc.sites().allBackups().size());

      assertTrue(dcc.sites().allBackups().contains(new BackupConfiguration("NYC", BackupConfiguration.BackupStrategy.SYNC,
                                                                        12003, BackupFailurePolicy.WARN, null, new TakeOfflineConfiguration(0,0))));
      assertNull(dcc.sites().backupFor().remoteSite());
      assertNull(dcc.sites().backupFor().remoteCache());
   }
View Full Code Here

      assertNull(dcc.sites().backupFor().remoteCache());
   }

   private void testDefault(Configuration dcc) {
      BackupConfiguration nyc = new BackupConfiguration("NYC", BackupConfiguration.BackupStrategy.SYNC,
                                                        12003l, BackupFailurePolicy.IGNORE, null, new TakeOfflineConfiguration(0,0));
      BackupConfiguration sfo = new BackupConfiguration("SFO", BackupConfiguration.BackupStrategy.ASYNC,
                                                        10000l, BackupFailurePolicy.WARN, null, new TakeOfflineConfiguration(0,0));
      BackupConfiguration lon = new BackupConfiguration("LON", BackupConfiguration.BackupStrategy.SYNC,
                                                        10000l, BackupFailurePolicy.WARN, null, new TakeOfflineConfiguration(0,0));
      assertTrue(dcc.sites().allBackups().contains(nyc));
      assertTrue(dcc.sites().allBackups().contains(sfo));
      assertTrue(dcc.sites().allBackups().contains(lon));
      assertTrue(dcc.sites().inUseBackups().contains(nyc));
      assertTrue(dcc.sites().inUseBackups().contains(sfo));
View Full Code Here

      assertEquals(admin("LON", 0).status("NYC"), XSiteAdminOperations.ONLINE);
      assertEquals(admin("LON", 1).status("NYC"), XSiteAdminOperations.ONLINE);

      BackupSenderImpl bs = backupSender("LON", 0);
      OfflineStatus offlineStatus = bs.getOfflineStatus("NYC");
      assertEquals(offlineStatus.getTakeOffline(), new TakeOfflineConfiguration(0, 0));

      assertEquals(XSiteAdminOperations.SUCCESS, admin("LON", 1).amendTakeOffline("NYC", 7, 12));
      assertEquals(offlineStatus.getTakeOffline(), new TakeOfflineConfiguration(7, 12));

      assertEquals(XSiteAdminOperations.SUCCESS, admin("LON", 1).setTakeOfflineAfterFailures("NYC", 8));
      assertEquals(offlineStatus.getTakeOffline(), new TakeOfflineConfiguration(8, 12));

      assertEquals(XSiteAdminOperations.SUCCESS, admin("LON", 1).setTakeOfflineMinTimeToWait("NYC", 13));
      assertEquals(offlineStatus.getTakeOffline(), new TakeOfflineConfiguration(8, 13));

      assertEquals(admin("LON", 0).getTakeOfflineAfterFailures("NYC"), "8");
      assertEquals(admin("LON", 0).getTakeOfflineMinTimeToWait("NYC"), "13");
      assertEquals(admin("LON", 1).getTakeOfflineAfterFailures("NYC"), "8");
      assertEquals(admin("LON", 1).getTakeOfflineMinTimeToWait("NYC"), "13");
View Full Code Here

   public void testNoTakeOffline() {
      Configuration dcc = cacheManager.getCacheConfiguration("noTakeOffline");
      assertEquals(1, dcc.sites().allBackups().size());

      assertTrue(dcc.sites().allBackups().contains(new BackupConfiguration("NYC", BackupConfiguration.BackupStrategy.SYNC,
                                                                        12003, BackupFailurePolicy.WARN, null, new TakeOfflineConfiguration(0,0))));
      assertNull(dcc.sites().backupFor().remoteSite());
      assertNull(dcc.sites().backupFor().remoteCache());
   }
View Full Code Here

      assertNull(dcc.sites().backupFor().remoteCache());
   }
   public void testTakeOfflineDifferentConfig() {
      Configuration dcc = cacheManager.getCacheConfiguration("takeOfflineDifferentConfig");
      assertEquals(1, dcc.sites().allBackups().size());
      TakeOfflineConfiguration toc = new TakeOfflineConfiguration(321, 3765);
      assertTrue(dcc.sites().allBackups().contains(new BackupConfiguration("NYC", BackupConfiguration.BackupStrategy.SYNC,
                                                                        12003l, BackupFailurePolicy.IGNORE, null, toc)));

   }
View Full Code Here

TOP

Related Classes of org.infinispan.configuration.cache.TakeOfflineConfiguration

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.