Search in sources :

Example 26 with MarketoError

use of org.talend.components.marketo.runtime.client.type.MarketoError in project components by Talend.

the class MarketoBaseRESTClientTest method testIsErrorRecoverable.

@Test
public void testIsErrorRecoverable() throws Exception {
    MarketoError error = new MarketoException("REST", "602", "Access token expired").toMarketoError();
    assertTrue(client.isErrorRecoverable(Arrays.asList(error)));
    for (String code : new String[] { "502", "604", "606", "608", "611", "614", "615" }) {
        error = new MarketoException("REST", code, "API Temporarily Unavailable").toMarketoError();
        assertTrue(client.isErrorRecoverable(Arrays.asList(error)));
    }
    error = new MarketoException("REST", "404", "Page not found").toMarketoError();
    assertFalse(client.isErrorRecoverable(Arrays.asList(error)));
}
Also used : MarketoException(org.talend.components.marketo.runtime.client.type.MarketoException) MarketoError(org.talend.components.marketo.runtime.client.type.MarketoError) Test(org.junit.Test)

Example 27 with MarketoError

use of org.talend.components.marketo.runtime.client.type.MarketoError in project components by Talend.

the class MarketoBaseRESTClientTest method testIsAccessTokenExpired.

@Test
public void testIsAccessTokenExpired() throws Exception {
    assertFalse(client.isAccessTokenExpired(null));
    MarketoError error = new MarketoException("REST", "602", "Access token expired").toMarketoError();
    assertTrue(client.isAccessTokenExpired(Arrays.asList(error)));
}
Also used : MarketoException(org.talend.components.marketo.runtime.client.type.MarketoException) MarketoError(org.talend.components.marketo.runtime.client.type.MarketoError) Test(org.junit.Test)

Aggregations

MarketoError (org.talend.components.marketo.runtime.client.type.MarketoError)27 MarketoRecordResult (org.talend.components.marketo.runtime.client.type.MarketoRecordResult)16 Test (org.junit.Test)12 MarketoException (org.talend.components.marketo.runtime.client.type.MarketoException)12 IndexedRecord (org.apache.avro.generic.IndexedRecord)8 MalformedURLException (java.net.MalformedURLException)7 InvalidKeyException (java.security.InvalidKeyException)7 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)7 ParseException (java.text.ParseException)7 ArrayList (java.util.ArrayList)7 JAXBException (javax.xml.bind.JAXBException)7 DatatypeConfigurationException (javax.xml.datatype.DatatypeConfigurationException)7 WebServiceException (javax.xml.ws.WebServiceException)7 ComponentException (org.talend.components.api.exception.ComponentException)7 MarketoSyncResult (org.talend.components.marketo.runtime.client.type.MarketoSyncResult)6 ArrayOfString (com.marketo.mktows.ArrayOfString)5 List (java.util.List)4 Schema (org.apache.avro.Schema)4 SyncStatus (org.talend.components.marketo.runtime.client.rest.type.SyncStatus)4 TMarketoBulkExecProperties (org.talend.components.marketo.tmarketobulkexec.TMarketoBulkExecProperties)4