use of uk.gov.gchq.gaffer.accumulostore.MockAccumuloStore 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.accumulostore.MockAccumuloStore in project Gaffer by gchq.
the class AccumuloRangeIDRetrieverTest method setup.
@BeforeClass
public static void setup() throws StoreException, IOException {
byteEntityStore = new MockAccumuloStore();
gaffer1KeyStore = new MockAccumuloStore();
byteEntityStore.initialise(schema, PROPERTIES);
gaffer1KeyStore.initialise(schema, CLASSIC_PROPERTIES);
defaultView = new View.Builder().edge(TestGroups.EDGE).entity(TestGroups.ENTITY).build();
setupGraph(byteEntityStore, numEntries);
setupGraph(gaffer1KeyStore, numEntries);
}
use of uk.gov.gchq.gaffer.accumulostore.MockAccumuloStore in project Gaffer by gchq.
the class InputFormatTest method shouldReturnCorrectDataToMapReduceJob.
private void shouldReturnCorrectDataToMapReduceJob(final Schema schema, final KeyPackage kp, final List<Element> data, final View view, final User user, final String instanceName, final Set<String> expectedResults) throws Exception {
final AccumuloStore store = new MockAccumuloStore();
final AccumuloProperties properties = AccumuloProperties.loadStoreProperties(StreamUtil.storeProps(getClass()));
switch(kp) {
case BYTE_ENTITY_KEY_PACKAGE:
properties.setKeyPackageClass(ByteEntityKeyPackage.class.getName());
properties.setInstance(instanceName + "_BYTE_ENTITY");
break;
case CLASSIC_KEY_PACKAGE:
properties.setKeyPackageClass(ClassicKeyPackage.class.getName());
properties.setInstance(instanceName + "_CLASSIC");
}
try {
store.initialise(schema, properties);
} catch (StoreException e) {
fail("StoreException thrown: " + e);
}
setupGraph(store, data);
// Set up local conf
final JobConf conf = new JobConf();
conf.set("fs.default.name", "file:///");
conf.set("mapred.job.tracker", "local");
final FileSystem fs = FileSystem.getLocal(conf);
// Update configuration with instance, table name, etc.
store.updateConfiguration(conf, view, user);
// Run Driver
final File outputFolder = testFolder.newFolder();
FileUtils.deleteDirectory(outputFolder);
final Driver driver = new Driver(outputFolder.getAbsolutePath());
driver.setConf(conf);
driver.run(new String[] {});
// Read results and check correct
final SequenceFile.Reader reader = new SequenceFile.Reader(fs, new Path(outputFolder + "/part-m-00000"), conf);
final Text text = new Text();
final Set<String> results = new HashSet<>();
while (reader.next(text)) {
results.add(text.toString());
}
reader.close();
assertEquals(expectedResults, results);
FileUtils.deleteDirectory(outputFolder);
}
Aggregations