use of org.talend.components.azurestorage.queue.runtime.AzureStorageQueueSourceOrSink 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.runtime.AzureStorageQueueSourceOrSink in project components by Talend.
the class AzureStorageQueueComponentsTest method testQueueInputProperties.
@Test
public void testQueueInputProperties() {
TAzureStorageQueueInputProperties properties = new TAzureStorageQueueInputProperties("test");
properties.connection.accountName.setValue("dummy");
properties.connection.accountKey.setValue("dummy");
properties.setupProperties();
properties.queueName.setValue("queueok");
AzureStorageQueueSourceOrSink sos = new AzureStorageQueueSourceOrSink();
// number of messages
properties.numberOfMessages.setValue(-1);
sos.initialize(null, properties);
assertEquals(ValidationResult.Result.ERROR, sos.validate(null).getStatus());
properties.numberOfMessages.setValue(0);
sos.initialize(null, properties);
assertEquals(ValidationResult.Result.ERROR, sos.validate(null).getStatus());
properties.numberOfMessages.setValue(1001);
sos.initialize(null, properties);
assertEquals(ValidationResult.Result.ERROR, sos.validate(null).getStatus());
properties.numberOfMessages.setValue(1);
sos.initialize(null, properties);
assertEquals(ValidationResult.OK.getStatus(), sos.validate(null).getStatus());
properties.numberOfMessages.setValue(32);
sos.initialize(null, properties);
assertEquals(ValidationResult.OK.getStatus(), sos.validate(null).getStatus());
// visibility timeout
properties.visibilityTimeoutInSeconds.setValue(-1);
sos.initialize(null, properties);
assertEquals(ValidationResult.Result.ERROR, sos.validate(null).getStatus());
properties.visibilityTimeoutInSeconds.setValue(1);
sos.initialize(null, properties);
assertEquals(ValidationResult.OK.getStatus(), sos.validate(null).getStatus());
}
use of org.talend.components.azurestorage.queue.runtime.AzureStorageQueueSourceOrSink in project components by Talend.
the class AzureStorageQueueComponentsTest method testQueueListProperties.
@Test
public void testQueueListProperties() {
TAzureStorageQueueListProperties properties = new TAzureStorageQueueListProperties("test");
properties.connection.accountName.setValue("dummy");
properties.connection.accountKey.setValue("dummy");
properties.setupProperties();
AzureStorageQueueSourceOrSink sos = new AzureStorageQueueSourceOrSink();
sos.initialize(null, properties);
assertEquals(ValidationResult.OK.getStatus(), sos.validate(null).getStatus());
}
Aggregations