Search in sources :

Example 6 with MarketoSource

use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.

the class MarketoSOAPClientTestIT method testGetLeadsChanges.

@Test
public void testGetLeadsChanges() throws Exception {
    inputProperties.inputOperation.setValue(getLeadChanges);
    inputProperties.afterInputOperation();
    inputProperties.beforeMappingInput();
    inputProperties.batchSize.setValue(1000);
    // 
    inputProperties.oldestCreateDate.setValue(DATE_OLDEST_CREATE);
    inputProperties.latestCreateDate.setValue(DATE_LATEST_CREATE);
    MarketoSource source = new MarketoSource();
    source.initialize(null, inputProperties);
    MarketoClientService client = source.getClientService(null);
    // 
    MarketoRecordResult result = client.getLeadChanges(inputProperties, null);
    List<IndexedRecord> changes = result.getRecords();
    assertTrue(changes.size() > 0);
    assertTrue(result.getRemainCount() > 0);
    List<IndexedRecord> records = result.getRecords();
    assertTrue(records.size() > 0);
    for (IndexedRecord r : records) {
        assertNotNull(r.get(0));
        assertTrue(r.get(0) instanceof Long);
    }
}
Also used : IndexedRecord(org.apache.avro.generic.IndexedRecord) MarketoSource(org.talend.components.marketo.runtime.MarketoSource) MarketoRecordResult(org.talend.components.marketo.runtime.client.type.MarketoRecordResult) Test(org.junit.Test)

Example 7 with MarketoSource

use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.

the class MarketoSOAPClientTestIT method testGetLeadActivityExcludeFilter.

@Test
public void testGetLeadActivityExcludeFilter() throws Exception {
    inputProperties.inputOperation.setValue(getLeadActivity);
    inputProperties.leadKeyTypeSOAP.setValue(EMAIL);
    inputProperties.leadSelectorSOAP.setValue(LeadKeySelector);
    inputProperties.updateSchemaRelated();
    inputProperties.batchSize.setValue(11);
    // 
    inputProperties.leadKeyValue.setValue(EMAIL_LEAD_MANY_INFOS);
    inputProperties.setExcludeTypes.setValue(true);
    inputProperties.excludeTypes.type.getValue().add(NewLead.toString());
    inputProperties.excludeTypes.type.getValue().add(ChangeDataValue.toString());
    MarketoSource source = new MarketoSource();
    source.initialize(null, inputProperties);
    MarketoClientService client = source.getClientService(null);
    // 
    MarketoRecordResult result = client.getLeadActivity(inputProperties, null);
    List<IndexedRecord> activities = result.getRecords();
    assertTrue(activities.size() > 0);
    for (IndexedRecord r : activities) {
        assertTrue(!"New Lead".equals(r.get(2)) && !"Change Data Value".equals(r.get(2)));
    }
}
Also used : IndexedRecord(org.apache.avro.generic.IndexedRecord) MarketoSource(org.talend.components.marketo.runtime.MarketoSource) MarketoRecordResult(org.talend.components.marketo.runtime.client.type.MarketoRecordResult) Test(org.junit.Test)

Example 8 with MarketoSource

use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.

the class MarketoSOAPClientTestIT method testBUG_TDI38439_MarketoWizardConnectionFail.

@Test(expected = IOException.class)
public void testBUG_TDI38439_MarketoWizardConnectionFail() throws Exception {
    inputProperties.connection.endpoint.setValue(ENDPOINT_SOAP);
    inputProperties.connection.clientAccessId.setValue(USERID_SOAP);
    inputProperties.connection.secretKey.setValue("false");
    MarketoSource source = new MarketoSource();
    source.initialize(null, inputProperties);
    MarketoClientService client = source.getClientService(null);
    fail("Shouldn't be here");
}
Also used : MarketoSource(org.talend.components.marketo.runtime.MarketoSource) Test(org.junit.Test)

Example 9 with MarketoSource

use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.

the class MarketoSOAPClientTestIT method testGetMultipleLeadsLastUpdate.

@Test
public void testGetMultipleLeadsLastUpdate() throws Exception {
    inputProperties.inputOperation.setValue(getMultipleLeads);
    inputProperties.leadSelectorSOAP.setValue(LastUpdateAtSelector);
    inputProperties.updateSchemaRelated();
    inputProperties.batchSize.setValue(10);
    // 
    inputProperties.oldestUpdateDate.setValue(DATE_OLDEST_UPDATE);
    inputProperties.latestUpdateDate.setValue(DATE_LATEST_UPDATE);
    MarketoSource source = new MarketoSource();
    source.initialize(null, inputProperties);
    MarketoClientService client = source.getClientService(null);
    // 
    assertTrue(client.getMultipleLeads(inputProperties, null).getRecords().size() > 0);
}
Also used : MarketoSource(org.talend.components.marketo.runtime.MarketoSource) Test(org.junit.Test)

Example 10 with MarketoSource

use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.

the class MarketoSOAPClientTestIT method testGetMultipleLeadsLeadKey.

@Test
public void testGetMultipleLeadsLeadKey() throws Exception {
    inputProperties.inputOperation.setValue(getMultipleLeads);
    inputProperties.leadKeyTypeSOAP.setValue(EMAIL);
    inputProperties.afterInputOperation();
    inputProperties.batchSize.setValue(100);
    inputProperties.leadKeyValues.setValue("undx00@undx.net,undx10@undx.net,undx20@undx.net,undx30@undx.net");
    MarketoSource source = new MarketoSource();
    source.initialize(null, inputProperties);
    MarketoClientService client = source.getClientService(null);
    // 
    MarketoRecordResult result = client.getMultipleLeads(inputProperties, null);
    LOG.debug("{}", result);
    List<IndexedRecord> records = result.getRecords();
    assertTrue(records.size() >= 4);
}
Also used : IndexedRecord(org.apache.avro.generic.IndexedRecord) MarketoSource(org.talend.components.marketo.runtime.MarketoSource) MarketoRecordResult(org.talend.components.marketo.runtime.client.type.MarketoRecordResult) Test(org.junit.Test)

Aggregations

MarketoSource (org.talend.components.marketo.runtime.MarketoSource)73 Test (org.junit.Test)72 MarketoRecordResult (org.talend.components.marketo.runtime.client.type.MarketoRecordResult)49 IndexedRecord (org.apache.avro.generic.IndexedRecord)37 MarketoSyncResult (org.talend.components.marketo.runtime.client.type.MarketoSyncResult)17 Schema (org.apache.avro.Schema)14 SyncStatus (org.talend.components.marketo.runtime.client.rest.type.SyncStatus)13 ArrayList (java.util.ArrayList)9 ListOperationParameters (org.talend.components.marketo.runtime.client.type.ListOperationParameters)7 Field (org.apache.avro.Schema.Field)5 Record (org.apache.avro.generic.GenericData.Record)4 MarketoError (org.talend.components.marketo.runtime.client.type.MarketoError)3 LeadRecord (com.marketo.mktows.LeadRecord)2 Path (java.nio.file.Path)2 GenericData (org.apache.avro.generic.GenericData)1