Search in sources :

Example 11 with DiscardOutput

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
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) GenerateObjects(uk.gov.gchq.gaffer.operation.impl.generate.GenerateObjects) User(uk.gov.gchq.gaffer.user.User) OperationChain(uk.gov.gchq.gaffer.operation.OperationChain) TestOperationsImpl(uk.gov.gchq.gaffer.operation.TestOperationsImpl) GetElements(uk.gov.gchq.gaffer.operation.impl.get.GetElements) DiscardOutput(uk.gov.gchq.gaffer.operation.impl.DiscardOutput) Sort(uk.gov.gchq.gaffer.operation.impl.compare.Sort) Test(org.junit.jupiter.api.Test)

Example 12 with DiscardOutput

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);
}
Also used : ExportToSet(uk.gov.gchq.gaffer.operation.impl.export.set.ExportToSet) Builder(uk.gov.gchq.gaffer.operation.OperationChain.Builder) GetElements(uk.gov.gchq.gaffer.operation.impl.get.GetElements) View(uk.gov.gchq.gaffer.data.elementdefinition.view.View) GetSetExport(uk.gov.gchq.gaffer.operation.impl.export.set.GetSetExport) EntityIdExtractor(uk.gov.gchq.gaffer.operation.data.generator.EntityIdExtractor) EntitySeed(uk.gov.gchq.gaffer.operation.data.EntitySeed) DiscardOutput(uk.gov.gchq.gaffer.operation.impl.DiscardOutput) Test(org.junit.Test)

Example 13 with DiscardOutput

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);
}
Also used : EntityIdExtractor(uk.gov.gchq.gaffer.operation.data.generator.EntityIdExtractor) GetGafferResultCacheExport(uk.gov.gchq.gaffer.operation.impl.export.resultcache.GetGafferResultCacheExport) Builder(uk.gov.gchq.gaffer.operation.OperationChain.Builder) EntitySeed(uk.gov.gchq.gaffer.operation.data.EntitySeed) ExportToGafferResultCache(uk.gov.gchq.gaffer.operation.impl.export.resultcache.ExportToGafferResultCache) GetElements(uk.gov.gchq.gaffer.operation.impl.get.GetElements) DiscardOutput(uk.gov.gchq.gaffer.operation.impl.DiscardOutput) View(uk.gov.gchq.gaffer.data.elementdefinition.view.View) Test(org.junit.Test)

Example 14 with DiscardOutput

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;
}
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 15 with DiscardOutput

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;
}
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)

Aggregations

DiscardOutput (uk.gov.gchq.gaffer.operation.impl.DiscardOutput)24 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)17 Test (org.junit.jupiter.api.Test)16 GetElements (uk.gov.gchq.gaffer.operation.impl.get.GetElements)15 User (uk.gov.gchq.gaffer.user.User)12 GetAllElements (uk.gov.gchq.gaffer.operation.impl.get.GetAllElements)11 Context (uk.gov.gchq.gaffer.store.Context)10 GetAdjacentIds (uk.gov.gchq.gaffer.operation.impl.get.GetAdjacentIds)8 JobDetail (uk.gov.gchq.gaffer.jobtracker.JobDetail)7 Operation (uk.gov.gchq.gaffer.operation.Operation)7 SplitStoreFromFile (uk.gov.gchq.gaffer.operation.impl.SplitStoreFromFile)7 Count (uk.gov.gchq.gaffer.operation.impl.Count)6 CountGroups (uk.gov.gchq.gaffer.operation.impl.CountGroups)5 GetJobDetails (uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails)5 Builder (uk.gov.gchq.gaffer.operation.OperationChain.Builder)4 Validate (uk.gov.gchq.gaffer.operation.impl.Validate)4 ExportToGafferResultCache (uk.gov.gchq.gaffer.operation.impl.export.resultcache.ExportToGafferResultCache)4 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)3 EntitySeed (uk.gov.gchq.gaffer.operation.data.EntitySeed)3 Limit (uk.gov.gchq.gaffer.operation.impl.Limit)3