Search in sources :

Example 11 with TMarketoInputProperties

use of org.talend.components.marketo.tmarketoinput.TMarketoInputProperties in project components by Talend.

the class MarketoInputReaderTestIT method testLeadActivityExcludeREST.

@Test
public void testLeadActivityExcludeREST() throws Exception {
    TMarketoInputProperties props = getRESTProperties();
    props.inputOperation.setValue(getLeadActivity);
    String since = new SimpleDateFormat(DATETIME_PATTERN_PARAM).format(new Date(new Date().getTime() - 10000000));
    props.sinceDateTime.setValue(since);
    props.batchSize.setValue(300);
    props.afterInputOperation();
    props.beforeMappingInput();
    props.setExcludeTypes.setValue(true);
    props.excludeTypes.type.setValue(Arrays.asList("NewLead", "ChangeDataValue"));
    reader = getReader(props);
    assertTrue(reader.start());
    IndexedRecord r = reader.getCurrent();
    assertNotNull(r);
    assertTrue(r.getSchema().getFields().size() > 6);
    while (reader.advance()) {
        r = reader.getCurrent();
        assertNotNull(r);
        // activityTypeId != NewLead
        assertNotEquals(12, r.get(3));
        // activityTypeId != ChangeDataValue
        assertNotEquals(13, r.get(3));
    }
    assertTrue(((int) reader.getReturnValues().get(RETURN_NB_CALL)) >= 6);
}
Also used : IndexedRecord(org.apache.avro.generic.IndexedRecord) TMarketoInputProperties(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) Test(org.junit.Test)

Example 12 with TMarketoInputProperties

use of org.talend.components.marketo.tmarketoinput.TMarketoInputProperties in project components by Talend.

the class MarketoInputReaderTestIT method testLeadChanges.

@Test
public void testLeadChanges() throws Exception {
    TMarketoInputProperties props = getSOAPProperties();
    props.inputOperation.setValue(getLeadChanges);
    props.afterInputOperation();
    props.batchSize.setValue(50);
    // 
    props.oldestCreateDate.setValue(DATE_OLDEST_CREATE);
    props.latestCreateDate.setValue(DATE_LATEST_CREATE);
    reader = getReader(props);
    assertTrue(reader.start());
    LOG.debug("record = {}.", reader.getCurrent());
    assertTrue(reader.advance());
    LOG.debug("record = {}.", reader.getCurrent());
    while (reader.advance()) {
        assertNotNull(reader.getCurrent());
    // LOG.debug("email: {}", reader.getCurrent().get(1));
    }
    assertTrue(((int) reader.getReturnValues().get(RETURN_NB_CALL)) > 1);
}
Also used : TMarketoInputProperties(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties) Test(org.junit.Test)

Example 13 with TMarketoInputProperties

use of org.talend.components.marketo.tmarketoinput.TMarketoInputProperties in project components by Talend.

the class MarketoClientCustomObjectsTestIT method setUp.

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

Example 14 with TMarketoInputProperties

use of org.talend.components.marketo.tmarketoinput.TMarketoInputProperties 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 15 with TMarketoInputProperties

use of org.talend.components.marketo.tmarketoinput.TMarketoInputProperties in project components by Talend.

the class MarketoInputReaderTestIT method testLeadActivityREST.

@Test
public void testLeadActivityREST() throws Exception {
    TMarketoInputProperties props = getRESTProperties();
    props.inputOperation.setValue(getLeadActivity);
    String since = new SimpleDateFormat(DATETIME_PATTERN_PARAM).format(new Date(new Date().getTime() - 10000000));
    props.sinceDateTime.setValue(since);
    props.batchSize.setValue(300);
    props.afterInputOperation();
    props.beforeMappingInput();
    reader = getReader(props);
    assertTrue(reader.start());
    IndexedRecord r = reader.getCurrent();
    assertNotNull(r);
    assertTrue(r.getSchema().getFields().size() > 6);
    while (reader.advance()) {
        r = reader.getCurrent();
        assertNotNull(r);
    }
    // 62 activities (62/10 API Limit)
    assertTrue(((int) reader.getReturnValues().get(RETURN_NB_CALL)) >= 6);
    // test pagination
    props.batchSize.setValue(5);
    reader = getReader(props);
    assertTrue(reader.start());
    r = reader.getCurrent();
    assertNotNull(r);
    assertTrue(r.getSchema().getFields().size() > 6);
    while (reader.advance()) {
        r = reader.getCurrent();
        assertNotNull(r);
    }
    assertTrue(((int) reader.getReturnValues().get(RETURN_NB_CALL)) >= 20);
}
Also used : IndexedRecord(org.apache.avro.generic.IndexedRecord) TMarketoInputProperties(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) Test(org.junit.Test)

Aggregations

TMarketoInputProperties (org.talend.components.marketo.tmarketoinput.TMarketoInputProperties)45 Test (org.junit.Test)25 Before (org.junit.Before)11 IndexedRecord (org.apache.avro.generic.IndexedRecord)10 TMarketoOutputProperties (org.talend.components.marketo.tmarketooutput.TMarketoOutputProperties)9 TMarketoListOperationProperties (org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties)6 Date (java.util.Date)5 Schema (org.apache.avro.Schema)5 SimpleDateFormat (java.text.SimpleDateFormat)4 MarketoRecordResult (org.talend.components.marketo.runtime.client.type.MarketoRecordResult)4 RuntimeContainer (org.talend.components.api.container.RuntimeContainer)2 MarketoRESTClient (org.talend.components.marketo.runtime.client.MarketoRESTClient)2 TMarketoBulkExecProperties (org.talend.components.marketo.tmarketobulkexec.TMarketoBulkExecProperties)2 LeadSelector (org.talend.components.marketo.tmarketoinput.TMarketoInputProperties.LeadSelector)2 NamedThing (org.talend.daikon.NamedThing)2 ValidationResult (org.talend.daikon.properties.ValidationResult)2 ValidationResultMutable (org.talend.daikon.properties.ValidationResultMutable)2 Gson (com.google.gson.Gson)1 AuthenticationHeader (com.marketo.mktows.AuthenticationHeader)1 MktowsPort (com.marketo.mktows.MktowsPort)1