Search in sources :

Example 1 with TAzureStoragePutProperties

use of org.talend.components.azurestorage.blob.tazurestorageput.TAzureStoragePutProperties in project components by Talend.

the class AzureStorageBaseBlobTestIT method uploadTestBlobs.

/**
 * uploadTestBlobs.
 *
 * @param container {@link String} container
 * @throws Exception the exception
 */
public void uploadTestBlobs(String container) throws Exception {
    assertTrue(doContainerCreate(container, AccessControl.Private));
    TAzureStoragePutProperties props = new TAzureStoragePutProperties("tests");
    props.container.setValue(container);
    setupConnectionProperties(props);
    props.localFolder.setValue(FOLDER_PATH_PUT);
    props.remoteFolder.setValue("");
    assertTrue(createBoundedReader(props).start());
}
Also used : TAzureStoragePutProperties(org.talend.components.azurestorage.blob.tazurestorageput.TAzureStoragePutProperties)

Example 2 with TAzureStoragePutProperties

use of org.talend.components.azurestorage.blob.tazurestorageput.TAzureStoragePutProperties in project components by Talend.

the class AzureStoragePutRuntimeTest method setup.

@Before
public void setup() throws IOException {
    properties = new TAzureStoragePutProperties(PROP_ + "Put");
    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.storagePut = new AzureStoragePutRuntime();
    localFolderPath = getClass().getClassLoader().getResource("azurestorage-put").getPath();
}
Also used : RuntimeContainerMock(org.talend.components.azurestorage.RuntimeContainerMock) TAzureStoragePutProperties(org.talend.components.azurestorage.blob.tazurestorageput.TAzureStoragePutProperties) TAzureStorageConnectionProperties(org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties) Before(org.junit.Before)

Example 3 with TAzureStoragePutProperties

use of org.talend.components.azurestorage.blob.tazurestorageput.TAzureStoragePutProperties in project components by Talend.

the class AzureStoragePutRuntime method initialize.

@Override
public ValidationResult initialize(RuntimeContainer runtimeContainer, ComponentProperties properties) {
    ValidationResult validationResult = super.initialize(runtimeContainer, properties);
    if (validationResult.getStatus() == ValidationResult.Result.ERROR) {
        return validationResult;
    }
    TAzureStoragePutProperties componentProperties = (TAzureStoragePutProperties) properties;
    localFolder = componentProperties.localFolder.getValue();
    remoteFolder = componentProperties.remoteFolder.getValue();
    useFileList = componentProperties.useFileList.getValue();
    files = componentProperties.files;
    this.dieOnError = componentProperties.dieOnError.getValue();
    this.azureStorageBlobService = new AzureStorageBlobService(getAzureConnection(runtimeContainer));
    // checks local folder
    String errorMessage = "";
    if (!new File(localFolder).exists()) {
        // $NON-NLS-1$
        errorMessage = messages.getMessage("error.EmptyLocalFolder");
    } else // checks file list if set.
    if (useFileList && files.fileMask.getValue().isEmpty()) {
        // $NON-NLS-1$
        errorMessage = messages.getMessage("error.EmptyFileList");
    }
    if (errorMessage.isEmpty()) {
        // everything is OK.
        return ValidationResult.OK;
    } else {
        return new ValidationResult(ValidationResult.Result.ERROR, errorMessage);
    }
}
Also used : TAzureStoragePutProperties(org.talend.components.azurestorage.blob.tazurestorageput.TAzureStoragePutProperties) ValidationResult(org.talend.daikon.properties.ValidationResult) File(java.io.File) AzureStorageBlobService(org.talend.components.azurestorage.blob.AzureStorageBlobService)

Aggregations

TAzureStoragePutProperties (org.talend.components.azurestorage.blob.tazurestorageput.TAzureStoragePutProperties)3 File (java.io.File)1 Before (org.junit.Before)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