Package ch.inftec.ju.db

Examples of ch.inftec.ju.db.JuDbException


        public void execute(IDatabaseConnection conn) {
          try {
            logger.debug("Executing Insert from: " + dataSetUrl);
            DatabaseOperation.INSERT.execute(conn, flatXmlDataSet);
          } catch (Exception ex) {
            throw new JuDbException("Couldnt insert data into DB", ex);
          }
        };
      });
     
    }
View Full Code Here


        public void execute(IDatabaseConnection conn) {
          try {
            logger.debug("Executing Update from: " + dataSetUrl);
            DatabaseOperation.UPDATE.execute(conn, flatXmlDataSet);
          } catch (Exception ex) {
            throw new JuDbException("Couldnt update data in DB", ex);
          }
        };
      });
     
    }
View Full Code Here

      try {
        this.dataSetUrl = xmlUrl;
        flatXmlDataSet = new FlatXmlDataSetBuilder().build(xmlUrl);
        return this;
      } catch (Exception ex) {
        throw new JuDbException("Couldn't import data from XML: xmlUrl", ex);
      }
    }
View Full Code Here

              .addTablesByDataSet(dataSetUrl, true)
              .createDataSet(conn);
           
            Assertion.assertEquals(flatXmlDataSet, dbDataSet);
          } catch (Exception ex) {
            throw new JuDbException("Couldn't assert DB data", ex);
          }
        }
       
      });
    }
View Full Code Here

        public void execute(IDatabaseConnection conn) {
          try {
            IDataSet  dbDataSet = conn.createDataSet();
            Assertion.assertEquals(flatXmlDataSet, dbDataSet);
          } catch (Exception ex) {
            throw new JuDbException("Couldn't assert DB data", ex);
          }
        }
      });
    }
View Full Code Here

            QueryDataSet tableDataSet = new QueryDataSet(conn);
            tableDataSet.addTable(tableName, String.format("select * from %s order by %s", tableName, orderColumnName));
           
            Assertion.assertEquals(flatXmlDataSet, tableDataSet);
          } catch (Exception ex) {
            throw new JuDbException("Couldn't assert DB data", ex);
          }
        }
      });
    }
View Full Code Here

    case ORACLE:
      this.setSchema(this.emUtil.getMetaDataUserName());
      dataTypeFactory = new Oracle10DataTypeFactory();
      break;
    default:
      throw new JuDbException("Unsupported DB: " + this.emUtil.getDbType());
    }
   
    this.setConfigProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, dataTypeFactory);
    this.setConfigProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER, metadataHandler);
  }
View Full Code Here

    Connection unwrappedConn = null;
    if (this.emUtil != null && this.emUtil.getDbType() == DbType.ORACLE && connection instanceof Proxy) {
      try {
        unwrappedConn = connection.unwrap(Connection.class);
      } catch (Exception ex) {
        throw new JuDbException("Couldn't unwrap Connection", ex);
      }
    }
    final Connection realConn = unwrappedConn != null
        ? unwrappedConn
        : connection;
   
    try {
      IDatabaseConnection conn = new DatabaseConnection(realConn, this.schemaName);
      for (String key : this.configProperties.keySet()) {
        conn.getConfig().setProperty(key, this.configProperties.get(key));
      }
      work.execute(conn);
    } catch (DatabaseUnitException ex) {
      throw new JuDbException("Couldn't execute DbUnitWork", ex);
    }
  }
View Full Code Here

    public ExportBuilder setTableNamesCasingByDataSet(String resourcePath) {
      try {
        this.exportItems.setCasedTableNames(new XPathGetter(XmlUtils.loadXml(
            JuUrl.resource().relativeTo(DbDataUtil.class).get(resourcePath))).getNodeNames("dataset/*"));
      } catch (Exception ex) {
        throw new JuDbException("Couldn't load table names data set " + resourcePath, ex);
      }
      return this;
    }
View Full Code Here

          }
        }
       
        return this;
      } catch (Exception ex) {
        throw new JuDbException("Couldn't add tables by dataset " + resourceUrl, ex);
      }
    }
View Full Code Here

TOP

Related Classes of ch.inftec.ju.db.JuDbException

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.