Package org.pentaho.platform.plugin.services.connections.xquery

Examples of org.pentaho.platform.plugin.services.connections.xquery.XQConnection.executeQuery()


  }

  public void testExecuteQuery() throws Exception {

    XQConnection connection = new XQConnection();
    IPentahoResultSet data = connection.executeQuery( TEST_QUERY );
    assertNotNull( "result set is null", data );

    assertTrue( "result set is wrong type", data instanceof XQResultSet );

    assertFalse( "Should not be scrollable", data.isScrollable() );
View Full Code Here


      XQConnection connection = new XQConnection();
      StaticQueryContext mockContext = mock( StaticQueryContext.class );
      when( mockContext.compileQuery( TEST_QUERY ) ).thenThrow( new XPathException( "Test XPathException" ) );
      connection.sqc = mockContext;

      IPentahoResultSet data = connection.executeQuery( TEST_QUERY );
      fail( "Should throw XPathException" );
    } catch ( XPathException e ) {
      // valid
    }
  }
View Full Code Here

    }
  }

  public void testGetDataRow() throws Exception {
    XQConnection connection = new XQConnection();
    IPentahoResultSet data = connection.executeQuery( TEST_QUERY );
    assertNotNull( "result set is null", data );

    Object[] row = data.getDataRow( 1 );
    assertEquals( "Harry Potter", row[0] );
    assertEquals( "J K. Rowling", row[1] );
View Full Code Here

    assertNull( row );
  }

  public void testGetDataColumn() throws Exception {
    XQConnection connection = new XQConnection();
    IPentahoResultSet data = connection.executeQuery( TEST_QUERY );
    assertNotNull( "result set is null", data );

    Object[] col = data.getDataColumn( 2 );
    assertEquals( "row count is wrong", 4, col.length );
View Full Code Here

  public void testRowLimit() throws Exception {

    XQConnection connection = new XQConnection();
    connection.setMaxRows( 2 );
    IPentahoResultSet data = connection.executeQuery( TEST_QUERY );
    assertNotNull( "result set is null", data );

    assertTrue( "result set is wrong type", data instanceof XQResultSet );

    assertEquals( "row count is wrong", 2, data.getRowCount() );
View Full Code Here

  }

  public void testValueAt() throws Exception {

    XQConnection connection = new XQConnection();
    IPentahoResultSet data = connection.executeQuery( TEST_QUERY );
    assertNotNull( "result set is null", data );

    assertEquals( "2005", data.getValueAt( 0, 2 ) );
    assertEquals( "Everyday Italian", data.getValueAt( 0, 0 ) );
View Full Code Here

    assertNull( data.getValueAt( 0, 99 ) );
  }

  public void testPeek() throws Exception {
    XQConnection connection = new XQConnection();
    IPentahoResultSet data = connection.executeQuery( TEST_QUERY );
    assertNotNull( "result set is null", data );

    assertTrue( "result set is wrong type", data instanceof XQResultSet );

    assertEquals( "row count is wrong", 4, data.getRowCount() );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.