Search in sources :

Example 31 with BoundedReader

use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.

the class AzureStorageQueueCreateReaderTestIT method testDeleteAndRecreateQueue.

@SuppressWarnings("rawtypes")
@Test
public void testDeleteAndRecreateQueue() throws Exception {
    TAzureStorageQueueCreateProperties properties = new TAzureStorageQueueCreateProperties("tests");
    properties.setupProperties();
    properties = (TAzureStorageQueueCreateProperties) setupConnectionProperties((AzureStorageProvideConnectionProperties) properties);
    String fqueue = TEST_QUEUE_NAME_CREATE + "deleteandrecreate";
    properties.queueName.setValue(fqueue);
    BoundedReader reader = createBoundedReader(properties);
    assertTrue(reader.start());
    reader.close();
    // 
    queueClient.getQueueReference(fqueue).delete();
    // 
    assertTrue(reader.start());
    reader.close();
}
Also used : TAzureStorageQueueCreateProperties(org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties) BoundedReader(org.talend.components.api.component.runtime.BoundedReader) Test(org.junit.Test)

Example 32 with BoundedReader

use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.

the class AzureStorageQueueListReaderTestIT method testListQueues.

@SuppressWarnings("rawtypes")
@Test
public void testListQueues() throws Throwable {
    TAzureStorageQueueListProperties properties = new TAzureStorageQueueListProperties("tests");
    properties.setupProperties();
    properties = (TAzureStorageQueueListProperties) setupConnectionProperties((AzureStorageProvideConnectionProperties) properties);
    BoundedReader reader = createBoundedReader(properties);
    assertTrue(reader.start());
    do {
        IndexedRecord current = (IndexedRecord) reader.getCurrent();
        assertNotNull(current);
        assertTrue(current.get(0) instanceof String);
    } while (reader.advance());
    assertTrue((int) reader.getReturnValues().get(AzureStorageDefinition.RETURN_TOTAL_RECORD_COUNT) > 0);
    reader.close();
}
Also used : TAzureStorageQueueListProperties(org.talend.components.azurestorage.queue.tazurestoragequeuelist.TAzureStorageQueueListProperties) IndexedRecord(org.apache.avro.generic.IndexedRecord) BoundedReader(org.talend.components.api.component.runtime.BoundedReader) Test(org.junit.Test)

Example 33 with BoundedReader

use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.

the class AzureStorageQueuePurgeReaderTestIT method testPurge.

@SuppressWarnings("rawtypes")
@Test
public void testPurge() throws Throwable {
    TAzureStorageQueuePurgeProperties properties = new TAzureStorageQueuePurgeProperties("tests");
    properties.setupProperties();
    properties = (TAzureStorageQueuePurgeProperties) setupConnectionProperties((AzureStorageProvideConnectionProperties) properties);
    properties.queueName.setValue(TEST_QUEUE_NAME);
    BoundedReader reader = createBoundedReader(properties);
    assertTrue(reader.start());
    assertFalse(reader.advance());
    reader.close();
    queue.downloadAttributes();
    assertEquals(0, queue.getApproximateMessageCount());
}
Also used : TAzureStorageQueuePurgeProperties(org.talend.components.azurestorage.queue.tazurestoragequeuepurge.TAzureStorageQueuePurgeProperties) BoundedReader(org.talend.components.api.component.runtime.BoundedReader) Test(org.junit.Test)

Example 34 with BoundedReader

use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.

the class AzureStorageQueueDeleteReaderTestIT method testDeleteQueue.

@SuppressWarnings("rawtypes")
@Test
public void testDeleteQueue() throws Throwable {
    // 
    TAzureStorageQueueCreateProperties props = new TAzureStorageQueueCreateProperties("tests");
    props.setupProperties();
    props = (TAzureStorageQueueCreateProperties) setupConnectionProperties((AzureStorageProvideConnectionProperties) props);
    props.queueName.setValue(TEST_QUEUE_NAME_CREATE);
    BoundedReader reader = createBoundedReader(props);
    reader.start();
    reader.close();
    // 
    TAzureStorageQueueDeleteProperties properties = new TAzureStorageQueueDeleteProperties("tests");
    properties.setupProperties();
    properties = (TAzureStorageQueueDeleteProperties) setupConnectionProperties((AzureStorageProvideConnectionProperties) properties);
    properties.queueName.setValue(TEST_QUEUE_NAME_CREATE);
    reader = createBoundedReader(properties);
    assertTrue(reader.start());
    assertNotNull(reader.getCurrent());
    assertTrue(((IndexedRecord) reader.getCurrent()).get(0) instanceof String);
    assertEquals(((IndexedRecord) reader.getCurrent()).get(0), TEST_NAME);
    assertTrue((int) reader.getReturnValues().get(AzureStorageDefinition.RETURN_TOTAL_RECORD_COUNT) == 1);
    reader.close();
}
Also used : TAzureStorageQueueCreateProperties(org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties) TAzureStorageQueueDeleteProperties(org.talend.components.azurestorage.queue.tazurestoragequeuedelete.TAzureStorageQueueDeleteProperties) IndexedRecord(org.apache.avro.generic.IndexedRecord) BoundedReader(org.talend.components.api.component.runtime.BoundedReader) Test(org.junit.Test)

Example 35 with BoundedReader

use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.

the class AzureStorageQueueInputReaderTestIT method testReadOneMessage.

@SuppressWarnings("rawtypes")
@Test
public void testReadOneMessage() throws Throwable {
    inputProps.numberOfMessages.setValue(1);
    BoundedReader reader = createBoundedReader(inputProps);
    assertTrue(reader.start());
    assertFalse(reader.advance());
    reader.close();
}
Also used : BoundedReader(org.talend.components.api.component.runtime.BoundedReader) Test(org.junit.Test)

Aggregations

BoundedReader (org.talend.components.api.component.runtime.BoundedReader)45 Test (org.junit.Test)37 IndexedRecord (org.apache.avro.generic.IndexedRecord)24 Matchers.anyString (org.mockito.Matchers.anyString)6 ArrayList (java.util.ArrayList)5 TAzureStorageQueueCreateProperties (org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties)4 GenericData (org.apache.avro.generic.GenericData)3 RemoteBlobsTable (org.talend.components.azurestorage.blob.helpers.RemoteBlobsTable)2 TAzureStorageQueueDeleteProperties (org.talend.components.azurestorage.queue.tazurestoragequeuedelete.TAzureStorageQueueDeleteProperties)2 Drive (com.google.api.services.drive.Drive)1 File (com.google.api.services.drive.model.File)1 FileList (com.google.api.services.drive.model.FileList)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Map (java.util.Map)1 Before (org.junit.Before)1 TAzureStorageContainerCreateProperties (org.talend.components.azurestorage.blob.tazurestoragecontainercreate.TAzureStorageContainerCreateProperties)1 TAzureStorageContainerDeleteProperties (org.talend.components.azurestorage.blob.tazurestoragecontainerdelete.TAzureStorageContainerDeleteProperties)1 TAzureStorageContainerExistProperties (org.talend.components.azurestorage.blob.tazurestoragecontainerexist.TAzureStorageContainerExistProperties)1 TAzureStorageContainerListProperties (org.talend.components.azurestorage.blob.tazurestoragecontainerlist.TAzureStorageContainerListProperties)1