use of org.talend.components.azurestorage.queue.tazurestoragequeuelist.TAzureStorageQueueListProperties 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.tazurestoragequeuelist.TAzureStorageQueueListProperties 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.tazurestoragequeuelist.TAzureStorageQueueListProperties in project components by Talend.
the class AzureStorageQueueListReaderTest method setUp.
@Before
public void setUp() throws Exception {
dummyCredential = new StorageCredentialsSharedAccessSignature("fakesaas");
properties = new TAzureStorageQueueListProperties(PROP_ + "QueueList");
properties.setupProperties();
properties.connection = getValidFakeConnection();
}
use of org.talend.components.azurestorage.queue.tazurestoragequeuelist.TAzureStorageQueueListProperties 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());
}
use of org.talend.components.azurestorage.queue.tazurestoragequeuelist.TAzureStorageQueueListProperties in project components by Talend.
the class AzureStorageQueueListReaderTestIT method testListQueues.
@SuppressWarnings("rawtypes")
@Test
public void testListQueues() throws Throwable {
TAzureStorageQueueListProperties properties = new TAzureStorageQueueListProperties("tests");
properties.setupProperties();
properties = (TAzureStorageQueueListProperties) setupConnectionProperties((AzureStorageProvideConnectionProperties) properties);
BoundedReader reader = createBoundedReader(properties);
assertTrue(reader.start());
do {
IndexedRecord current = (IndexedRecord) reader.getCurrent();
assertNotNull(current);
assertTrue(current.get(0) instanceof String);
} while (reader.advance());
assertTrue((int) reader.getReturnValues().get(AzureStorageDefinition.RETURN_TOTAL_RECORD_COUNT) > 0);
reader.close();
}
Aggregations