Examples of instanceConfig()


Examples of org.apache.helix.PropertyKey.Builder.instanceConfig()

      boolean wantEnabled) {
    ZKHelixDataAccessor accessor =
        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
    Builder keyBuilder = accessor.keyBuilder();

    InstanceConfig config = accessor.getProperty(keyBuilder.instanceConfig(instance));
    AssertJUnit.assertEquals(wantEnabled, config.getInstanceEnabled());
  }

  private void verifyInstance(ZkClient zkClient, String clusterName, String instance,
      boolean wantExists) {
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.instanceConfig()

    });
    ClusterSetup.processCommandLineArgs(new String[] {
        "--zkSvr", _zkaddr, "--dropNode", clusterName, "localhost:12918"
    });

    Assert.assertNull(accessor.getProperty(keyBuilder.instanceConfig("localhost_12918")),
        "Instance config should be dropped");
    Assert.assertFalse(_zkclient.exists(PropertyPathConfig.getPath(PropertyType.INSTANCES,
        clusterName, "localhost_12918")), "Instance/host should be dropped");

    System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.instanceConfig()

    if (liveInstance != null) {
      throw new HelixException("Can't drop " + instanceId + ", please stop " + instanceId
          + " before drop it");
    }

    InstanceConfig config = accessor.getProperty(keyBuilder.instanceConfig(instanceId));
    if (config == null) {
      String error = "Node " + instanceId + " does not exist, cannot drop";
      _logger.warn(error);
      throw new HelixException(error);
    }
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.instanceConfig()

  public void swapInstance(String clusterName, String oldInstanceName, String newInstanceName) {
    ZKHelixDataAccessor accessor =
        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
    Builder keyBuilder = accessor.keyBuilder();

    InstanceConfig oldConfig = accessor.getProperty(keyBuilder.instanceConfig(oldInstanceName));
    if (oldConfig == null) {
      String error = "Old instance " + oldInstanceName + " does not exist, cannot swap";
      _logger.warn(error);
      throw new HelixException(error);
    }
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.instanceConfig()

      String error = "Old instance " + oldInstanceName + " does not exist, cannot swap";
      _logger.warn(error);
      throw new HelixException(error);
    }

    InstanceConfig newConfig = accessor.getProperty(keyBuilder.instanceConfig(newInstanceName));
    if (newConfig == null) {
      String error = "New instance " + newInstanceName + " does not exist, cannot swap";
      _logger.warn(error);
      throw new HelixException(error);
    }
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.instanceConfig()

    // test change content
    HelixDataAccessor accessor = manager.getHelixDataAccessor();
    Builder keyBuilder = accessor.keyBuilder();
    String instanceName = "localhost_12918";
    HelixProperty value = accessor.getProperty(keyBuilder.instanceConfig(instanceName));
    value._record.setSimpleField("" + System.currentTimeMillis(), "newValue");
    listener._instanceConfigChanged = false;
    accessor.setProperty(keyBuilder.instanceConfig(instanceName), value);
    Thread.sleep(1000); // wait zk callback
    Assert.assertTrue(listener._instanceConfigChanged,
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.instanceConfig()

    Builder keyBuilder = accessor.keyBuilder();
    String instanceName = "localhost_12918";
    HelixProperty value = accessor.getProperty(keyBuilder.instanceConfig(instanceName));
    value._record.setSimpleField("" + System.currentTimeMillis(), "newValue");
    listener._instanceConfigChanged = false;
    accessor.setProperty(keyBuilder.instanceConfig(instanceName), value);
    Thread.sleep(1000); // wait zk callback
    Assert.assertTrue(listener._instanceConfigChanged,
        "Should get instanceConfig callback invoked since we change instanceConfig");

    value = accessor.getProperty(keyBuilder.clusterConfig());
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.instanceConfig()

      instanceConfig.setPort(Integer.toString(i));
      LiveInstance liveInstance = new LiveInstance(instanceName);
      liveInstance.setSessionId("session_" + i);

      Builder keyBuilder = accessor.keyBuilder();
      accessor.setProperty(keyBuilder.instanceConfig(instanceName), instanceConfig);
      accessor.setProperty(keyBuilder.liveInstance(instanceName), liveInstance);
    }
  }

  protected void runStage(ClusterEvent event, Stage stage) {
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.instanceConfig()

    instanceConfig.setPort("3");

    HelixDataAccessor accessor = manager.getHelixDataAccessor();
    Builder keyBuilder = accessor.keyBuilder();
    accessor.setProperty(keyBuilder.liveInstance(instanceName), liveInstance);
    accessor.setProperty(keyBuilder.instanceConfig(instanceName), instanceConfig);

    String oldResource = "testResourceOld";
    CurrentState currentState = new CurrentState(oldResource);
    currentState.setState(PartitionId.from("testResourceOld_0"), State.from("OFFLINE"));
    currentState.setState(PartitionId.from("testResourceOld_1"), State.from("SLAVE"));
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.instanceConfig()

      String instance = "localhost_" + instances[i];
      InstanceConfig instanceConfig = new InstanceConfig(instance);
      instanceConfig.setHostName("localhost");
      instanceConfig.setPort("" + instances[i]);
      instanceConfig.setInstanceEnabled(true);
      accessor.setProperty(keyBuilder.instanceConfig(instance), instanceConfig);
    }
  }
}
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.