Package com.spotify.helios.common.protocol

Examples of com.spotify.helios.common.protocol.CreateJobResponse


        .setVersion(testJobVersion)
        .setImage(BUSYBOX)
        .setCommand(IDLE_COMMAND)
        .build();
    final JobId jobId = job.getId();
    final CreateJobResponse created = client.createJob(job).get();
    assertEquals(CreateJobResponse.Status.OK, created.getStatus());

    final Deployment deployment = Deployment.of(jobId, START);
    final JobDeployResponse deployed = client.deploy(deployment, testHost()).get();
    assertEquals(JobDeployResponse.Status.OK, deployed.getStatus());
View Full Code Here


    client = defaultClient();
  }

  @Test
  public void verifyCanDeployOnSeveralHosts() throws Exception {
    final CreateJobResponse created = client.createJob(job).get();
    assertEquals(CreateJobResponse.Status.OK, created.getStatus());

    final List<AgentMain> agents = Lists.newArrayList();

    for (int i = 0; i < HOSTS; i++) {
      final AgentMain agent =
View Full Code Here

        // if job had an id coming in, preserve it
        .setHash(job.getId().getHash())
        .build();
    final String jobIdString = actualJob.getId().toString();
    if (!errors.isEmpty()) {
      throw badRequest(new CreateJobResponse(INVALID_JOB_DEFINITION, ImmutableList.copyOf(errors),
          jobIdString));
    }
    try {
      model.addJob(actualJob);
    } catch (JobExistsException e) {
      throw badRequest(new CreateJobResponse(JOB_ALREADY_EXISTS, ImmutableList.<String>of(),
          jobIdString));
    }
    log.info("created job: {}", actualJob);
    return new CreateJobResponse(CreateJobResponse.Status.OK, ImmutableList.<String>of(),
        jobIdString);
  }
View Full Code Here

    }
  }

  @Test
  public void deployJobx() throws Exception {
    final CreateJobResponse createResult = client.createJob(Job.newBuilder()
        .setVersion("" + System.currentTimeMillis())
        .setName(JOB_NAME)
        .setImage(BUSYBOX)
        .setCommand(IDLE_COMMAND)
        .build()).get();
    id = JobId.fromString(createResult.getId());

    assertEquals(CreateJobResponse.Status.OK, createResult.getStatus());

    final Map<JobId, Job> jobMap = client.jobs(JOB_NAME).get();
    boolean found = false;
    for (Entry<JobId, Job> entry : jobMap.entrySet()) {
      if (entry.getKey().toString().equals(createResult.getId())) {
        found = true;
        break;
      }
    }
    assertTrue("expected to find job I just created in results", found);
View Full Code Here

    assertTrue("expected to find job I just created in results", found);
  }

  @Test
  public void deployJob() throws Exception {
    final CreateJobResponse createResult = client.createJob(Job.newBuilder()
      .setVersion("" + System.currentTimeMillis())
      .setName(JOB_NAME)
      .setImage(BUSYBOX)
      .setCommand(IDLE_COMMAND)
      .build()).get();
    id = JobId.fromString(createResult.getId());

    assertEquals(CreateJobResponse.Status.OK, createResult.getStatus());

    final List<String> hosts = client.listHosts().get();
    deployHost = Iterables.get(hosts, 0);
    final JobDeployResponse deployResult = client.deploy(
        new Deployment(id, Goal.START, Deployment.EMTPY_DEPLOYER_USER),
View Full Code Here

  void deploy() {
    try {
      // Create job
      log.info("Creating job {}", job.getId().toShortString());
      final CreateJobResponse createResponse = get(client.createJob(job));
      if (createResponse.getStatus() != CreateJobResponse.Status.OK) {
        fail(format("Failed to create job %s - %s", job.getId(),
                    createResponse.toString()));
      }

      // Deploy job
      final Deployment deployment = Deployment.of(job.getId(), Goal.START);
      for (final String host : hosts) {
View Full Code Here

    }
  }

  @Test
  public void testClient() throws Exception {
    final CreateJobResponse created = client.createJob(job).get();
    assertEquals(CreateJobResponse.Status.OK, created.getStatus());

    JobId jobId = job.getId();
    // Wait for agent to come up
    awaitHostRegistered(client, testHost(), LONG_WAIT_SECONDS, SECONDS);
    awaitHostStatus(client, testHost(), UP, LONG_WAIT_SECONDS, SECONDS);
View Full Code Here

    assertEquals(START, status2.getGoal());
    assertEquals(RUNNING, status2.getState());
  }

  private JobId createAndAwaitJobRunning() throws Exception {
    final CreateJobResponse jobby = client.createJob(job).get();
    assertEquals(CreateJobResponse.Status.OK, jobby.getStatus());
    final JobId jobId = job.getId();
    final JobDeployResponse deployResponse = client.deploy(
        Deployment.of(jobId, START), TEST_HOST).get();
    assertEquals(JobDeployResponse.Status.OK, deployResponse.getStatus());
    awaitJobState(client, TEST_HOST, jobId, State.RUNNING, 30, TimeUnit.SECONDS);
View Full Code Here

        .setImage(BUSYBOX)
        .setCommand(IDLE_COMMAND)
        .setPorts(ImmutableMap.of("foo", PortMapping.of(10002, externalPort)))
        .build();

    final CreateJobResponse created1 = client.createJob(job1).get();
    assertEquals(CreateJobResponse.Status.OK, created1.getStatus());

    final CreateJobResponse created2 = client.createJob(job2).get();
    assertEquals(CreateJobResponse.Status.OK, created2.getStatus());

    final Deployment deployment1 = Deployment.of(job1.getId(), STOP);
    final JobDeployResponse deployed1 = client.deploy(deployment1, testHost()).get();
    assertEquals(JobDeployResponse.Status.OK, deployed1.getStatus());
View Full Code Here

        .build();
  }

  @Test
  public void testClient() throws Exception {
    final CreateJobResponse created = client.createJob(job).get();
    assertEquals(CreateJobResponse.Status.OK, created.getStatus());
    assertVolumes(job.getId());
  }
View Full Code Here

TOP

Related Classes of com.spotify.helios.common.protocol.CreateJobResponse

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.