Search in sources :

Example 11 with GetJobDetails

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

the class GetGafferResultCacheExportExample method exportAndGetJobDetails.

public JobDetail exportAndGetJobDetails() {
    // ---------------------------------------------------------
    final OperationChain<JobDetail> opChain = new OperationChain.Builder().first(new GetAllElements()).then(new ExportToGafferResultCache<>()).then(new DiscardOutput()).then(new GetJobDetails()).build();
    // ---------------------------------------------- -----------
    jobDetail = runExample(opChain, null);
    return jobDetail;
}
Also used : JobDetail(uk.gov.gchq.gaffer.jobtracker.JobDetail) GetJobDetails(uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails) OperationChain(uk.gov.gchq.gaffer.operation.OperationChain) GetAllElements(uk.gov.gchq.gaffer.operation.impl.get.GetAllElements) ExportToGafferResultCache(uk.gov.gchq.gaffer.operation.impl.export.resultcache.ExportToGafferResultCache) DiscardOutput(uk.gov.gchq.gaffer.operation.impl.DiscardOutput)

Example 12 with GetJobDetails

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

the class GetJobDetailsExample method getJobDetailsInOperationChain.

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

Example 13 with GetJobDetails

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

the class GetJobDetailsTest method shouldJSONSerialiseAndDeserialise.

@Test
public void shouldJSONSerialiseAndDeserialise() throws SerialisationException {
    // Given
    final GetJobDetails operation = new GetJobDetails.Builder().jobId("jobId").build();
    // When
    byte[] json = JSONSerialiser.serialise(operation, true);
    final GetJobDetails deserialisedOp = JSONSerialiser.deserialise(json, GetJobDetails.class);
    // Then
    assertEquals("jobId", deserialisedOp.getJobId());
}
Also used : GetJobDetails(uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails) Test(org.junit.jupiter.api.Test) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest)

Example 14 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) Test(org.junit.jupiter.api.Test) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest)

Example 15 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
    assertThatExceptionOfType(OperationException.class).isThrownBy(() -> handler.doOperation(operation, new Context(user), store)).extracting("message").isNotNull();
}
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.jupiter.api.Test)

Aggregations

GetJobDetails (uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails)17 JobDetail (uk.gov.gchq.gaffer.jobtracker.JobDetail)12 Test (org.junit.jupiter.api.Test)7 ExportToGafferResultCache (uk.gov.gchq.gaffer.operation.impl.export.resultcache.ExportToGafferResultCache)6 User (uk.gov.gchq.gaffer.user.User)6 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)5 DiscardOutput (uk.gov.gchq.gaffer.operation.impl.DiscardOutput)5 GetAllEdges (uk.gov.gchq.gaffer.operation.impl.get.GetAllEdges)5 GetAllElements (uk.gov.gchq.gaffer.operation.impl.get.GetAllElements)5 OperationTest (uk.gov.gchq.gaffer.operation.OperationTest)4 OperationException (uk.gov.gchq.gaffer.operation.OperationException)3 Context (uk.gov.gchq.gaffer.store.Context)3 Store (uk.gov.gchq.gaffer.store.Store)3 Test (org.junit.Test)2 JobTracker (uk.gov.gchq.gaffer.jobtracker.JobTracker)2 CloseableIterable (uk.gov.gchq.gaffer.commonutil.iterable.CloseableIterable)1 GroupCounts (uk.gov.gchq.gaffer.data.GroupCounts)1 Element (uk.gov.gchq.gaffer.data.element.Element)1 EntityId (uk.gov.gchq.gaffer.data.element.id.EntityId)1 Builder (uk.gov.gchq.gaffer.operation.OperationChain.Builder)1