예제 #1
0
  protected List<String> setupDefaultMaster(final int offset, String... args) throws Exception {
    // TODO (dano): Move this bootstrapping to something reusable
    final CuratorFramework curator = zk.curatorWithSuperAuth();
    curator.newNamespaceAwareEnsurePath(Paths.configHosts()).ensure(curator.getZookeeperClient());
    curator.newNamespaceAwareEnsurePath(Paths.configJobs()).ensure(curator.getZookeeperClient());
    curator.newNamespaceAwareEnsurePath(Paths.configJobRefs()).ensure(curator.getZookeeperClient());
    curator.newNamespaceAwareEnsurePath(Paths.statusHosts()).ensure(curator.getZookeeperClient());
    curator.newNamespaceAwareEnsurePath(Paths.statusMasters()).ensure(curator.getZookeeperClient());
    curator.newNamespaceAwareEnsurePath(Paths.historyJobs()).ensure(curator.getZookeeperClient());
    curator
        .newNamespaceAwareEnsurePath(Paths.configId(zkClusterId))
        .ensure(curator.getZookeeperClient());

    final List<String> argsList =
        Lists.newArrayList(
            "-vvvv",
            "--no-log-setup",
            "--http",
            "http://0.0.0.0:" + (masterPort() + offset),
            "--admin",
            "http://0.0.0.0:" + (masterAdminPort() + offset),
            "--domain",
            "",
            "--zk",
            zk.connectString(),
            "--zk-enable-acls",
            "--zk-acl-agent-user",
            AGENT_USER,
            "--zk-acl-agent-digest",
            AGENT_DIGEST,
            "--zk-acl-master-user",
            MASTER_USER,
            "--zk-acl-master-password",
            MASTER_PASSWORD);

    final String name;
    if (asList(args).contains("--name")) {
      name = args[asList(args).indexOf("--name") + 1];
    } else {
      name = TEST_MASTER + offset;
      argsList.addAll(asList("--name", TEST_MASTER));
    }

    final String stateDir = masterStateDirs.resolve(name).toString();
    argsList.addAll(asList("--state-dir", stateDir));

    argsList.addAll(asList(args));

    return argsList;
  }
예제 #2
0
 protected AgentMain startDefaultAgent(final String host, final String... args) throws Exception {
   final String stateDir = agentStateDirs.resolve(host).toString();
   final List<String> argsList =
       Lists.newArrayList(
           "-vvvv",
           "--no-log-setup",
           "--no-http",
           "--name",
           host,
           "--docker=" + DOCKER_HOST,
           "--zk",
           zk.connectString(),
           "--zk-session-timeout",
           "100",
           "--zk-connection-timeout",
           "100",
           "--zk-enable-acls",
           "--zk-acl-master-user",
           MASTER_USER,
           "--zk-acl-master-digest",
           MASTER_DIGEST,
           "--zk-acl-agent-user",
           AGENT_USER,
           "--zk-acl-agent-password",
           AGENT_PASSWORD,
           "--state-dir",
           stateDir,
           "--domain",
           "",
           "--port-range="
               + dockerPortRange.lowerEndpoint()
               + ":"
               + dockerPortRange.upperEndpoint());
   argsList.addAll(asList(args));
   return startAgent(argsList.toArray(new String[argsList.size()]));
 }