Search in sources :

Example 21 with MarketoSource

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

the class MarketoRESTClientTestIT method testGetLeadFail.

@Test
public void testGetLeadFail() throws Exception {
    iprops.inputOperation.setValue(getLead);
    iprops.leadKeyTypeREST.setValue(email);
    iprops.afterInputOperation();
    // 
    iprops.leadKeyValue.setValue(EMAIL_INEXISTANT);
    MarketoSource source = new MarketoSource();
    source.initialize(null, iprops);
    MarketoClientService client = source.getClientService(null);
    // 
    MarketoRecordResult result = client.getLead(iprops, null);
    LOG.debug("{}", result);
    List<IndexedRecord> records = result.getRecords();
    assertEquals(emptyList(), records);
}
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 22 with MarketoSource

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

the class MarketoRESTClientTestIT method testGetMultipleLeadsListNameFail.

@Test
public void testGetMultipleLeadsListNameFail() throws Exception {
    iprops.inputOperation.setValue(getMultipleLeads);
    iprops.afterInputOperation();
    iprops.batchSize.setValue(200);
    // 
    iprops.leadSelectorREST.setValue(StaticListSelector);
    iprops.listParam.setValue(STATIC_LIST_NAME);
    iprops.listParamListName.setValue("undx_test_list******");
    MarketoSource source = new MarketoSource();
    source.initialize(null, iprops);
    MarketoClientService client = source.getClientService(null);
    // 
    MarketoRecordResult result = client.getMultipleLeads(iprops, null);
    LOG.debug("{}", result);
    assertFalse(result.isSuccess());
    assertNotNull(result.getErrors());
    assertEquals(0, result.getRecordCount());
    assertEquals(0, result.getRemainCount());
    assertEquals(emptyList(), client.getMultipleLeads(iprops, null).getRecords());
}
Also used : MarketoSource(org.talend.components.marketo.runtime.MarketoSource) MarketoRecordResult(org.talend.components.marketo.runtime.client.type.MarketoRecordResult) Test(org.junit.Test)

Example 23 with MarketoSource

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

the class MarketoRESTClientTestIT method testGetLeadActivityIncludeFilter.

@Test
public void testGetLeadActivityIncludeFilter() throws Exception {
    iprops.inputOperation.setValue(getLeadActivity);
    iprops.afterInputOperation();
    iprops.batchSize.setValue(300);
    iprops.includeTypes.type.getValue().add(IncludeExcludeFieldsREST.NewLead.toString());
    iprops.includeTypes.type.getValue().add(IncludeExcludeFieldsREST.ChangeDataValue.toString());
    iprops.sinceDateTime.setValue(DATE_OLDEST_CREATE);
    iprops.beforeMappingInput();
    // 
    MarketoSource source = new MarketoSource();
    source.initialize(null, iprops);
    MarketoClientService client = source.getClientService(null);
    // 
    MarketoRecordResult result = client.getLeadActivity(iprops, null);
    LOG.debug("{}", result);
    List<IndexedRecord> activities = result.getRecords();
    assertTrue(activities.size() > 0);
    for (IndexedRecord r : activities) {
        LOG.debug("r=" + r);
        assertTrue("New Lead".equals(r.get(4)) || "Change Data Value".equals(r.get(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)

Example 24 with MarketoSource

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

the class MarketoRESTClientTestIT method testGetLeadsChanges.

/*
     *
     * ************************ getLeadChanges ************************
     *
     */
@Test
public void testGetLeadsChanges() throws Exception {
    iprops.inputOperation.setValue(getLeadChanges);
    iprops.afterInputOperation();
    iprops.batchSize.setValue(100);
    iprops.sinceDateTime.setValue(DATE_OLDEST_CREATE);
    iprops.fieldList.setValue("id,email,firstName,lastName,company");
    iprops.beforeMappingInput();
    // 
    MarketoSource source = new MarketoSource();
    source.initialize(null, iprops);
    MarketoClientService client = source.getClientService(null);
    // 
    MarketoRecordResult result = client.getLeadChanges(iprops, null);
    LOG.debug("{}", result);
    List<IndexedRecord> changes = result.getRecords();
    assertTrue(changes.size() > 0);
    assertTrue(result.getRemainCount() > 0);
}
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 25 with MarketoSource

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

the class MarketoRESTClientTestIT method testBadConnectionString.

@Test(expected = IOException.class)
public void testBadConnectionString() throws Exception {
    iprops.connection.endpoint.setValue("htps://marketo.com/rest/v1");
    MarketoSource source = new MarketoSource();
    source.initialize(null, iprops);
    MarketoClientService client = source.getClientService(null);
    fail("Shouldn't be here");
}
Also used : MarketoSource(org.talend.components.marketo.runtime.MarketoSource) 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