Search in sources :

Example 1 with WizardNameComparator

use of org.talend.components.api.wizard.WizardNameComparator in project components by Talend.

the class SalesforceComponentTestIT method testModuleWizard.

@Test
public void testModuleWizard() throws Throwable {
    ComponentWizard connectionWizard = getComponentService().getComponentWizard(SalesforceConnectionWizardDefinition.COMPONENT_WIZARD_NAME, "nodeSalesforce");
    List<Form> forms = connectionWizard.getForms();
    Form connectionWizardForm = forms.get(0);
    SalesforceConnectionProperties connProps = (SalesforceConnectionProperties) connectionWizardForm.getProperties();
    ComponentWizard[] subWizards = getComponentService().getComponentWizardsForProperties(connProps, "location").toArray(new ComponentWizard[3]);
    Arrays.sort(subWizards, new WizardNameComparator());
    assertEquals(3, subWizards.length);
    assertTrue(subWizards[0].getDefinition().isTopLevel());
    assertEquals("Salesforce Connection", subWizards[0].getDefinition().getMenuItemName());
    assertFalse(subWizards[1].getDefinition().isTopLevel());
    assertEquals("Edit Salesforce", subWizards[1].getDefinition().getMenuItemName());
    assertFalse(subWizards[2].getDefinition().isTopLevel());
    assertEquals("Retrieve Salesforce Modules", subWizards[2].getDefinition().getMenuItemName());
}
Also used : ComponentWizard(org.talend.components.api.wizard.ComponentWizard) WizardNameComparator(org.talend.components.api.wizard.WizardNameComparator) SalesforceConnectionProperties(org.talend.components.salesforce.SalesforceConnectionProperties) Form(org.talend.daikon.properties.presentation.Form) Test(org.junit.Test)

Example 2 with WizardNameComparator

use of org.talend.components.api.wizard.WizardNameComparator 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 3 with WizardNameComparator

use of org.talend.components.api.wizard.WizardNameComparator in project components by Talend.

the class SpringSnowflakeTestIT method testModuleWizard.

@Test
public void testModuleWizard() throws Throwable {
    ComponentWizard connectionWizard = getComponentService().getComponentWizard(SnowflakeConnectionWizardDefinition.COMPONENT_WIZARD_NAME, "nodeSnowflake");
    List<Form> forms = connectionWizard.getForms();
    Form connFormWizard = forms.get(0);
    SnowflakeConnectionProperties connProps = (SnowflakeConnectionProperties) connFormWizard.getProperties();
    ComponentWizard[] subWizards = getComponentService().getComponentWizardsForProperties(connProps, "location").toArray(new ComponentWizard[2]);
    Arrays.sort(subWizards, new WizardNameComparator());
    assertEquals(2, subWizards.length);
    assertTrue(subWizards[0].getDefinition().isTopLevel());
    assertEquals("Snowflake Connection", subWizards[0].getDefinition().getMenuItemName());
    // 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());
// will remove the edit wizard in future, no need to test more about it
// Add module wizard - we refer to the existing connection properties as we don't present the UI
// for them.
// assertTrue(connProps == ((SnowflakeTableListProperties) subWizards[2].getForms().get(0).getProperties())
// .getConnectionProperties());
// assertFalse(subWizards[2].getDefinition().isTopLevel());
// assertEquals("Snowflake Tables", subWizards[2].getDefinition().getMenuItemName());
}
Also used : ComponentWizard(org.talend.components.api.wizard.ComponentWizard) WizardNameComparator(org.talend.components.api.wizard.WizardNameComparator) Form(org.talend.daikon.properties.presentation.Form) SnowflakeConnectionProperties(org.talend.components.snowflake.SnowflakeConnectionProperties) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Test (org.junit.Test)3 ComponentWizard (org.talend.components.api.wizard.ComponentWizard)3 WizardNameComparator (org.talend.components.api.wizard.WizardNameComparator)3 Form (org.talend.daikon.properties.presentation.Form)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 TAzureStorageConnectionProperties (org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties)1 SalesforceConnectionProperties (org.talend.components.salesforce.SalesforceConnectionProperties)1 SnowflakeConnectionProperties (org.talend.components.snowflake.SnowflakeConnectionProperties)1