Search in sources :

Example 36 with TMarketoInputProperties

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

the class MarketoSourceOrSinkTestIT method testGetClientService.

@Test(expected = IOException.class)
public void testGetClientService() throws Exception {
    TMarketoInputProperties props = new TMarketoInputProperties("test");
    props.setupProperties();
    props.connection.setupProperties();
    sos.initialize(null, props);
    assertEquals("Marketo REST API Client [].", sos.getClientService(null).toString());
    // 2times for cache
    assertEquals("Marketo REST API Client [].", sos.getClientService(null).toString());
    props.setupProperties();
    sos = new MarketoSourceOrSink();
    props.connection.apiMode.setValue(APIMode.SOAP);
    props.connection.endpoint.setValue("https://www.marketo.com");
    sos.initialize(null, props);
    assertEquals("Marketo SOAP API Client [null].", sos.getClientService(null).toString());
}
Also used : TMarketoInputProperties(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties) Test(org.junit.Test)

Example 37 with TMarketoInputProperties

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

the class MarketoSourceTest method testTDI38561.

@Test
public void testTDI38561() throws Exception {
    TMarketoInputProperties props = new TMarketoInputProperties("test");
    props.connection.setupProperties();
    props.setupProperties();
    props.connection.endpoint.setValue("htp:ttoot.com");
    props.connection.clientAccessId.setValue("user");
    props.connection.secretKey.setValue("secret");
    source.initialize(null, props);
    assertEquals(ValidationResult.Result.ERROR, source.validate(null).getStatus());
    props.connection.endpoint.setValue("https://ttoot.com");
    source.initialize(null, props);
    assertEquals(ValidationResult.Result.ERROR, source.validate(null).getStatus());
    props.connection.endpoint.setValue("https://ttoot.com/rustinpeace/rest");
    source.initialize(null, props);
    assertEquals(ValidationResult.Result.ERROR, source.validate(null).getStatus());
    props.connection.endpoint.setValue("https://ttoot.com/rest");
    source.initialize(null, props);
    ValidationResult vr = source.validate(null);
    assertEquals(ValidationResult.Result.ERROR, vr.getStatus());
}
Also used : TMarketoInputProperties(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties) ValidationResult(org.talend.daikon.properties.ValidationResult) Test(org.junit.Test)

Example 38 with TMarketoInputProperties

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

the class MarketoSourceTest method setUp.

@Before
public void setUp() throws Exception {
    source = new MarketoSource();
    // 
    iprops = new TMarketoInputProperties("test");
    iprops.connection.setupProperties();
    iprops.connection.endpoint.setValue("http://ABC.mkto.com");
    iprops.connection.clientAccessId.setValue("fakeId");
    iprops.connection.secretKey.setValue("sekret");
    iprops.setupProperties();
    // 
    bulkProps = new TMarketoBulkExecProperties("test");
    bulkProps.setupProperties();
    bulkProps.connection.init();
}
Also used : TMarketoInputProperties(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties) TMarketoBulkExecProperties(org.talend.components.marketo.tmarketobulkexec.TMarketoBulkExecProperties) Before(org.junit.Before)

Example 39 with TMarketoInputProperties

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

