Search in sources :

Example 1 with TAzureStorageGetProperties

use of org.talend.components.azurestorage.blob.tazurestorageget.TAzureStorageGetProperties in project components by Talend.

the class AzureStorageGetRuntimeTest method setup.

@Before
public void setup() throws IOException {
    properties = new TAzureStorageGetProperties(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");
    properties.container.setValue("goog-container-name-1");
    runtimeContainer = new RuntimeContainerMock();
    this.storageGet = new AzureStorageGetRuntime();
    localFolder = FileUtils.createTempDirectory();
}
Also used : RuntimeContainerMock(org.talend.components.azurestorage.RuntimeContainerMock) TAzureStorageGetProperties(org.talend.components.azurestorage.blob.tazurestorageget.TAzureStorageGetProperties) TAzureStorageConnectionProperties(org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties) Before(org.junit.Before)

Example 2 with TAzureStorageGetProperties

use of org.talend.components.azurestorage.blob.tazurestorageget.TAzureStorageGetProperties in project components by Talend.

the class AzureStorageGetRuntime method initialize.

@Override
public ValidationResult initialize(RuntimeContainer runtimeContainer, ComponentProperties properties) {
    ValidationResult validationResult = super.initialize(runtimeContainer, properties);
    if (validationResult.getStatus() == ValidationResult.Result.ERROR) {
        return validationResult;
    }
    TAzureStorageGetProperties componentProperties = (TAzureStorageGetProperties) properties;
    localFolder = componentProperties.localFolder.getValue();
    remoteBlobsGet = componentProperties.remoteBlobsGet;
    this.dieOnError = componentProperties.dieOnError.getValue();
    azureStorageBlobService = new AzureStorageBlobService(getAzureConnection(runtimeContainer));
    String errorMessage = "";
    if (remoteBlobsGet.prefix.getValue() == null || remoteBlobsGet.prefix.getValue().isEmpty()) {
        // $NON-NLS-1$
        errorMessage = messages.getMessage("error.EmptyBlobs");
    }
    if (errorMessage.isEmpty()) {
        // everything is OK.
        return ValidationResult.OK;
    } else {
        return new ValidationResult(ValidationResult.Result.ERROR, errorMessage);
    }
}
Also used : TAzureStorageGetProperties(org.talend.components.azurestorage.blob.tazurestorageget.TAzureStorageGetProperties) ValidationResult(org.talend.daikon.properties.ValidationResult) AzureStorageBlobService(org.talend.components.azurestorage.blob.AzureStorageBlobService)

Example 3 with TAzureStorageGetProperties

use of org.talend.components.azurestorage.blob.tazurestorageget.TAzureStorageGetProperties in project components by Talend.

the class AzureStorageSourceTest method testGetRemoteBlobs.

/**
 * Test method for {@link org.talend.components.azurestorage.blob.runtime.AzureStorageSource#getRemoteBlobs()}.
 */
@Test
public final void testGetRemoteBlobs() {
    TAzureStorageGetProperties props = new TAzureStorageGetProperties("test");
    props.setupProperties();
    List<String> prefixes = Arrays.asList("test1", "test2");
    List<Boolean> includes = Arrays.asList(true, false);
    props.remoteBlobs.prefix.setValue(prefixes);
    props.remoteBlobs.include.setValue(includes);
    source.initialize(null, props);
    assertNotNull(source.getRemoteBlobs());
}
Also used : TAzureStorageGetProperties(org.talend.components.azurestorage.blob.tazurestorageget.TAzureStorageGetProperties) Test(org.junit.Test)

Aggregations

TAzureStorageGetProperties (org.talend.components.azurestorage.blob.tazurestorageget.TAzureStorageGetProperties)3 Before (org.junit.Before)1 Test (org.junit.Test)1 RuntimeContainerMock (org.talend.components.azurestorage.RuntimeContainerMock)1 AzureStorageBlobService (org.talend.components.azurestorage.blob.AzureStorageBlobService)1 TAzureStorageConnectionProperties (org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties)1 ValidationResult (org.talend.daikon.properties.ValidationResult)1