Search in sources :

Example 1 with S3DatasetProperties

use of org.talend.components.simplefileio.s3.S3DatasetProperties in project components by Talend.

the class S3OutputRuntimeTestIT method testParquet_merge.

@Test
public void testParquet_merge() throws IOException {
    S3DatasetProperties datasetProps = s3.createS3DatasetProperties();
    datasetProps.format.setValue(SimpleFileIOFormat.PARQUET);
    S3OutputProperties outputProperties = new S3OutputProperties("out");
    outputProperties.init();
    outputProperties.setDatasetProperties(datasetProps);
    outputProperties.mergeOutput.setValue(true);
    // Create the runtime.
    S3OutputRuntime runtime = new S3OutputRuntime();
    runtime.initialize(null, outputProperties);
    // Use the runtime in a Spark pipeline to test.
    final Pipeline p = spark.createPipeline();
    PCollection<IndexedRecord> input = // 
    p.apply(// 
    Create.of(// 
    ConvertToIndexedRecord.convertToAvro(new String[] { "1", "one" }), // 
    ConvertToIndexedRecord.convertToAvro(new String[] { "2", "two" })));
    input.apply(runtime);
    // And run the test.
    p.run().waitUntilFinish();
    FileSystem s3FileSystem = S3Connection.createFileSystem(datasetProps);
    MiniDfsResource.assertReadParquetFile(s3FileSystem, s3.getS3APath(datasetProps), new HashSet<IndexedRecord>(// 
    Arrays.asList(// 
    ConvertToIndexedRecord.convertToAvro(new String[] { "1", "one" }), ConvertToIndexedRecord.convertToAvro(new String[] { "2", "two" }))), false);
    MiniDfsResource.assertFileNumber(s3FileSystem, s3.getS3APath(datasetProps), 1);
}
Also used : S3DatasetProperties(org.talend.components.simplefileio.s3.S3DatasetProperties) ConvertToIndexedRecord(org.talend.components.adapter.beam.transform.ConvertToIndexedRecord) IndexedRecord(org.apache.avro.generic.IndexedRecord) S3OutputProperties(org.talend.components.simplefileio.s3.output.S3OutputProperties) FileSystem(org.apache.hadoop.fs.FileSystem) Pipeline(org.apache.beam.sdk.Pipeline) Test(org.junit.Test)

Example 2 with S3DatasetProperties

use of org.talend.components.simplefileio.s3.S3DatasetProperties in project components by Talend.

the class S3SparkRuntimeTestIT method testAvro_sseAndCseKmsEncryption.

/**
 * Basic Avro test with sseKmsEncryption.
 */
@Ignore("cse not yet supported.")
@Test
public void testAvro_sseAndCseKmsEncryption() throws IOException {
    S3DatasetProperties datasetProps = s3.createS3DatasetProperties(true, true);
    datasetProps.format.setValue(SimpleFileIOFormat.AVRO);
    test_noEncryption(datasetProps);
}
Also used : S3DatasetProperties(org.talend.components.simplefileio.s3.S3DatasetProperties) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with S3DatasetProperties

use of org.talend.components.simplefileio.s3.S3DatasetProperties in project components by Talend.

the class S3SparkRuntimeTestIT method testAvro_noEncryption.

/**
 * Basic Avro test.
 */
@Test
public void testAvro_noEncryption() throws IOException {
    S3DatasetProperties datasetProps = s3.createS3DatasetProperties();
    datasetProps.format.setValue(SimpleFileIOFormat.AVRO);
    test_noEncryption(datasetProps);
    // Get some object metadata from the results.
    ObjectMetadata md = s3.getObjectMetadata(datasetProps);
    assertThat(md.getSSEAlgorithm(), nullValue());
    assertThat(md.getSSEAwsKmsKeyId(), nullValue());
}
Also used : S3DatasetProperties(org.talend.components.simplefileio.s3.S3DatasetProperties) ObjectMetadata(com.talend.shaded.com.amazonaws.services.s3.model.ObjectMetadata) Test(org.junit.Test)

Example 4 with S3DatasetProperties

use of org.talend.components.simplefileio.s3.S3DatasetProperties in project components by Talend.

the class S3SparkRuntimeTestIT method testParquet_noEncryption.

/**
 * Basic Parquet test.
 */
@Test
public void testParquet_noEncryption() throws IOException {
    S3DatasetProperties datasetProps = s3.createS3DatasetProperties();
    datasetProps.format.setValue(SimpleFileIOFormat.PARQUET);
    test_noEncryption(datasetProps);
}
Also used : S3DatasetProperties(org.talend.components.simplefileio.s3.S3DatasetProperties) Test(org.junit.Test)

Example 5 with S3DatasetProperties

use of org.talend.components.simplefileio.s3.S3DatasetProperties in project components by Talend.

the class S3RoundTripRuntimeTestIT method testAvro_sseAndCseKmsEncryption.

/**
 * Basic Avro test with sseKmsEncryption.
 */
@Ignore("cse not yet supported.")
@Test
public void testAvro_sseAndCseKmsEncryption() throws IOException {
    S3DatasetProperties datasetProps = s3.createS3DatasetProperties(true, true);
    datasetProps.format.setValue(SimpleFileIOFormat.AVRO);
    test_noEncryption(datasetProps);
}
Also used : S3DatasetProperties(org.talend.components.simplefileio.s3.S3DatasetProperties) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

S3DatasetProperties (org.talend.components.simplefileio.s3.S3DatasetProperties)22 Test (org.junit.Test)16 Ignore (org.junit.Ignore)7 S3OutputProperties (org.talend.components.simplefileio.s3.output.S3OutputProperties)6 IndexedRecord (org.apache.avro.generic.IndexedRecord)5 ObjectMetadata (com.talend.shaded.com.amazonaws.services.s3.model.ObjectMetadata)4 Pipeline (org.apache.beam.sdk.Pipeline)3 FileSystem (org.apache.hadoop.fs.FileSystem)3 ConvertToIndexedRecord (org.talend.components.adapter.beam.transform.ConvertToIndexedRecord)3 S3DatastoreProperties (org.talend.components.simplefileio.s3.S3DatastoreProperties)3 Schema (org.apache.avro.Schema)2 S3InputProperties (org.talend.components.simplefileio.s3.input.S3InputProperties)2 RecordSet (org.talend.components.test.RecordSet)2 AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)1 StaticCredentialsProvider (com.amazonaws.internal.StaticCredentialsProvider)1 Region (com.amazonaws.regions.Region)1 AmazonS3 (com.amazonaws.services.s3.AmazonS3)1 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)1 AmazonS3EncryptionClient (com.amazonaws.services.s3.AmazonS3EncryptionClient)1 CryptoConfiguration (com.amazonaws.services.s3.model.CryptoConfiguration)1