Search in sources :

Example 21 with TAzureStorageConnectionProperties

use of org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties in project components by Talend.

the class AzureStorageConnectionWizardTest method testWizard.

@Test
public void testWizard() throws Throwable {
    final List<RepoProps> repoProps = new ArrayList<>();
    Repository repo = new TestRepository(repoProps);
    getComponentService().setRepository(repo);
    Set<ComponentWizardDefinition> wizards = getComponentService().getTopLevelComponentWizards();
    int count = 0;
    ComponentWizardDefinition wizardDef = null;
    for (ComponentWizardDefinition wizardDefinition : wizards) {
        if (wizardDefinition instanceof AzureStorageConnectionWizardDefinition) {
            wizardDef = wizardDefinition;
            count++;
        }
    }
    assertEquals(1, count);
    assertEquals("Create an Azure Storage Connection", wizardDef.getMenuItemName());
    ComponentWizard wiz = getComponentService().getComponentWizard(AzureStorageConnectionWizardDefinition.COMPONENT_WIZARD_NAME, "nodeAzureStorage");
    assertNotNull(wiz);
    assertEquals("nodeAzureStorage", wiz.getRepositoryLocation());
    List<Form> forms = wiz.getForms();
    Form connFormWizard = forms.get(0);
    assertEquals("Wizard", connFormWizard.getName());
    assertFalse(connFormWizard.isAllowBack());
    assertFalse(connFormWizard.isAllowForward());
    assertFalse(connFormWizard.isAllowFinish());
    // Main from SalesforceModuleListProperties
    assertEquals("Container", forms.get(1).getName());
    assertEquals("Queue", forms.get(2).getName());
    assertEquals("Table", forms.get(3).getName());
    assertEquals("Azure Storage Connection Settings", connFormWizard.getTitle());
    assertEquals("Fill in fields to configure connection.", connFormWizard.getSubtitle());
    TAzureStorageConnectionProperties connProps = (TAzureStorageConnectionProperties) connFormWizard.getProperties();
    connProps.setupProperties();
    Object image = getComponentService().getWizardPngImage(AzureStorageConnectionWizardDefinition.COMPONENT_WIZARD_NAME, WizardImageType.TREE_ICON_16X16);
    assertNotNull(image);
    image = getComponentService().getWizardPngImage(AzureStorageConnectionWizardDefinition.COMPONENT_WIZARD_NAME, WizardImageType.WIZARD_BANNER_75X66);
    assertNotNull(image);
    // Check the non-top-level wizard
    // check password i18n
    assertEquals("Name", connProps.getProperty("name").getDisplayName());
    connProps.name.setValue("connName");
    connProps.accountName.setValue("demo");
    connProps.accountKey.setValue("demo");
    // check name i18n
    // $NON-NLS-1$
    NamedThing nameProp = connFormWizard.getWidget("name").getContent();
    assertEquals("Name", nameProp.getDisplayName());
    connProps = (TAzureStorageConnectionProperties) PropertiesTestUtils.checkAndValidate(getComponentService(), connFormWizard, "testConnection", connProps);
    assertFalse(connFormWizard.isAllowForward());
    Form modForm = forms.get(1);
}
Also used : Form(org.talend.daikon.properties.presentation.Form) ArrayList(java.util.ArrayList) TAzureStorageConnectionProperties(org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties) NamedThing(org.talend.daikon.NamedThing) Repository(org.talend.daikon.properties.service.Repository) ComponentWizard(org.talend.components.api.wizard.ComponentWizard) ComponentWizardDefinition(org.talend.components.api.wizard.ComponentWizardDefinition) Test(org.junit.Test)

Example 22 with TAzureStorageConnectionProperties

use of org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties in project components by Talend.

the class AzureStorageConnectionWizardTest method testModuleWizard.

@Test
public void testModuleWizard() throws Throwable {
    ComponentWizard wiz = getComponentService().getComponentWizard(AzureStorageConnectionWizardDefinition.COMPONENT_WIZARD_NAME, "nodeAzureStorage");
    List<Form> forms = wiz.getForms();
    Form connFormWizard = forms.get(0);
    TAzureStorageConnectionProperties connProps = (TAzureStorageConnectionProperties) connFormWizard.getProperties();
    ComponentWizard[] subWizards = getComponentService().getComponentWizardsForProperties(connProps, "location").toArray(new ComponentWizard[1]);
    Arrays.sort(subWizards, new WizardNameComparator());
    assertEquals(2, subWizards.length);
    // Edit connection wizard - we copy the connection properties, as we present the UI, so we use the
    // connection properties object created by the new wizard
    assertFalse(connProps == subWizards[1].getForms().get(0).getProperties());
// Add module wizard - we refer to the existing connection properties as we don't present the UI
// for them.
}
Also used : ComponentWizard(org.talend.components.api.wizard.ComponentWizard) WizardNameComparator(org.talend.components.api.wizard.WizardNameComparator) Form(org.talend.daikon.properties.presentation.Form) TAzureStorageConnectionProperties(org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties) Test(org.junit.Test)

Example 23 with TAzureStorageConnectionProperties

