Package org.jtester.exception

Examples of org.jtester.exception.JTesterException


      ObjectInputStream in = new ObjectInputStream(inputStream);
      Object obj = in.readObject();
      in.close();
      return (T) obj;
    } catch (Throwable e) {
      throw new JTesterException(e);
    }
  }
View Full Code Here


      return properties;

    } catch (FileNotFoundException e) {
      return null;
    } catch (Throwable e) {
      throw new JTesterException("Unable to load configuration file: " + propertiesFileName + " from user home",
          e);
    } finally {
      closeQuietly(inputStream);
    }
  }
View Full Code Here

      properties.load(inputStream);
      return properties;
    } catch (FileNotFoundException e) {
      return null;
    } catch (Throwable e) {
      throw new JTesterException("Unable to load configuration file: " + propertiesFileName, e);
    } finally {
      closeQuietly(inputStream);
    }
  }
View Full Code Here

        String constraintName = resultSet.getString("CONSTRAINT_NAME");
        alterStatement.executeUpdate("alter table " + qualified(tableName) + " drop constraint "
            + quoted(constraintName));
      }
    } catch (Throwable e) {
      throw new JTesterException(
          "Error while disabling not referential constraints on schema " + getSchemaName(), e);
    } finally {
      closeQuietly(queryStatement);
      closeQuietly(connection, alterStatement, resultSet);
    }
View Full Code Here

        String constraintName = resultSet.getString("CONSTRAINT_NAME");
        alterStatement.executeUpdate("alter table " + qualified(tableName) + " drop constraint "
            + quoted(constraintName));
      }
    } catch (Throwable e) {
      throw new JTesterException("Error while disabling check and unique constraints on schema "
          + getSchemaName(), e);
    } finally {
      closeQuietly(queryStatement);
      closeQuietly(connection, alterStatement, resultSet);
    }
View Full Code Here

        String columnName = resultSet.getString("COLUMN_NAME");
        alterStatement.executeUpdate("alter table " + qualified(tableName) + " alter column "
            + quoted(columnName) + " set null");
      }
    } catch (Throwable e) {
      throw new JTesterException("Error while disabling not null constraints on schema " + getSchemaName(), e);
    } finally {
      closeQuietly(queryStatement);
      closeQuietly(connection, alterStatement, resultSet);
    }
  }
View Full Code Here

  private static Method getAnnotationPropertyWithName(Class<? extends Annotation> annotation,
      String annotationPropertyName) {
    try {
      return annotation.getMethod(annotationPropertyName);
    } catch (NoSuchMethodException e) {
      throw new JTesterException("Could not find annotation property named " + annotationPropertyName
          + " on annotation " + annotation.getName());
    }
  }
View Full Code Here

  public static <T> T getAnnotationPropertyValue(Method annotationProperty, Annotation annotation) {
    try {
      return (T) annotationProperty.invoke(annotation);
    } catch (IllegalAccessException e) {
      throw new JTesterException("Error retrieving value of property " + annotationProperty.getName()
          + " of annotation of type " + annotation.getClass().getSimpleName(), e);
    } catch (InvocationTargetException e) {
      throw new JTesterException("Error retrieving value of property " + annotationProperty.getName()
          + " of annotation of type " + annotation.getClass().getSimpleName(), e);
    }
  }
View Full Code Here

    } else if ("upper_case".equals(storedIdentifierCase)) {
      return UPPER_CASE;
    } else if ("mixed_case".equals(storedIdentifierCase)) {
      return MIXED_CASE;
    } else if (!"auto".equals(storedIdentifierCase)) {
      throw new JTesterException("Unknown value " + storedIdentifierCase + " for property "
          + PROPKEY_STORED_IDENTIFIER_CASE
          + ". It should be one of lower_case, upper_case, mixed_case or auto.");
    }

    Connection connection = null;
    try {
      connection = getSQLHandler().getDataSource().getConnection();

      DatabaseMetaData databaseMetaData = connection.getMetaData();
      if (databaseMetaData.storesUpperCaseIdentifiers()) {
        return UPPER_CASE;
      } else if (databaseMetaData.storesLowerCaseIdentifiers()) {
        return LOWER_CASE;
      } else {
        return MIXED_CASE;
      }
    } catch (SQLException e) {
      throw new JTesterException("Unable to determine stored identifier case.", e);
    } finally {
      closeQuietly(connection, null, null);
    }
  }
View Full Code Here

        return null;
      }
      return quoteString;

    } catch (SQLException e) {
      throw new JTesterException("Unable to determine identifier quote string.", e);
    } finally {
      closeQuietly(connection, null, null);
    }
  }
View Full Code Here

TOP

Related Classes of org.jtester.exception.JTesterException

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.