Search in sources :

Example 1 with TMarketoListOperationProperties

use of org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties in project components by Talend.

the class MarketoRESTClientTestIT method setUp.

@Before
public void setUp() throws Exception {
    iprops = new TMarketoInputProperties("test");
    iprops.connection.setupProperties();
    iprops.connection.endpoint.setValue(ENDPOINT_REST);
    iprops.connection.clientAccessId.setValue(USERID_REST);
    iprops.connection.secretKey.setValue(SECRETKEY_REST);
    iprops.connection.apiMode.setValue(APIMode.REST);
    iprops.schemaInput.setupProperties();
    iprops.mappingInput.setupProperties();
    iprops.setupProperties();
    iprops.includeTypes.setupProperties();
    iprops.includeTypes.type.setValue(new ArrayList<String>());
    iprops.excludeTypes.setupProperties();
    iprops.excludeTypes.type.setValue(new ArrayList<String>());
    iprops.connection.setupLayout();
    iprops.schemaInput.setupLayout();
    iprops.setupLayout();
    // 
    listProperties = new TMarketoListOperationProperties("test");
    listProperties.connection.setupProperties();
    listProperties.connection.endpoint.setValue(ENDPOINT_REST);
    listProperties.connection.clientAccessId.setValue(USERID_REST);
    listProperties.connection.secretKey.setValue(SECRETKEY_REST);
    listProperties.connection.apiMode.setValue(APIMode.REST);
    listProperties.schemaInput.setupProperties();
    listProperties.setupProperties();
    listProperties.connection.setupLayout();
    listProperties.schemaInput.setupLayout();
    listProperties.setupLayout();
    // 
    outProperties = new TMarketoOutputProperties("test");
    outProperties.connection.setupProperties();
    outProperties.connection.endpoint.setValue(ENDPOINT_REST);
    outProperties.connection.clientAccessId.setValue(USERID_REST);
    outProperties.connection.secretKey.setValue(SECRETKEY_REST);
    outProperties.connection.apiMode.setValue(APIMode.REST);
    outProperties.schemaInput.setupProperties();
    outProperties.setupProperties();
    outProperties.connection.setupLayout();
    outProperties.schemaInput.setupLayout();
    outProperties.setupLayout();
}
Also used : TMarketoOutputProperties(org.talend.components.marketo.tmarketooutput.TMarketoOutputProperties) TMarketoListOperationProperties(org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties) TMarketoInputProperties(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties) Before(org.junit.Before)

Example 2 with TMarketoListOperationProperties

use of org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties in project components by Talend.

the class MarketoListOperationWriterTestIT method getSOAPProperties.

public TMarketoListOperationProperties getSOAPProperties() {
    TMarketoListOperationProperties props = new TMarketoListOperationProperties("test");
    props.connection.setupProperties();
    props.connection.endpoint.setValue(ENDPOINT_SOAP);
    props.connection.clientAccessId.setValue(USERID_SOAP);
    props.connection.secretKey.setValue(SECRETKEY_SOAP);
    props.connection.apiMode.setValue(APIMode.SOAP);
    props.connection.setupLayout();
    props.setupProperties();
    props.schemaInput.setupProperties();
    props.schemaInput.schema.setValue(MarketoConstants.getListOperationSOAPSchema());
    props.connection.setupLayout();
    props.schemaInput.setupLayout();
    props.setupLayout();
    props.updateOutputSchemas();
    return props;
}
Also used : TMarketoListOperationProperties(org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties)

Example 3 with TMarketoListOperationProperties

use of org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties in project components by Talend.

the class MarketoSOAPClientTestIT method setUp.

@Before
public void setUp() throws Exception {
    inputProperties = new TMarketoInputProperties("test");
    inputProperties.connection.setupProperties();
    inputProperties.connection.endpoint.setValue(ENDPOINT_SOAP);
    inputProperties.connection.clientAccessId.setValue(USERID_SOAP);
    inputProperties.connection.secretKey.setValue(SECRETKEY_SOAP);
    inputProperties.schemaInput.setupProperties();
    inputProperties.mappingInput.setupProperties();
    inputProperties.includeTypes.setupProperties();
    inputProperties.setupProperties();
    inputProperties.connection.apiMode.setValue(SOAP);
    inputProperties.includeTypes.type.setValue(new ArrayList<String>());
    inputProperties.excludeTypes.setupProperties();
    inputProperties.excludeTypes.type.setValue(new ArrayList<String>());
    inputProperties.connection.setupLayout();
    inputProperties.schemaInput.setupLayout();
    inputProperties.setupLayout();
    // 
    listProperties = new TMarketoListOperationProperties("test");
    listProperties.connection.setupProperties();
    listProperties.connection.endpoint.setValue(ENDPOINT_SOAP);
    listProperties.connection.clientAccessId.setValue(USERID_SOAP);
    listProperties.connection.secretKey.setValue(SECRETKEY_SOAP);
    listProperties.schemaInput.setupProperties();
    listProperties.setupProperties();
    listProperties.connection.apiMode.setValue(SOAP);
    listProperties.connection.setupLayout();
    listProperties.schemaInput.setupLayout();
    listProperties.setupLayout();
    // 
    outProperties = new TMarketoOutputProperties("test");
    outProperties.connection.setupProperties();
    outProperties.connection.endpoint.setValue(ENDPOINT_SOAP);
    outProperties.connection.clientAccessId.setValue(USERID_SOAP);
    outProperties.connection.secretKey.setValue(SECRETKEY_SOAP);
    outProperties.schemaInput.setupProperties();
    outProperties.setupProperties();
    outProperties.connection.apiMode.setValue(SOAP);
    outProperties.connection.setupLayout();
    outProperties.schemaInput.setupLayout();
    outProperties.setupLayout();
}
Also used : TMarketoOutputProperties(org.talend.components.marketo.tmarketooutput.TMarketoOutputProperties) TMarketoListOperationProperties(org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties) TMarketoInputProperties(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties) Before(org.junit.Before)

