Search in sources :

Example 66 with IPentahoResultSet

use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.

the class ResultSetCompareComponentTest method execute_fails_when_resultSets_have_different_number_of_columns.

@Test
public void execute_fails_when_resultSets_have_different_number_of_columns() {
    ResultSetCompareComponent rscc = createResultSetCompareComponent();
    IPentahoResultSet rs1 = createResultSet(1, 1, RESULT_SET_ELEMENT_VALUE);
    IPentahoResultSet rs2 = createResultSet(2, 1, RESULT_SET_ELEMENT_VALUE);
    ResultSetCompareAction resultSetCompareAction = createResultSetCompareAction(rs1, rs2, 0, false, true);
    rscc.setActionDefinition(resultSetCompareAction);
    rscc.validate();
    int actualExecuteResult = rscc.execute();
    assertEquals(IRuntimeContext.RUNTIME_STATUS_FAILURE, actualExecuteResult);
}
Also used : IPentahoResultSet(org.pentaho.commons.connection.IPentahoResultSet) ResultSetCompareAction(org.pentaho.actionsequence.dom.actions.ResultSetCompareAction) Test(org.junit.Test)

Example 67 with IPentahoResultSet

use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.

the class ResultSetCompareComponentTest method validation_fails_without_second_resultSets.

@Test
public void validation_fails_without_second_resultSets() {
    IPentahoResultSet rs = Mockito.mock(IPentahoResultSet.class);
    int actualValidateResult = callValidationWithResultSets(rs, null);
    assertEquals(IRuntimeContext.RUNTIME_CONTEXT_VALIDATE_FAIL, actualValidateResult);
}
Also used : IPentahoResultSet(org.pentaho.commons.connection.IPentahoResultSet) Test(org.junit.Test)

Example 68 with IPentahoResultSet

use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.

the class ResultSetCompareComponentTest method execute_fails_when_resultSets_have_different_number_of_rows.

@Test
public void execute_fails_when_resultSets_have_different_number_of_rows() {
    ResultSetCompareComponent rscc = createResultSetCompareComponent();
    IPentahoResultSet rs1 = createResultSet(1, 1, RESULT_SET_ELEMENT_VALUE);
    IPentahoResultSet rs2 = createResultSet(1, 2, RESULT_SET_ELEMENT_VALUE);
    ResultSetCompareAction resultSetCompareAction = createResultSetCompareAction(rs1, rs2, 0, false, true);
    rscc.setActionDefinition(resultSetCompareAction);
    rscc.validate();
    int actualExecuteResult = rscc.execute();
    assertEquals(IRuntimeContext.RUNTIME_STATUS_FAILURE, actualExecuteResult);
}
Also used : IPentahoResultSet(org.pentaho.commons.connection.IPentahoResultSet) ResultSetCompareAction(org.pentaho.actionsequence.dom.actions.ResultSetCompareAction) Test(org.junit.Test)

Example 69 with IPentahoResultSet

use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.

the class ResultSetCompareComponentTest method executeSuccessful.

@Test
public void executeSuccessful() {
    ResultSetCompareComponent rscc = createResultSetCompareComponent();
    IPentahoResultSet rs1 = createResultSet(new String[][] { { FIRST_ROW }, { SECOND_ROW } });
    IPentahoResultSet rs2 = createResultSet(new String[][] { { FIRST_ROW }, { SECOND_ROW } });
    ResultSetCompareAction resultSetCompareAction = createResultSetCompareAction(rs1, rs2, 0, false, true);
    rscc.setActionDefinition(resultSetCompareAction);
    rscc.validate();
    int actualExecuteResult = rscc.execute();
    assertEquals(IRuntimeContext.RUNTIME_STATUS_SUCCESS, actualExecuteResult);
}
Also used : IPentahoResultSet(org.pentaho.commons.connection.IPentahoResultSet) ResultSetCompareAction(org.pentaho.actionsequence.dom.actions.ResultSetCompareAction) Test(org.junit.Test)

Example 70 with IPentahoResultSet

use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.

the class ResultSetCompareComponentTest method validation_fails_without_compareColumnNumber.

@Test
public void validation_fails_without_compareColumnNumber() {
    ResultSetCompareComponent rscc = createResultSetCompareComponent();
    IPentahoResultSet rs = Mockito.mock(IPentahoResultSet.class);
    ResultSetCompareAction resultSetCompareAction = createResultSetCompareAction(rs, rs, null, false, true);
    rscc.setActionDefinition(resultSetCompareAction);
    int actualValidateResult = rscc.validate();
    assertEquals(IRuntimeContext.RUNTIME_CONTEXT_VALIDATE_FAIL, actualValidateResult);
}
Also used : IPentahoResultSet(org.pentaho.commons.connection.IPentahoResultSet) ResultSetCompareAction(org.pentaho.actionsequence.dom.actions.ResultSetCompareAction) Test(org.junit.Test)

Aggregations

IPentahoResultSet (org.pentaho.commons.connection.IPentahoResultSet)113 Test (org.junit.Test)26 Node (org.dom4j.Node)18 ArrayList (java.util.ArrayList)17 IPentahoMetaData (org.pentaho.commons.connection.IPentahoMetaData)12 Iterator (java.util.Iterator)10 List (java.util.List)10 IPentahoConnection (org.pentaho.commons.connection.IPentahoConnection)10 IActionParameter (org.pentaho.platform.api.engine.IActionParameter)10 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)10 OutputStream (java.io.OutputStream)9 ResultSetCompareAction (org.pentaho.actionsequence.dom.actions.ResultSetCompareAction)8 IRuntimeContext (org.pentaho.platform.api.engine.IRuntimeContext)8 XQConnection (org.pentaho.platform.plugin.services.connections.xquery.XQConnection)8 SQLException (java.sql.SQLException)7 HashMap (java.util.HashMap)6 StandaloneSession (org.pentaho.platform.engine.core.system.StandaloneSession)6 Map (java.util.Map)5 Set (java.util.Set)5 IPreparedComponent (org.pentaho.platform.api.data.IPreparedComponent)5