Search in sources :

Example 41 with ValidationResultMutable

use of org.talend.daikon.properties.ValidationResultMutable in project components by Talend.

the class SalesforceConnectionPropertiesTest method testValidateTestConnection.

@Test
public void testValidateTestConnection() throws Exception {
    properties.init();
    Form wizardForm = properties.getForm(SalesforceConnectionProperties.FORM_WIZARD);
    try (MockRuntimeSourceOrSinkTestFixture testFixture = new MockRuntimeSourceOrSinkTestFixture(equalTo(properties), createDefaultTestDataset())) {
        testFixture.setUp();
        // Valid
        ValidationResult vr1 = properties.validateTestConnection();
        assertEquals(ValidationResult.Result.OK, vr1.getStatus());
        assertTrue(wizardForm.isAllowForward());
        // Not valid
        when(testFixture.runtimeSourceOrSink.validate(any(RuntimeContainer.class))).thenReturn(new ValidationResultMutable().setStatus(ValidationResult.Result.ERROR).setMessage("Error"));
        ValidationResult vr2 = properties.validateTestConnection();
        assertEquals(ValidationResult.Result.ERROR, vr2.getStatus());
        assertFalse(wizardForm.isAllowForward());
    }
}
Also used : Form(org.talend.daikon.properties.presentation.Form) ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable) ValidationResult(org.talend.daikon.properties.ValidationResult) RuntimeContainer(org.talend.components.api.container.RuntimeContainer) Test(org.junit.Test)

Aggregations

ValidationResultMutable (org.talend.daikon.properties.ValidationResultMutable)41 IOException (java.io.IOException)11 SandboxedInstance (org.talend.daikon.sandbox.SandboxedInstance)8 ValidationResult (org.talend.daikon.properties.ValidationResult)7 SQLException (java.sql.SQLException)5 Schema (org.apache.avro.Schema)5 MarketoComponentDefinition.getSandboxedInstance (org.talend.components.marketo.MarketoComponentDefinition.getSandboxedInstance)3 MarketoSourceOrSinkRuntime (org.talend.components.marketo.runtime.MarketoSourceOrSinkRuntime)3 SalesforceDefinition.getSandboxedInstance (org.talend.components.salesforce.SalesforceDefinition.getSandboxedInstance)3 SalesforceRuntimeSourceOrSink (org.talend.components.salesforce.common.SalesforceRuntimeSourceOrSink)3 User (com.google.api.services.drive.model.User)2 File (java.io.File)2 GeneralSecurityException (java.security.GeneralSecurityException)2 Connection (java.sql.Connection)2 MarketoSourceOrSinkSchemaProvider (org.talend.components.marketo.runtime.MarketoSourceOrSinkSchemaProvider)2 TMarketoInputProperties (org.talend.components.marketo.tmarketoinput.TMarketoInputProperties)2 LeadSelector (org.talend.components.marketo.tmarketoinput.TMarketoInputProperties.LeadSelector)2 SalesforceSchemaHelper (org.talend.components.salesforce.schema.SalesforceSchemaHelper)2 NamedThing (org.talend.daikon.NamedThing)2 TalendRuntimeException (org.talend.daikon.exception.TalendRuntimeException)2