Search in sources :

Example 46 with Label

use of io.mantisrx.common.Label in project mantis by Netflix.

the class JobClusterManagerTest method testJobClusterArtifactUpdate.

@Test
public void testJobClusterArtifactUpdate() throws MalformedURLException {
    TestKit probe = new TestKit(system);
    String clusterName = "testJobClusterArtifactUpdate";
    List<Label> labels = Lists.newLinkedList();
    final JobClusterDefinitionImpl fakeJobCluster = createFakeJobClusterDefn(clusterName, labels);
    jobClusterManagerActor.tell(new JobClusterManagerProto.CreateJobClusterRequest(fakeJobCluster, "user"), probe.getRef());
    JobClusterManagerProto.CreateJobClusterResponse createResp = probe.expectMsgClass(JobClusterManagerProto.CreateJobClusterResponse.class);
    assertEquals(SUCCESS_CREATED, createResp.responseCode);
    UpdateJobClusterArtifactRequest req = new JobClusterManagerProto.UpdateJobClusterArtifactRequest(clusterName, "myjar", "1.0.1", true, "user");
    jobClusterManagerActor.tell(req, probe.getRef());
    JobClusterManagerProto.UpdateJobClusterArtifactResponse updateResp = probe.expectMsgClass(JobClusterManagerProto.UpdateJobClusterArtifactResponse.class);
    assertEquals(SUCCESS, updateResp.responseCode);
    jobClusterManagerActor.tell(new GetJobClusterRequest(clusterName), probe.getRef());
    GetJobClusterResponse getResp = probe.expectMsgClass(GetJobClusterResponse.class);
    assertEquals(SUCCESS, getResp.responseCode);
    // assertEquals("myjar", getResp.getJobCluster().get().g.getArtifactName());
    assertEquals("1.0.1", getResp.getJobCluster().get().getLatestVersion());
}
Also used : GetJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobClusterResponse) UpdateJobClusterArtifactRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterArtifactRequest) Label(io.mantisrx.common.Label) JobClusterDefinitionImpl(io.mantisrx.server.master.domain.JobClusterDefinitionImpl) TestKit(akka.testkit.javadsl.TestKit) GetJobClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobClusterRequest) JobClusterManagerProto(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto) Test(org.junit.Test)

Example 47 with Label

use of io.mantisrx.common.Label in project mantis by Netflix.

the class DataFormatAdapterTest method completedJobToNamedJobCompletedJobTest.

@Test
public void completedJobToNamedJobCompletedJobTest() {
    String name = "name";
    String jobId = "name-1";
    String version = "0.0.1";
    JobState jobState = JobState.Completed;
    long submittedAt = 1234l;
    long terminatedAt = 2234l;
    String me = "me";
    List<Label> labels = new ArrayList<>();
    labels.add(new Label("l1", "v1"));
    JobClusterDefinitionImpl.CompletedJob cJob = new JobClusterDefinitionImpl.CompletedJob(name, jobId, version, jobState, submittedAt, terminatedAt, me, labels);
    NamedJob.CompletedJob njobCJob = DataFormatAdapter.convertCompletedJobToNamedJobCompletedJob(cJob);
    assertEquals(name, njobCJob.getName());
    assertEquals(jobId, njobCJob.getJobId());
    assertEquals(version, njobCJob.getVersion());
    assertEquals(MantisJobState.Completed, njobCJob.getState());
    assertEquals(submittedAt, njobCJob.getSubmittedAt());
    assertEquals(terminatedAt, njobCJob.getTerminatedAt());
    JobClusterDefinitionImpl.CompletedJob reconverted = DataFormatAdapter.convertNamedJobCompletedJobToCompletedJob(njobCJob);
    assertEquals(cJob, reconverted);
}
Also used : NamedJob(io.mantisrx.server.master.store.NamedJob) Label(io.mantisrx.common.Label) ArrayList(java.util.ArrayList) JobState(io.mantisrx.master.jobcluster.job.JobState) MantisJobState(io.mantisrx.runtime.MantisJobState) Test(org.junit.Test)

Aggregations

Label (io.mantisrx.common.Label)47 Test (org.junit.Test)43 ArrayList (java.util.ArrayList)30 JobDefinition (io.mantisrx.server.master.domain.JobDefinition)15 TestKit (akka.testkit.javadsl.TestKit)14 JobClusterDefinitionImpl (io.mantisrx.server.master.domain.JobClusterDefinitionImpl)13 InvalidJobException (io.mantisrx.runtime.command.InvalidJobException)11 GetJobClusterRequest (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobClusterRequest)8 GetJobClusterResponse (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobClusterResponse)8 Parameter (io.mantisrx.runtime.parameter.Parameter)8 ActorRef (akka.actor.ActorRef)7 JobClusterManagerProto (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto)7 JobClusterProto (io.mantisrx.master.jobcluster.proto.JobClusterProto)7 MantisJobStore (io.mantisrx.server.master.persistence.MantisJobStore)7 MantisScheduler (io.mantisrx.server.master.scheduler.MantisScheduler)7 Matchers.anyString (org.mockito.Matchers.anyString)7 JobId (io.mantisrx.server.master.domain.JobId)6 SchedulingInfo (io.mantisrx.runtime.descriptor.SchedulingInfo)4 DisableJobClusterRequest (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.DisableJobClusterRequest)3 JobSla (io.mantisrx.runtime.JobSla)3