Search in sources :

Example 1 with TMarketoConnectionProperties

use of org.talend.components.marketo.tmarketoconnection.TMarketoConnectionProperties in project components by Talend.

the class MarketoSourceOrSink method getEffectiveConnection.

public TMarketoConnectionProperties getEffectiveConnection(RuntimeContainer container) {
    TMarketoConnectionProperties connProps = properties.getConnectionProperties();
    String refComponentId = connProps.getReferencedComponentId();
    // Using another component's connection
    if (refComponentId != null) {
        // In a runtime container
        if (container != null) {
            TMarketoConnectionProperties shared = (TMarketoConnectionProperties) container.getComponentData(refComponentId, KEY_CONNECTION_PROPERTIES);
            if (shared != null) {
                return shared;
            }
        }
        // Design time
        connProps = connProps.getReferencedConnectionProperties();
    }
    if (container != null) {
        container.setComponentData(container.getCurrentComponentId(), KEY_CONNECTION_PROPERTIES, connProps);
    }
    return connProps;
}
Also used : TMarketoConnectionProperties(org.talend.components.marketo.tmarketoconnection.TMarketoConnectionProperties)

Example 2 with TMarketoConnectionProperties

use of org.talend.components.marketo.tmarketoconnection.TMarketoConnectionProperties in project components by Talend.

the class MarketoCustomObjectsSchemasPropertiesTest method setUp.

@Before
public void setUp() throws Exception {
    properties = new MarketoCustomObjectsSchemasProperties("test");
    properties.setupProperties();
    connection = new TMarketoConnectionProperties("testconn");
    connection.setupProperties();
    connection.endpoint.setValue("http://fakeendpoint.com");
    connection.clientAccessId.setValue("user0000");
    connection.secretKey.setValue("secretk");
    properties.setupLayout();
}
Also used : TMarketoConnectionProperties(org.talend.components.marketo.tmarketoconnection.TMarketoConnectionProperties) Before(org.junit.Before)

Example 3 with TMarketoConnectionProperties

use of org.talend.components.marketo.tmarketoconnection.TMarketoConnectionProperties in project components by Talend.

the class MarketoConnectionWizardTest method testSetupProperties.

@Test
public void testSetupProperties() throws Exception {
    TMarketoConnectionProperties p = new TMarketoConnectionProperties("test");
    p.setupProperties();
    wiz.setupProperties(p);
    assertEquals(p, wiz.connProperties);
    assertEquals(p, wiz.coProps.connection);
}
Also used : TMarketoConnectionProperties(org.talend.components.marketo.tmarketoconnection.TMarketoConnectionProperties) Test(org.junit.Test)

Example 4 with TMarketoConnectionProperties

use of org.talend.components.marketo.tmarketoconnection.TMarketoConnectionProperties in project components by Talend.

the class MarketoSourceOrSink method validate.

@Override
public ValidationResult validate(RuntimeContainer container) {
    TMarketoConnectionProperties conn = getEffectiveConnection(container);
    String endpoint = conn.endpoint.getValue();
    String clientAccess = conn.clientAccessId.getValue();
    String secretKey = conn.secretKey.getValue();
    ValidationResultMutable vr = new ValidationResultMutable();
    if (endpoint == null || endpoint.isEmpty()) {
        vr.setMessage(messages.getMessage("error.validation.connection.endpoint"));
        vr.setStatus(ValidationResult.Result.ERROR);
        return vr;
    }
    if (clientAccess == null || clientAccess.isEmpty()) {
        vr.setMessage(messages.getMessage("error.validation.connection.clientaccess"));
        vr.setStatus(ValidationResult.Result.ERROR);
        return vr;
    }
    if (secretKey == null || secretKey.isEmpty()) {
        vr.setMessage(messages.getMessage("error.validation.connection.secretkey"));
        vr.setStatus(ValidationResult.Result.ERROR);
        return vr;
    }
    // bug/TDI-38439_MarketoWizardConnection
    return validateConnection(conn);
}
Also used : ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable) TMarketoConnectionProperties(org.talend.components.marketo.tmarketoconnection.TMarketoConnectionProperties)

Example 5 with TMarketoConnectionProperties

use of org.talend.components.marketo.tmarketoconnection.TMarketoConnectionProperties in project components by Talend.

the class MarketoConnectionWizardTest method testWizardDefinitionCreateWizard.

@Test
public void testWizardDefinitionCreateWizard() throws Exception {
    MarketoConnectionWizard w = (MarketoConnectionWizard) def.createWizard(repoLoc);
    assertNotNull(w);
    w = (MarketoConnectionWizard) def.createWizard(new TMarketoConnectionProperties("test"), repoLoc);
    assertNotNull(w);
}
Also used : TMarketoConnectionProperties(org.talend.components.marketo.tmarketoconnection.TMarketoConnectionProperties) Test(org.junit.Test)

Aggregations

TMarketoConnectionProperties (org.talend.components.marketo.tmarketoconnection.TMarketoConnectionProperties)6 Before (org.junit.Before)2 Test (org.junit.Test)2 ValidationResultMutable (org.talend.daikon.properties.ValidationResultMutable)1