use of uk.gov.gchq.gaffer.operation.impl.get.GetAdjacentEntitySeeds in project Gaffer by gchq.
the class OperationChainLimiterTest method shouldAcceptOperationChainWhenUserHasMaxAuthScoreGreaterThanChainScore.
@Test
public void shouldAcceptOperationChainWhenUserHasMaxAuthScoreGreaterThanChainScore() {
// Given
final OperationChain opChain = new OperationChain.Builder().first(new GetAdjacentEntitySeeds()).then(new GetAdjacentEntitySeeds()).then(new GetAdjacentEntitySeeds()).then(new GenerateObjects()).build();
final User user = new User.Builder().opAuths("SuperUser", "User").build();
// When
OPERATION_CHAIN_LIMITER.preExecute(opChain, user);
// Then - no exceptions
}
use of uk.gov.gchq.gaffer.operation.impl.get.GetAdjacentEntitySeeds in project Gaffer by gchq.
the class OperationChainLimiterTest method shouldAcceptOperationChainWhenUserHasAuthScoreEqualToChainScore.
@Test
public void shouldAcceptOperationChainWhenUserHasAuthScoreEqualToChainScore() {
// Given
final OperationChain opChain = new OperationChain.Builder().first(new GetAdjacentEntitySeeds()).then(new GenerateObjects()).build();
final User user = new User.Builder().opAuths("User").build();
// When
OPERATION_CHAIN_LIMITER.preExecute(opChain, user);
// Then - no exceptions
}
use of uk.gov.gchq.gaffer.operation.impl.get.GetAdjacentEntitySeeds in project Gaffer by gchq.
the class GetAdjacentEntitySeedsIT method shouldGetEntitySeeds.
private void shouldGetEntitySeeds(final List<String> expectedResultSeeds, final GetOperation.IncludeIncomingOutgoingType inOutType) throws IOException, OperationException {
// Given
final User user = new User();
final List<EntitySeed> seeds = new ArrayList<>();
for (final String seed : SEEDS) {
seeds.add(new EntitySeed(seed));
}
final GetAdjacentEntitySeeds operation = new GetAdjacentEntitySeeds.Builder().seeds(seeds).includeEntities(true).includeEdges(GetOperation.IncludeEdgeType.ALL).inOutType(inOutType).build();
// When
final CloseableIterable<EntitySeed> results = graph.execute(operation, user);
// Then
List<String> resultSeeds = new ArrayList<>();
for (final EntitySeed result : results) {
resultSeeds.add((String) result.getVertex());
}
Collections.sort(resultSeeds);
Collections.sort(expectedResultSeeds);
assertArrayEquals("Expected: " + expectedResultSeeds + ", but got: " + resultSeeds, expectedResultSeeds.toArray(), resultSeeds.toArray());
}
Aggregations