Package com.eviware.soapui.impl.wsdl.teststeps

Examples of com.eviware.soapui.impl.wsdl.teststeps.JdbcRequestTestStep


    }
  }

  private void getDatabaseConnection() throws SQLException, SoapUIException
  {
    JdbcRequestTestStep testStep = request.getTestStep();
    connection = JdbcUtils.initConnection( context, testStep.getDriver(), testStep.getConnectionString(),
        testStep.getPassword() );
    // IMPORTANT: setting as readOnly raises an exception in calling stored
    // procedures!
    // connection.setReadOnly( true );
  }
View Full Code Here


  private void load() throws Exception
  {
    try
    {
      JdbcRequestTestStep testStep = request.getTestStep();

      if( testStep.isStoredProcedure() )
      {
        timestamp = System.currentTimeMillis();
        statement.execute();
      }
      else
View Full Code Here

    }
  }

  private void prepare() throws Exception
  {
    JdbcRequestTestStep testStep = request.getTestStep();
    getDatabaseConnection();
    List<TestProperty> props = testStep.getPropertyList();
    if( testStep.isStoredProcedure() )
    {
      rawSql = PropertyExpander.expandProperties( context, testStep.getQuery() );

      if( !rawSql.startsWith( "{call " ) && !rawSql.endsWith( "}" ) )
        rawSql = "{call " + rawSql + "}";

    }
    else
    {
      rawSql = PropertyExpander.expandProperties( context, testStep.getQuery() );
    }
    NamedParameterStatement p = new NamedParameterStatement( connection, rawSql );
    for( TestProperty testProperty : props )
    {
      String value = PropertyExpander.expandProperties( context, testProperty.getValue() );
      if( !testProperty.getName().equals( WsdlTestStepWithProperties.RESPONSE_AS_XML ) )
      {
        p.setString( testProperty.getName(), value );
      }
    }
    statement = p.getStatement();

    try
    {
      if( !StringUtils.isNullOrEmpty( testStep.getQueryTimeout() ) )
      {
        String queryTimeout = PropertyExpander.expandProperties( testStep, testStep.getQueryTimeout() );
        statement.setQueryTimeout( Integer.parseInt( queryTimeout ) );
      }
    }
    catch( NumberFormatException e )
    {
      SoapUI.logError( e, "Problem setting timeout" );
    }

    try
    {
      if( !StringUtils.isNullOrEmpty( testStep.getMaxRows() ) )
      {
        String maxRows = PropertyExpander.expandProperties( testStep, testStep.getMaxRows() );
        statement.setMaxRows( Integer.parseInt( maxRows ) );
      }
    }
    catch( NumberFormatException e )
    {
      SoapUI.logError( e, "Problem setting maxRows" );
    }
    try
    {
      if( !StringUtils.isNullOrEmpty( testStep.getFetchSize() ) )
      {
        String fetchSize = PropertyExpander.expandProperties( testStep, testStep.getFetchSize() );
        statement.setFetchSize( Integer.parseInt( fetchSize ) );
      }
    }
    catch( NumberFormatException e )
    {
View Full Code Here

    super( JDBC_TYPE, "JDBC Request", "Jdbc Request returns xml result", "/jdbc_request.gif" );
  }

  public WsdlTestStep buildTestStep( WsdlTestCase testCase, TestStepConfig config, boolean forLoadTest )
  {
    return new JdbcRequestTestStep( testCase, config, forLoadTest );
  }
View Full Code Here

    public JdbcRequestTestStepFactory() {
        super(JDBC_TYPE, "JDBC Request", "Jdbc Request returns xml result", "/jdbc_request.gif");
    }

    public WsdlTestStep buildTestStep(WsdlTestCase testCase, TestStepConfig config, boolean forLoadTest) {
        return new JdbcRequestTestStep(testCase, config, forLoadTest);
    }
View Full Code Here

            SoapUI.logError(ex);
        }
    }

    private void getDatabaseConnection() throws SQLException, SoapUIException {
        JdbcRequestTestStep testStep = request.getTestStep();
        connection = JdbcUtils.initConnection(context, testStep.getDriver(), testStep.getConnectionString(),
                testStep.getPassword());
        // IMPORTANT: setting as readOnly raises an exception in calling stored
        // procedures!
        // connection.setReadOnly( true );
    }
View Full Code Here

        // connection.setReadOnly( true );
    }

    private void load() throws Exception {
        try {
            JdbcRequestTestStep testStep = request.getTestStep();

            if (testStep.isStoredProcedure()) {
                timestamp = System.currentTimeMillis();
                statement.execute();
            } else {
                timestamp = System.currentTimeMillis();
                statement.execute();
View Full Code Here

            timeTaken = System.currentTimeMillis() - timestamp;
        }
    }

    private void prepare() throws Exception {
        JdbcRequestTestStep testStep = request.getTestStep();
        getDatabaseConnection();
        List<TestProperty> props = testStep.getPropertyList();
        if (testStep.isStoredProcedure()) {
            rawSql = PropertyExpander.expandProperties(context, testStep.getQuery());

            if (!rawSql.startsWith("{call ") && !rawSql.endsWith("}")) {
                rawSql = "{call " + rawSql + "}";
            }

        } else {
            rawSql = PropertyExpander.expandProperties(context, testStep.getQuery());
        }
        NamedParameterStatement p = new NamedParameterStatement(connection, rawSql);
        for (TestProperty testProperty : props) {
            String value = PropertyExpander.expandProperties(context, testProperty.getValue());
            if (!testProperty.getName().equals(WsdlTestStepWithProperties.RESPONSE_AS_XML)) {
                p.setString(testProperty.getName(), value);
            }
        }
        statement = p.getStatement();

        try {
            if (!StringUtils.isNullOrEmpty(testStep.getQueryTimeout())) {
                String queryTimeout = PropertyExpander.expandProperties(testStep, testStep.getQueryTimeout());
                statement.setQueryTimeout(Integer.parseInt(queryTimeout));
            }
        } catch (NumberFormatException e) {
            SoapUI.logError(e, "Problem setting timeout");
        }

        try {
            if (!StringUtils.isNullOrEmpty(testStep.getMaxRows())) {
                String maxRows = PropertyExpander.expandProperties(testStep, testStep.getMaxRows());
                statement.setMaxRows(Integer.parseInt(maxRows));
            }
        } catch (NumberFormatException e) {
            SoapUI.logError(e, "Problem setting maxRows");
        }
        try {
            if (!StringUtils.isNullOrEmpty(testStep.getFetchSize())) {
                String fetchSize = PropertyExpander.expandProperties(testStep, testStep.getFetchSize());
                statement.setFetchSize(Integer.parseInt(fetchSize));
            }
        } catch (NumberFormatException e) {
            SoapUI.logError(e, "Problem setting fetchSize");
        }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.wsdl.teststeps.JdbcRequestTestStep

Copyright © 2018 www.massapicom. 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.