Search in sources :

Example 1 with TAzureStorageListProperties

use of org.talend.components.azurestorage.blob.tazurestoragelist.TAzureStorageListProperties in project components by Talend.

the class AzureStorageBaseBlobTestIT method listAllBlobs.

@SuppressWarnings("rawtypes")
public List<String> listAllBlobs(String container) throws Exception {
    List<String> blobs = new ArrayList<>();
    TAzureStorageListProperties props = new TAzureStorageListProperties("tests");
    props.container.setValue(container);
    setupConnectionProperties(props);
    RemoteBlobsTable rmt = new RemoteBlobsTable("tests");
    List<String> pfx = new ArrayList<>();
    List<Boolean> inc = new ArrayList<>();
    pfx.add("");
    inc.add(true);
    rmt.prefix.setValue(pfx);
    rmt.include.setValue(inc);
    props.remoteBlobs = rmt;
    props.schema.schema.setValue(schemaForBlobList);
    BoundedReader reader = createBoundedReader(props);
    Boolean rows = reader.start();
    Object row;
    while (rows) {
        row = ((IndexedRecord) reader.getCurrent()).get(0);
        assertNotNull(row);
        assertTrue(row instanceof String);
        blobs.add(row.toString());
        rows = reader.advance();
    }
    reader.close();
    return blobs;
}
Also used : TAzureStorageListProperties(org.talend.components.azurestorage.blob.tazurestoragelist.TAzureStorageListProperties) RemoteBlobsTable(org.talend.components.azurestorage.blob.helpers.RemoteBlobsTable) ArrayList(java.util.ArrayList) BoundedReader(org.talend.components.api.component.runtime.BoundedReader)

Example 2 with TAzureStorageListProperties

use of org.talend.components.azurestorage.blob.tazurestoragelist.TAzureStorageListProperties in project components by Talend.

the class AzureStorageListReaderTest method setUp.

@Before
public void setUp() throws Exception {
    runtimeContainer = new RuntimeContainerMock();
    AzureStorageSource source = new AzureStorageSource();
    properties = new TAzureStorageListProperties(PROP_ + "List");
    properties.connection = new TAzureStorageConnectionProperties(PROP_ + "Connection");
    properties.connection.protocol.setValue(Protocol.HTTP);
    properties.connection.accountName.setValue("fakeAccountName");
    properties.connection.accountKey.setValue("fakeAccountKey=ANBHFYRJJFHRIKKJFU");
    properties.setupProperties();
    source.initialize(runtimeContainer, properties);
    reader = (AzureStorageListReader) source.createReader(runtimeContainer);
    reader.azureStorageBlobService = blobService;
}
Also used : TAzureStorageListProperties(org.talend.components.azurestorage.blob.tazurestoragelist.TAzureStorageListProperties) RuntimeContainerMock(org.talend.components.azurestorage.RuntimeContainerMock) TAzureStorageConnectionProperties(org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties) Before(org.junit.Before)

Example 3 with TAzureStorageListProperties

use of org.talend.components.azurestorage.blob.tazurestoragelist.TAzureStorageListProperties in project components by Talend.

the class AzureStorageComponentsTest method testBlobListSchema.

@Test
public void testBlobListSchema() {
    Schema s = // $NON-NLS-3$
    SchemaBuilder.record("Main").fields().name("BlobName").prop(SchemaConstants.TALEND_COLUMN_DB_LENGTH, "300").prop(SchemaConstants.TALEND_IS_LOCKED, "true").type(AvroUtils._string()).noDefault().endRecord();
    TAzureStorageListProperties props = new TAzureStorageListProperties("tests");
    props.setupProperties();
    Schema ps = props.schema.schema.getValue();
    assertEquals(s, ps);
}
Also used : TAzureStorageListProperties(org.talend.components.azurestorage.blob.tazurestoragelist.TAzureStorageListProperties) Schema(org.apache.avro.Schema) Test(org.junit.Test)

Example 4 with TAzureStorageListProperties

use of org.talend.components.azurestorage.blob.tazurestoragelist.TAzureStorageListProperties in project components by Talend.

the class AzureStorageSourceTest method setUp.

@Before
public void setUp() throws Exception {
    source = new AzureStorageSource();
    AzureStorageBlobProperties props = new TAzureStorageListProperties("test");
}
Also used : TAzureStorageListProperties(org.talend.components.azurestorage.blob.tazurestoragelist.TAzureStorageListProperties) AzureStorageBlobProperties(org.talend.components.azurestorage.blob.AzureStorageBlobProperties) Before(org.junit.Before)

Aggregations

TAzureStorageListProperties (org.talend.components.azurestorage.blob.tazurestoragelist.TAzureStorageListProperties)4 Before (org.junit.Before)2 ArrayList (java.util.ArrayList)1 Schema (org.apache.avro.Schema)1 Test (org.junit.Test)1 BoundedReader (org.talend.components.api.component.runtime.BoundedReader)1 RuntimeContainerMock (org.talend.components.azurestorage.RuntimeContainerMock)1 AzureStorageBlobProperties (org.talend.components.azurestorage.blob.AzureStorageBlobProperties)1 RemoteBlobsTable (org.talend.components.azurestorage.blob.helpers.RemoteBlobsTable)1 TAzureStorageConnectionProperties (org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties)1