Package org.teiid.test.framework.exception

Examples of org.teiid.test.framework.exception.TransactionRuntimeException


            throw tre;
      } catch (Throwable e) {
    if (!test.exceptionExpected()) {
        e.printStackTrace();
    }
    throw new TransactionRuntimeException(e.getMessage());
      }

      runTest(test);

      debug("Completed transaction test: " + test.getTestName());
View Full Code Here


    }

    public void validate() {
  databaseName = this.getEnvironment().getProperty(DS_DATABASENAME);
  if (databaseName == null || databaseName.length() == 0) {
      throw new TransactionRuntimeException("Property " + DS_DATABASENAME
        + " was not specified");
  }

  serverName = this.getEnvironment().getProperty(DS_SERVERNAME);
  if (serverName == null || serverName.length() == 0) {
      throw new TransactionRuntimeException("Property " + DS_SERVERNAME
        + " was not specified");
  }

  this.portNumber = this.getEnvironment().getProperty(DS_SERVERPORT);

  this.applName = this.getEnvironment().getProperty(DS_APPLICATION_NAME);

  if (this.getEnvironment().getProperty(DS_DATASOURCE) != null) {
              this.driver = this.getEnvironment().getProperty(DS_DATASOURCE);
          if (this.driver == null || this.driver.length() == 0) {
              throw new TransactionRuntimeException("Property " + DS_DATASOURCE
                + " was null");
          }
     
  } else {
          this.driver = this.getEnvironment().getProperty(DS_DRIVER);
          if (this.driver == null || this.driver.length() == 0) {
              throw new TransactionRuntimeException("Property " + DS_DRIVER
                + " was not specified");
          }
  }
 
  this.url = this.getEnvironment().getProperty(DS_URL);
View Full Code Here

      ConnectionStrategy strategy = null;
         Properties props = configLoader.getProperties();
          
          String type = props.getProperty(ConfigPropertyNames.CONNECTION_TYPE, ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION);
          if (type == null) {
            throw new TransactionRuntimeException("Property " + ConfigPropertyNames.CONNECTION_TYPE + " was specified");
          }
         
          try {
         
                  if (type.equalsIgnoreCase(ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION)) {
                    // pass in null to create new strategy
                          strategy = new DriverConnection(props);
                          TestLogger.logDebug("Created Driver Strategy");
                  }
                  else if (type.equalsIgnoreCase(ConfigPropertyNames.CONNECTION_TYPES.DATASOURCE_CONNECTION)) {
                      strategy = new DataSourceConnection(props);
                      TestLogger.logDebug("Created DataSource Strategy");
                  }
                  else if (type.equalsIgnoreCase(ConfigPropertyNames.CONNECTION_TYPES.JNDI_CONNECTION)) {
                      strategy = new JEEConnection(props);
                      TestLogger.logDebug("Created JEE Strategy");
                  }  
                 
                  if (strategy == null) {
                    new TransactionRuntimeException("Invalid property value for " + ConfigPropertyNames.CONNECTION_TYPE + " is " + type );
                  }
                  // call configure here because this is creating the connection to Teiid
                  // direct connections to the datasource use the static call directly to create strategy and don't need to configure
                strategy.configure();
                  return strategy;
          } catch (Exception e) {
              throw new TransactionRuntimeException(e);
          }

      }     
View Full Code Here

  DataSource ds = null;
  if (identifier != null) {
      ds = DataSourceMgr.getInstance().getDataSource(identifier);
  }
  if (ds == null) {
      throw new TransactionRuntimeException(
        "Program Error: DataSource is not mapped to Identifier "
          + identifier);
  }

  Connection conn = ds.getConnection();
View Full Code Here

  DataSource ds = null;
  if (identifier != null) {
      ds = DataSourceMgr.getInstance().getDataSource(identifier);
  }
  if (ds == null) {
      throw new TransactionRuntimeException(
        "Program Error: DataSource is not mapped to Identifier "
          + identifier);
  }

  XAConnection conn = ds.getXAConnection();
