use of org.talend.components.azurestorage.queue.tazurestoragequeueoutput.TAzureStorageQueueOutputProperties in project components by Talend.
the class AzureStorageQueueComponentsTest method testTAzureStorageQueueOutputProperties.
@Test
public void testTAzureStorageQueueOutputProperties() {
TAzureStorageQueueOutputProperties op = new TAzureStorageQueueOutputProperties("test");
op.setupProperties();
HashSet<PropertyPathConnector> connectors = new HashSet<>();
connectors.add(op.FLOW_CONNECTOR);
assertEquals(connectors, op.getAllSchemaPropertiesConnectors(true));
connectors.clear();
connectors.add(op.MAIN_CONNECTOR);
assertEquals(connectors, op.getAllSchemaPropertiesConnectors(false));
}
use of org.talend.components.azurestorage.queue.tazurestoragequeueoutput.TAzureStorageQueueOutputProperties in project components by Talend.
the class AzureStorageQueueSinkTest method testCreateWriteOperation.
/**
* Test method for
* {@link org.talend.components.azurestorage.queue.runtime.AzureStorageQueueSink#createWriteOperation()}.
*/
@Test
public final void testCreateWriteOperation() {
AzureStorageQueueSink sink = new AzureStorageQueueSink();
TAzureStorageQueueOutputProperties p = new TAzureStorageQueueOutputProperties("test");
p.connection.setupProperties();
p.setupProperties();
sink.initialize(null, p);
assertNotNull(sink.createWriteOperation());
assertNotNull(sink.createWriteOperation().createWriter(null));
assertEquals(sink, sink.createWriteOperation().getSink());
List<Result> writerResults = new ArrayList<Result>();
Result r = new Result("test");
writerResults.add(r);
AzureStorageQueueWriteOperation wo = (AzureStorageQueueWriteOperation) sink.createWriteOperation();
wo.initialize(null);
assertNotNull(wo.finalize(writerResults, null));
}
use of org.talend.components.azurestorage.queue.tazurestoragequeueoutput.TAzureStorageQueueOutputProperties in project components by Talend.
the class AzureStorageQueueOutputWriterTestIT method testWriteSimpleMessage.
@Test
public void testWriteSimpleMessage() throws Throwable {
queue.clear();
//
TAzureStorageQueueOutputProperties properties = new TAzureStorageQueueOutputProperties("tests");
properties = (TAzureStorageQueueOutputProperties) setupConnectionProperties((AzureStorageProvideConnectionProperties) properties);
properties.setupProperties();
properties.queueName.setValue(TEST_QUEUE_NAME);
Writer<?> writer = createWriter(properties);
writer.open("test-uid");
for (String m : messages) {
IndexedRecord entity = new GenericData.Record(properties.schema.schema.getValue());
entity.put(0, m + "SIMPLE");
writer.write(entity);
}
writer.close();
queue.downloadAttributes();
assertEquals(3, queue.getApproximateMessageCount());
for (CloudQueueMessage msg : queue.retrieveMessages(3)) {
assertNotNull(msg.getMessageContentAsString());
assertTrue(msg.getMessageContentAsString().indexOf("SIMPLE") > 0);
}
}
use of org.talend.components.azurestorage.queue.tazurestoragequeueoutput.TAzureStorageQueueOutputProperties in project components by Talend.
the class AzureStorageQueueWriterTest method setUp.
@Before
public void setUp() throws Exception {
AzureStorageQueueSink sink = new AzureStorageQueueSink();
TAzureStorageQueueOutputProperties p = new TAzureStorageQueueOutputProperties("test");
p.connection.setupProperties();
p.setupProperties();
sink.initialize(null, p);
writer = (AzureStorageQueueWriter) sink.createWriteOperation().createWriter(null);
}
use of org.talend.components.azurestorage.queue.tazurestoragequeueoutput.TAzureStorageQueueOutputProperties in project components by Talend.
the class AzureStorageQueuePurgeReaderTestIT method fillInQueue.
@Before
public void fillInQueue() throws Throwable {
TAzureStorageQueueOutputProperties properties = new TAzureStorageQueueOutputProperties("tests");
properties = (TAzureStorageQueueOutputProperties) setupConnectionProperties((AzureStorageProvideConnectionProperties) properties);
properties.setupProperties();
properties.queueName.setValue(TEST_QUEUE_NAME);
AzureStorageQueueSink sink = new AzureStorageQueueSink();
sink.initialize(null, properties);
sink.validate(null);
Writer<?> writer = sink.createWriteOperation().createWriter(null);
writer.open("test-uid");
for (String m : messages) {
IndexedRecord entity = new GenericData.Record(properties.schema.schema.getValue());
entity.put(0, m + "SIMPLE");
writer.write(entity);
}
writer.close();
queue.downloadAttributes();
assertTrue(queue.getApproximateMessageCount() > 3);
}
Aggregations