Search in sources :

Example 6 with TAzureStorageQueueCreateProperties

use of org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties in project components by Talend.

the class AzureStorageQueueCreateReaderTestIT method testCreateNewQueue.

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

Example 7 with TAzureStorageQueueCreateProperties

use of org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties 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 8 with TAzureStorageQueueCreateProperties

use of org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties in project components by Talend.

the class AzureStorageBaseQueueTestIT method createTestQueue.

@BeforeClass
public static void createTestQueue() throws Throwable {
    TAzureStorageQueueCreateProperties properties = new TAzureStorageQueueCreateProperties("tests");
    properties = (TAzureStorageQueueCreateProperties) setupConnectionProperties((AzureStorageProvideConnectionProperties) properties);
    properties.setupProperties();
    properties.queueName.setValue(TEST_QUEUE_NAME);
    AzureStorageQueueSource source = new AzureStorageQueueSource();
    source.initialize(null, properties);
    queueClient = source.getStorageQueueClient(null);
    queue = source.getCloudQueue(null, TEST_QUEUE_NAME);
    queue.createIfNotExists();
}
Also used : TAzureStorageQueueCreateProperties(org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties) AzureStorageQueueSource(org.talend.components.azurestorage.queue.runtime.AzureStorageQueueSource) BeforeClass(org.junit.BeforeClass)

Example 9 with TAzureStorageQueueCreateProperties

use of org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties 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)

Aggregations

TAzureStorageQueueCreateProperties (org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties)9 Test (org.junit.Test)5 BoundedReader (org.talend.components.api.component.runtime.BoundedReader)4 IndexedRecord (org.apache.avro.generic.IndexedRecord)2 Before (org.junit.Before)2 RuntimeContainerMock (org.talend.components.azurestorage.RuntimeContainerMock)2 TAzureStorageConnectionProperties (org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties)2 ValidationResult (org.talend.daikon.properties.ValidationResult)2 BeforeClass (org.junit.BeforeClass)1 AzureStorageQueueService (org.talend.components.azurestorage.queue.AzureStorageQueueService)1 AzureStorageQueueSource (org.talend.components.azurestorage.queue.runtime.AzureStorageQueueSource)1 AzureStorageQueueSourceOrSink (org.talend.components.azurestorage.queue.runtime.AzureStorageQueueSourceOrSink)1 TAzureStorageQueueDeleteProperties (org.talend.components.azurestorage.queue.tazurestoragequeuedelete.TAzureStorageQueueDeleteProperties)1