View Full Code Here

    public void validate() {

  String urlProp = this.getEnvironment().getProperty(DS_URL);
  if (urlProp == null || urlProp.length() == 0) {
      throw new TransactionRuntimeException("Property " + DS_URL
        + " was not specified");
  }
  StringBuffer urlSB = new StringBuffer(urlProp);

  String appl = this.getEnvironment().getProperty(DS_APPLICATION_NAME);
  if (appl != null) {
      urlSB.append(";");
      urlSB.append("ApplicationName").append("=").append(appl);
  }

  url = urlSB.toString();

  driver = this.getEnvironment().getProperty(DS_DRIVER);
  if (driver == null || driver.length() == 0) {
      throw new TransactionRuntimeException("Property " + DS_DRIVER
        + " was not specified");
  }

  // need both user variables because Teiid uses 'user' and connectors use
  // 'username'

  this.username = this.getEnvironment().getProperty(DS_USER);
  if (username == null) {
      this.username = this.getEnvironment().getProperty(DS_USERNAME);
  }
  this.pwd = this.getEnvironment().getProperty(DS_PASSWORD);

  try {
      // Load jdbc driver
      Class.forName(driver);
  } catch (ClassNotFoundException e) {
      throw new TransactionRuntimeException(e);
  }

    }
View Full Code Here

              this.getResultsGenerator().generateErrorFile(tr.getQuerySetID(),
              tr.getQueryID(), sql, resultSet, resultException,
              results )
             
        } catch (QueryTestFailedException qtfe) {
          throw new TransactionRuntimeException(qtfe.getMessage());
        }
    }


  } else if (getResultsMode().equalsIgnoreCase(
    TestProperties.RESULT_MODES.GENERATE)) { //$NON-NLS-1$

      try {
   
    this.getResultsGenerator().generateQueryResultFile(tr.getQuerySetID(),
      tr.getQueryID(), sql, resultSet, resultException, tr.getStatus());
     
      } catch (QueryTestFailedException qtfe) {
    throw new TransactionRuntimeException(qtfe.getMessage());
      }

  } else {
      // just create the error file for any failures
      if (tr.getException() != null) {
    tr.setStatus(TestResult.RESULT_STATE.TEST_EXCEPTION);
    try {
        this.getResultsGenerator().generateErrorFile(tr.getQuerySetID(),
          tr.getQueryID(), sql, resultSet, resultException, null);

    } catch (QueryTestFailedException qtfe) {
        throw new TransactionRuntimeException(qtfe.getMessage());
    }
      }
  }

View Full Code Here

  if (_instance == null) {
      _instance = new DataSourceMgr();
      try {
    _instance.loadDataSourceMappings();
      } catch (QueryTestFailedException e) {
    throw new TransactionRuntimeException(e);
      } catch (TransactionRuntimeException e) {
    throw e;
      }

  }
View Full Code Here

    }
      modelToDatasourceMap.put(modelname, ds);
      return ds;
  } catch (QueryTestFailedException e) {
      throw new TransactionRuntimeException(e);
  }
    }
View Full Code Here

      TestLogger.logDebug("Using override for datasources loc: " + dsloc);
  }
 
  File[] dirs = findAllChildDirectories(dsloc);
  if (dirs == null || dirs.length == 0) {
      throw new TransactionRuntimeException(
        "No datasource directories found at location "
          + dsloc);
  }
  for (int i = 0; i < dirs.length; i++) {
      File d = dirs[i];

      addDataSource(d, allDatasourcesMap);

  }

  if (allDatasourcesMap == null || allDatasourcesMap.isEmpty()) {
      throw new TransactionRuntimeException(
        "Error: No Datasources were loaded.");
  } else if (allDatasourcesMap.size() < 2) {
      throw new TransactionRuntimeException(
        "Error: Must load 2 Datasources, only 1 was found.");
  }

  TestLogger.logDebug("Number of total datasource mappings loaded "
View Full Code Here

TOP

Related Classes of org.teiid.test.framework.exception.TransactionRuntimeException

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.