use of uk.gov.gchq.gaffer.operation.impl.DiscardOutput in project Gaffer by gchq.
the class OperationAuthoriserTest method shouldAcceptOperationChainWhenUserHasAllOpAuths.
@Test
public void shouldAcceptOperationChainWhenUserHasAllOpAuths() {
// Given
final OperationAuthoriser hook = fromJson(OP_AUTHS_PATH);
final OperationChain opChain = new OperationChain.Builder().first(new GetElements()).then(new GenerateObjects<>()).then(new DiscardOutput()).then(new TestOperationsImpl(Collections.singletonList(new Sort()))).build();
final User user = new User.Builder().opAuths("SuperUser", "ReadUser", "User").build();
// When
hook.preExecute(opChain, new Context(user));
// Then - no exceptions
}
use of uk.gov.gchq.gaffer.operation.impl.DiscardOutput in project Gaffer by gchq.
the class ExportIT method shouldExportResultsInSet.
@Test
public void shouldExportResultsInSet() throws OperationException {
// Given
final View edgesView = new View.Builder().edge(TestGroups.EDGE).build();
final OperationChain<Iterable<?>> exportOpChain = new Builder().first(new GetElements.Builder().input(new EntitySeed(SOURCE_DIR_0)).view(edgesView).build()).then(new ExportToSet<>()).then(new GenerateObjects.Builder<EntityId>().generator(new EntityIdExtractor()).build()).then(new GetElements.Builder().view(edgesView).build()).then(new ExportToSet<>()).then(new DiscardOutput()).then(new GetSetExport()).build();
// When
final Iterable<?> export = graph.execute(exportOpChain, getUser());
// Then
assertThat(Sets.newHashSet(export)).hasSize(2);
}
use of uk.gov.gchq.gaffer.operation.impl.DiscardOutput in project Gaffer by gchq.
the class ExportIT method shouldExportResultsToGafferCache.
@Test
public void shouldExportResultsToGafferCache() throws OperationException {
assumeThat(graph.isSupported(ExportToGafferResultCache.class)).as("Gaffer result cache has not been enabled for this store.").isTrue();
// Given
final View edgesView = new View.Builder().edge(TestGroups.EDGE).build();
final OperationChain<? extends Iterable<?>> exportOpChain = new Builder().first(new GetElements.Builder().input(new EntitySeed(SOURCE_DIR_0)).view(edgesView).build()).then(new ExportToGafferResultCache<>()).then(new GenerateObjects.Builder<EntityId>().generator(new EntityIdExtractor()).build()).then(new GetElements.Builder().view(edgesView).build()).then(new ExportToGafferResultCache<>()).then(new DiscardOutput()).then(new GetGafferResultCacheExport()).build();
// When
final Iterable<?> export = graph.execute(exportOpChain, getUser());
// Then
assertThat(Sets.newHashSet(export)).hasSize(2);
}
use of uk.gov.gchq.gaffer.operation.impl.DiscardOutput 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;
}
use of uk.gov.gchq.gaffer.operation.impl.DiscardOutput 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;
}
Aggregations