Search in sources :

Example 6 with RFileReaderRDD

use of uk.gov.gchq.gaffer.sparkaccumulo.operation.rfilereaderrdd.RFileReaderRDD in project Gaffer by gchq.

the class RFileReaderRddIT method throwRTX_whenRDDHasIncorrectUser.

@Test
public void throwRTX_whenRDDHasIncorrectUser() throws IOException, InterruptedException, AccumuloSecurityException, AccumuloException, TableNotFoundException, TableExistsException {
    // Given
    final MiniAccumuloCluster cluster = createAccumuloCluster(tableName, config, Arrays.asList("Bananas"));
    final RFileReaderRDD rdd = new RFileReaderRDD(sparkSession.sparkContext(), cluster.getInstanceName(), cluster.getZooKeepers(), "Incorrect Username", "", tableName, new HashSet<>(), serialiseConfiguration(config));
    // When / Then
    assertThatExceptionOfType(RuntimeException.class).isThrownBy(rdd::getPartitions).withMessage("Exception connecting to Accumulo");
}
Also used : RFileReaderRDD(uk.gov.gchq.gaffer.sparkaccumulo.operation.rfilereaderrdd.RFileReaderRDD) MiniAccumuloCluster(org.apache.accumulo.minicluster.MiniAccumuloCluster) Test(org.junit.jupiter.api.Test)

Example 7 with RFileReaderRDD

use of uk.gov.gchq.gaffer.sparkaccumulo.operation.rfilereaderrdd.RFileReaderRDD in project Gaffer by gchq.

the class RFileReaderRddIT method testRFileReaderRDDCanBeCreatedWith5TableInputs.

@Test
public void testRFileReaderRDDCanBeCreatedWith5TableInputs() throws IOException, InterruptedException, AccumuloSecurityException, AccumuloException, TableNotFoundException, TableExistsException {
    // Given
    final List<String> dataInput = Arrays.asList("train", "plane", "automobile", "bike", "boat");
    final MiniAccumuloCluster cluster = createAccumuloCluster(tableName, config, dataInput);
    // When
    final RFileReaderRDD rdd = new RFileReaderRDD(sparkSession.sparkContext(), cluster.getInstanceName(), cluster.getZooKeepers(), MiniAccumuloClusterProvider.USER, MiniAccumuloClusterProvider.PASSWORD, tableName, new HashSet<>(), serialiseConfiguration(config));
    // Then
    assertThat(rdd.count()).isEqualTo(dataInput.size());
    assertThat(rdd.getPartitions()).hasSize(1);
}
Also used : RFileReaderRDD(uk.gov.gchq.gaffer.sparkaccumulo.operation.rfilereaderrdd.RFileReaderRDD) MiniAccumuloCluster(org.apache.accumulo.minicluster.MiniAccumuloCluster) Test(org.junit.jupiter.api.Test)

Aggregations

RFileReaderRDD (uk.gov.gchq.gaffer.sparkaccumulo.operation.rfilereaderrdd.RFileReaderRDD)7 MiniAccumuloCluster (org.apache.accumulo.minicluster.MiniAccumuloCluster)6 Test (org.junit.jupiter.api.Test)5 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 IteratorSetting (org.apache.accumulo.core.client.IteratorSetting)1 Configuration (org.apache.hadoop.conf.Configuration)1 Job (org.apache.hadoop.mapreduce.Job)1 IteratorSettingException (uk.gov.gchq.gaffer.accumulostore.key.exception.IteratorSettingException)1 OperationException (uk.gov.gchq.gaffer.operation.OperationException)1