the class MarketoLeadClientTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    iprops = new TMarketoInputProperties("test");
    iprops.schemaInput.setupProperties();
    iprops.schemaInput.setupLayout();
    iprops.connection.setupProperties();
    iprops.connection.setupLayout();
    iprops.connection.setupProperties();
    iprops.connection.endpoint.setValue("https://fake.io/rest");
    iprops.connection.clientAccessId.setValue("clientaccess");
    iprops.connection.secretKey.setValue("sekret");
    // shorten interval for tests
    iprops.connection.attemptsIntervalTime.setValue(200);
    iprops.setupProperties();
    iprops.setupLayout();
    oprops = new TMarketoOutputProperties("test");
    oprops.schemaInput.setupProperties();
    oprops.schemaInput.setupLayout();
    oprops.connection.setupProperties();
    oprops.connection.setupLayout();
    oprops.connection.setupProperties();
    oprops.connection.endpoint.setValue("https://fake.io/rest");
    oprops.connection.clientAccessId.setValue("clientaccess");
    oprops.connection.secretKey.setValue("sekret");
    // shorten interval for tests
    oprops.connection.attemptsIntervalTime.setValue(200);
    oprops.setupProperties();
    oprops.setupLayout();
    lprops = new TMarketoListOperationProperties("test");
    lprops.schemaInput.setupProperties();
    lprops.schemaInput.setupLayout();
    lprops.connection.setupProperties();
    lprops.connection.setupLayout();
    lprops.connection.setupProperties();
    lprops.connection.endpoint.setValue("https://fake.io/rest");
    lprops.connection.clientAccessId.setValue("clientaccess");
    lprops.connection.secretKey.setValue("sekret");
    // shorten interval for tests
    lprops.connection.attemptsIntervalTime.setValue(200);
    lprops.setupProperties();
    lprops.setupLayout();
    client = spy(new MarketoRESTClient(iprops.connection));
    doNothing().when(client).getToken();
    doReturn("000123456").when(client).getPageToken(anyString());
    client.connect();
}
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 40 with TMarketoInputProperties

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

the class MarketoSOAPClientTest method setUp.

@Before
public void setUp() throws Exception {
    iprops = new TMarketoInputProperties("test");
    iprops.schemaInput.setupProperties();
    iprops.schemaInput.setupLayout();
    iprops.connection.setupProperties();
    iprops.connection.setupLayout();
    iprops.connection.setupProperties();
    iprops.connection.apiMode.setValue(APIMode.SOAP);
    iprops.connection.endpoint.setValue("https://fake.io");
    iprops.connection.clientAccessId.setValue("clientaccess");
    iprops.connection.secretKey.setValue("sekret");
    iprops.setupProperties();
    iprops.setupLayout();
    oprops = new TMarketoOutputProperties("test");
    oprops.schemaInput.setupProperties();
    oprops.schemaInput.setupLayout();
    oprops.connection.setupProperties();
    oprops.connection.setupLayout();
    oprops.connection.setupProperties();
    oprops.connection.apiMode.setValue(APIMode.SOAP);
    oprops.connection.endpoint.setValue("https://fake.io");
    oprops.connection.clientAccessId.setValue("clientaccess");
    oprops.connection.secretKey.setValue("sekret");
    oprops.setupProperties();
    oprops.setupLayout();
    lprops = new TMarketoListOperationProperties("test");
    lprops.schemaInput.setupProperties();
    lprops.schemaInput.setupLayout();
    lprops.connection.setupProperties();
    lprops.connection.setupLayout();
    lprops.connection.setupProperties();
    lprops.connection.apiMode.setValue(APIMode.SOAP);
    lprops.connection.endpoint.setValue("https://fake.io");
    lprops.connection.clientAccessId.setValue("clientaccess");
    lprops.connection.secretKey.setValue("sekret");
    lprops.setupProperties();
    lprops.setupLayout();
    client = spy(new MarketoSOAPClient(iprops.connection));
    port = mock(MktowsPort.class);
    AuthenticationHeader header = mock(AuthenticationHeader.class);
    doReturn(port).when(client).getMktowsApiSoapPort();
    doReturn(header).when(client).getAuthentificationHeader();
    doReturn(null).when(port).listMObjects(any(ParamsListMObjects.class), any(AuthenticationHeader.class));
    client.connect();
    objectFactory = new ObjectFactory();
    factory = DatatypeFactory.newInstance();
    Date dateTest = MarketoUtils.parseDateString(DATE_EXPECTED);
    gcDateTest = new GregorianCalendar();
    gcDateTest.setTime(dateTest);
}
Also used : AuthenticationHeader(com.marketo.mktows.AuthenticationHeader) ObjectFactory(com.marketo.mktows.ObjectFactory) TMarketoOutputProperties(org.talend.components.marketo.tmarketooutput.TMarketoOutputProperties) TMarketoListOperationProperties(org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties) GregorianCalendar(java.util.GregorianCalendar) TMarketoInputProperties(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties) ParamsListMObjects(com.marketo.mktows.ParamsListMObjects) MktowsPort(com.marketo.mktows.MktowsPort) Date(java.util.Date) Before(org.junit.Before)

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