Search in sources :

Example 11 with OctaneTaskAbridged

use of com.hp.octane.integrations.dto.connectivity.OctaneTaskAbridged in project octane-ci-java-sdk by MicroFocus.

the class TaskingServiceTests method testRunAPI.

@Test
public void testRunAPI() {
    TasksProcessor tasksProcessor = client.getTasksProcessor();
    Assert.assertNotNull(tasksProcessor);
    OctaneTaskAbridged taskAbridged = dtoFactory.newDTO(OctaneTaskAbridged.class).setId(UUID.randomUUID().toString()).setUrl(OctaneSPEndpointSimulator.getSimulatorUrl() + APIPrefix + "/jobs/job-a/run");
    OctaneResultAbridged resultAbridged = tasksProcessor.execute(taskAbridged);
    Assert.assertNotNull(resultAbridged);
    Assert.assertEquals(HttpStatus.SC_CREATED, resultAbridged.getStatus());
    Assert.assertEquals(taskAbridged.getId(), resultAbridged.getId());
    Assert.assertEquals(client.getInstanceId(), resultAbridged.getServiceId());
    Assert.assertNull(resultAbridged.getBody());
}
Also used : OctaneResultAbridged(com.hp.octane.integrations.dto.connectivity.OctaneResultAbridged) OctaneTaskAbridged(com.hp.octane.integrations.dto.connectivity.OctaneTaskAbridged) Test(org.junit.Test)

Example 12 with OctaneTaskAbridged

use of com.hp.octane.integrations.dto.connectivity.OctaneTaskAbridged in project octane-ci-java-sdk by MicroFocus.

the class TaskingServiceTests method testJobSpecificAPI.

@Test
public void testJobSpecificAPI() {
    TasksProcessor tasksProcessor = client.getTasksProcessor();
    Assert.assertNotNull(tasksProcessor);
    OctaneTaskAbridged taskAbridged = dtoFactory.newDTO(OctaneTaskAbridged.class).setId(UUID.randomUUID().toString()).setUrl(OctaneSPEndpointSimulator.getSimulatorUrl() + APIPrefix + "/jobs/job-a");
    OctaneResultAbridged resultAbridged = tasksProcessor.execute(taskAbridged);
    runCommonAsserts(resultAbridged, taskAbridged.getId(), HttpStatus.SC_OK);
    PipelineNode pipeline = dtoFactory.dtoFromJson(resultAbridged.getBody(), PipelineNode.class);
    Assert.assertNotNull(pipeline);
    Assert.assertEquals("job-a", pipeline.getJobCiId());
    Assert.assertEquals("Job A", pipeline.getName());
    Assert.assertNotNull(pipeline.getPhasesInternal());
    Assert.assertTrue(pipeline.getPhasesInternal().isEmpty());
    Assert.assertNotNull(pipeline.getPhasesPostBuild());
    Assert.assertTrue(pipeline.getPhasesPostBuild().isEmpty());
    Assert.assertNotNull(pipeline.getParameters());
    Assert.assertTrue(pipeline.getParameters().isEmpty());
    Assert.assertNull(pipeline.getMultiBranchType());
}
Also used : OctaneResultAbridged(com.hp.octane.integrations.dto.connectivity.OctaneResultAbridged) PipelineNode(com.hp.octane.integrations.dto.pipelines.PipelineNode) OctaneTaskAbridged(com.hp.octane.integrations.dto.connectivity.OctaneTaskAbridged) Test(org.junit.Test)

Example 13 with OctaneTaskAbridged

use of com.hp.octane.integrations.dto.connectivity.OctaneTaskAbridged in project octane-ci-java-sdk by MicroFocus.

the class TaskingServiceTests method testJobNoImplementedAPI.

@Test
public void testJobNoImplementedAPI() {
    TasksProcessor tasksProcessor = client.getTasksProcessor();
    Assert.assertNotNull(tasksProcessor);
    OctaneTaskAbridged taskAbridged = dtoFactory.newDTO(OctaneTaskAbridged.class).setId(UUID.randomUUID().toString()).setUrl(OctaneSPEndpointSimulator.getSimulatorUrl() + APIPrefix + "/jobs");
    TaskingTestPluginServicesTest.getJobsAPIReturnNull = true;
    OctaneResultAbridged resultAbridged = tasksProcessor.execute(taskAbridged);
    TaskingTestPluginServicesTest.getJobsAPIReturnNull = false;
    runCommonAsserts(resultAbridged, taskAbridged.getId(), HttpStatus.SC_NOT_IMPLEMENTED);
}
Also used : OctaneResultAbridged(com.hp.octane.integrations.dto.connectivity.OctaneResultAbridged) OctaneTaskAbridged(com.hp.octane.integrations.dto.connectivity.OctaneTaskAbridged) Test(org.junit.Test)

Example 14 with OctaneTaskAbridged

use of com.hp.octane.integrations.dto.connectivity.OctaneTaskAbridged in project octane-ci-java-sdk by MicroFocus.

the class TaskingServiceTests method testRunNotImplementedAPI.

@Test
public void testRunNotImplementedAPI() {
    TasksProcessor tasksProcessor = client.getTasksProcessor();
    Assert.assertNotNull(tasksProcessor);
    OctaneTaskAbridged taskAbridged = dtoFactory.newDTO(OctaneTaskAbridged.class).setId(UUID.randomUUID().toString()).setUrl(OctaneSPEndpointSimulator.getSimulatorUrl() + APIPrefix + "/jobs/job-a/run");
    TaskingTestPluginServicesTest.runAPINotImplemented = true;
    OctaneResultAbridged resultAbridged = tasksProcessor.execute(taskAbridged);
    TaskingTestPluginServicesTest.runAPINotImplemented = false;
    Assert.assertNotNull(resultAbridged);
    Assert.assertEquals(HttpStatus.SC_NOT_IMPLEMENTED, resultAbridged.getStatus());
    Assert.assertEquals(taskAbridged.getId(), resultAbridged.getId());
    Assert.assertEquals(client.getInstanceId(), resultAbridged.getServiceId());
    Assert.assertNull(resultAbridged.getBody());
}
Also used : OctaneResultAbridged(com.hp.octane.integrations.dto.connectivity.OctaneResultAbridged) OctaneTaskAbridged(com.hp.octane.integrations.dto.connectivity.OctaneTaskAbridged) Test(org.junit.Test)

Aggregations

OctaneTaskAbridged (com.hp.octane.integrations.dto.connectivity.OctaneTaskAbridged)14 Test (org.junit.Test)13 OctaneResultAbridged (com.hp.octane.integrations.dto.connectivity.OctaneResultAbridged)11 PipelineNode (com.hp.octane.integrations.dto.pipelines.PipelineNode)3 CIJobsList (com.hp.octane.integrations.dto.general.CIJobsList)2 TaskProcessingErrorBody (com.hp.octane.integrations.dto.connectivity.TaskProcessingErrorBody)1 CIParameter (com.hp.octane.integrations.dto.parameters.CIParameter)1 OctaneSPEndpointSimulator (com.hp.octane.integrations.testhelpers.OctaneSPEndpointSimulator)1 GZIPInputStream (java.util.zip.GZIPInputStream)1 Response (org.eclipse.jetty.server.Response)1