Example 4 with TMarketoListOperationProperties

use of org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties in project components by Talend.

the class MarketoSink method validate.

@Override
public ValidationResult validate(RuntimeContainer container) {
    ValidationResultMutable vr = new ValidationResultMutable(super.validate(container));
    if (vr.getStatus().equals(Result.ERROR)) {
        return vr;
    }
    // output
    if (properties instanceof TMarketoOutputProperties) {
        switch(((TMarketoOutputProperties) properties).outputOperation.getValue()) {
            case syncLead:
                break;
            case syncMultipleLeads:
                break;
            case deleteLeads:
                break;
            case syncCustomObjects:
                if (StringUtils.isEmpty(((TMarketoOutputProperties) properties).customObjectName.getValue())) {
                    vr.setStatus(Result.ERROR);
                    vr.setMessage(messages.getMessage("error.validation.customobject.customobjectname"));
                    return vr;
                }
                if (StringUtils.isEmpty(((TMarketoOutputProperties) properties).customObjectDedupeBy.getValue())) {
                // TODO check API if required. Not sure...
                }
                break;
            case deleteCustomObjects:
                if (StringUtils.isEmpty(((TMarketoOutputProperties) properties).customObjectName.getValue())) {
                    vr.setStatus(Result.ERROR);
                    vr.setMessage(messages.getMessage("error.validation.customobject.customobjectname"));
                    return vr;
                }
                break;
        }
    }
    // check list operations
    if (properties instanceof TMarketoListOperationProperties) {
    // nothing to check for now.
    }
    // check getMultipleLeads with an input
    if (properties instanceof TMarketoInputProperties) {
        // operation must be getMultipleLeads
        if (!((TMarketoInputProperties) properties).inputOperation.getValue().equals(InputOperation.getMultipleLeads)) {
            vr.setStatus(Result.ERROR);
            vr.setMessage(messages.getMessage("error.validation.sink.getmultipleleads.only"));
            return vr;
        }
        // lead selector must be LeadKeySelector
        LeadSelector selector;
        if (APIMode.SOAP.equals(properties.getConnectionProperties().apiMode.getValue())) {
            selector = ((TMarketoInputProperties) properties).leadSelectorSOAP.getValue();
        } else {
            selector = ((TMarketoInputProperties) properties).leadSelectorREST.getValue();
        }
        if (!selector.equals(LeadSelector.LeadKeySelector)) {
            vr.setStatus(Result.ERROR);
            vr.setMessage(messages.getMessage("error.validation.sink.leadkeyselector.only"));
            return vr;
        }
        // lead key values must be defined
        if (StringUtils.isEmpty(((TMarketoInputProperties) properties).leadKeyValues.getValue())) {
            vr.setStatus(Result.ERROR);
            vr.setMessage(messages.getMessage("error.validation.leadkeyvalues"));
            return vr;
        }
    }
    return ValidationResult.OK;
}
Also used : TMarketoOutputProperties(org.talend.components.marketo.tmarketooutput.TMarketoOutputProperties) ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable) TMarketoListOperationProperties(org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties) TMarketoInputProperties(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties) LeadSelector(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties.LeadSelector)

Example 5 with TMarketoListOperationProperties

use of org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties in project components by Talend.

the class MarketoListOperationWriterTestIT method getRESTProperties.

public TMarketoListOperationProperties getRESTProperties() {
    TMarketoListOperationProperties props = new TMarketoListOperationProperties("test");
    props.connection.setupProperties();
    props.connection.endpoint.setValue(ENDPOINT_REST);
    props.connection.clientAccessId.setValue(USERID_REST);
    props.connection.secretKey.setValue(SECRETKEY_REST);
    props.connection.apiMode.setValue(APIMode.REST);
    props.setupProperties();
    props.schemaInput.setupProperties();
    props.connection.setupLayout();
    props.schemaInput.setupLayout();
    props.setupLayout();
    props.schemaInput.schema.setValue(MarketoConstants.getListOperationRESTSchema());
    props.updateOutputSchemas();
    return props;
}
Also used : TMarketoListOperationProperties(org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties)

Aggregations

TMarketoListOperationProperties (org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties)10 TMarketoOutputProperties (org.talend.components.marketo.tmarketooutput.TMarketoOutputProperties)7 TMarketoInputProperties (org.talend.components.marketo.tmarketoinput.TMarketoInputProperties)6 Before (org.junit.Before)5 Test (org.junit.Test)2 AuthenticationHeader (com.marketo.mktows.AuthenticationHeader)1 MktowsPort (com.marketo.mktows.MktowsPort)1 ObjectFactory (com.marketo.mktows.ObjectFactory)1 ParamsListMObjects (com.marketo.mktows.ParamsListMObjects)1 Date (java.util.Date)1 GregorianCalendar (java.util.GregorianCalendar)1 LeadSelector (org.talend.components.marketo.tmarketoinput.TMarketoInputProperties.LeadSelector)1 ValidationResultMutable (org.talend.daikon.properties.ValidationResultMutable)1