use of org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties in project components by Talend.

the class AzureStorageQueueRuntimeTest method setup.

@Before
public void setup() throws IOException {
    properties = new TAzureStorageQueueCreateProperties(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");
    runtimeContainer = new RuntimeContainerMock();
    this.azureStorageQueue = new AzureStorageQueueRuntime() {
    };
}
Also used : TAzureStorageQueueCreateProperties(org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties) RuntimeContainerMock(org.talend.components.azurestorage.RuntimeContainerMock) TAzureStorageConnectionProperties(org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties) Before(org.junit.Before)

Example 24 with TAzureStorageConnectionProperties

use of org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties in project components by Talend.

the class AzureStorageTableReaderTest method setUp.

@Before
public void setUp() throws Exception {
    container = new RuntimeContainerMock();
    properties = new TAzureStorageInputTableProperties(PROP_ + "InputTable");
    properties.setupProperties();
    // valid fake 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.tableName.setValue("testTable");
    properties.filterExpression.column.setValue(new ArrayList<String>());
    properties.filterExpression.fieldType.setValue(new ArrayList<String>());
    properties.filterExpression.function.setValue(new ArrayList<String>());
    properties.filterExpression.operand.setValue(new ArrayList<String>());
    properties.filterExpression.predicate.setValue(new ArrayList<String>());
    properties.filterExpression.column.getValue().add("PartitionKey");
    properties.filterExpression.fieldType.getValue().add(SupportedFieldType.STRING.name());
    properties.filterExpression.function.getValue().add(Comparison.EQUAL.name());
    properties.filterExpression.operand.getValue().add("Departement");
    properties.filterExpression.predicate.getValue().add(Predicate.AND.name());
    source = new AzureStorageTableSource();
}
Also used : RuntimeContainerMock(org.talend.components.azurestorage.RuntimeContainerMock) TAzureStorageInputTableProperties(org.talend.components.azurestorage.table.tazurestorageinputtable.TAzureStorageInputTableProperties) TAzureStorageConnectionProperties(org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties)

Example 25 with TAzureStorageConnectionProperties

use of org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties in project components by Talend.

the class AzureStorageListReaderTest method setUp.

@Before
public void setUp() throws Exception {
    runtimeContainer = new RuntimeContainerMock();
    AzureStorageSource source = new AzureStorageSource();
    properties = new TAzureStorageListProperties(PROP_ + "List");
    properties.connection = new TAzureStorageConnectionProperties(PROP_ + "Connection");
    properties.connection.protocol.setValue(Protocol.HTTP);
    properties.connection.accountName.setValue("fakeAccountName");
    properties.connection.accountKey.setValue("fakeAccountKey=ANBHFYRJJFHRIKKJFU");
    properties.setupProperties();
    source.initialize(runtimeContainer, properties);
    reader = (AzureStorageListReader) source.createReader(runtimeContainer);
    reader.azureStorageBlobService = blobService;
}
Also used : TAzureStorageListProperties(org.talend.components.azurestorage.blob.tazurestoragelist.TAzureStorageListProperties) RuntimeContainerMock(org.talend.components.azurestorage.RuntimeContainerMock) TAzureStorageConnectionProperties(org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties) Before(org.junit.Before)

Aggregations

TAzureStorageConnectionProperties (org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties)27 RuntimeContainerMock (org.talend.components.azurestorage.RuntimeContainerMock)16 Before (org.junit.Before)14 Test (org.junit.Test)7 ValidationResult (org.talend.daikon.properties.ValidationResult)3 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 ComponentWizard (org.talend.components.api.wizard.ComponentWizard)2 TAzureStorageQueueCreateProperties (org.talend.components.azurestorage.queue.tazurestoragequeuecreate.TAzureStorageQueueCreateProperties)2 TAzureStorageOutputTableProperties (org.talend.components.azurestorage.table.tazurestorageoutputtable.TAzureStorageOutputTableProperties)2 NamedThing (org.talend.daikon.NamedThing)2 Form (org.talend.daikon.properties.presentation.Form)2 ComponentWizardDefinition (org.talend.components.api.wizard.ComponentWizardDefinition)1 WizardNameComparator (org.talend.components.api.wizard.WizardNameComparator)1 AzureStorageProvideConnectionProperties (org.talend.components.azurestorage.AzureStorageProvideConnectionProperties)1 AzureStorageSourceOrSink (org.talend.components.azurestorage.blob.runtime.AzureStorageSourceOrSink)1 TAzureStorageContainerCreateProperties (org.talend.components.azurestorage.blob.tazurestoragecontainercreate.TAzureStorageContainerCreateProperties)1 TAzureStorageContainerDeleteProperties (org.talend.components.azurestorage.blob.tazurestoragecontainerdelete.TAzureStorageContainerDeleteProperties)1 TAzureStorageContainerExistProperties (org.talend.components.azurestorage.blob.tazurestoragecontainerexist.TAzureStorageContainerExistProperties)1 TAzureStorageContainerListProperties (org.talend.components.azurestorage.blob.tazurestoragecontainerlist.TAzureStorageContainerListProperties)1