コード例 #1
0
  @Test
  public void testHotRestart() {
    String dir = "/mnt/hot-restart-root/";
    int validationTimeout = 13131;
    int dataLoadTimeout = 45454;
    String xml =
        "<hazelcast xmlns=\"http://www.hazelcast.com/schema/config\">\n"
            + "<hot-restart-persistence enabled=\"true\">"
            + "<base-dir>"
            + dir
            + "</base-dir>"
            + "<validation-timeout-seconds>"
            + validationTimeout
            + "</validation-timeout-seconds>"
            + "<data-load-timeout-seconds>"
            + dataLoadTimeout
            + "</data-load-timeout-seconds>"
            + "</hot-restart-persistence>\n"
            + "</hazelcast>";

    Config config = new InMemoryXmlConfig(xml);
    HotRestartPersistenceConfig hotRestartPersistenceConfig =
        config.getHotRestartPersistenceConfig();
    assertTrue(hotRestartPersistenceConfig.isEnabled());
    assertEquals(
        new File(dir).getAbsolutePath(),
        hotRestartPersistenceConfig.getBaseDir().getAbsolutePath());
    assertEquals(validationTimeout, hotRestartPersistenceConfig.getValidationTimeoutSeconds());
    assertEquals(dataLoadTimeout, hotRestartPersistenceConfig.getDataLoadTimeoutSeconds());
  }
コード例 #2
0
 @Test
 public void testHotRestart() {
   File dir = new File("/mnt/hot-restart/");
   HotRestartPersistenceConfig hotRestartPersistenceConfig =
       config.getHotRestartPersistenceConfig();
   assertTrue(hotRestartPersistenceConfig.isEnabled());
   assertEquals(dir.getAbsolutePath(), hotRestartPersistenceConfig.getBaseDir().getAbsolutePath());
   assertEquals(1111, hotRestartPersistenceConfig.getValidationTimeoutSeconds());
   assertEquals(2222, hotRestartPersistenceConfig.getDataLoadTimeoutSeconds());
 }