use of uk.gov.gchq.gaffer.user.User in project Gaffer by gchq.
the class AddElementsFromHdfsIT method createGraph.
private Graph createGraph(final Class<? extends AccumuloKeyPackage> keyPackageClass) throws StoreException {
final Schema schema = Schema.fromJson(StreamUtil.schemas(getClass()));
final AccumuloProperties properties = AccumuloProperties.loadStoreProperties(StreamUtil.storeProps(getClass()));
properties.setKeyPackageClass(keyPackageClass.getName());
properties.setInstance("instance_" + keyPackageClass.getName());
final AccumuloStore store = new MockAccumuloStore();
store.initialise(schema, properties);
store.updateConfiguration(createLocalConf(), new View(), new User());
return new Graph.Builder().store(store).build();
}
use of uk.gov.gchq.gaffer.user.User in project Gaffer by gchq.
the class AccumuloRangeIDRetrieverTest method shouldRetieveElementsInRangeBetweenSeeds.
private void shouldRetieveElementsInRangeBetweenSeeds(final AccumuloStore store) throws StoreException {
// Create set to query for
final Set<Pair<ElementSeed>> simpleEntityRanges = new HashSet<>();
simpleEntityRanges.add(new Pair<ElementSeed>(new EntitySeed("0000"), new EntitySeed("0999")));
// Retrieve elements when less simple entities are provided than the max number of entries for the batch scanner
final GetElementsOperation<Pair<ElementSeed>, CloseableIterable<Element>> operation = new GetElementsInRanges<>(defaultView, simpleEntityRanges);
try {
final AccumuloRangeIDRetriever retriever = new AccumuloRangeIDRetriever(store, operation, new User());
assertEquals(numEntries, Iterables.size(retriever));
} catch (IteratorSettingException e) {
fail("Unable to construct Range Retriever");
}
}
use of uk.gov.gchq.gaffer.user.User in project Gaffer by gchq.
the class JcsJobTrackerTest method shouldOverwriteJob.
@Test
public void shouldOverwriteJob() {
// Given
final User user = mock(User.class);
final OperationChain<?> opChain = mock(OperationChain.class);
given(opChain.toString()).willReturn("op chain to string");
final String jobId = "jobId1";
final JobDetail job1 = new JobDetail(jobId, "userId1", opChain, JobStatus.RUNNING, "description1");
final JobDetail job2 = new JobDetail(jobId, "userId1", opChain, JobStatus.FINISHED, "description2");
// When
jobTracker.addOrUpdateJob(job1, user);
jobTracker.addOrUpdateJob(job2, user);
// Then
final JobDetail resultJob = jobTracker.getJob(jobId, user);
assertEquals(job2, resultJob);
}
use of uk.gov.gchq.gaffer.user.User in project Gaffer by gchq.
the class JcsJobTrackerTest method shouldValidateJobDetailAndThrowExceptionIfMissingJobId.
@Test
public void shouldValidateJobDetailAndThrowExceptionIfMissingJobId() {
// Given
final User user = mock(User.class);
final OperationChain<?> opChain = mock(OperationChain.class);
given(opChain.toString()).willReturn("op chain to string");
final JobDetail job = new JobDetail("", "userId1", opChain, JobStatus.RUNNING, "description");
// When / Then
try {
jobTracker.addOrUpdateJob(job, user);
fail("Exception expected");
} catch (final IllegalArgumentException e) {
assertNotNull(e.getMessage());
}
}
use of uk.gov.gchq.gaffer.user.User in project Gaffer by gchq.
the class JcsJobTrackerTest method shouldValidateJobDetailAndThrowExceptionIfNull.
@Test
public void shouldValidateJobDetailAndThrowExceptionIfNull() {
// Given
final User user = mock(User.class);
final JobDetail job = null;
// When / Then
try {
jobTracker.addOrUpdateJob(job, user);
fail("Exception expected");
} catch (final IllegalArgumentException e) {
assertNotNull(e.getMessage());
}
}
Aggregations