Search in sources :

Example 6 with GetJobDetails

use of uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails in project Gaffer by gchq.

the class GetJobDetailsTest method builderShouldCreatePopulatedOperation.

@Test
@Override
public void builderShouldCreatePopulatedOperation() {
    // When
    final GetJobDetails op = new GetJobDetails.Builder().jobId("jobId").build();
    // Then
    assertEquals("jobId", op.getJobId());
}
Also used : GetJobDetails(uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest) Test(org.junit.Test)

Example 7 with GetJobDetails

use of uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails in project Gaffer by gchq.

the class GetJobDetailsExample method getJobDetailsInOperationChain.

public JobDetail getJobDetailsInOperationChain() {
    // ---------------------------------------------------------
    final OperationChain<JobDetail> opChain = new OperationChain.Builder().first(new GetAllEdges()).then(new GetJobDetails()).build();
    // ---------------------------------------------------------
    final JobDetail jobDetail = runExample(opChain);
    jobId = jobDetail.getJobId();
    return jobDetail;
}
Also used : GetJobDetails(uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails) JobDetail(uk.gov.gchq.gaffer.jobtracker.JobDetail) GetAllEdges(uk.gov.gchq.gaffer.operation.impl.get.GetAllEdges) OperationChain(uk.gov.gchq.gaffer.operation.OperationChain)

Example 8 with GetJobDetails

use of uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails in project Gaffer by gchq.

the class GetJobResultsExample method runExamples.

@Override
public void runExamples() {
    try {
        final OperationChain<JobDetail> opChain = new OperationChain.Builder().first(new GetAllEdges()).then(new ExportToGafferResultCache()).then(new GetJobDetails()).build();
        final JobDetail jobDetails = getGraph().execute(opChain, new User("user01"));
        jobId = jobDetails.getJobId();
    } catch (final OperationException e) {
        throw new RuntimeException(e);
    }
    getJobResults();
}
Also used : GetJobDetails(uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails) JobDetail(uk.gov.gchq.gaffer.jobtracker.JobDetail) User(uk.gov.gchq.gaffer.user.User) GetAllEdges(uk.gov.gchq.gaffer.operation.impl.get.GetAllEdges) ExportToGafferResultCache(uk.gov.gchq.gaffer.operation.impl.export.resultcache.ExportToGafferResultCache) OperationException(uk.gov.gchq.gaffer.operation.OperationException)

Example 9 with GetJobDetails

use of uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails in project Gaffer by gchq.

the class GetJobDetailsHandlerTest method shouldGetJobDetailsByDelegatingToJobTrackerWithOperationJobId.

@Test
public void shouldGetJobDetailsByDelegatingToJobTrackerWithOperationJobId() throws OperationException {
    // Given
    final String jobId = "jobId";
    final GetJobDetailsHandler handler = new GetJobDetailsHandler();
    final GetJobDetails operation = new GetJobDetails.Builder().jobId(jobId).build();
    final Store store = mock(Store.class);
    final JobTracker jobTracker = mock(JobTracker.class);
    final User user = mock(User.class);
    final JobDetail jobsDetail = mock(JobDetail.class);
    final Context context = new Context(user);
    given(store.getJobTracker()).willReturn(jobTracker);
    given(jobTracker.getJob(jobId, user)).willReturn(jobsDetail);
    // When
    final JobDetail result = handler.doOperation(operation, context, store);
    // Then
    assertSame(jobsDetail, result);
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) GetJobDetails(uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails) JobDetail(uk.gov.gchq.gaffer.jobtracker.JobDetail) User(uk.gov.gchq.gaffer.user.User) JobTracker(uk.gov.gchq.gaffer.jobtracker.JobTracker) Store(uk.gov.gchq.gaffer.store.Store) Test(org.junit.Test)

Example 10 with GetJobDetails

use of uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails in project Gaffer by gchq.

the class GetJobDetailsHandlerTest method shouldThrowExceptionIfJobTrackerIsNotConfigured.

@Test
public void shouldThrowExceptionIfJobTrackerIsNotConfigured() {
    // Given
    final GetJobDetailsHandler handler = new GetJobDetailsHandler();
    final GetJobDetails operation = mock(GetJobDetails.class);
    final Store store = mock(Store.class);
    final User user = mock(User.class);
    given(store.getJobTracker()).willReturn(null);
    // When / Then
    try {
        handler.doOperation(operation, new Context(user), store);
        fail("Exception expected");
    } catch (final OperationException e) {
        assertNotNull(e.getMessage());
    }
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) GetJobDetails(uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails) User(uk.gov.gchq.gaffer.user.User) Store(uk.gov.gchq.gaffer.store.Store) OperationException(uk.gov.gchq.gaffer.operation.OperationException) Test(org.junit.Test)

Aggregations

GetJobDetails (uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails)10 JobDetail (uk.gov.gchq.gaffer.jobtracker.JobDetail)7 Test (org.junit.Test)6 GetAllEdges (uk.gov.gchq.gaffer.operation.impl.get.GetAllEdges)5 User (uk.gov.gchq.gaffer.user.User)5 ExportToGafferResultCache (uk.gov.gchq.gaffer.operation.impl.export.resultcache.ExportToGafferResultCache)3 Context (uk.gov.gchq.gaffer.store.Context)3 Store (uk.gov.gchq.gaffer.store.Store)3 JobTracker (uk.gov.gchq.gaffer.jobtracker.JobTracker)2 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)2 OperationException (uk.gov.gchq.gaffer.operation.OperationException)2 OperationTest (uk.gov.gchq.gaffer.operation.OperationTest)2