use of org.talend.components.marketo.runtime.client.type.MarketoError in project components by Talend.
the class MarketoBulkExecReaderTest method testRetryOperationFailNonRecoverableErrror.
@Test
public void testRetryOperationFailNonRecoverableErrror() throws Exception {
MarketoRecordResult mkto = new MarketoRecordResult();
mkto.setErrors(Arrays.asList(new MarketoError("REST", "902", "Invalid operation")));
when(client.bulkImport(any(TMarketoBulkExecProperties.class))).thenReturn(mkto);
doReturn(false).when(client).isErrorRecoverable(any(List.class));
reader.properties.dieOnError.setValue(false);
assertFalse(reader.start());
int result = (int) reader.getReturnValues().get(RETURN_NB_CALL);
assertEquals(1, result);
}
use of org.talend.components.marketo.runtime.client.type.MarketoError in project components by Talend.
the class MarketoLeadClientTest method getListOperationResult.
public SyncResult getListOperationResult(boolean isSuccess, String status) {
SyncResult result = new SyncResult();
List<SyncStatus> records = new ArrayList<>();
if (isSuccess) {
result.setSuccess(true);
SyncStatus ss = new SyncStatus();
ss.setSeq(0);
ss.setMarketoGUID("mkto-123456");
ss.setStatus(status);
ss.setErrorMessage("");
records.add(ss);
result.setResult(records);
} else {
result.setSuccess(false);
result.setErrors(Arrays.asList(new MarketoError("REST", "errorlist")));
}
return result;
}
use of org.talend.components.marketo.runtime.client.type.MarketoError in project components by Talend.
the class MarketoSOAPClientTest method testIsErrorRecoverable.
@Test
public void testIsErrorRecoverable() throws Exception {
MarketoError error = new MarketoException("SOAP", "20016 Request Expired").toMarketoError();
assertTrue(client.isErrorRecoverable(Arrays.asList(error)));
for (String code : new String[] { "10001", "20011", "20023", "20024" }) {
error = new MarketoException("SOAP", String.format("SOAP %s Concurrency Limit Exceeded", code)).toMarketoError();
assertTrue(client.isErrorRecoverable(Arrays.asList(error)));
}
error = new MarketoException("SOAP", "404 Page not found").toMarketoError();
assertFalse(client.isErrorRecoverable(Arrays.asList(error)));
}
use of org.talend.components.marketo.runtime.client.type.MarketoError in project components by Talend.
the class MarketoRuntimeTestBase method getFailedRecordResult.
public static MarketoRecordResult getFailedRecordResult(String api, String code, String message) {
MarketoRecordResult mkto = new MarketoRecordResult();
mkto.setSuccess(false);
mkto.setErrors(Arrays.asList(new MarketoError(api, code, message)));
return mkto;
}
use of org.talend.components.marketo.runtime.client.type.MarketoError in project components by Talend.
the class MarketoRuntimeTestBase method getFailedSyncResult.
public MarketoSyncResult getFailedSyncResult(boolean withSyncRecord) {
MarketoSyncResult mkto = new MarketoSyncResult();
mkto.setSuccess(false);
mkto.setErrors(Arrays.asList(new MarketoError("REST", "error")));
if (withSyncRecord) {
SyncStatus sts1 = new SyncStatus();
sts1.setId(12345);
sts1.setStatus("failed");
sts1.setMarketoGUID("mktoGUID");
sts1.setSeq(0);
List<SyncStatus> stl = new ArrayList<>();
stl.add(sts1);
mkto.setRecords(stl);
}
return mkto;
}
Aggregations