use of org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties in project components by Talend.
the class AzureStorageQueueComponentsTest method testQueueNameValidation.
@Test
public void testQueueNameValidation() {
ValidationResult vrEmpty = new ValidationResult(Result.ERROR, i18nMessages.getMessage("error.NameEmpty"));
ValidationResult vrSize = new ValidationResult(Result.ERROR, i18nMessages.getMessage("error.LengthError"));
ValidationResult vrDash = new ValidationResult(Result.ERROR, i18nMessages.getMessage("error.TwoDashError"));
ValidationResult vrName = new ValidationResult(Result.ERROR, i18nMessages.getMessage("error.QueueNameError"));
//
TAzureStorageQueueCreateProperties properties = new TAzureStorageQueueCreateProperties("test");
properties.connection.accountName.setValue("dummy");
properties.connection.accountKey.setValue("dummy");
properties.setupProperties();
AzureStorageQueueSourceOrSink sos = new AzureStorageQueueSourceOrSink();
// empty queue name
sos.initialize(null, properties);
assertEquals(vrEmpty.getMessage(), sos.validate(null).getMessage());
// invalid queue size
properties.queueName.setValue("in");
sos.initialize(null, properties);
assertEquals(vrSize.getMessage(), sos.validate(null).getMessage());
properties.queueName.setValue("a-too-long-queue-name-a-too-long-queue-name-a-too-long-queue-name");
sos.initialize(null, properties);
assertEquals(vrSize.getMessage(), sos.validate(null).getMessage());
// invalid queue name dashes
properties.queueName.setValue("in--in");
sos.initialize(null, properties);
assertEquals(vrDash.getMessage(), sos.validate(null).getMessage());
// invalid queue name
properties.queueName.setValue("a-wrongQueueName");
sos.initialize(null, properties);
assertEquals(vrName.getMessage(), sos.validate(null).getMessage());
// a good queue name
properties.queueName.setValue("a-good-queue-name");
sos.initialize(null, properties);
assertEquals(ValidationResult.OK.getStatus(), sos.validate(null).getStatus());
}
use of org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties in project components by Talend.
the class AzureStorageQueueCreateReaderTestIT method testCreateExistingQueue.
@SuppressWarnings("rawtypes")
@Test
public void testCreateExistingQueue() throws Throwable {
TAzureStorageQueueCreateProperties properties = new TAzureStorageQueueCreateProperties("tests");
properties.setupProperties();
properties = (TAzureStorageQueueCreateProperties) setupConnectionProperties((AzureStorageProvideConnectionProperties) properties);
String fqueue = TEST_QUEUE_NAME_CREATE + getRandomTestUID() + "b";
properties.queueName.setValue(fqueue);
BoundedReader reader = createBoundedReader(properties);
assertTrue(reader.start());
assertTrue((int) reader.getReturnValues().get(AzureStorageDefinition.RETURN_TOTAL_RECORD_COUNT) > 0);
reader.close();
//
assertFalse(reader.start());
assertTrue((int) reader.getReturnValues().get(AzureStorageDefinition.RETURN_TOTAL_RECORD_COUNT) > 0);
reader.close();
}
use of org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties in project components by Talend.
the class AzureStorageQueueCreateRuntime method initialize.
@Override
public ValidationResult initialize(RuntimeContainer runtimeContainer, ComponentProperties properties) {
ValidationResult vr = super.initialize(runtimeContainer, properties);
if (!ValidationResult.OK.getStatus().equals(vr.getStatus())) {
return vr;
}
this.dieOnError = ((TAzureStorageQueueCreateProperties) properties).dieOnError.getValue();
this.queueService = new AzureStorageQueueService(getAzureConnection(runtimeContainer));
return ValidationResult.OK;
}
use of org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties in project components by Talend.
the class AzureStorageQueueCreateRuntimeTest method setup.
@Before
public void setup() throws IOException {
properties = new TAzureStorageQueueCreateProperties(PROP_ + "Get");
properties.setupProperties();
// valid connection
properties.connection = new TAzureStorageConnectionProperties(PROP_ + "Connection");
properties.connection.protocol.setValue(Protocol.HTTP);
properties.connection.accountName.setValue("fakeAccountName");
properties.connection.accountKey.setValue("fakeAccountKey=ANBHFYRJJFHRIKKJFU");
runtimeContainer = new RuntimeContainerMock();
this.azureStorageQueueCreate = new AzureStorageQueueCreateRuntime();
}
use of org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties in project components by Talend.
the class AzureStorageQueueRuntimeTest method setup.
@Before
public void setup() throws IOException {
properties = new TAzureStorageQueueCreateProperties(PROP_ + "Get");
properties.setupProperties();
// valid connection
properties.connection = new TAzureStorageConnectionProperties(PROP_ + "Connection");
properties.connection.protocol.setValue(Protocol.HTTP);
properties.connection.accountName.setValue("fakeAccountName");
properties.connection.accountKey.setValue("fakeAccountKey=ANBHFYRJJFHRIKKJFU");
runtimeContainer = new RuntimeContainerMock();
this.azureStorageQueue = new AzureStorageQueueRuntime() {
};
}
Aggregations