use of org.talend.components.azurestorage.queue.tazurestoragequeueinput.TAzureStorageQueueInputProperties in project components by Talend.
the class AzureStorageQueueComponentsTest method testTAzureStorageQueueInputProperties.
@Test
public void testTAzureStorageQueueInputProperties() {
TAzureStorageQueueInputProperties ip = new TAzureStorageQueueInputProperties("test");
ip.connection.setupProperties();
ip.setupProperties();
ip.peekMessages.setValue(false);
ip.afterPeekMessages();
assertFalse(ip.deleteMessages.getValue());
ip.deleteMessages.setValue(true);
ip.afterDeleteMessages();
assertTrue(ip.deleteMessages.getValue());
assertFalse(ip.peekMessages.getValue());
}
use of org.talend.components.azurestorage.queue.tazurestoragequeueinput.TAzureStorageQueueInputProperties in project components by Talend.
the class AzureStorageQueueInputReaderTest method setup.
@Before
public void setup() throws IOException {
properties = new TAzureStorageQueueInputProperties(PROP_ + "QueueInputReader");
properties.setupProperties();
properties.connection = getValidFakeConnection();
properties.queueName.setValue("some-queue-name");
}
use of org.talend.components.azurestorage.queue.tazurestoragequeueinput.TAzureStorageQueueInputProperties in project components by Talend.
the class AzureStorageQueueSourceOrSinkTest method setUp.
@Before
public void setUp() throws Exception {
sos = new AzureStorageQueueSourceOrSink();
props = new TAzureStorageQueueListProperties("tests");
props.setupProperties();
queueInputProperties = new TAzureStorageQueueInputProperties("test");
queueInputProperties.setupProperties();
queueInputProperties.connection.accountName.setValue("fakeAccountName");
queueInputProperties.connection.accountKey.setValue("fakeAccountKey=ANBHFYRJJFHRIKKJFU");
runtimeContainer = new RuntimeContainerMock();
}
use of org.talend.components.azurestorage.queue.tazurestoragequeueinput.TAzureStorageQueueInputProperties in project components by Talend.
the class AzureStorageQueueSourceOrSink method validate.
@Override
public ValidationResult validate(RuntimeContainer container) {
ValidationResult vr = super.validate(container);
if (vr != ValidationResult.OK)
return vr;
if (properties instanceof TAzureStorageQueueListProperties) {
// no validation needed...
return ValidationResult.OK;
}
if (properties instanceof AzureStorageQueueProperties) {
String q = ((AzureStorageQueueProperties) properties).queueName.getValue();
if (q.isEmpty()) {
return new ValidationResult(ValidationResult.Result.ERROR, i18nMessages.getMessage("error.NameEmpty"));
}
if (q.length() < 3 || q.length() > 63) {
return new ValidationResult(ValidationResult.Result.ERROR, i18nMessages.getMessage("error.LengthError"));
}
if (q.indexOf("--") > -1) {
return new ValidationResult(ValidationResult.Result.ERROR, i18nMessages.getMessage("error.TwoDashError"));
}
if (!queueCheckNamePattern.matcher(q.replaceAll("-", "")).matches()) {
return new ValidationResult(ValidationResult.Result.ERROR, i18nMessages.getMessage("error.QueueNameError"));
}
}
if (properties instanceof TAzureStorageQueueInputProperties) {
int nom = ((TAzureStorageQueueInputProperties) properties).numberOfMessages.getValue();
if (nom < 1 || nom > 32) {
return new ValidationResult(ValidationResult.Result.ERROR, i18nMessages.getMessage("error.ParameterLengthError"));
}
int vtimeout = ((TAzureStorageQueueInputProperties) properties).visibilityTimeoutInSeconds.getValue();
if (vtimeout < 0) {
return new ValidationResult(ValidationResult.Result.ERROR, i18nMessages.getMessage("error.ParameterValueError"));
}
}
return ValidationResult.OK;
}
use of org.talend.components.azurestorage.queue.tazurestoragequeueinput.TAzureStorageQueueInputProperties 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());
}
Aggregations