Index: main/org/exolab/castor/jdo/drivers/HsqlQueryExpression.java =================================================================== RCS file: /scm/castor/castor/src/main/org/exolab/castor/jdo/drivers/HsqlQueryExpression.java,v retrieving revision 1.9 diff -u -r1.9 HsqlQueryExpression.java --- main/org/exolab/castor/jdo/drivers/HsqlQueryExpression.java 1 Oct 2004 19:45:49 -0000 1.9 +++ main/org/exolab/castor/jdo/drivers/HsqlQueryExpression.java 1 Jul 2005 23:42:32 -0000 @@ -39,6 +39,8 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. * * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: MySQLQueryExpression.java,v 1.8 2004/10/01 19:45:23 wguttmann Exp $ */ @@ -55,806 +57,198 @@ /** - * QueryExpression for HypersonicSQL. - *

- * This implementation was created mainly to allow the use of multiple outer - * joins during HSQL query expression creation. The syntax provided by - * the generic driver does not work with HSQL so this class was needed. + * QueryExpression for MySQL. * - * @author Santiago Arriaga + * @author Oleg Nitz + * @version $Revision: 1.8 $ $Date: 2004/10/01 19:45:23 $ */ public final class HsqlQueryExpression extends JDBCQueryExpression { - /** - * Public constructor - */ - public HsqlQueryExpression( PersistenceFactory factory ) - { - super( factory ); - } - /** - * Redefinition of JDBCQueryExpression.addColumn() method. This is needed - * because aliases are sometimes needed during the creation of HSQL - * expressions involving multiple outer joins. The original implementation - * does not allows this. - */ - public final void addColumn( String tableName, String columnName ) - { - _tables.put( tableName, tableName ); - _cols.addElement( new HsqlColumn(tableName, columnName) ); - } - /** - * Redefinition of JDBCQueryExpression.addCondition() method. This is needed - * because aliases are sometimes needed during the creation of HSQL - * expressions involving multiple outer joins. The original implementation - * does not allows this. - */ - public void addCondition( String tableName, String columnName, - String condOp, String value ) + public HsqlQueryExpression( PersistenceFactory factory ) { - _tables.put( tableName, tableName ); - _conds.addElement - ( new HsqlCondition(tableName, columnName, condOp, value) ); + super( factory ); } - public String getStatement( boolean lock ) - { - StringBuffer sql = new StringBuffer(128); - - HsqlAliasInfo aliasInfo = new HsqlAliasInfo(_joins); - addSelectClause(sql, aliasInfo); - addFromClause(sql, aliasInfo); - boolean first = addJoinClause(sql, aliasInfo); - addWhereClause( sql, aliasInfo, first ); - addOrderByClause(sql); - addForUpdateClause(sql, lock); - - return sql.toString(); + public String getStatement( boolean lock ) { + return getStandardStatement( lock, false ).toString(); } - + /** - * Creates the select clause of the query expression - * @param buffer The StringBuffer to which all the results are appended - * @param aliasInfo The information about the possible aliases in the class - */ - private void addSelectClause(StringBuffer buffer, HsqlAliasInfo aliasInfo) - { - buffer.append( JDBCSyntax.Select ); - - if ( _limit != null ) - { - if (_offset != null) - { - buffer.append(JDBCSyntax.Limit); - buffer.append(_offset).append(" "); // hsqldb doesn't use comma - buffer.append(_limit).append(" "); - } - else - { - buffer.append(" TOP ").append(_limit).append(" "); + * Helper method. Can be used in two cases: + * 1) for JDBC drivers which support "{oj ...OUTER JOIN ...}" notation (in accordance with + * JDBC specification); + * 2) for the databases which support "... OUTER JOIN ..." notation (in accordance with + * SQL-92 standard); . + * @param lock whether to lock selected tables + * @param oj true in the first case above, false in the second case. + **/ + protected StringBuffer getStandardStatement( boolean lock, boolean oj ) { + StringBuffer sql; + Enumeration enumeration; + boolean first; + Hashtable tables; + Vector done = new Vector(); + String tableName; + String tableAlias; + + sql = new StringBuffer(); + sql.append( JDBCSyntax.Select ); + + if ( _limit != null ) { + if (_offset != null) { + sql.append(JDBCSyntax.Limit); + sql.append(_offset).append(" "); // hsqldb doesn't use comma + sql.append(_limit).append(" "); + } else { + sql.append(" TOP ").append(_limit).append(" "); } } if ( _distinct ) - buffer.append( JDBCSyntax.Distinct ); - - addColumnList(buffer, aliasInfo); - } - - /** - * Add the from clause to the statement. This uses the hsql syntax for - * outer joins. Much of the functionality of the superclass is duplicated - * here but a refactoring should eliminate all the code that's been - * repeated - */ - private void addFromClause(StringBuffer buffer, HsqlAliasInfo aliasInfo) - { - buffer.append( JDBCSyntax.From ); - - Hashtable tables = (Hashtable)_tables.clone(); - - boolean first = addOuterJoins(buffer, tables, aliasInfo); - addTables(buffer, tables, first); - } - - /** - * Add the necessary outer joins to the syntax - * @param buffer The StringBuffer being appended - * @param tables A table hash clone obtained from _tables. the tables - * participating in the outer join are being deleted from this hash in - * this method so the method that displays the tables will know what to - * displaty - * @param aliasInfo The information of the aliases - * associated with the tables participating in multiple outer joins - * @return true if there were outer joins added to the query; false - * otherwise - */ - private boolean addOuterJoins - (StringBuffer buffer, Hashtable tables, HsqlAliasInfo aliasInfo) - { - boolean first = true; - - for ( int i = 0 ; i < _joins.size() ; ++i ) - { - Join join = (Join) _joins.elementAt( i ); - if ( join.outer ) - { - if ( first ) - first = false; - else - buffer.append( JDBCSyntax.TableSeparator ); - - addOuterJoin(buffer, join, aliasInfo); - - tables.remove( join.leftTable ); - tables.remove( join.rightTable ); - } - } - - return first; - } - - /** - * Add a single outer join to the output buffer - * @param buffer The StringBuffer being appended - * @param join The join to be displayed - * @param aliasInfo Says which columns need an alias because they are - * defined in multiple places - */ - private void addOuterJoin - (StringBuffer buffer, Join join, HsqlAliasInfo aliasInfo) - { - String leftAlias = aliasInfo.getAliasFor(join.leftTable, join); - String rightAlias = aliasInfo.getAliasFor(join.rightTable, join); - - addJoinTable( buffer, join.leftTable, leftAlias ); - buffer.append( JDBCSyntax.LeftJoin ); - addJoinTable( buffer, join.rightTable, rightAlias ); - - buffer.append( JDBCSyntax.On ).append(" ("); - - String leftTable = (leftAlias == null)? join.leftTable : leftAlias; - String rightTable = (rightAlias == null)? join.rightTable : rightAlias; - - addOuterJoinCondition - (buffer, join.leftColumns, join.rightColumns, leftTable, rightTable); - - buffer.append( ")" ); - } - - /** - * Add the outer join condition to the buffer - * @param buffer The StringBuffer which is being appended - * @param leftColumns The columns of the left participant. - * @param rightColumns The column of the right participant. - * @param leftTable The name of the left participant which may be a table - * name or an alias name - * @param rightTable The name of the right participant which may be a table - * name or an alias name - */ - private void addOuterJoinCondition - (StringBuffer buffer, String[] leftColumns, String[] rightColumns, - String leftTable, String rightTable) - { - String name; - for ( int j = 0 ; j < leftColumns.length ; ++j ) - { - if ( j > 0 ) - buffer.append( JDBCSyntax.And ); - - name = leftTable + JDBCSyntax.TableColumnSeparator + leftColumns[ j ]; - buffer.append( _factory.quoteName( name ) ); - - buffer.append( OpEquals ); - - name = rightTable + JDBCSyntax.TableColumnSeparator + rightColumns[ j ]; - buffer.append( _factory.quoteName( name ) ); - } - } - - /** - * Add a table participant in the join with it's corresponding alias if - * necessary - */ - private void addJoinTable(StringBuffer buffer, String table, String alias) - { - buffer.append(table); - - if(alias != null) - buffer.append(' ').append(alias); - } + sql.append( JDBCSyntax.Distinct ); - /** - * This method add the tables to the FROM clause that do not participate - * in an outer join. Those tables are contained in the tables structure - * @param buffer StringBuffer instance which is being appended - * @param tables The tables that participate in the query but do not - * participate in an outer join - * @param first true if there were any outer joins added to the buffer - * false otherwise - */ - private void addTables(StringBuffer buffer, Hashtable tables, boolean first) - { - Enumeration enumeration = tables.elements(); - while ( enumeration.hasMoreElements() ) - { - if ( first ) - first = false; + if ( _select == null ) + sql.append( getColumnList() ); else - buffer.append( JDBCSyntax.TableSeparator ); + sql.append( _select).append(" "); - buffer.append( _factory.quoteName( (String) enumeration.nextElement() ) ); - } - } + sql.append( JDBCSyntax.From ); - /** - * Add the join clause to the current expression - * @param buffer The buffer to which the generated output is beind appended - * @param aliasInfo The class that contains the tables that - * are present in more than an outer join clause and therefore must be - * added to the join - */ - private boolean addJoinClause(StringBuffer buffer, HsqlAliasInfo aliasInfo) - { - boolean first = true; - Join join; - - for ( int i = 0 ; i < _joins.size() ; ++i ) - { - join = (Join)_joins.elementAt( i ); - if(join.outer) - continue; - - first = addWhereOrAnd(buffer, first); - - addJoin(buffer, aliasInfo, join); - } - - first = addOuterJoins(buffer, aliasInfo, first); - - return first; - } - - private void addJoin(StringBuffer buffer, HsqlAliasInfo aliasInfo, Join join) - { - String where; - - for ( int j = 0 ; j < join.leftColumns.length ; ++j ) - { - if ( j > 0 ) - buffer.append( JDBCSyntax.And ); - - where = quoteTableAndColumn( join.leftTable, join.leftColumns[j] ); - buffer.append - ( checkForAlias(aliasInfo, join.leftTable, where) ); - buffer.append( OpEquals ); - - where = quoteTableAndColumn( join.rightTable, join.rightColumns[j] ); - buffer.append - ( checkForAlias(aliasInfo,join.rightTable, where) ); - } - } - - private String checkForAlias(HsqlAliasInfo aliasInfo, String tableName, String where) { - String alias = aliasInfo.getAnAliasFor(tableName); - if( alias != null ) { - return substituteAlias(where,tableName,alias); - } - return where; - } - - /** - * Add the outer join conditions to the WHERE part of the expression. - * this implies a join between the tables defined more than once in outer - * table statements - * @param buffer The buffer which is being appended - * @param aliasInfo Holds the information about the tables declared more - * than once in an outer join - * @first true if no previous conditions were appended to the WHERE clause, - * false otherwise - * @return the status of the first flag after processing the multiple - * outer join conditions - */ - private boolean addOuterJoins - (StringBuffer buffer, HsqlAliasInfo aliasInfo, boolean first) - { - for(Enumeration keys = aliasInfo.getTables(); keys.hasMoreElements();) - { - String key = (String)keys.nextElement(); - Hashtable hash = aliasInfo.getAliasHash(key); - - Enumeration joins = hash.keys(); - Join join = (Join)joins.nextElement(); - String[] columns = ( join.leftTable.equals(key) )? - join.leftColumns : join.rightColumns; - - while( joins.hasMoreElements() ) - { - first = addWhereOrAnd(buffer, first); + // Use outer join syntax for all outer joins. Inner joins come later. + tables = (Hashtable) _tables.clone(); + first = true; + // gather all outer joins with the same left part + for ( int i = 0 ; i < _joins.size() ; ++i ) { + Join join; + + join = (Join) _joins.elementAt( i ); + + if ( ! join.outer || done.contains( join.leftTable ) ) + continue; + if ( first ) + first = false; + else + sql.append( JDBCSyntax.TableSeparator ); + if ( oj ) + sql.append( "{oj " ); + sql.append( _factory.quoteName( join.leftTable ) ); + sql.append( JDBCSyntax.LeftJoin ); + tableName = (String) tables.get( join.rightTable ); + if( join.rightTable.equals( tableName ) ) { + sql.append( _factory.quoteName( tableName ) ); + } else { + sql.append( _factory.quoteName( tableName ) + " " + + _factory.quoteName( join.rightTable ) ); + } + sql.append( JDBCSyntax.On ); + for ( int j = 0 ; j < join.leftColumns.length ; ++j ) { + if ( j > 0 ) + sql.append( JDBCSyntax.And ); + sql.append( _factory.quoteName( join.leftTable + JDBCSyntax.TableColumnSeparator + + join.leftColumns[ j ] ) ).append( OpEquals ); + sql.append( _factory.quoteName( join.rightTable + JDBCSyntax.TableColumnSeparator + + join.rightColumns[ j ] ) ); + } - addOuterJoinCondition(buffer, columns, columns, - (String)hash.get(join), (String)hash.get( joins.nextElement() )); + tables.remove( join.leftTable ); + tables.remove( join.rightTable ); + for ( int k = i + 1 ; k < _joins.size() ; ++k ) { + Join join2; + + join2 = (Join) _joins.elementAt( k ); + if ( ! join2.outer || ! join.leftTable.equals( join2.leftTable ) ) + continue; + sql.append( JDBCSyntax.LeftJoin ); + tableName = (String) tables.get( join2.rightTable ); + + if( join2.rightTable.equals( tableName ) ) { + sql.append( _factory.quoteName( tableName ) ); + } else { + sql.append( _factory.quoteName( tableName ) + " " + + _factory.quoteName( join2.rightTable ) ); + } + sql.append( JDBCSyntax.On ); + for ( int j = 0 ; j < join2.leftColumns.length ; ++j ) { + if ( j > 0 ) + sql.append( JDBCSyntax.And ); + sql.append( _factory.quoteName( join2.leftTable + JDBCSyntax.TableColumnSeparator + + join2.leftColumns[ j ] ) ).append( OpEquals ); + sql.append( _factory.quoteName( join2.rightTable + JDBCSyntax.TableColumnSeparator + + join2.rightColumns[ j ] ) ); + } + tables.remove( join2.rightTable ); + } + if ( oj ) + sql.append( "}" ); + done.addElement( join.leftTable ); + } + enumeration = tables.keys(); + while ( enumeration.hasMoreElements() ) { + if ( first ) + first = false; + else + sql.append( JDBCSyntax.TableSeparator ); + tableAlias = (String) enumeration.nextElement(); + tableName = (String) tables.get( tableAlias ); + if( tableAlias.equals( tableName ) ) { + sql.append( _factory.quoteName( tableName ) ); + } else { + sql.append( _factory.quoteName( tableName ) + " " + + _factory.quoteName( tableAlias ) ); + } } - } - return first; - } - - private String quoteTableAndColumn(String table, String column) - { - return _factory.quoteName - (table + JDBCSyntax.TableColumnSeparator + column); - } - - /** - * This method adds the where clause taking into account possible aliases - * for columns - * @param buffer The buffer being appended - * @param aliasInfo The information of the aliases to be substituted for - * some tables - */ - protected boolean addWhereClause - ( StringBuffer buffer, HsqlAliasInfo aliasInfo, boolean first ) - { - first = addConditions(buffer, aliasInfo, first); - - first = addWhere(buffer, aliasInfo, first); - - return first; - } - - /** - * This method adds the conditions to the query being constructed - */ - private boolean addConditions - ( StringBuffer buffer, HsqlAliasInfo aliasInfo, boolean first ) - { - HsqlCondition condition; - - if ( _conds.size() > 0 ) - { - first = addWhereOrAnd(buffer, first); - - for ( int i = 0 ; i < _conds.size() ; ++i ) - { - if ( i > 0 ) - buffer.append( JDBCSyntax.And ); - - condition = (HsqlCondition)_conds.elementAt(i); - buffer.append( getConditionString( condition, aliasInfo ) ); + // Use standard join syntax for all inner joins + first = true; + for ( int i = 0 ; i < _joins.size() ; ++i ) { + Join join; + + join = (Join) _joins.elementAt( i ); + if ( ! join.outer ) { + if ( first ) { + sql.append( JDBCSyntax.Where ); + first = false; + } else + sql.append( JDBCSyntax.And ); + for ( int j = 0 ; j < join.leftColumns.length ; ++j ) { + if ( j > 0 ) + sql.append( JDBCSyntax.And ); + sql.append( _factory.quoteName( join.leftTable + JDBCSyntax.TableColumnSeparator + + join.leftColumns[ j ] ) ).append( OpEquals ); + sql.append( _factory.quoteName( join.rightTable + JDBCSyntax.TableColumnSeparator + + join.rightColumns[ j ] ) ); + } + } } - } + first = addWhereClause( sql, first ); - return first; - } - - /** - * This method adds the where part to the query. This method performs an - * ugly workaround to substitute the aliases that may be a source of - * problems in some cases. The best solution to this is a refactoring - * that does not use the _where as a String but rather as a more flexible - * representation - */ - private boolean addWhere - ( StringBuffer buffer, HsqlAliasInfo aliasInfo, boolean first ) - { - if ( _where != null ) - { - first = addWhereOrAnd(buffer, first); - String where = _where; - - for(Enumeration enumeration = aliasInfo.getTables(); enumeration.hasMoreElements();) - { - String table = (String)enumeration.nextElement(); - String alias = (String)aliasInfo.getAnAliasFor(table); - - where = substituteAlias(where, table + '.', alias + '.'); - } - - buffer.append(where); - } + if ( _order != null ) + sql.append(JDBCSyntax.OrderBy).append(_order); - return first; + // There is no standard way to lock selected tables. + return sql; } - /** - * Make a substitution of the givne table with the given aliases. This is - * just a workaround, will work for most cases but is NOT bulletproof - * and may fail for some cases - * @param expression The string representing the where class - * @param table The table being replaced - * @param alias The alias that will replace the table name + /** + * Provides an implementation of {@link QueryExpression#isLimitClauseSupported()}. + * @return true to indicate that this feature is supported by mySQL. + * @see org.exolab.castor.persist.spi.QueryExpression#isLimitClauseSupported() */ - private String substituteAlias - (String expression, String table, String alias) - { - StringBuffer buffer = new StringBuffer( expression.length() ); - - int pos = 0; - int end = expression.indexOf(table); - for( ; end != -1; end = expression.indexOf(table, pos) ) - { - buffer.append( expression.substring(pos, end) ); - buffer.append( alias ); - pos = end + table.length(); - } - - buffer.append( expression.substring(pos) ); - return buffer.toString(); + public boolean isLimitClauseSupported() { + return true; } - - /** - * Add the order by clause - */ - private void addOrderByClause(StringBuffer buffer) - { - if ( _order != null ) - buffer.append(JDBCSyntax.OrderBy).append(_order); - } - - /** - * Add the for update class + + /** + * Provides an implementation of {@link QueryExpression#isOffsetClauseSupported()}. + * @return true to indicate that this feature is supported by mySQL. + * @see org.exolab.castor.persist.spi.QueryExpression#isOffsetClauseSupported() */ - private void addForUpdateClause(StringBuffer buffer, boolean lock) - { - // Use FOR UPDATE to lock selected tables. - //if ( lock ) - // buffer.append( " FOR UPDATE" ); - } - - /** - * This method adds the column list to the buffer. This method is used - * instead of getColumnList() in the superclass - * @param buffer the buffer to which the list is being added - * @param aliasInfo The class that defines which tables require to - * display an alias instead of a table name - */ - private void addColumnList(StringBuffer buffer, HsqlAliasInfo aliasInfo) - { - if ( _cols.size() == 0 && _select == null ) // ? (Preserved from superclass) - { - buffer.append("1"); - return; - } - - int i = 0; - for ( i = 0 ; i < _cols.size() ; ++i ) - { - if ( i > 0 ) - buffer.append( JDBCSyntax.ColumnSeparator ); - - buffer.append - ( getColumnString( (HsqlColumn)_cols.elementAt(i), aliasInfo ) ); - } - - if ( _select != null ) // ? (Preserved from superclass) - if ( i > 0 ) - buffer.append( JDBCSyntax.ColumnSeparator ).append( _select ); - else - buffer.append( _select ); - } - - /** - * This method creates the column syntax taking into account any alias - * definition given in outer hash - * @param column The column instance to be returned - * @param aliasInfo The class with the definition of the columns that - * need to display an alias - */ - private String getColumnString(HsqlColumn column, HsqlAliasInfo aliasInfo) - { - String tableName = column.getTableName(); - String columnName = column.getColumnName(); - - if( aliasInfo.tableExists(tableName) ) - tableName = aliasInfo.getAnAliasFor(tableName); - - return tableName + JDBCSyntax.TableColumnSeparator + columnName; - } - - /** - * This method creates the condition syntax taking into account any alias - * definition given in outer hash - * @param condition The condition instance to be returned as a String - * @param aliasInfo The object with the definition of the columns that - * need to display an alias - */ - private String getConditionString - (HsqlCondition condition, HsqlAliasInfo aliasInfo) - { - return getColumnString(condition.getColumn(), aliasInfo) + - condition.getOperator() + condition.getValue(); - } - - /** - * Add WHERE or AND keyword depending if is the first condition statement - * or not - * @param buffer The buffer being appended - * @param first Whether this is the first condition in the where part or not - * @return always false as the resulting value of the first flag after this - * call - */ - private boolean addWhereOrAnd(StringBuffer buffer, boolean first) - { - if ( first ) - buffer.append( JDBCSyntax.Where ); - else - buffer.append( JDBCSyntax.And ); - - return false; - } - - /** - * Provides an implementation of {@link QueryExpression#isLimitClauseSupported()}. - * @return true to indicate that this feature is supported by HSQL. - * @see org.exolab.castor.persist.spi.QueryExpression#isLimitClauseSupported() - */ - public boolean isLimitClauseSupported() - { - return true; - } - - /** - * Provides an implementation of {@link QueryExpression#isOffsetClauseSupported()}. - * @return true to indicate that this feature is supported by HSQL. - * @see org.exolab.castor.persist.spi.QueryExpression#isOffsetClauseSupported() - */ - public boolean isOffsetClauseSupported() - { - return true; - } - -////////////////////////////////////////////////////////////////////////////// -// CLASS DELIMITER -////////////////////////////////////////////////////////////////////////////// - -/** - * This class encapsulates the information of the aliases related to sql - * outer joins. This class is defined as inner to easily see the Join class. - * A further refactoring should make this class a top-level class - */ -final class HsqlAliasInfo -{ - /** - * Counter that will be used to generate different alias names - */ - private int _count = 1; - - /** - * A hashtable with the following structure: - *

-   *    key:name-of-the-table(String)
-   *           value:(Hashtable):
-   *                     {
-   *                     key:join object which contains the table(Join)
-   *                              values: a random alias string(String)
-   *                     }
-   * 
- * That is a Hashtable with Hashtables as values. It purpose is to map a - * table name with the multiple join objects that declare it and each - * join with the alias that the column has in there. Only the tables - * that are defined in multiple places are placed inside this structure, - * because they are the only ones which require alias creation - */ - private final Hashtable _hash; - - /** - * Public constructor. This builds an alias info class from the joins - * participating in a query - */ - public HsqlAliasInfo(Vector joins) - { _hash = getRepeatedTablesInOuterJoinsHash(joins); } - - /** - * This method returns the hash internal values - * @return a not-null Hashtable instance - */ - private Hashtable getRepeatedTablesInOuterJoinsHash(Vector joins) - { - Hashtable hash = new Hashtable(); - - Hashtable countHash = getTableCountInOuterJoinsHash(joins); - String table; - Vector vec; - for(Enumeration keys = countHash.keys(); keys.hasMoreElements();) - { - table = (String)keys.nextElement(); - vec = (Vector)countHash.get( table ); - - if(vec.size() > 1) - { - Hashtable temp = new Hashtable(); - for(Enumeration joinenum = vec.elements(); joinenum.hasMoreElements();) - temp.put( joinenum.nextElement(), "a" + (_count++) ); - - hash.put(table, temp); - } - } - - return hash; - } - - /** - * This method returns a hashtable strcture which the keys are each of the - * tables defined in outer join clauses and the values is a Vector of - * the join objects which define each one of the tables. This will be used - * as an auxiliary to create the structure described in the - * getRepeatedTablesInOuterJoinsHash() method - */ - private Hashtable getTableCountInOuterJoinsHash(Vector joins) - { - Hashtable hash = new Hashtable(); - Join join = null; - - for ( int i = 0 ; i < joins.size() ; ++i ) - { - join = (Join)joins.elementAt( i ); - if (join.outer) - { - addTableCount(hash, join.leftTable, join); - addTableCount(hash, join.rightTable, join); - } - } - - return hash; - } - - /** - * This method adds a count to the structure described (and returned) in the - * getTableCountInOutersJoinHash method - * @param hash The hash to which the count will be added - * @param table The table to which the join will be appended - * @param join The join object - */ - private void addTableCount(Hashtable hash, String table, Join join) - { - Vector vec = null; - - if( hash.containsKey(table) ) - vec = (Vector)hash.get(table); - else - { - vec = new Vector(); - hash.put(table, vec); - } - - vec.addElement(join); - } - - //////////////////////////////////////////////////////////////////////////// - // Public methods - - /** - * Return a list of the tables involved in more than one outer join and - * they need an alias - */ - public Enumeration getTables() - { return _hash.keys(); } - - /** - * Check if the given table is involved in more thatn one oter join - */ - public boolean tableExists(String table) - { return _hash.containsKey(table); } - - /** - * Return any alias for the given table - * @param table a not null table name - * @return an alias for the input table; or null if the table has no aliases - * because it does not participate in more than one outer join - */ - public String getAnAliasFor(String table) - { - Hashtable hash = (Hashtable)_hash.get(table); - - return (hash == null)? - null : (String)hash.elements().nextElement(); - } - - /** - * Get the alias for the given table and join - * @param table a not null table name that may participate in more than one - * outer join - * @param join a not null join name in which the given table participates - * given table - * @return the alias for the input table and join; or null if the table has - * no aliases because it does not participate in more than one outer join - */ - public String getAliasFor(String table, Join join) - { - Hashtable hash = (Hashtable)_hash.get(table); - - return (hash == null)? - null : (String)hash.get(join); - } - - /** - * Get the hash of aliases for the given table - * @return a Hashtable instance which keys are the join objects and the - * values are the alias names for the given table. If the table has no - * aliases it returns null - */ - public Hashtable getAliasHash(String table) - { return (Hashtable)_hash.get(table); } - -} - -} - -////////////////////////////////////////////////////////////////////////////// -// CLASS DELIMITER -////////////////////////////////////////////////////////////////////////////// - -/** - * Simple abstraction of a column. Note that this class is immutable so - * that this class may be copied to other instances during the clonation - * process performed in the superclass without the risk of introducing - * undesired side effects. - */ -final class HsqlColumn - { - private final String _tableName; - - private final String _columnName; - - /** - * Public constructor - */ - public HsqlColumn(String tableName, String columnName) - { - _tableName = tableName; - _columnName = columnName; + public boolean isOffsetClauseSupported() { + return true; } - public final String getTableName() - { return _tableName; } - - public final String getColumnName() - { return _columnName; } - - } - -////////////////////////////////////////////////////////////////////////////// -// CLASS DELIMITER -////////////////////////////////////////////////////////////////////////////// - -/** - * Simple abstraction of a condition. Note that this class is immutable so - * that this class may be copied to other instances during the clonation - * process performed in the superclass without the risk of introducing - * undesired side effects. - */ -final class HsqlCondition - { - private final HsqlColumn _column; - - private final String _operator; - - private final String _value; - - /** - * Public constructor - */ - public HsqlCondition - (String tableName, String columnName, String operator, String value) - { - _column = new HsqlColumn(tableName, columnName); - _operator = operator; - _value = value; - } - - public final HsqlColumn getColumn() - { return _column; } - - public final String getOperator() - { return _operator; } - - public final String getValue() - { return _value; } - } - Index: tests/tests.xml =================================================================== RCS file: /scm/castor/castor/src/tests/tests.xml,v retrieving revision 1.21 diff -u -r1.21 tests.xml --- tests/tests.xml 16 Jun 2005 12:14:25 -0000 1.21 +++ tests/tests.xml 1 Jul 2005 23:42:36 -0000 @@ -29,27 +29,33 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - @@ -96,27 +102,30 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - @@ -164,29 +173,27 @@ - - - - - - - - - + + + + + + + + + + + + + + + - + - - - - - - - - @@ -232,28 +239,33 @@ - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - + + + @@ -300,29 +312,31 @@ - - - - - - - - + + + + + + + + + + + + + + + + + - - + - - - - - - - + @@ -367,29 +381,31 @@ - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - + - + @@ -434,27 +450,30 @@ - - - - - - - - + + + + + + + + + + + + + + + + + - + - - - - - - Index: tests/ctf/jdo/tc0x/SynchronizableImpl.java =================================================================== RCS file: /scm/castor/castor/src/tests/ctf/jdo/tc0x/SynchronizableImpl.java,v retrieving revision 1.2 diff -u -r1.2 SynchronizableImpl.java --- tests/ctf/jdo/tc0x/SynchronizableImpl.java 20 Jun 2005 12:00:59 -0000 1.2 +++ tests/ctf/jdo/tc0x/SynchronizableImpl.java 1 Jul 2005 23:42:36 -0000 @@ -45,7 +45,6 @@ package ctf.jdo.tc0x; -import java.util.Enumeration; import java.util.Iterator; import java.util.List; @@ -54,7 +53,7 @@ public final class SynchronizableImpl implements TxSynchronizable { - public void committed(TransactionContext tx) { + public void committed(final TransactionContext tx) { Iterator it = tx.iterateReadWriteObjectsInTransaction(); if (it.hasNext()) { List syncs = TestSynchronizable._synchronizables; @@ -65,9 +64,11 @@ boolean isUpdateCacheNeeded = tx.isUpdateCacheNeeded(object); boolean isUpdatePersistNeeded = tx.isUpdatePersistNeeded(object); String change = ""; - if (isDeleted) change = change + "deleted"; - if (isCreated) change = change + "created"; - if (isUpdateCacheNeeded || isUpdatePersistNeeded) change = change + "updated"; + if (isDeleted) { change = change + "deleted"; } + if (isCreated) { change = change + "created"; } + if (isUpdateCacheNeeded || isUpdatePersistNeeded) { + change = change + "updated"; + } syncs.add(change + ":" + object.toString()); } } Index: tests/jdo/Collections.java =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/Collections.java,v retrieving revision 1.6 diff -u -r1.6 Collections.java --- tests/jdo/Collections.java 7 Jun 2005 10:56:18 -0000 1.6 +++ tests/jdo/Collections.java 1 Jul 2005 23:42:37 -0000 @@ -71,7 +71,7 @@ private JDOCategory _category; public Collections( TestHarness category ) { - super( category, "TC28", "Collections" ); + super( category, "TC128", "Collections" ); _category = (JDOCategory) category; } Index: tests/jdo/Dependent.java =================================================================== RCS file: tests/jdo/Dependent.java diff -N tests/jdo/Dependent.java --- tests/jdo/Dependent.java 5 Mar 2005 13:42:01 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,296 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: Dependent.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ - */ - - -package jdo; - - -import org.exolab.castor.jdo.Database; -import org.exolab.castor.jdo.QueryResults; -import org.exolab.castor.jdo.OQLQuery; -import org.exolab.castor.jdo.PersistenceException; - -import harness.TestHarness; -import harness.CastorTestCase; - - -/** - * Test for dependent relationship between data objects. - * A dependent object life cycle rely on its master object. - * For example, if the master object is deleted, it will - * be deleted by Castor as well. If the dependent object - * is dereferenced, it will be removed from the database. - */ -public class Dependent extends CastorTestCase { - - private JDOCategory _category; - - private Database _db; - - /** - * Constructor - * - * @param category The test suite for these tests - */ - public Dependent( TestHarness category ) { - super( category, "TC24", "Dependent objects tests" ); - _category = (JDOCategory) category; - } - - /** - * Get a JDO database - */ - public void setUp() - throws PersistenceException { - - _db = _category.getDatabase(); - } - - public void runTest() - throws PersistenceException { - - OQLQuery oql; - OQLQuery groupOql; - TestMaster master; - TestGroup group; - TestDetail detail; - QueryResults qres; - TestMaster master2; - int cnt; - - _db = _category.getDatabase(); - - stream.println( "Delete everything" ); - _db.begin(); - oql = _db.getOQLQuery( "SELECT master FROM jdo.TestMaster master" ); - qres = oql.execute(); - - for ( cnt = 0; qres.hasMore(); cnt++ ) { - _db.remove( qres.next() ); - } - oql.close(); - stream.println( "Deleting " + cnt + " master objects" ); - - - oql = _db.getOQLQuery( "SELECT group FROM jdo.TestGroup group" ); - qres = oql.execute(); - for ( cnt = 0; qres.hasMore(); cnt++ ) { - _db.remove( qres.nextElement() ); - } - oql.close(); - stream.println( "Deleting " + cnt + " group objects" ); - _db.commit(); - - stream.println( "Attempt to create master with details" ); - _db.begin(); - master = new TestMaster(); - master.addDetail( new TestDetail( 5 ) ); - detail = new TestDetail( 6 ); - detail.addDetail2( new TestDetail2() ); - detail.addDetail2( new TestDetail2() ); - - master.addDetail( detail ); - detail = new TestDetail( 7 ); - detail.setDetail3( new TestDetail3( 101 ) ); - detail.addDetail2( new TestDetail2() ); - detail.addDetail2( new TestDetail2() ); - master.addDetail( detail ); - group = new TestGroup(); - _db.create( group ); - master.setGroup( group ); - _db.create( master ); - _db.commit(); - - _db.begin(); - master = (TestMaster) _db.load( TestMaster.class, new Integer( TestMaster.DefaultId ) ); - if ( master != null ) { - if ( master.getGroup() == null ) { - stream.println( "Error: loaded master without group: " + master ); - fail("loaded master without group: " + master); - } else if ( master.getGroup().getId() != TestGroup.DefaultId ) { - stream.println( "Error: loaded master with wrong group: " + master ); - fail("loaded master with wrong group: " + master); - } - if ( master.getDetails() == null || - ! master.getDetails().contains( new TestDetail( 5 ) ) || - ! master.getDetails().contains( new TestDetail( 6 ) ) || - ! master.getDetails().contains( new TestDetail( 7 ) ) ) { - stream.println( "Error: loaded master without three details: " + master ); - fail("loaded master without three details: " + master); - } - detail = master.findDetail( 5 ); - if ( detail.getDetails2() != null && detail.getDetails2().size() != 0 ) { - stream.println( "Error: loaded detail 5 with details2: " + detail ); - fail("loaded detail 5 with details2: " + detail); - } - detail = master.findDetail( 6 ); - if ( detail.getDetails2() == null || detail.getDetails2().size() != 2 ) { - stream.println( "Error: loaded detail 6 without two details: " + detail ); - fail("loaded detail 6 without two details: " + detail); - } - detail = master.findDetail( 7 ); - if ( detail.getDetails2() == null || detail.getDetails2().size() != 2) { - stream.println( "Error: loaded detail 7 without two details: " + detail ); - fail("loaded detail 7 without two details: " + detail); - } - if ( detail.getDetail3() == null || detail.getDetail3().getId() != 101 ) { - stream.println( "Error: loaded detail 6 wrong detail3: " + detail ); - fail("loaded detail 7 wrong detail3: " + detail); - } - } else { - stream.println( "Error: failed to create master with details and group" ); - fail("failed to create master with details and group"); - } - stream.println( "Created master with details: " + master ); - _db.commit(); - - - stream.println( "Attempt to change details" ); - _db.begin(); - master = (TestMaster) _db.load( TestMaster.class, new Integer( TestMaster.DefaultId ) ); - if ( master == null ) { - stream.println( "Error: failed to find master with details group" ); - fail("failed to find master with details group" ); - } - // remove detail with id == 5 - master.getDetails().remove( master.getDetails().indexOf( master.findDetail( 5 ) ) ); - // remove detail with id == 6 explicitly - detail = (TestDetail) master.findDetail( 6 ); - master.getDetails().remove( master.getDetails().indexOf( detail ) ); - detail = (TestDetail) master.findDetail( 7 ); - detail.setDetail3( new TestDetail3( 102 ) ); - // add new detail - master.addDetail( new TestDetail( 8 ) ); - // add new detail and create it explicitely - detail = new TestDetail( 9 ); - master.addDetail( detail ); - // delete, then create detail with id == 7 explicitly - detail = (TestDetail) master.findDetail( 7 ); - master.getDetails().remove( master.getDetails().indexOf( detail ) ); - master.addDetail( detail ); - _db.commit(); - _db.begin(); - master = (TestMaster) _db.load( TestMaster.class, new Integer( TestMaster.DefaultId ) ); - if ( master != null ) { - if ( master.getDetails().size() == 0 || - master.getDetails().contains( new TestDetail( 5 ) ) || - master.getDetails().contains( new TestDetail( 6 ) ) || - ! master.getDetails().contains( new TestDetail( 7 ) ) || - ! master.getDetails().contains( new TestDetail( 8 ) ) || - ! master.getDetails().contains( new TestDetail( 9 ) ) ) { - stream.println( "Error: loaded master has wrong set of details: " + master ); - fail("loaded master has wrong set of details: " + master); - } else { - stream.println( "Details changed correctly: " + master ); - } - detail = (TestDetail) master.findDetail( 7 ); - if ( detail.getDetail3() == null || detail.getDetail3().getId() != 102 ) { - stream.println( "Error: loaded detail y wrong detail3: " + detail ); - fail("loaded detail 7 wrong detail3: " + detail); - } - } else { - stream.println( "Error: master not found" ); - fail("master not found"); - } - _db.commit(); - - stream.println( "Test OQL query" ); - _db.begin(); - oql = _db.getOQLQuery( "SELECT master FROM jdo.TestMaster master WHERE master.details.value1=$1" ); - oql.bind(TestDetail.DefaultValue); - qres = oql.execute(); - if ( qres.hasMore() ) { - stream.println( "OK: correct result of query 1 " ); - } else { - stream.println( "Error: incorrect result of query 1 " ); - fail("incorrect result of query 1"); - } - oql.bind(TestDetail.DefaultValue + "*"); - qres = oql.execute(); - if ( qres.hasMore() ) { - stream.println( "Error: incorrect result of query 2 " ); - fail("incorrect result of query 2"); - } else { - stream.println( "OK: correct result of query 2 " ); - } - oql.close(); - oql = _db.getOQLQuery( "SELECT master FROM jdo.TestMaster master WHERE master.details.details2.value1=$1" ); - oql.bind(TestDetail2.DefaultValue); - qres = oql.execute(); - if ( qres.hasMore() ) { - stream.println( "OK: correct result of query 3 " ); - } else { - stream.println( "Error: incorrect result of query 3 " ); - fail("incorrect result of query 3"); - } - oql.bind(TestDetail2.DefaultValue + "*"); - qres = oql.execute(); - if ( qres.hasMore() ) { - stream.println( "Error: incorrect result of query 4 " ); - fail("incorrect result of query 4"); - } else { - stream.println( "OK: correct result of query 4 " ); - } - oql.close(); - oql = _db.getOQLQuery( "SELECT master FROM jdo.TestMaster master WHERE master.group=$1" ); - oql.bind(group); - qres = oql.execute(); - if ( qres.hasMore() ) { - stream.println( "OK: correct result of query 5 " ); - } else { - stream.println( "Error: incorrect result of query 5 " ); - fail("incorrect result of query 5"); - } - oql.close(); - _db.commit(); - - } - - public void tearDown() - throws PersistenceException { - if ( _db.isActive() ) _db.rollback(); - _db.close(); - } -} Index: tests/jdo/DependentKeyGen.java =================================================================== RCS file: tests/jdo/DependentKeyGen.java diff -N tests/jdo/DependentKeyGen.java --- tests/jdo/DependentKeyGen.java 5 Mar 2005 13:42:01 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,324 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 2001 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: DependentKeyGen.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ - */ - - -package jdo; - - -import org.exolab.castor.jdo.Database; -import org.exolab.castor.jdo.QueryResults; -import org.exolab.castor.jdo.OQLQuery; -import org.exolab.castor.jdo.PersistenceException; - -import harness.TestHarness; -import harness.CastorTestCase; - - -/** - * Test for dependent relationship between data objects. - * A dependent object life cycle rely on its master object. - * For example, if the master object is deleted, it will - * be deleted by Castor as well. If the dependent object - * is dereferenced, it will be removed from the database. - */ -public class DependentKeyGen extends CastorTestCase { - - private JDOCategory _category; - - private Database _db; - - /** - * Constructor - * - * @param category The test suite for these tests - */ - public DependentKeyGen( TestHarness category ) { - super( category, "TC24a", "Dependent objects tests" ); - _category = (JDOCategory) category; - } - - /** - * Get a JDO database - */ - public void setUp() - throws PersistenceException { - - _db = _category.getDatabase(); - } - - public void runTest() - throws PersistenceException { - - int detailId5, detailId6, detailId7, detailId8, detailId9; - TestDetailKeyGen detail5, detail6, detail7, detail8, detail9; - OQLQuery oql; - OQLQuery groupOql; - int masterId; - TestMasterKeyGen master; - TestGroup group; - int groupId; - TestDetailKeyGen detail; - QueryResults qres; - TestMasterKeyGen master2; - int cnt; - - _db = _category.getDatabase(); - - stream.println( "Delete everything" ); - _db.begin(); - oql = _db.getOQLQuery( "SELECT master FROM jdo.TestMasterKeyGen master" ); - qres = oql.execute(); - - for ( cnt = 0; qres.hasMore(); cnt++ ) { - _db.remove( qres.next() ); - } - oql.close(); - stream.println( "Deleting " + cnt + " master objects" ); - - - oql = _db.getOQLQuery( "SELECT group FROM jdo.TestGroup group" ); - qres = oql.execute(); - for ( cnt = 0; qres.hasMore(); cnt++ ) { - _db.remove( qres.nextElement() ); - } - oql.close(); - stream.println( "Deleting " + cnt + " group objects" ); - _db.commit(); - - stream.println( "Attempt to create master with details" ); - _db.begin(); - master = new TestMasterKeyGen(); - detail5 = new TestDetailKeyGen(); - master.addDetail( detail5 ); - detail6 = new TestDetailKeyGen(); - detail6.addDetail2( new TestDetailKeyGen2() ); - detail6.addDetail2( new TestDetailKeyGen2() ); - master.addDetail( detail6 ); - detail7 = new TestDetailKeyGen(); - detail7.addDetail2( new TestDetailKeyGen2() ); - detail7.addDetail2( new TestDetailKeyGen2() ); - detail7.setDetail3( new TestDetailKeyGen3() ); - master.addDetail( detail7 ); - group = new TestGroup(); - _db.create( group ); - - master.setGroup( group ); - _db.create( master ); - _db.commit(); - - detailId5 = detail5.getId(); - detailId6 = detail6.getId(); - detailId7 = detail7.getId(); - masterId = master.getId(); - groupId = group.getId(); - - _db.begin(); - master = (TestMasterKeyGen) _db.load( TestMasterKeyGen.class, new Integer( masterId ) ); - if ( master != null ) { - if ( master.getGroup() == null ) { - stream.println( "Error: loaded master without group: " + master ); - fail("loaded master without group: " + master); - } else if ( master.getGroup().getId() != groupId ) { - stream.println( "Error: loaded master with wrong group: " + master ); - fail("loaded master with wrong group: " + master); - } - if ( master.getDetails() == null || - ! master.getDetails().contains( new TestDetailKeyGen( detailId5 ) ) || - ! master.getDetails().contains( new TestDetailKeyGen( detailId6 ) ) || - ! master.getDetails().contains( new TestDetailKeyGen( detailId7 ) ) ) { - stream.println( "Error: loaded master without three details: " + master ); - fail("loaded master without three details: " + master); - } - detail = master.findDetail( detailId5 ); - if ( detail.getDetails2() != null && detail.getDetails2().size() != 0 ) { - stream.println( "Error: loaded detail 5 with details2: " + detail ); - fail("loaded detail 5 with details2: " + detail ); - } - if ( detail.getDetail3() != null ) { - stream.println( "Error: loaded detail 5 with unexpected details3: " + detail ); - fail("loaded detail 5 with unexpected details3: " + detail ); - } - detail = master.findDetail( detailId6 ); - if ( detail.getDetails2() == null || detail.getDetails2().size() != 2 ) { - stream.println( "Error: loaded detail 6 without two details: " + detail ); - fail("loaded detail 6 without two details2: " + detail); - } - if ( detail.getDetail3() != null ) { - stream.println( "Error: loaded detail 6 with unexpected details3: " + detail ); - fail("loaded detail 6 with unexpected details3: " + detail ); - } - - detail = master.findDetail( detailId7 ); - if ( detail.getDetails2() == null || detail.getDetails2().size() != 2) { - stream.println( "Error: loaded detail 7 without two details: " + detail ); - fail("loaded detail 7 without two details2: " + detail); - } - if ( detail.getDetail3() == null ) { - stream.println( "Error: loaded detail 7 without the expected details3: " + detail ); - fail("loaded detail 7 without the expected details3: " + detail ); - } - - } else { - stream.println( "Error: failed to create master with details and group" ); - fail("failed to create master with details and group"); - } - stream.println( "Created master with details: " + master ); - _db.commit(); - - - stream.println( "Attempt to change details" ); - _db.begin(); - master = (TestMasterKeyGen) _db.load( TestMasterKeyGen.class, new Integer( masterId ) ); - if ( master == null ) { - stream.println( "Error: failed to find master with details group" ); - fail("failed to find master with details group" ); - } - // remove detail with id == 5 - master.getDetails().remove( master.getDetails().indexOf( master.findDetail( detailId5 ) ) ); - // remove detail with id == 6 explicitly - detail = (TestDetailKeyGen) master.findDetail( detailId6 ); - master.getDetails().remove( master.getDetails().indexOf( detail ) ); - // add new detail - detail8 = new TestDetailKeyGen(); - master.addDetail( detail8 ); - // add new detail and create it explicitely - detail9 = new TestDetailKeyGen(); - master.addDetail( detail9 ); - // delete, then create detail with id == 7 explicitly - detail7 = (TestDetailKeyGen) master.findDetail( detailId7 ); - master.getDetails().remove( master.getDetails().indexOf( detail7 ) ); - master.addDetail( detail7 ); - _db.commit(); - detailId8 = detail8.getId(); - detailId9 = detail9.getId(); - - _db.begin(); - master = (TestMasterKeyGen) _db.load( TestMasterKeyGen.class, new Integer( masterId ) ); - if ( master != null ) { - if ( master.getDetails().size() == 0 || - master.getDetails().contains( new TestDetailKeyGen( detailId5 ) ) || - master.getDetails().contains( new TestDetailKeyGen( detailId6 ) ) || - ! master.getDetails().contains( new TestDetailKeyGen( detailId7 ) ) || - ! master.getDetails().contains( new TestDetailKeyGen( detailId8 ) ) || - ! master.getDetails().contains( new TestDetailKeyGen( detailId9 ) ) ) { - stream.println( "Error: loaded master has wrong set of details: " + master ); - fail("loaded master has wrong set of details: " + master); - } else { - stream.println( "Details changed correctly: " + master ); - } - } else { - stream.println( "Error: master not found" ); - fail("master not found"); - } - _db.commit(); - - stream.println( "Test OQL query" ); - _db.begin(); - oql = _db.getOQLQuery( "SELECT master FROM jdo.TestMasterKeyGen master WHERE master.details.value1=$1" ); - oql.bind(TestDetail.DefaultValue); - qres = oql.execute(); - if ( qres.hasMore() ) { - stream.println( "OK: correct result of query 1 " ); - } else { - stream.println( "Error: incorrect result of query 1 " ); - fail("incorrect result of query 1"); - } - oql.bind(TestDetail.DefaultValue + "*"); - qres = oql.execute(); - if ( qres.hasMore() ) { - stream.println( "Error: incorrect result of query 2 " ); - fail("incorrect result of query 2"); - } else { - stream.println( "OK: correct result of query 2 " ); - } - oql.close(); - oql = _db.getOQLQuery( "SELECT master FROM jdo.TestMasterKeyGen master WHERE master.details.details2.value1=$1" ); - oql.bind(TestDetailKeyGen2.DefaultValue); - qres = oql.execute(); - if ( qres.hasMore() ) { - stream.println( "OK: correct result of query 3 " ); - } else { - stream.println( "Error: incorrect result of query 3 " ); - fail("incorrect result of query 3"); - } - oql.bind(TestDetailKeyGen2.DefaultValue + "*"); - qres = oql.execute(); - if ( qres.hasMore() ) { - stream.println( "Error: incorrect result of query 4 " ); - fail("incorrect result of query 4"); - } else { - stream.println( "OK: correct result of query 4 " ); - } - oql.close(); - oql = _db.getOQLQuery( "SELECT master FROM jdo.TestMasterKeyGen master WHERE master.group=$1" ); - oql.bind(group); - qres = oql.execute(); - if ( qres.hasMore() ) { - stream.println( "OK: correct result of query 5 " ); - } else { - stream.println( "Error: incorrect result of query 5 " ); - fail("incorrect result of query 5"); - } - oql.close(); - _db.commit(); - - stream.println( "Test rollback" ); - _db.begin(); - master = (TestMasterKeyGen) _db.load( TestMasterKeyGen.class, new Integer( masterId ) ); - int detailsCount = master.getDetails().size(); - _db.rollback(); - if ( detailsCount != master.getDetails().size() ) { - stream.println( "Error: "+(master.getDetails().size() - detailsCount)+" details added in rollback"); - fail("Details added in rollback"); - } - - } - - public void tearDown() - throws PersistenceException { - if ( _db.isActive() ) _db.rollback(); - _db.close(); - } -} Index: tests/jdo/DependentKeyGenUpdate.java =================================================================== RCS file: tests/jdo/DependentKeyGenUpdate.java diff -N tests/jdo/DependentKeyGenUpdate.java --- tests/jdo/DependentKeyGenUpdate.java 5 Mar 2005 13:42:01 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,428 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999-2001 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: DependentKeyGenUpdate.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ - */ - - -package jdo; - - -import java.sql.Connection; -import java.sql.SQLException; -import org.exolab.castor.jdo.Database; -import org.exolab.castor.jdo.QueryResults; -import org.exolab.castor.jdo.OQLQuery; -import org.exolab.castor.jdo.PersistenceException; -import org.exolab.castor.jdo.ObjectModifiedException; - -import harness.TestHarness; -import harness.CastorTestCase; - - -/** - * Test for dependent relationship between data objects for - * long transaction. A dependent object life cycle rely on - * its master object. For example, if the master object is - * deleted, it will be deleted by Castor as well. If the - * dependent object is dereferenced, it will be removed from - * the database. - */ -public class DependentKeyGenUpdate extends CastorTestCase { - - - private Connection _conn; - - - private JDOCategory _category; - - - private Database _db; - - - public DependentKeyGenUpdate( TestHarness category ) - throws PersistenceException { - - super( category, "TC25a", "Dependent update objects tests" ); - _category = (JDOCategory) category; - } - - public void setUp() - throws PersistenceException, SQLException { - _db = _category.getDatabase(); - _conn = _category.getJDBCConnection(); - _conn.setAutoCommit( false ); - } - - public void runTest() - throws PersistenceException, SQLException { - - OQLQuery oql; - OQLQuery groupOql; - QueryResults qres; - int cnt; - TestMasterKeyGen master, master2; - int masterId, masterId2; - TestDetailKeyGen detail5, detail6, detail7, detail8, detail9; - int detailId5, detailId6, detailId7, detailId8, detailId9; - TestDetailKeyGen detailA, detailB, detailC, detailD, detailE; - int detailIdA, detailIdB, detailIdC, detailIdD, detailIdE; - TestGroup group; - TestDetailKeyGen detail; - TestDetailKeyGen2 detail2; - int detail2Id; - TestDetailKeyGen3 detail3; - int detail3Id; - - stream.println( "Delete everything" ); - _db.begin(); - oql = _db.getOQLQuery( "SELECT master FROM jdo.TestMasterKeyGen master" ); - qres = oql.execute(); - - for ( cnt = 0; qres.hasMore(); cnt++ ) { - _db.remove( qres.next() ); - } - stream.println( "Deleting " + cnt + " master objects" ); - - oql = _db.getOQLQuery( "SELECT group FROM jdo.TestGroup group" ); - qres = oql.execute(); - for ( cnt = 0; qres.hasMore(); cnt++ ) { - _db.remove( qres.nextElement() ); - } - stream.println( "Deleting " + cnt + " group objects" ); - _db.commit(); - - stream.println( "Attempt to create master with details" ); - _db.begin(); - master = new TestMasterKeyGen(); - detail5 = new TestDetailKeyGen(); - master.addDetail( detail5 ); - detail6 = new TestDetailKeyGen(); - detail6.addDetail2( new TestDetailKeyGen2() ); - detail6.addDetail2( new TestDetailKeyGen2() ); - detail3 = new TestDetailKeyGen3( 101 ); - detail6.setDetail3( detail3 ); - master.addDetail( detail6 ); - detail7 = new TestDetailKeyGen(); - detail7.addDetail2( new TestDetailKeyGen2() ); - detail7.addDetail2( new TestDetailKeyGen2() ); - master.addDetail( detail7 ); - group = new TestGroup(); - _db.create( group ); - master.setGroup( group ); - _db.create( master ); - _db.commit(); - - masterId = master.getId(); - detailId5 = detail5.getId(); - detailId6 = detail6.getId(); - detailId7 = detail7.getId(); - detail3Id = detail3.getId(); - - _db.begin(); - master = (TestMasterKeyGen) _db.load( TestMasterKeyGen.class, new Integer( masterId ) ); - if ( master != null ) { - if ( master.getGroup() == null ) { - stream.println( "Error: loaded master without group: " + master ); - fail("expecting group"); - } else if ( master.getGroup().getId() != TestGroup.DefaultId ) { - stream.println( "Error: loaded master with wrong group: " + master ); - fail("incorrect group" + master); - } - if ( master.getDetails() == null || - ! master.getDetails().contains( new TestDetailKeyGen( detailId5 ) ) || - ! master.getDetails().contains( new TestDetailKeyGen( detailId6 ) ) || - ! master.getDetails().contains( new TestDetailKeyGen( detailId7 ) ) ) { - stream.println( "Error: loaded master without three details: " + master ); - fail("incorrect detail(s)"+master+" expecting: "+detailId5+","+detailId6+","+detailId7); - } - detail5 = master.findDetail( detailId5 ); - if ( detail5.getDetails2() != null && detail5.getDetails2().size() != 0 ) { - stream.println( "Error: loaded detail 5 with details2: " + detail5 ); - fail("unexpected element found"); - } - detail6 = master.findDetail( detailId6 ); - if ( detail6.getDetails2() == null || detail6.getDetails2().size() != 2) { - stream.println( "Error: loaded detail 6 without two details: " + detail6 ); - fail("details' size mismatch"); - } - if ( detail6.getDetail3() == null || detail6.getDetail3().getId() != detail3Id ) { - stream.println( "Error: loaded detail 6 with wrong detail3: " + detail6 ); - fail("loaded detail 6 with wrong detail3: " + detail6); - } - detail7 = master.findDetail( detailId7 ); - if ( detail7.getDetails2() == null || detail7.getDetails2().size() != 2) { - stream.println( "Error: loaded detail 7 without two details: " + detail7 ); - fail("details' size mismatch"); - } - } else { - stream.println( "Error: failed to create master with details and group" ); - fail("failed to create master with details and group"); - } - _db.commit(); - stream.println( "Created master with details: " + master ); - - stream.println( "Attempt to change details" ); - _db.begin(); - master = (TestMasterKeyGen) _db.load( TestMasterKeyGen.class, new Integer( masterId ) ); - if ( master == null ) { - stream.println( "Error: failed to find master with details group" ); - fail("master not found"); - } - // remove detail with id == 5 - master.getDetails().remove( master.getDetails().indexOf( master.findDetail( detailId5 ) ) ); - // add new detail - detail8 = new TestDetailKeyGen(); - master.addDetail( detail8 ); - // add new detail and create it explicitely - detail9 = new TestDetailKeyGen(); - master.addDetail( detail9 ); - detail6 = (TestDetailKeyGen) master.findDetail( detailId6 ); - // change 1:1 dependent relationship - detail3 = new TestDetailKeyGen3(); - detail6.setDetail3( detail3 ); - - _db.commit(); - detailId8 = detail8.getId(); - detailId9 = detail9.getId(); - detail3Id = detail3.getId(); - - _db.begin(); - master = (TestMasterKeyGen) _db.load( TestMasterKeyGen.class, new Integer( masterId ) ); - if ( master != null ) { - if ( master.getDetails().size() == 0 || - master.getDetails().contains( new TestDetailKeyGen( detailId5 ) ) || - ! master.getDetails().contains( new TestDetailKeyGen( detailId6 ) ) || - master.findDetail( detailId6 ).getDetails2() == null || - master.findDetail( detailId6 ).getDetails2().size() != 2 || - master.findDetail( detailId6 ).getDetail3() == null || - master.findDetail( detailId6 ).getDetail3().getId() != detail3Id || - ! master.getDetails().contains( new TestDetailKeyGen( detailId7 ) ) || - ! master.getDetails().contains( new TestDetailKeyGen( detailId8 ) ) || - ! master.getDetails().contains( new TestDetailKeyGen( detailId9 ) ) ) { - stream.println( "Error: loaded master has wrong set of details: " + master ); - fail("loaded master has wrong set of details: "+master.findDetail( detailId6 )); - } else { - stream.println( "Details changed correctly: " + master ); - } - } else { - stream.println( "Error: master not found" ); - fail("master not found"); - } - _db.commit(); - - - stream.println( "Test long transaction with dirty checking" ); - _db.begin(); - master = (TestMasterKeyGen) _db.load( TestMasterKeyGen.class, new Integer( masterId ) ); - if ( master == null ) { - stream.println( "Error: failed to find master with details group" ); - fail("master not found"); - } - _db.commit(); - _db.begin(); - master2 = (TestMasterKeyGen) _db.load( TestMasterKeyGen.class, new Integer( masterId ) ); - master2.setValue1( master2.getValue1() + "2" ); - _db.commit(); - - stream.println( "Test 1" ); - try { - _db.begin(); - _db.update( master ); - _db.commit(); - stream.println( "Error: Dirty checking doesn't work" ); - fail("dirty check failed"); - } catch ( ObjectModifiedException exept ) { - _db.rollback(); - stream.println( "OK: Dirty checking works" ); - } - - stream.println( "Test 2" ); - detailA = new TestDetailKeyGen(); - detail2 = new TestDetailKeyGen2(); - detailA.addDetail2( detail2 ); - master2.addDetail( detailA ); - master2.getDetails().remove( new TestDetailKeyGen( detailId8 ) ); - master2.getDetails().remove( new TestDetailKeyGen( detailId9 ) ); - try { - _db.begin(); - _db.update( master2 ); - _db.commit(); - stream.println( "OK: Dirty checking works" ); - } catch ( ObjectModifiedException exept ) { - _db.rollback(); - stream.println( "Error: Dirty checking doesn't work" ); - fail("dirty check failed"); - } - detailIdA = detailA.getId(); - detail2Id = detail2.getId(); - - stream.println( "Test 3" ); - _conn.createStatement().execute( "UPDATE test_master SET value1='concurrent' WHERE id=" - + master2.getId() ); - _conn.commit(); - master2.setValue1( "long transaction new value" ); - try { - _db.begin(); - _db.update( master2 ); - _db.commit(); - stream.println( "Error: Dirty checking doesn't work" ); - fail("dirty check failed"); - } catch ( ObjectModifiedException except ) { - if (_db.isActive()) { - _db.rollback(); - } - - stream.println( "OK: Dirty checking works" ); - } - _db.begin(); - master = (TestMasterKeyGen) _db.load( TestMasterKeyGen.class, new Integer( masterId ) ); - if ( master != null ) { - if ( master.getDetails().size() == 0 || - ! master.getDetails().contains( new TestDetailKeyGen( detailIdA ) ) || - master.findDetail( detailIdA ).findDetail2( detail2Id ) == null || - ! master.getDetails().contains( new TestDetailKeyGen( detailId6 ) ) || - master.findDetail( detailId6 ).getDetails2() == null || - master.findDetail( detailId6 ).getDetails2().size() != 2 || - ! master.getDetails().contains( new TestDetailKeyGen( detailId7 ) ) || - master.getDetails().contains( new TestDetailKeyGen( detailId8 ) ) || - master.getDetails().contains( new TestDetailKeyGen( detailId9 ) ) ) { - stream.println( "Error: loaded master has wrong set of details: " + master ); - fail("unexpect set of details"); - } else { - stream.println( "Details changed correctly in the long transaction: " + master ); - } - } else { - stream.println( "Error: master not found" ); - fail("master not found"); - } - _db.commit(); - - // modify an dependent object and see if it got updated - stream.println( "Test 3" ); - detailA = master.findDetail( detailIdA ); - detailA.setValue1("new updated value"); - detailA.findDetail2( detail2Id ).setValue1("new detail 2 value"); - detail3 = new TestDetailKeyGen3(); - detailA.setDetail3( detail3 ); - detail6 = master.findDetail( detailId6 ); - detail6.getDetails2().clear(); - - _db.begin(); - _db.update( master ); - _db.commit(); - detail3Id = detail3.getId(); - - _db.begin(); - master = (TestMasterKeyGen) _db.load( TestMasterKeyGen.class, new Integer( masterId ) ); - if ( master != null ) { - if ( master.getDetails() == null || - master.getDetails().size() == 0 || - ! master.getDetails().contains( new TestDetailKeyGen( detailIdA ) ) || - master.findDetail( detailIdA ).getDetail3() == null || - master.findDetail( detailIdA ).getDetail3().getId() != detail3Id || - ! master.getDetails().contains( new TestDetailKeyGen( detailId6 ) ) || - master.findDetail( detailId6 ).getDetails2().size() != 0 || - master.findDetail( detailId6 ).getDetail3() == null || - ! master.getDetails().contains( new TestDetailKeyGen( detailId7 ) ) || - master.getDetails().contains( new TestDetailKeyGen( detailId8 ) ) || - master.getDetails().contains( new TestDetailKeyGen( detailId9 ) ) || - ! "new updated value".equals( master.findDetail( detailIdA ).getValue1()) || - master.findDetail( detailIdA ).findDetail2( detail2Id ) == null || - ! "new detail 2 value".equals( master.findDetail( detailIdA ).findDetail2( detail2Id ).getValue1() ) ) { - - stream.println( "Error: loaded master has wrong set of details: " + master ); - fail("unexpected set of details"); - } else { - stream.println( "Details changed correctly in the long transaction: " + master ); - } - } else { - stream.println( "Error: master not found" ); - fail("master not found"); - } - _db.commit(); - - // test unsetting one-one relationship - detail6 = master.findDetail( detailId6 ); - detail6.setDetail3( null ); - _db.begin(); - _db.update( master ); - _db.commit(); - - _db.begin(); - master = (TestMasterKeyGen) _db.load( TestMasterKeyGen.class, new Integer( masterId ) ); - if ( master != null ) { - if ( master.getDetails() == null || - master.getDetails().size() == 0 || - ! master.getDetails().contains( new TestDetailKeyGen( detailIdA ) ) || - master.findDetail( detailIdA ).getDetail3() == null || - master.findDetail( detailIdA ).getDetail3().getId() != detail3Id || - ! master.getDetails().contains( new TestDetailKeyGen( detailId6 ) ) || - master.findDetail( detailId6 ).getDetails2().size() != 0 || - master.findDetail( detailId6 ).getDetail3() != null || - ! master.getDetails().contains( new TestDetailKeyGen( detailId7 ) ) || - master.getDetails().contains( new TestDetailKeyGen( detailId8 ) ) || - master.getDetails().contains( new TestDetailKeyGen( detailId9 ) ) || - ! "new updated value".equals( master.findDetail( detailIdA ).getValue1()) || - master.findDetail( detailIdA ).findDetail2( detail2Id ) == null || - ! "new detail 2 value".equals( master.findDetail( detailIdA ).findDetail2( detail2Id ).getValue1() ) ) { - - stream.println( "Error: loaded master has wrong set of details: " + master ); - fail("unexpected set of details"); - } else { - stream.println( "Details changed correctly in the long transaction: " + master ); - } - } else { - stream.println( "Error: master not found" ); - fail("master not found"); - } - _db.commit(); - - } - - public void tearDown() - throws PersistenceException, SQLException { - if ( _db.isActive() ) _db.rollback(); - _db.close(); - _conn.close(); - } -} Index: tests/jdo/DependentOrder.java =================================================================== RCS file: tests/jdo/DependentOrder.java diff -N tests/jdo/DependentOrder.java --- tests/jdo/DependentOrder.java 5 Mar 2005 13:42:01 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,169 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: DependentOrder.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ - */ - - -package jdo; - -import org.exolab.castor.jdo.Database; -import org.exolab.castor.jdo.PersistenceException; - -import harness.TestHarness; -import harness.CastorTestCase; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class DependentOrder extends CastorTestCase -{ - - private JDOCategory _category; - - private Database _db; - - private Connection _conn; - - /** - * Constructor - * - * @param category The test suite for these tests - */ - public DependentOrder( TestHarness category ) - { - super( category, "TC31", "Dependent object order using key-gen" ); - _category = (JDOCategory) category; - } - - /** - * Get a JDO database - */ - public void setUp() - throws PersistenceException, SQLException - { - _db = _category.getDatabase(); - _conn = _category.getJDBCConnection(); - _conn.setAutoCommit( false ); - - stream.println( "Delete everything" ); - Statement stmt = _conn.createStatement(); - stmt.executeUpdate( "delete from depend2" ); - stmt.executeUpdate( "delete from master" ); - stmt.executeUpdate( "delete from depend1" ); - _conn.commit(); - - } - - public void runTest() - throws PersistenceException, SQLException - { - _db.begin(); - - stream.println( "Build master object and its dependent objects" ); - - // no ids needed, they come from the key-gen - Master master = new Master(); - Depend1 depend1 = new Depend1(); - master.setDepend1(depend1); - Depend2 depend2 = new Depend2(); - master.addDepend2(depend2); - - stream.println( "Create object tree in db" ); - _db.create(master); - _db.commit(); - stream.println( "depend1_id after creation : " + master.getDepend1().getId() ); - - _db.begin(); - try - { - stream.println( "read depend1_id from db" ); - PreparedStatement pstmt = - _conn.prepareStatement( "select depend1_id from master where id=?" ); - stream.println( "master id: " + master.getId() ); - pstmt.setInt( 1, master.getId() ); - pstmt.execute(); - ResultSet result = pstmt.getResultSet(); - if (!result.next()) - { - fail("Master object not created"); - } - - stream.println( "depend1_id in db : " + result.getInt( "depend1_id" ) ); - - if ( result.getInt( "depend1_id" ) == 0 ) - { - fail( "Depend1 object not linked to Master object" ); - } - } - catch ( SQLException e ) - { - fail( "Exception when checking master object row: " + e ); - } - - _db.commit(); - - // test for bug 973 Dependent objects deletion order problem - try - { - stream.println( "Deleting master object" ); - _db.begin(); - master = ( Master ) _db.load( Master.class, new Integer( master.getId() ) ); - _db.remove( master ); - _db.commit(); - } - catch ( Exception e ) - { - fail( "Exception thrown " + e ); - } - - } - - public void tearDown() throws PersistenceException - { - if ( _db.isActive() ) _db.rollback(); - _db.close(); - } -} Index: tests/jdo/DependentUpdate.java =================================================================== RCS file: tests/jdo/DependentUpdate.java diff -N tests/jdo/DependentUpdate.java --- tests/jdo/DependentUpdate.java 5 Mar 2005 13:42:01 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,364 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999-2001 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: DependentUpdate.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ - */ - - -package jdo; - - -import java.sql.Connection; -import java.sql.SQLException; -import org.exolab.castor.jdo.Database; -import org.exolab.castor.jdo.QueryResults; -import org.exolab.castor.jdo.OQLQuery; -import org.exolab.castor.jdo.PersistenceException; -import org.exolab.castor.jdo.ObjectModifiedException; - -import harness.TestHarness; -import harness.CastorTestCase; - - -/** - * Test for dependent relationship between data objects for - * long transaction. A dependent object life cycle rely on - * its master object. For example, if the master object is - * deleted, it will be deleted by Castor as well. If the - * dependent object is dereferenced, it will be removed from - * the database. - */ -public class DependentUpdate extends CastorTestCase { - - - private Connection _conn; - - - private JDOCategory _category; - - - private Database _db; - - - public DependentUpdate( TestHarness category ) - throws PersistenceException { - - super( category, "TC25", "Dependent update objects tests" ); - _category = (JDOCategory) category; - } - - public void setUp() - throws PersistenceException, SQLException { - _db = _category.getDatabase(); - _conn = _category.getJDBCConnection(); - _conn.setAutoCommit( false ); - } - - public void runTest() - throws PersistenceException, SQLException { - - OQLQuery oql; - OQLQuery groupOql; - TestMaster master; - TestGroup group; - TestDetail detail; - TestDetail2 detail2; - QueryResults qres; - TestMaster master2; - int cnt; - int detailId = 0; - - stream.println( "Delete everything" ); - _db.begin(); - oql = _db.getOQLQuery( "SELECT master FROM jdo.TestMaster master" ); - qres = oql.execute(); - - for ( cnt = 0; qres.hasMore(); cnt++ ) { - _db.remove( qres.next() ); - } - stream.println( "Deleting " + cnt + " master objects" ); - - oql = _db.getOQLQuery( "SELECT group FROM jdo.TestGroup group" ); - qres = oql.execute(); - for ( cnt = 0; qres.hasMore(); cnt++ ) { - _db.remove( qres.nextElement() ); - } - stream.println( "Deleting " + cnt + " group objects" ); - _db.commit(); - - stream.println( "Attempt to create master with details" ); - _db.begin(); - master = new TestMaster(); - master.addDetail( new TestDetail( 5 ) ); - detail = new TestDetail( 6 ); - detail.addDetail2( new TestDetail2() ); - detail.addDetail2( new TestDetail2() ); - detail.setDetail3( new TestDetail3( 101 ) ); - master.addDetail( detail ); - detail = new TestDetail( 7 ); - detail.addDetail2( new TestDetail2() ); - detail.addDetail2( new TestDetail2() ); - master.addDetail( detail ); - group = new TestGroup(); - _db.create( group ); - master.setGroup( group ); - _db.create( master ); - _db.commit(); - - _db.begin(); - master = (TestMaster) _db.load( TestMaster.class, new Integer( TestMaster.DefaultId ) ); - if ( master != null ) { - if ( master.getGroup() == null ) { - stream.println( "Error: loaded master without group: " + master ); - fail("expecting group"); - } else if ( master.getGroup().getId() != TestGroup.DefaultId ) { - stream.println( "Error: loaded master with wrong group: " + master ); - fail("incorrect group"); - } - if ( master.getDetails() == null || - ! master.getDetails().contains( new TestDetail( 5 ) ) || - ! master.getDetails().contains( new TestDetail( 6 ) ) || - ! master.getDetails().contains( new TestDetail( 7 ) ) ) { - stream.println( "Error: loaded master without three details: " + master ); - fail("incorrect detail(s)"); - } - detail = master.findDetail( 5 ); - if ( detail.getDetails2() != null && detail.getDetails2().size() != 0 ) { - stream.println( "Error: loaded detail 5 with details2: " + qres.next() ); - fail("unexpected element found"); - } - detail = master.findDetail( 6 ); - if ( detail.getDetails2() == null || detail.getDetails2().size() != 2) { - stream.println( "Error: loaded detail 6 without two details: " + detail ); - fail("details' size mismatch"); - } - if ( detail.getDetail3() == null || detail.getDetail3().getId() != 101 ) { - stream.println( "Error: loaded detail 6 with wrong detail3: " + detail ); - fail("loaded detail 6 with wrong detail3: " + detail); - } - detail = master.findDetail( 7 ); - if ( detail.getDetails2() == null || detail.getDetails2().size() != 2) { - stream.println( "Error: loaded detail 7 without two details: " + detail ); - fail("details' size mismatch"); - } - } else { - stream.println( "Error: failed to create master with details and group" ); - fail("failed to create master with details and group"); - } - _db.commit(); - stream.println( "Created master with details: " + master ); - - stream.println( "Attempt to change details" ); - _db.begin(); - master = (TestMaster) _db.load( TestMaster.class, new Integer( TestMaster.DefaultId ) ); - if ( master == null ) { - stream.println( "Error: failed to find master with details group" ); - fail("master not found"); - } - // remove detail with id == 5 - master.getDetails().remove( master.getDetails().indexOf( master.findDetail( 5 ) ) ); - // add new detail - master.addDetail( new TestDetail( 8 ) ); - // add new detail and create it explicitely - detail = new TestDetail( 9 ); - master.addDetail( detail ); - detail = (TestDetail) master.findDetail( 6 ); - // change 1:1 dependent relationship - detail.setDetail3( new TestDetail3( 102 ) ); - // delete, then create detail with id == 7 explicitly - detail = (TestDetail) master.findDetail( 7 ); - master.getDetails().remove( master.getDetails().indexOf( detail ) ); - master.addDetail( detail ); - _db.commit(); - - _db.begin(); - master = (TestMaster) _db.load( TestMaster.class, new Integer( TestMaster.DefaultId ) ); - if ( master != null ) { - if ( master.getDetails().size() == 0 || - master.getDetails().contains( new TestDetail( 5 ) ) || - ! master.getDetails().contains( new TestDetail( 6 ) ) || - master.findDetail( 6 ).getDetails2() == null || - master.findDetail( 6 ).getDetails2().size() != 2 || - master.findDetail( 6 ).getDetail3() == null || - master.findDetail( 6 ).getDetail3().getId() != 102 || - ! master.getDetails().contains( new TestDetail( 7 ) ) || - ! master.getDetails().contains( new TestDetail( 8 ) ) || - ! master.getDetails().contains( new TestDetail( 9 ) ) ) { - stream.println( "Error: loaded master has wrong set of details: " + master ); - fail("loaded master has wrong set of details"); - } else { - stream.println( "Details changed correctly: " + master ); - } - } else { - stream.println( "Error: master not found" ); - fail("master not found"); - } - _db.commit(); - - - stream.println( "Test long transaction with dirty checking" ); - _db.begin(); - master = (TestMaster) _db.load( TestMaster.class, new Integer( TestMaster.DefaultId ) ); - if ( master == null ) { - stream.println( "Error: failed to find master with details group" ); - fail("master not found"); - } - _db.commit(); - _db.begin(); - master2 = (TestMaster) _db.load( TestMaster.class, new Integer( TestMaster.DefaultId ) ); - master2.setValue1( master2.getValue1() + "2" ); - _db.commit(); - - stream.println( "Test 1" ); - try { - _db.begin(); - _db.update( master ); - _db.commit(); - stream.println( "Error: Dirty checking doesn't work" ); - fail("dirty check failed"); - } catch ( ObjectModifiedException exept ) { - _db.rollback(); - stream.println( "OK: Dirty checking works" ); - } - - stream.println( "Test 2" ); - detail = new TestDetail( 5 ); - detail2 = new TestDetail2(); - detail.addDetail2( detail2 ); - master2.addDetail( detail ); - master2.getDetails().remove( new TestDetail( 8 ) ); - master2.getDetails().remove( new TestDetail( 9 ) ); - try { - _db.begin(); - _db.update( master2 ); - _db.commit(); - detailId = detail2.getId(); - stream.println( "OK: Dirty checking works" ); - } catch ( ObjectModifiedException exept ) { - _db.rollback(); - stream.println( "Error: Dirty checking doesn't work" ); - fail("dirty check failed"); - } - - stream.println( "Test 3" ); - _conn.createStatement().execute( "UPDATE test_master SET value1='concurrent' WHERE id=" - + master2.getId() ); - _conn.commit(); - master2.setValue1( "long transaction new value" ); - try { - _db.begin(); - _db.update( master2 ); - _db.commit(); - stream.println( "Error: Dirty checking doesn't work" ); - fail("dirty check failed"); - } catch ( ObjectModifiedException except ) { - if (_db.isActive()) { - _db.rollback(); - } - - stream.println( "OK: Dirty checking works" ); - } - _db.begin(); - master = (TestMaster) _db.load( TestMaster.class, new Integer( TestMaster.DefaultId ) ); - if ( master != null ) { - if ( master.getDetails().size() == 0 || - ! master.getDetails().contains( new TestDetail( 5 ) ) || - master.findDetail( 5 ).findDetail2( detailId ) == null || - ! master.getDetails().contains( new TestDetail( 6 ) ) || - master.findDetail( 6 ).getDetails2() == null || - master.findDetail( 6 ).getDetails2().size() != 2 || - ! master.getDetails().contains( new TestDetail( 7 ) ) || - master.getDetails().contains( new TestDetail( 8 ) ) || - master.getDetails().contains( new TestDetail( 9 ) ) ) { - stream.println( "Error: loaded master has wrong set of details: " + master ); - fail("unexpect set of details"); - } else { - stream.println( "Details changed correctly in the long transaction: " + master ); - } - } else { - stream.println( "Error: master not found" ); - fail("master not found"); - } - _db.commit(); - - // modify an dependent object and see if it got updated - stream.println( "Test 3" ); - detail = master.findDetail( 5 ); - detail.setValue1("new updated value"); - detail.findDetail2( detailId ).setValue1("new detail 2 value"); - _db.begin(); - _db.update( master ); - _db.commit(); - - _db.begin(); - master = (TestMaster) _db.load( TestMaster.class, new Integer( TestMaster.DefaultId ) ); - if ( master != null ) { - if ( master.getDetails() == null || - master.getDetails().size() == 0 || - ! master.getDetails().contains( new TestDetail( 5 ) ) || - ! master.getDetails().contains( new TestDetail( 6 ) ) || - ! master.getDetails().contains( new TestDetail( 7 ) ) || - master.getDetails().contains( new TestDetail( 8 ) ) || - master.getDetails().contains( new TestDetail( 9 ) ) || - ! "new updated value".equals( master.findDetail( 5 ).getValue1()) || - master.findDetail( 5 ).findDetail2( detailId ) == null || - ! "new detail 2 value".equals( master.findDetail( 5 ).findDetail2( detailId ).getValue1() ) ) { - - stream.println( "Error: loaded master has wrong set of details: " + master ); - fail("unexpected set of details"); - } else { - stream.println( "Details changed correctly in the long transaction: " + master ); - } - } else { - stream.println( "Error: master not found" ); - fail("master not found"); - } - _db.commit(); - } - - public void tearDown() - throws PersistenceException, SQLException { - if ( _db.isActive() ) _db.rollback(); - _db.close(); - _conn.close(); - } -} Index: tests/jdo/KeyGenGeneric.java =================================================================== RCS file: tests/jdo/KeyGenGeneric.java diff -N tests/jdo/KeyGenGeneric.java --- tests/jdo/KeyGenGeneric.java 5 Oct 2004 22:26:41 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,173 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: KeyGenGeneric.java,v 1.5 2004/10/05 22:26:41 wguttmann Exp $ - */ - - -package jdo; - - -import org.exolab.castor.jdo.Database; -import org.exolab.castor.jdo.OQLQuery; -import org.exolab.castor.jdo.QueryResults; -import org.exolab.castor.jdo.PersistenceException; -import harness.TestHarness; -import harness.CastorTestCase; - - -/** - * Test for generic key generators (MAX and HIGH-LOW). - */ -public class KeyGenGeneric extends CastorTestCase { - - private JDOCategory _category; - - private Database _db; - - public KeyGenGeneric( TestHarness category ) { - this( category, "TC41", "Key generators: MAX, HIGH-LOW" ); - } - - public KeyGenGeneric( TestHarness category, String name, String description ) { - super( category, name, description ); - _category = (JDOCategory) category; - } - - public void setUp() - throws PersistenceException { - _db = _category.getDatabase(); - } - - public void runTest() - throws PersistenceException, Exception { - - testOneKeyGen( TestMaxObject.class, TestMaxExtends.class ); - - testOneKeyGen( TestHighLowObject.class, TestHighLowExtends.class ); - - testOneKeyGen( TestHighLowObjectSameConnection.class, TestHighLowExtendsSameConnection.class ); - - } - - public void tearDown() - throws PersistenceException { - if ( _db.isActive() ) _db.rollback(); - _db.close(); - } - - /** - * The main goal of the test is to verify key generators in the case - * of "extends" relation between two classes. - * For each key generator we have a pair of classes: TestXXXObject and - * TestXXXExtends which use key generator XXX. - */ - protected boolean testOneKeyGen( Class objClass, Class extClass ) - throws PersistenceException, Exception { - - OQLQuery oql; - TestKeyGenObject object; - TestKeyGenObject ext; - QueryResults enumeration; - boolean result; - - result = true; - - // Open transaction in order to perform JDO operations - _db.begin(); - - // Create first object - object = (TestKeyGenObject) objClass.newInstance(); - stream.println( "Creating first object: " + object ); - _db.create( object ); - stream.println( "Created first object: " + object ); - - // Create second object - ext = (TestKeyGenObject) extClass.newInstance(); - stream.println( "Creating second object: " + ext ); - _db.create( ext ); - stream.println( "Created second object: " + ext ); - - _db.commit(); - - _db.begin(); - - // Find the first object and remove it - //object = (TestKeyGenObject) _db.load( objClass, object.getId() ); - oql = _db.getOQLQuery(); - oql.create( "SELECT object FROM " + objClass.getName() + - " object WHERE id = $1" ); - oql.bind( object.getId() ); - enumeration = oql.execute(); - stream.println( "Removing first object: " + object ); - if ( enumeration.hasMore() ) { - object = (TestKeyGenObject) enumeration.next(); - _db.remove( object ); - stream.println( "OK: Removed" ); - } else { - stream.println( "Error: Not found" ); - result = false; - } - - // Find the second object and remove it - //ext = (TestKeyGenObject) _db.load( extClass, ext.getId() ); - oql = _db.getOQLQuery(); - oql.create( "SELECT ext FROM " + extClass.getName() + - " ext WHERE id = $1" ); - oql.bind( ext.getId() ); - enumeration = oql.execute(); - stream.println( "Removing second object: " + ext ); - if ( enumeration.hasMore() ) { - ext = (TestKeyGenObject) enumeration.next(); - _db.remove( ext ); - stream.println( "OK: Removed" ); - } else { - stream.println( "Error: Not found" ); - result = false; - } - - _db.commit(); - - return result; - } - -} Index: tests/jdo/KeyGenIdentity.java =================================================================== RCS file: tests/jdo/KeyGenIdentity.java diff -N tests/jdo/KeyGenIdentity.java --- tests/jdo/KeyGenIdentity.java 8 Jun 2004 10:15:59 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,71 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: KeyGenIdentity.java,v 1.2 2004/06/08 10:15:59 wguttmann Exp $ - */ - - -package jdo; - -import org.exolab.castor.jdo.PersistenceException; -import harness.TestHarness; - - -/** - * Test for IDENTITY key generator. An IDENTITY key generator - * make uses of the RDBMS auto - increment features to generate - * a primary key for a newly created object. - */ -public class KeyGenIdentity extends KeyGenGeneric { - - public KeyGenIdentity( TestHarness category ) { - - super( category, "TC44" , "Key generator: IDENTITY" ); - } - - public void runTest() - throws PersistenceException, Exception { - - testOneKeyGen( TestIdentityObject.class, TestIdentityExtends.class ); - } - -} Index: tests/jdo/KeyGenReturning.java =================================================================== RCS file: tests/jdo/KeyGenReturning.java diff -N tests/jdo/KeyGenReturning.java --- tests/jdo/KeyGenReturning.java 11 May 2005 17:18:50 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,70 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: KeyGenReturning.java,v 1.3 2005/05/11 17:18:50 rjoachim Exp $ - */ - - -package jdo; - -import org.exolab.castor.jdo.PersistenceException; -import harness.TestHarness; - - -/** - * Test for RETURNING key generator. - */ -public class KeyGenReturning extends KeyGenGeneric { - - public KeyGenReturning( TestHarness category ) { - - super( category, "TC43" , "Key generator: RETURNING" ); - } - - public void runTest() - throws PersistenceException, Exception { - - testOneKeyGen( TestReturningObject.class, TestReturningExtends.class ); - } - -} - Index: tests/jdo/KeyGenSequence.java =================================================================== RCS file: tests/jdo/KeyGenSequence.java diff -N tests/jdo/KeyGenSequence.java --- tests/jdo/KeyGenSequence.java 8 Jun 2004 10:17:29 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,68 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: KeyGenSequence.java,v 1.2 2004/06/08 10:17:29 wguttmann Exp $ - */ - - -package jdo; - -import org.exolab.castor.jdo.PersistenceException; -import harness.TestHarness; - - -/** - * Test for SEQUENCE key generator. - */ -public class KeyGenSequence extends KeyGenGeneric { - - public KeyGenSequence( TestHarness category ) { - super( category, "TC42", "Key generator: SEQUENCE" ); - } - - public void runTest() - throws PersistenceException, Exception { - - testOneKeyGen( TestSequenceObject.class, TestSequenceExtends.class ); - } - -} Index: tests/jdo/KeyGenUuid.java =================================================================== RCS file: tests/jdo/KeyGenUuid.java diff -N tests/jdo/KeyGenUuid.java --- tests/jdo/KeyGenUuid.java 5 Oct 2004 22:26:41 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,165 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999-2001 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: KeyGenUuid.java,v 1.4 2004/10/05 22:26:41 wguttmann Exp $ - */ - - -package jdo; - - -import org.exolab.castor.jdo.Database; -import org.exolab.castor.jdo.OQLQuery; -import org.exolab.castor.jdo.QueryResults; -import org.exolab.castor.jdo.PersistenceException; -import harness.TestHarness; -import harness.CastorTestCase; - -/** - * Test for generic key generators (UUID). - */ -public class KeyGenUuid extends CastorTestCase { - - private JDOCategory _category; - - private Database _db; - - public KeyGenUuid( TestHarness category ) { - this( "TC45", "Key generator: UUID", category ); - } - - - public KeyGenUuid( String name, String description, TestHarness category ) { - super( category, name, description ); - _category = (JDOCategory) category; - } - - - public void setUp() - throws PersistenceException { - _db = _category.getDatabase(); - } - - public void runTest() - throws PersistenceException, Exception { - - testOneKeyGen( TestUuidObject.class, TestUuidExtends.class ); - } - - public void tearDown() - throws PersistenceException { - if ( _db.isActive() ) _db.rollback(); - _db.close(); - } - - /** - * The main goal of the test is to verify key generators in the case - * of "extends" relation between two classes. - * For each key generator we have a pair of classes: TestXXXObject and - * TestXXXExtends which use key generator XXX. - */ - protected void testOneKeyGen( Class objClass, Class extClass ) - throws PersistenceException, Exception { - - OQLQuery oql; - TestUuidObject object; - TestUuidObject ext; - QueryResults enumeration; - - // Open transaction in order to perform JDO operations - _db.begin(); - - // Create first object - object = (TestUuidObject) objClass.newInstance(); - stream.println( "Creating first object: " + object ); - _db.create( object ); - stream.println( "Created first object: " + object ); - - // Create second object - ext = (TestUuidObject) extClass.newInstance(); - stream.println( "Creating second object: " + ext ); - _db.create( ext ); - stream.println( "Created second object: " + ext ); - - _db.commit(); - - _db.begin(); - - // Find the first object and remove it - //object = (TestUuidObject) _db.load( objClass, object.getId() ); - oql = _db.getOQLQuery(); - oql.create( "SELECT object FROM " + objClass.getName() + - " object WHERE id = $1" ); - oql.bind( object.getId() ); - enumeration = oql.execute(); - stream.println( "Removing first object: " + object ); - if ( enumeration.hasMore() ) { - object = (TestUuidObject) enumeration.next(); - _db.remove( object ); - stream.println( "OK: Removed" ); - } else { - stream.println( "Error: Not found" ); - fail("first object not found"); - } - - // Find the second object and remove it - //ext = (TestUuidObject) _db.load( extClass, ext.getId() ); - oql = _db.getOQLQuery(); - oql.create( "SELECT ext FROM " + extClass.getName() + - " ext WHERE id = $1" ); - oql.bind( ext.getId() ); - enumeration = oql.execute(); - stream.println( "Removing second object: " + ext ); - if ( enumeration.hasMore() ) { - ext = (TestUuidObject) enumeration.next(); - _db.remove( ext ); - stream.println( "OK: Removed" ); - } else { - stream.println( "Error: Not found" ); - fail("second object not found"); - } - _db.commit(); - - } - -} - Index: tests/jdo/LazyLoading.java =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/LazyLoading.java,v retrieving revision 1.4 diff -u -r1.4 LazyLoading.java --- tests/jdo/LazyLoading.java 11 May 2005 17:18:50 -0000 1.4 +++ tests/jdo/LazyLoading.java 1 Jul 2005 23:42:39 -0000 @@ -81,7 +81,7 @@ public LazyLoading( TestHarness category ) { - super( category, "TC26", "Lazy Loading" ); + super( category, "TC126", "Lazy Loading" ); _category = (JDOCategory) category; } Index: tests/jdo/ManyToMany.java =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/ManyToMany.java,v retrieving revision 1.4 diff -u -r1.4 ManyToMany.java --- tests/jdo/ManyToMany.java 5 Mar 2005 13:42:01 -0000 1.4 +++ tests/jdo/ManyToMany.java 1 Jul 2005 23:42:40 -0000 @@ -75,7 +75,7 @@ * @param category The test suite of these tests */ public ManyToMany( TestHarness category ) { - super( category, "TC23", "ManyToMany" ); + super( category, "TC123", "ManyToMany" ); _category = (JDOCategory) category; } Index: tests/jdo/Master.java =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/Master.java,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Master.java --- tests/jdo/Master.java 3 Mar 2003 07:10:07 -0000 1.1.1.1 +++ tests/jdo/Master.java 1 Jul 2005 23:42:40 -0000 @@ -1,109 +1,109 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: Master.java,v 1.1.1.1 2003/03/03 07:10:07 kvisco Exp $ - */ - - -package jdo; - -import java.util.ArrayList; - -/** - * @table MASTER - * @key-generator MAX - */ -public class Master -{ - /** @sql-name depend1_oid */ - private Depend1 depend1; - - /** @primary-key */ - private int id; - - public Depend1 getDepend1() - { - return depend1; - } - - public void setDepend1(Depend1 depend1) - { - this.depend1 = depend1; - } - - public int getId() - { - return id; - } - - public void setId(int id) - { - this.id = id; - } - - public ArrayList getDepends2() - { - return depends2; - } - - public void setDepends2(ArrayList depends2) - { - this.depends2 = depends2; - } - - /** - * @field-type jdo.Depend2 - * @many-key master_oid - */ - private ArrayList depends2 = new ArrayList(); - - public void addDepend2(Depend2 depend2) - { - depends2.add(depend2); - depend2.setMaster(this); - } - - public String toString() - { - return "Master object #" + id; - } -} +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: Master.java,v 1.1.1.1 2003/03/03 07:10:07 kvisco Exp $ + */ + + +package jdo; + +import java.util.ArrayList; + +/** + * @table MASTER + * @key-generator MAX + */ +public class Master +{ + /** @sql-name depend1_oid */ + private Depend1 depend1; + + /** @primary-key */ + private int id; + + public Depend1 getDepend1() + { + return depend1; + } + + public void setDepend1(Depend1 depend1) + { + this.depend1 = depend1; + } + + public int getId() + { + return id; + } + + public void setId(int id) + { + this.id = id; + } + + public ArrayList getDepends2() + { + return depends2; + } + + public void setDepends2(ArrayList depends2) + { + this.depends2 = depends2; + } + + /** + * @field-type jdo.Depend2 + * @many-key master_oid + */ + private ArrayList depends2 = new ArrayList(); + + public void addDepend2(Depend2 depend2) + { + depends2.add(depend2); + depend2.setMaster(this); + } + + public String toString() + { + return "Master object #" + id; + } +} Index: tests/jdo/TestDetail.java =================================================================== RCS file: tests/jdo/TestDetail.java diff -N tests/jdo/TestDetail.java --- tests/jdo/TestDetail.java 5 Mar 2005 13:42:01 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,221 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestDetail.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ - */ - - -package jdo; - - -import java.util.ArrayList; -import java.util.Iterator; - - -/** - * Test object mapping to test_detaul used to conduct relation tests. - */ -public class TestDetail -{ - - - private int _id; - - - private String _value; - - - private TestMaster _master; - - - private ArrayList _details2; - - - private TestDetail3 _detail3; - - - static final int DefaultId = 5; - - - static final String DefaultValue = "group"; - - - public TestDetail( int id ) - { - this(); - _id = id; - } - - - public TestDetail() - { - _value = DefaultValue; - _details2 = new ArrayList(); - } - - - public void setId( int id ) - { - _id = id; - } - - - public int getId() - { - return _id; - } - - - public void setValue1( String value ) - { - _value = value; - } - - - public String getValue1() - { - return _value; - } - - - public void setMaster( TestMaster master ) - { - _master = master; - } - - - public TestMaster getMaster() - { - return _master; - } - - - public void addDetail2( TestDetail2 detail2 ) - { - _details2.add( detail2 ); - detail2.setDetail( this ); - } - - - public ArrayList getDetails2() - { - return _details2; - } - - - public void setDetail3( TestDetail3 detail3 ) - { - if ( _detail3 != null ) - _detail3.setDetail( null ); - - if ( detail3 != null ) - detail3.setDetail( this ); - _detail3 = detail3; - } - - - public TestDetail3 getDetail3() { - return _detail3; - } - - - public void setDetails2( ArrayList list ) { - _details2 = list; - } - - public TestDetail2 createDetail2() - { - return new TestDetail2(); - } - - - public TestDetail2 findDetail2( int id ) - { - Iterator enumeration; - TestDetail2 detail2; - - if ( _details2 == null ) { - return null; - } - - enumeration = _details2.iterator(); - while ( enumeration.hasNext() ) { - detail2 = (TestDetail2) enumeration.next(); - if ( detail2.getId() == id ) { - return detail2; - } - } - return null; - } - - - public String toString() - { - String details2 = ""; - - if ( _details2 != null ) { - for ( int i = 0 ; i < _details2.size() ; ++i ) { - if ( i > 0 ) - details2 = details2 + ", "; - details2 = details2 + _details2.get( i ).toString(); - } - } - return ""; - } - - - public int hashCode() { - return _id; - } - - public boolean equals( Object other ) - { - if ( other == this ) - return true; - if ( other != null && other instanceof TestDetail ) { - return ( ( (TestDetail) other )._id == _id ); - } - return false; - } - - -} Index: tests/jdo/TestDetail2.java =================================================================== RCS file: tests/jdo/TestDetail2.java diff -N tests/jdo/TestDetail2.java --- tests/jdo/TestDetail2.java 3 Mar 2003 07:10:12 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,142 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestDetail2.java,v 1.1.1.1 2003/03/03 07:10:12 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test object mapping to test_detail2 used to conduct relation tests. - */ -public class TestDetail2 -{ - - - private int _id; - - - private String _value; - - - private TestDetail _detail; - - - static final int DefaultId = 5; - - - static final String DefaultValue = "value"; - - - public TestDetail2( int id ) - { - _id = id; - _value = DefaultValue; - } - - - public TestDetail2() - { - _value = DefaultValue; - } - - - public void setId( int id ) - { - _id = id; - } - - - public int getId() - { - return _id; - } - - - public void setValue1( String value ) - { - _value = value; - } - - - public String getValue1() - { - return _value; - } - - - public void setDetail( TestDetail detail ) - { - _detail = detail; - } - - - public TestDetail getDetail() - { - return _detail; - } - - - public String toString() - { - return _id + " / " + _value + " / " + (_detail==null?0:_detail.getId()); - } - - - public int hashCode() { - return _id; - } - - public boolean equals( Object other ) - { - if ( other == this ) - return true; - if ( other != null && other instanceof TestDetail2 ) { - return ( ( (TestDetail2) other )._id == _id ); - } - return false; - } - - -} Index: tests/jdo/TestDetail3.java =================================================================== RCS file: tests/jdo/TestDetail3.java diff -N tests/jdo/TestDetail3.java --- tests/jdo/TestDetail3.java 3 Mar 2003 07:10:12 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,142 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 2001 (C) Intalio, Inc. All Rights Reserved. - * - * $Id $ - */ - - -package jdo; - - -/** - * Test object mapping to test_detail2 used to conduct relation tests. - */ -public class TestDetail3 -{ - - - private int _id; - - - private String _value; - - - private TestDetail _detail; - - - static final int DefaultId = 100; - - - static final String DefaultValue = "value"; - - - public TestDetail3( int id ) - { - _id = id; - _value = DefaultValue; - } - - - public TestDetail3() - { - _value = DefaultValue; - } - - - public void setId( int id ) - { - _id = id; - } - - - public int getId() - { - return _id; - } - - - public void setValue1( String value ) - { - _value = value; - } - - - public String getValue1() - { - return _value; - } - - - public void setDetail( TestDetail detail ) - { - _detail = detail; - } - - - public TestDetail getDetail() - { - return _detail; - } - - - public String toString() - { - return _id + " / " + _value + " / " + (_detail==null?0:_detail.getId()); - } - - - public int hashCode() { - return _id; - } - - public boolean equals( Object other ) - { - if ( other == this ) - return true; - if ( other != null && other instanceof TestDetail3 ) { - return ( ( (TestDetail3) other )._id == _id ); - } - return false; - } - - -} Index: tests/jdo/TestDetailKeyGen.java =================================================================== RCS file: tests/jdo/TestDetailKeyGen.java diff -N tests/jdo/TestDetailKeyGen.java --- tests/jdo/TestDetailKeyGen.java 5 Mar 2005 13:42:01 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,220 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 2001 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestDetailKeyGen.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ - */ - - -package jdo; - - -import java.util.ArrayList; -import java.util.Iterator; - - -/** - * Test object mapping to test_detaul used to conduct relation tests. - */ -public class TestDetailKeyGen -{ - - - private int _id; - - - private String _value; - - - private TestMasterKeyGen _master; - - - private ArrayList _details2; - - - private TestDetailKeyGen3 _detail3; - - - static final int DefaultId = 5; - - - static final String DefaultValue = "group"; - - - public TestDetailKeyGen( int id ) - { - this(); - _id = id; - } - - public TestDetailKeyGen() - { - _value = DefaultValue; - _details2 = new ArrayList(); - } - - - public void setId( int id ) - { - _id = id; - } - - - public int getId() - { - return _id; - } - - - public void setValue1( String value ) - { - _value = value; - } - - - public String getValue1() - { - return _value; - } - - - public void setMaster( TestMasterKeyGen master ) - { - _master = master; - } - - - public TestMasterKeyGen getMaster() - { - return _master; - } - - - public void addDetail2( TestDetailKeyGen2 detail2 ) - { - _details2.add( detail2 ); - detail2.setDetail( this ); - } - - - public ArrayList getDetails2() - { - return _details2; - } - - - public void setDetail3( TestDetailKeyGen3 detail3 ) - { - if ( _detail3 != null ) - _detail3.setDetail( null ); - - if ( detail3 != null ) - detail3.setDetail( this ); - _detail3 = detail3; - } - - - public TestDetailKeyGen3 getDetail3() { - return _detail3; - } - - - public void setDetails2( ArrayList list ) { - _details2 = list; - } - - public TestDetailKeyGen2 createDetail2() - { - return new TestDetailKeyGen2(); - } - - - public TestDetailKeyGen2 findDetail2( int id ) - { - Iterator enumeration; - TestDetailKeyGen2 detail2; - - if ( _details2 == null ) { - return null; - } - - enumeration = _details2.iterator(); - while ( enumeration.hasNext() ) { - detail2 = (TestDetailKeyGen2) enumeration.next(); - if ( detail2.getId() == id ) { - return detail2; - } - } - return null; - } - - - public String toString() - { - String details2 = ""; - - if ( _details2 != null ) { - for ( int i = 0 ; i < _details2.size() ; ++i ) { - if ( i > 0 ) - details2 = details2 + ", "; - details2 = details2 + _details2.get( i ).toString(); - } - } - return ""; - } - - - public int hashCode() { - return _id; - } - - public boolean equals( Object other ) - { - if ( other == this ) - return true; - if ( other != null && other instanceof TestDetailKeyGen ) { - return ( ( (TestDetailKeyGen) other )._id == _id ); - } - return false; - } - - -} Index: tests/jdo/TestDetailKeyGen2.java =================================================================== RCS file: tests/jdo/TestDetailKeyGen2.java diff -N tests/jdo/TestDetailKeyGen2.java --- tests/jdo/TestDetailKeyGen2.java 3 Mar 2003 07:10:12 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,142 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 2001 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestDetailKeyGen2.java,v 1.1.1.1 2003/03/03 07:10:12 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test object mapping to test_detail2 used to conduct relation tests. - */ -public class TestDetailKeyGen2 -{ - - - private int _id; - - - private String _value; - - - private TestDetailKeyGen _detail; - - - static final int DefaultId = 5; - - - static final String DefaultValue = "value"; - - - public TestDetailKeyGen2( int id ) - { - _id = id; - _value = DefaultValue; - } - - - public TestDetailKeyGen2() - { - _value = DefaultValue; - } - - - public void setId( int id ) - { - _id = id; - } - - - public int getId() - { - return _id; - } - - - public void setValue1( String value ) - { - _value = value; - } - - - public String getValue1() - { - return _value; - } - - - public void setDetail( TestDetailKeyGen detail ) - { - _detail = detail; - } - - - public TestDetailKeyGen getDetail() - { - return _detail; - } - - - public String toString() - { - return _id + " / " + _value + " / " + (_detail==null?0:_detail.getId()); - } - - - public int hashCode() { - return _id; - } - - public boolean equals( Object other ) - { - if ( other == this ) - return true; - if ( other != null && other instanceof TestDetailKeyGen2 ) { - return ( ( (TestDetailKeyGen2) other )._id == _id ); - } - return false; - } - - -} Index: tests/jdo/TestDetailKeyGen3.java =================================================================== RCS file: tests/jdo/TestDetailKeyGen3.java diff -N tests/jdo/TestDetailKeyGen3.java --- tests/jdo/TestDetailKeyGen3.java 3 Mar 2003 07:10:12 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,142 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 2001 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestDetailKeyGen3.java,v 1.1.1.1 2003/03/03 07:10:12 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test object mapping to test_detail2 used to conduct relation tests. - */ -public class TestDetailKeyGen3 -{ - - - private int _id; - - - private String _value; - - - private TestDetailKeyGen _detail; - - - static final int DefaultId = 5; - - - static final String DefaultValue = "value"; - - - public TestDetailKeyGen3( int id ) - { - _id = id; - _value = DefaultValue; - } - - - public TestDetailKeyGen3() - { - _value = DefaultValue; - } - - - public void setId( int id ) - { - _id = id; - } - - - public int getId() - { - return _id; - } - - - public void setValue1( String value ) - { - _value = value; - } - - - public String getValue1() - { - return _value; - } - - - public void setDetail( TestDetailKeyGen detail ) - { - _detail = detail; - } - - - public TestDetailKeyGen getDetail() - { - return _detail; - } - - - public String toString() - { - return _id + " / " + _value + " / " + (_detail==null?0:_detail.getId()); - } - - - public int hashCode() { - return _id; - } - - public boolean equals( Object other ) - { - if ( other == this ) - return true; - if ( other != null && other instanceof TestDetailKeyGen2 ) { - return ( ( (TestDetailKeyGen3) other )._id == _id ); - } - return false; - } - - -} Index: tests/jdo/TestHighLowExtends.java =================================================================== RCS file: tests/jdo/TestHighLowExtends.java diff -N tests/jdo/TestHighLowExtends.java --- tests/jdo/TestHighLowExtends.java 3 Mar 2003 07:10:13 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,87 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestHighLowExtends.java,v 1.1.1.1 2003/03/03 07:10:13 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test object for HIGH-LOW key generator. - */ -public class TestHighLowExtends extends TestHighLowObject -{ - - private String _ext; - - - static final String DefaultExt = "ext"; - - - public TestHighLowExtends() - { - super(); - _ext = DefaultExt; - } - - - public void setExt( String ext ) - { - _ext = ext; - } - - - public String getExt() - { - return _ext; - } - - - public String toString() - { - return super.toString() + " / " + _ext; - } - - -} Index: tests/jdo/TestHighLowExtendsSameConnection.java =================================================================== RCS file: tests/jdo/TestHighLowExtendsSameConnection.java diff -N tests/jdo/TestHighLowExtendsSameConnection.java --- tests/jdo/TestHighLowExtendsSameConnection.java 15 Sep 2004 21:22:41 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,87 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestHighLowExtendsSameConnection.java,v 1.1 2004/09/15 21:22:41 wguttmann Exp $ - */ - - -package jdo; - - -/** - * Test object for HIGH-LOW key generator. - */ -public class TestHighLowExtendsSameConnection extends TestHighLowObjectSameConnection -{ - - private String _ext; - - - static final String DefaultExt = "ext"; - - - public TestHighLowExtendsSameConnection() - { - super(); - _ext = DefaultExt; - } - - - public void setExt( String ext ) - { - _ext = ext; - } - - - public String getExt() - { - return _ext; - } - - - public String toString() - { - return super.toString() + " / " + _ext; - } - - -} Index: tests/jdo/TestHighLowObject.java =================================================================== RCS file: tests/jdo/TestHighLowObject.java diff -N tests/jdo/TestHighLowObject.java --- tests/jdo/TestHighLowObject.java 3 Mar 2003 07:10:13 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,88 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestHighLowObject.java,v 1.1.1.1 2003/03/03 07:10:13 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test object for HIGH-LOW key generator. - */ -public class TestHighLowObject extends TestKeyGenObject -{ - - - private String _attr; - - - static final String DefaultAttr = "attr"; - - - public TestHighLowObject() - { - _attr = DefaultAttr; - } - - - public void setAttr( String attr ) - { - _attr = attr; - } - - - public String getAttr() - { - return _attr; - } - - - public String toString() - { - return super.toString() + " / " + _attr; - } - - -} - Index: tests/jdo/TestHighLowObjectSameConnection.java =================================================================== RCS file: tests/jdo/TestHighLowObjectSameConnection.java diff -N tests/jdo/TestHighLowObjectSameConnection.java --- tests/jdo/TestHighLowObjectSameConnection.java 15 Sep 2004 21:22:54 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,88 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestHighLowObjectSameConnection.java,v 1.1 2004/09/15 21:22:54 wguttmann Exp $ - */ - - -package jdo; - - -/** - * Test object for HIGH-LOW key generator. - */ -public class TestHighLowObjectSameConnection extends TestKeyGenObject -{ - - - private String _attr; - - - static final String DefaultAttr = "attr"; - - - public TestHighLowObjectSameConnection() - { - _attr = DefaultAttr; - } - - - public void setAttr( String attr ) - { - _attr = attr; - } - - - public String getAttr() - { - return _attr; - } - - - public String toString() - { - return super.toString() + " / " + _attr; - } - - -} - Index: tests/jdo/TestIdentityExtends.java =================================================================== RCS file: tests/jdo/TestIdentityExtends.java diff -N tests/jdo/TestIdentityExtends.java --- tests/jdo/TestIdentityExtends.java 3 Mar 2003 07:10:13 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,87 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestIdentityExtends.java,v 1.1.1.1 2003/03/03 07:10:13 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test "extends" relation for IDENTITY key generator. - */ -public class TestIdentityExtends extends TestIdentityObject -{ - - private String _ext; - - - static final String DefaultExt = "ext"; - - - public TestIdentityExtends() - { - super(); - _ext = DefaultExt; - } - - - public void setExt( String ext ) - { - _ext = ext; - } - - - public String getExt() - { - return _ext; - } - - - public String toString() - { - return super.toString() + " / " + _ext; - } - - -} Index: tests/jdo/TestIdentityObject.java =================================================================== RCS file: tests/jdo/TestIdentityObject.java diff -N tests/jdo/TestIdentityObject.java --- tests/jdo/TestIdentityObject.java 3 Mar 2003 07:10:13 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,87 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestIdentityObject.java,v 1.1.1.1 2003/03/03 07:10:13 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test object for IDENTITY key generator. - */ -public class TestIdentityObject extends TestKeyGenObject -{ - - - private String _attr; - - - static final String DefaultAttr = "attr"; - - - public TestIdentityObject() - { - _attr = DefaultAttr; - } - - - public void setAttr( String attr ) - { - _attr = attr; - } - - - public String getAttr() - { - return _attr; - } - - - public String toString() - { - return super.toString() + " / " + _attr; - } - - -} Index: tests/jdo/TestKeyGenObject.java =================================================================== RCS file: tests/jdo/TestKeyGenObject.java diff -N tests/jdo/TestKeyGenObject.java --- tests/jdo/TestKeyGenObject.java 3 Mar 2003 07:10:13 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,78 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestKeyGenObject.java,v 1.1.1.1 2003/03/03 07:10:13 kvisco Exp $ - */ - - -package jdo; - - -/** - * The base class of all test object for key generators. - */ -public abstract class TestKeyGenObject -{ - - - private Integer _id; - - - public void setId( Integer id ) - { - _id = id; - } - - - public Integer getId() - { - return _id; - } - - - public String toString() - { - return ( _id == null ? "null" : _id.toString() ); - } - - -} Index: tests/jdo/TestMaster.java =================================================================== RCS file: tests/jdo/TestMaster.java diff -N tests/jdo/TestMaster.java --- tests/jdo/TestMaster.java 5 Mar 2005 13:42:01 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,198 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestMaster.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ - */ - - -package jdo; - - -import java.util.ArrayList; -import java.util.Iterator; -import org.exolab.castor.jdo.TimeStampable; - - -/** - * Test object mapping to test_master used to conduct relation tests. - */ -public class TestMaster implements TimeStampable -{ - - - private int _id; - - - private String _value; - - - private TestGroup _group; - - - private ArrayList _details; - - - private long _timeStamp; - - - static final int DefaultId = 3; - - - static final String DefaultValue = "master"; - - - public TestMaster() - { - _id = DefaultId; - _value = DefaultValue; - _group = null; - _details = new ArrayList(); - } - - - public void setId( int id ) - { - _id = id; - } - - - public int getId() - { - return _id; - } - - - public void setValue1( String value ) - { - _value = value; - } - - - public String getValue1() - { - return _value; - } - - - public void setGroup( TestGroup group ) - { - _group = group; - } - - - public TestGroup getGroup() - { - return _group; - } - - - public TestGroup createGroup() - { - return new TestGroup(); - } - - - public void addDetail( TestDetail detail ) - { - _details.add( detail ); - detail.setMaster( this ); - } - - - public ArrayList getDetails() - { - return _details; - } - - - public void setDetails( ArrayList array ) { - _details = array; - } - - public TestDetail findDetail(int id) - { - Iterator enumeration; - TestDetail detail; - - enumeration = _details.iterator(); - while ( enumeration.hasNext() ) { - detail = (TestDetail) enumeration.next(); - if ( detail.getId() == id ) { - return detail; - } - } - return null; - } - - - public TestDetail createDetail() - { - return new TestDetail(); - } - - - public String toString() - { - String details = ""; - - for ( int i = 0 ; i < _details.size() ; ++i ) { - if ( i > 0 ) - details = details + ", "; - details = details + _details.get( i ).toString(); - } - return _id + " / " + _value + " (" + _group + ") { " + details + " }"; - } - - - public void jdoSetTimeStamp( long timeStamp ) - { - _timeStamp = timeStamp; - } - - - public long jdoGetTimeStamp() - { - return _timeStamp; - } - - -} Index: tests/jdo/TestMasterKeyGen.java =================================================================== RCS file: tests/jdo/TestMasterKeyGen.java diff -N tests/jdo/TestMasterKeyGen.java --- tests/jdo/TestMasterKeyGen.java 5 Mar 2005 13:42:01 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,198 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 2001 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestMasterKeyGen.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ - */ - - -package jdo; - - -import java.util.ArrayList; -import java.util.Iterator; -import org.exolab.castor.jdo.TimeStampable; - - -/** - * Test object mapping to test_master used to conduct relation tests. - */ -public class TestMasterKeyGen implements TimeStampable -{ - - - private int _id; - - - private String _value; - - - private TestGroup _group; - - - private ArrayList _details; - - - private long _timeStamp; - - - static final int DefaultId = 3; - - - static final String DefaultValue = "master"; - - - public TestMasterKeyGen() - { - _id = DefaultId; - _value = DefaultValue; - _group = null; - _details = new ArrayList(); - } - - - public void setId( int id ) - { - _id = id; - } - - - public int getId() - { - return _id; - } - - - public void setValue1( String value ) - { - _value = value; - } - - - public String getValue1() - { - return _value; - } - - - public void setGroup( TestGroup group ) - { - _group = group; - } - - - public TestGroup getGroup() - { - return _group; - } - - - public TestGroup createGroup() - { - return new TestGroup(); - } - - - public void addDetail( TestDetailKeyGen detail ) - { - _details.add( detail ); - detail.setMaster( this ); - } - - - public ArrayList getDetails() - { - return _details; - } - - - public void setDetails( ArrayList array ) { - _details = array; - } - - public TestDetailKeyGen findDetail(int id) - { - Iterator enumeration; - TestDetailKeyGen detail; - - enumeration = _details.iterator(); - while ( enumeration.hasNext() ) { - detail = (TestDetailKeyGen) enumeration.next(); - if ( detail.getId() == id ) { - return detail; - } - } - return null; - } - - - public TestDetailKeyGen createDetail() - { - return new TestDetailKeyGen(); - } - - - public String toString() - { - String details = ""; - - for ( int i = 0 ; i < _details.size() ; ++i ) { - if ( i > 0 ) - details = details + ", "; - details = details + _details.get( i ).toString(); - } - return _id + " / " + _value + " (" + _group + ") { " + details + " }"; - } - - - public void jdoSetTimeStamp( long timeStamp ) - { - _timeStamp = timeStamp; - } - - - public long jdoGetTimeStamp() - { - return _timeStamp; - } - - -} Index: tests/jdo/TestMaxExtends.java =================================================================== RCS file: tests/jdo/TestMaxExtends.java diff -N tests/jdo/TestMaxExtends.java --- tests/jdo/TestMaxExtends.java 3 Mar 2003 07:10:13 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,87 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestMaxExtends.java,v 1.1.1.1 2003/03/03 07:10:13 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test "extends" relation for MAX key generator. - */ -public class TestMaxExtends extends TestMaxObject -{ - - private String _ext; - - - static final String DefaultExt = "ext"; - - - public TestMaxExtends() - { - super(); - _ext = DefaultExt; - } - - - public void setExt( String ext ) - { - _ext = ext; - } - - - public String getExt() - { - return _ext; - } - - - public String toString() - { - return super.toString() + " / " + _ext; - } - - -} Index: tests/jdo/TestMaxObject.java =================================================================== RCS file: tests/jdo/TestMaxObject.java diff -N tests/jdo/TestMaxObject.java --- tests/jdo/TestMaxObject.java 3 Mar 2003 07:10:14 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,87 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestMaxObject.java,v 1.1.1.1 2003/03/03 07:10:14 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test object for MAX key generator. - */ -public class TestMaxObject extends TestKeyGenObject -{ - - - private String _attr; - - - static final String DefaultAttr = "attr"; - - - public TestMaxObject() - { - _attr = DefaultAttr; - } - - - public void setAttr( String attr ) - { - _attr = attr; - } - - - public String getAttr() - { - return _attr; - } - - - public String toString() - { - return super.toString() + " / " + _attr; - } - - -} Index: tests/jdo/TestReturningExtends.java =================================================================== RCS file: tests/jdo/TestReturningExtends.java diff -N tests/jdo/TestReturningExtends.java --- tests/jdo/TestReturningExtends.java 3 Mar 2003 07:10:15 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,87 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestReturningExtends.java,v 1.1.1.1 2003/03/03 07:10:15 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test "extends" relation for RETURNING key generator. - */ -public class TestReturningExtends extends TestReturningObject -{ - - private String _ext; - - - static final String DefaultExt = "ext"; - - - public TestReturningExtends() - { - super(); - _ext = DefaultExt; - } - - - public void setExt( String ext ) - { - _ext = ext; - } - - - public String getExt() - { - return _ext; - } - - - public String toString() - { - return super.toString() + " / " + _ext; - } - - -} Index: tests/jdo/TestReturningObject.java =================================================================== RCS file: tests/jdo/TestReturningObject.java diff -N tests/jdo/TestReturningObject.java --- tests/jdo/TestReturningObject.java 3 Mar 2003 07:10:15 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,87 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestReturningObject.java,v 1.1.1.1 2003/03/03 07:10:15 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test object for RETURNING key generator. - */ -public class TestReturningObject extends TestKeyGenObject -{ - - - private String _attr; - - - static final String DefaultAttr = "attr"; - - - public TestReturningObject() - { - _attr = DefaultAttr; - } - - - public void setAttr( String attr ) - { - _attr = attr; - } - - - public String getAttr() - { - return _attr; - } - - - public String toString() - { - return super.toString() + " / " + _attr; - } - - -} Index: tests/jdo/TestSequenceExtends.java =================================================================== RCS file: tests/jdo/TestSequenceExtends.java diff -N tests/jdo/TestSequenceExtends.java --- tests/jdo/TestSequenceExtends.java 3 Mar 2003 07:10:15 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,87 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestSequenceExtends.java,v 1.1.1.1 2003/03/03 07:10:15 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test "extends" relation for SEQUENCE key generator. - */ -public class TestSequenceExtends extends TestSequenceObject -{ - - private String _ext; - - - static final String DefaultExt = "ext"; - - - public TestSequenceExtends() - { - super(); - _ext = DefaultExt; - } - - - public void setExt( String ext ) - { - _ext = ext; - } - - - public String getExt() - { - return _ext; - } - - - public String toString() - { - return super.toString() + " / " + _ext; - } - - -} Index: tests/jdo/TestSequenceObject.java =================================================================== RCS file: tests/jdo/TestSequenceObject.java diff -N tests/jdo/TestSequenceObject.java --- tests/jdo/TestSequenceObject.java 3 Mar 2003 07:10:15 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,87 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestSequenceObject.java,v 1.1.1.1 2003/03/03 07:10:15 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test object for SEQUENCE key generator. - */ -public class TestSequenceObject extends TestKeyGenObject -{ - - - private String _attr; - - - static final String DefaultAttr = "attr"; - - - public TestSequenceObject() - { - _attr = DefaultAttr; - } - - - public void setAttr( String attr ) - { - _attr = attr; - } - - - public String getAttr() - { - return _attr; - } - - - public String toString() - { - return super.toString() + " / " + _attr; - } - - -} Index: tests/jdo/TestUuidExtends.java =================================================================== RCS file: tests/jdo/TestUuidExtends.java diff -N tests/jdo/TestUuidExtends.java --- tests/jdo/TestUuidExtends.java 3 Mar 2003 07:10:16 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,87 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestUuidExtends.java,v 1.1.1.1 2003/03/03 07:10:16 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test "extends" relation for UUID key generator. - */ -public class TestUuidExtends extends TestUuidObject -{ - - private String _ext; - - - static final String DefaultExt = "ext"; - - - public TestUuidExtends() - { - super(); - _ext = DefaultExt; - } - - - public void setExt( String ext ) - { - _ext = ext; - } - - - public String getExt() - { - return _ext; - } - - - public String toString() - { - return super.toString() + " / " + _ext; - } - - -} Index: tests/jdo/TestUuidObject.java =================================================================== RCS file: tests/jdo/TestUuidObject.java diff -N tests/jdo/TestUuidObject.java --- tests/jdo/TestUuidObject.java 3 Mar 2003 07:10:16 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,102 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. - * - * $Id: TestUuidObject.java,v 1.1.1.1 2003/03/03 07:10:16 kvisco Exp $ - */ - - -package jdo; - - -/** - * Test object for UUID key generator. - */ -public class TestUuidObject -{ - - - private String _id; - - - private String _attr; - - - static final String DefaultAttr = "attr"; - - - public TestUuidObject() - { - _attr = DefaultAttr; - } - - - public void setId( String id ) - { - _id = id; - } - - - public String getId() - { - return _id; - } - - - public void setAttr( String attr ) - { - _attr = attr; - } - - - public String getAttr() - { - return _attr; - } - - - public String toString() - { - return ( _id == null ? "null" : _id.toString() ) + " / " + _attr; - } - - -} Index: tests/jdo/hsql.sql =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/hsql.sql,v retrieving revision 1.4 diff -u -r1.4 hsql.sql --- tests/jdo/hsql.sql 16 Jun 2005 12:13:46 -0000 1.4 +++ tests/jdo/hsql.sql 1 Jul 2005 23:42:42 -0000 @@ -229,6 +229,142 @@ create unique index tc1x_pks_category_pk on tc1x_pks_category( id ); +-- tc2x TESTS + +drop table if exists test_master; + +create table tc2x_master ( + id numeric(10,0) not null, + value1 varchar(200) not null, + group_id numeric(10,0) null +); + +create unique index tc2x_master_pk on tc2x_master ( id ); + +drop table if exists tc2x_detail; + +create table tc2x_detail ( + detail_id numeric(10,0) not null, + master_id numeric(10,0) not null, + value1 varchar(200) not null +); + +create unique index tc2x_detail_pk on tc2x_detail ( detail_id ); + +drop table if exists tc2x_detail2; + +create table tc2x_detail2 ( + detail2_id numeric(10,0) not null, + detail_id numeric(10,0) not null, + value1 varchar(200 ) not null +); + +create unique index tc2x_detail2_pk on tc2x_detail2 ( detail2_id ); + +drop table if exists tc2x_detail3; + +create table tc2x_detail3 +( + detail3_id numeric(10,0) not null, + detail_id numeric(10,0) not null, + value1 varchar(200 ) not null +); + +create unique index tc2x_detail3_pk on tc2x_detail3 ( detail3_id ); + +drop table if exists tc2x_group; + +create table tc2x_group ( + id numeric(10,0) not null, + value1 varchar(200) not null +); + +create unique index tc2x_group_pk on tc2x_group ( id ); + +drop table if exists tc2x_depend2; +drop table if exists tc2x_depend_master; +drop table if exists tc2x_depend1; + +create table tc2x_depend1 ( + id int not null primary key +); + +create table tc2x_depend_master ( + id int not null primary key, + depend1_id int, + foreign key ( depend1_id ) references tc2x_depend1 ( id ) +); + +create table tc2x_depend2 ( + id int not null primary key, + master_id int, + foreign key ( master_id ) references tc2x_depend_master ( id ) +); + +drop table if exists tc2x_keygen; + +create table tc2x_keygen ( + id int not null, + attr varchar(200) not null +); + +create unique index tc2x_keygen_pk on tc2x_keygen ( id ); + +drop table if exists tc2x_keygen_ext; + +create table tc2x_keygen_ext ( + id int not null, + ext varchar(200) not null +); + +create unique index tc2x_keygen_ext_pk on tc2x_keygen_ext ( id ); + +drop table if exists tc2x_uuid; + +create table tc2x_uuid ( + id char(30) not null, + attr varchar(200) not null +); + +create unique index tc2x_uuid_pk on tc2x_uuid ( id ); + +drop table if exists tc2x_uuid_ext; + +create table tc2x_uuid_ext ( + id char(30) not null, + ext varchar(200) not null +); + +create unique index tc2x_uuid_ext_pk on tc2x_uuid_ext ( id ); + +drop table if exists tc2x_identity; + +create table tc2x_identity ( + id identity, + attr varchar(200) not null +); + +drop table if exists tc2x_identity_ext; + +create table tc2x_identity_ext ( + id integer not null, + ext varchar(200) not null +); + +create unique index tc2x_ident_ext_pk on tc2x_identity_ext ( id ); + +drop table if exists tc2x_seqtable; + +create table tc2x_seqtable ( + table_name varchar(200) not null, + max_id int +); + +create unique index tc2x_seqtable_pk on tc2x_seqtable ( table_name ); + + + + @@ -426,52 +562,6 @@ create unique index test_table_extends_pk on test_table_extends ( id ); -drop table if exists test_master; - -create table test_master ( - id numeric(10,0) not null, - value1 varchar(200) not null, - group_id numeric(10,0) null -); - -create unique index test_master_pk - on test_master ( id ); - - -drop table if exists test_detail; - -create table test_detail ( - detail_id numeric(10,0) not null, - master_id numeric(10,0) not null, - value1 varchar(200) not null -); - -create unique index test_detail_pk - on test_detail ( detail_id ); - - -drop table if exists test_detail2; - -create table test_detail2 ( - detail2_id numeric(10,0) not null, - detail_id numeric(10,0) not null, - value1 varchar(200 ) not null -); - -create unique index test_detail2_pk on test_detail2 ( detail2_id ); - -drop table if exists test_detail3; - -create table test_detail3 -( - detail3_id numeric(10,0) not null, - detail_id numeric(10,0) not null, - value1 varchar(200 ) not null -); - -create unique index test_detail3_pk on test_detail3 ( detail3_id ); - - drop table if exists test_group; create table test_group ( @@ -502,58 +592,6 @@ ); */ -drop table if exists test_keygen; - -create table test_keygen ( - id int not null, - attr varchar(200) not null -); - -create unique index test_keygen_pk - on test_keygen ( id ); - - -drop table if exists test_keygen_ext; - -create table test_keygen_ext ( - id int not null, - ext varchar(200) not null -); - -create unique index test_keygen_ext_pk on test_keygen_ext ( id ); - - -drop table if exists test_uuid; - -create table test_uuid ( - id char(30) not null, - attr varchar(200) not null -); - -create unique index test_uuid_pk - on test_uuid ( id ); - - -drop table if exists test_uuid_ext; - -create table test_uuid_ext ( - id char(30) not null, - ext varchar(200) not null -); - -create unique index test_uuid_ext_pk on test_uuid_ext ( id ); - - -drop table if exists test_seqtable; - -create table test_seqtable ( - table_name varchar(200) not null, - max_id int -); - -create unique index test_seqtable_pk - on test_seqtable ( table_name ); - drop table if exists test_persistent; @@ -577,26 +615,6 @@ ); create unique index test_related_pk on test_related ( id ); - - -/* -drop table if exists test_identity; - -create table test_identity ( - id integer not null primary key auto_increment, - attr varchar(200) not null -); -*/ - - -drop table if exists test_identity_ext; - -create table test_identity_ext ( - id integer not null, - ext varchar(200) not null -); - -create unique index test_ident_ext_pk on test_identity_ext ( id ); drop table if exists test_col; Index: tests/jdo/mapping.xml =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/mapping.xml,v retrieving revision 1.15 diff -u -r1.15 mapping.xml --- tests/jdo/mapping.xml 16 Jun 2005 12:13:46 -0000 1.15 +++ tests/jdo/mapping.xml 1 Jul 2005 23:42:43 -0000 @@ -3,6 +3,7 @@ + @@ -239,136 +240,6 @@ - - Test master table - - - - - - - - - - - - - - - - - Test detail table - - - - - - - - - - - - - - - - - - - - Test detail2 table - - - - - - - - - - - - - - Test detail3 table - - - - - - - - - - - - - - Test master table - - - - - - - - - - - - - - - - - Test detail table - - - - - - - - - - - - - - - - - - - - Test detail2 table - - - - - - - - - - - - - - Test detail3 table - - - - - - - - - - - - Test groups table @@ -380,144 +251,6 @@ - - - Table used for MAX key generator testing - - - - - - - - - - - Table used for MAX key generator testing - - - - - - - - Table used for HIGH-LOW key generator testing - - - - - - - - - - - Table used for HIGH-LOW key generator testing - - - - - - - - Table used for HIGH-LOW key generator testing with same-connection=true - - - - - - - - - - - Table used for HIGH-LOW key generator testing with same-connection=true - - - - - - - - Table used for SEQUENCE key generator testing - - - - - - - - - - - Table used for SEQUENCE key generator testing - - - - - - - - Table used for IDENTITY key generator testing - - - - - - - - - - - Table used for IDENTITY key generator testing - - - - - - - - Table used for SEQUENCE key generator testing in RETURNING - mode for Oracle8i - - - - - - - - - - - - Table used for SEQUENCE key generator testing in RETURNING - mode for Oracle8i - - - - - - - - - Table used for UUID key generator testing - - - - - - - - - - - Table used for UUID key generator testing - - - - - - Test Persistent interface handling @@ -822,22 +555,4 @@ - - - - - - - - - - - - - - - - - - Index: tests/jdo/mssql.sql =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/mssql.sql,v retrieving revision 1.7 diff -u -r1.7 mssql.sql --- tests/jdo/mssql.sql 16 Jun 2005 12:13:46 -0000 1.7 +++ tests/jdo/mssql.sql 1 Jul 2005 23:42:44 -0000 @@ -283,6 +283,188 @@ go +-- tc2x TESTS + +drop table tc2x_master +go +create table tc2x_master ( + id numeric(10,0) not null, + value1 varchar(200) not null, + group_id numeric(10,0) null +) +go +create unique index tc2x_master_pk on tc2x_master ( id ) +go +grant all on tc2x_master to test +go + +drop table tc2x_detail +go +create table tc2x_detail ( + detail_id numeric(10,0) not null, + master_id numeric(10,0) not null, + value1 varchar(200 ) not null +) +go +create unique index tc2x_detail_pk on tc2x_detail ( detail_id ) +go +grant all on tc2x_detail to test +go + +drop table tc2x_detail2 +go +create table tc2x_detail2 ( + detail2_id numeric(10,0) not null, + detail_id numeric(10,0) not null, + value1 varchar(200 ) not null +) +go +create unique index tc2x_detail2_pk on tc2x_detail2 ( detail2_id ) +go +grant all on tc2x_detail2 to test +go + +drop table tc2x_detail3 +go +create table tc2x_detail3 ( + detail3_id numeric(10,0) not null, + detail_id numeric(10,0) not null, + value1 varchar(200 ) not null +) +go +create unique index tc2x_detail3_pk on tc2x_detail3 ( detail3_id ) +go +grant all on tc2x_detail3 to test +go + +drop table tc2x_group +go +create table tc2x_group ( + id numeric(10,0) not null, + value1 varchar(200) not null +) +go +create unique index tc2x_group_pk on tc2x_group ( id ) +go +grant all on tc2x_group to test +go + +drop table tc2x_depend2 +go +drop table tc2x_depend_master +go +drop table tc2x_depend1 +go +create table tc2x_depend1 ( + id int not null primary key +) +go +grant all on tc2x_depend1 to test +go +create table tc2x_depend_master ( + id int not null primary key, + depend1_id int, + index tc2x_master_depend1 ( depend1_id ), + foreign key ( depend1_id ) references tc2x_depend1 ( id ) +) +go +grant all on tc2x_depend_master to test +go +create table tc2x_depend2 ( + id int not null primary key, + master_id int, + index tc2x_depend2_master ( master_id ), + foreign key ( master_id ) references tc2x_depend_master ( id ) +) +go +grant all on tc2x_depend2 to test +go + +drop table tc2x_keygen +go +create table tc2x_keygen ( + id int not null, + attr varchar(200) not null +) +go +create unique index tc2x_keygen_pk on tc2x_keygen ( id ) +go +grant all on tc2x_keygen to test +go + +drop table tc2x_keygen_ext +go +create table tc2x_keygen_ext ( + id int not null, + ext varchar(200) not null +) +go +create unique index tc2x_keygen_ext_pk on tc2x_keygen_ext ( id ) +go +grant all on tc2x_keygen_ext to test +go + +drop table tc2x_uuid +go +create table tc2x_uuid ( + id char(30) not null, + attr varchar(200) not null +) +go +create unique index tc2x_uuid_pk on tc2x_uuid ( id ) +go +grant all on tc2x_uuid to test +go + +drop table tc2x_uuid_ext +go +create table tc2x_uuid_ext ( + id char(30) not null, + ext varchar(200) not null +) +go +create unique index tc2x_uuid_ext_pk on tc2x_uuid_ext ( id ) +go +grant all on tc2x_uuid_ext to test +go + +drop table tc2x_identity +go +create table tc2x_identity ( + id numeric(10,0) identity, + attr varchar(200) not null +) +go +grant all on tc2x_identity to test +go + +drop table tc2x_identity_ext +go +create table tc2x_identity_ext ( + id numeric(10,0) not null, + ext varchar(200) not null +) +go +create unique index tc2x_ident_ext_pk on tc2x_identity_ext ( id ) +go +grant all on tc2x_identity_ext to test +go + +drop table tc2x_seqtable +go +create table tc2x_seqtable ( + table_name varchar(200) not null, + max_id int null +) +go +create unique index tc2x_seqtable_pk on tc2x_seqtable ( table_name ) +go +grant all on tc2x_seqtable to test +go + + + + @@ -561,64 +743,6 @@ grant all on test_table_ex to test go --- test_master -drop table test_master -go -create table test_master ( - id numeric(10,0) not null, - value1 varchar(200) not null, - group_id numeric(10,0) null -) -go -create unique index test_master_pk on test_master ( id ) -go -grant all on test_master to test -go - --- test_detail -drop table test_detail -go -create table test_detail ( - detail_id numeric(10,0) not null, - master_id numeric(10,0) not null, - value1 varchar(200 ) not null -) -go -create unique index test_detail_pk on test_detail ( detail_id ) -go -grant all on test_detail to test -go - --- test_detail2 -drop table test_detail2 -go -create table test_detail2 -( - detail2_id numeric(10,0) not null, - detail_id numeric(10,0) not null, - value1 varchar(200 ) not null -) -go -create unique index test_detail2_pk on test_detail2 ( detail2_id ) -go -grant all on test_detail2 to test -go - --- test_detail3 -drop table test_detail3 -go -create table test_detail3 -( - detail3_id numeric(10,0) not null, - detail_id numeric(10,0) not null, - value1 varchar(200 ) not null -) -go -create unique index test_detail3_pk on test_detail3 ( detail3_id ) -go -grant all on test_detail3 to test -go - -- test_group drop table test_group go @@ -632,69 +756,6 @@ grant all on test_group to test go --- test_keygen -drop table test_keygen -go -create table test_keygen ( - id int not null, - attr varchar(200) not null -) -go -create unique index test_keygen_pk on test_keygen ( id ) -go -grant all on test_keygen to test -go - --- test_keygen_ext -drop table test_keygen_ext -go -create table test_keygen_ext ( - id int not null, - ext varchar(200) not null -) -go -create unique index test_keygen_ext_pk on test_keygen_ext ( id ) -go -grant all on test_keygen_ext to test -go - -drop table test_uuid -go -create table test_uuid ( - id char(30) not null, - attr varchar(200) not null -) -go -create unique index test_uuid_pk on test_uuid ( id ) -go -grant all on test_uuid to test -go - -drop table test_uuid_ext -go -create table test_uuid_ext ( - id char(30) not null, - ext varchar(200) not null -) -go -create unique index test_uuid_ext_pk on test_uuid_ext ( id ) -go -grant all on test_uuid_ext to test -go - --- test_seqtable -drop table test_seqtable -go -create table test_seqtable ( - table_name varchar(200) not null, - max_id int null -) -go -create unique index test_seqtable_pk on test_seqtable ( table_name ) -go -grant all on test_seqtable to test -go - drop table test_persistent go create table test_persistent ( @@ -723,29 +784,6 @@ grant all on test_related to test go - --- test the identity key generator -drop table test_identity -go -create table test_identity ( - id numeric(10,0) identity, - attr varchar(200) not null -) -go -grant all on test_identity to test -go - -drop table test_identity_ext -go -create table test_identity_ext ( - id numeric(10,0) not null, - ext varchar(200) not null -) -go -create unique index test_ident_ext_pk on test_identity_ext ( id ) -go -grant all on test_identity_ext to test -go -- The test stored procedure on TransactSQL drop procedure proc_check_permissions Index: tests/jdo/mysql.sql =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/mysql.sql,v retrieving revision 1.12 diff -u -r1.12 mysql.sql --- tests/jdo/mysql.sql 16 Jun 2005 12:13:46 -0000 1.12 +++ tests/jdo/mysql.sql 1 Jul 2005 23:42:45 -0000 @@ -232,6 +232,145 @@ create unique index tc1x_pks_category_pk on tc1x_pks_category( id ); +-- tc2x TESTS + +drop table if exists tc2x_master; + +create table tc2x_master ( + id numeric(10,0) not null, + value1 varchar(200) not null, + group_id numeric(10,0) null +); + +create unique index tc2x_master_pk on tc2x_master ( id ); + +drop table if exists tc2x_detail; + +create table tc2x_detail ( + detail_id numeric(10,0) not null, + master_id numeric(10,0) not null, + value1 varchar(200) not null +); + +create unique index tc2x_detail_pk on tc2x_detail ( detail_id ); + +drop table if exists tc2x_detail2; + +create table tc2x_detail2 ( + detail2_id numeric(10,0) not null, + detail_id numeric(10,0) not null, + value1 varchar(200 ) not null +); + +create unique index tc2x_detail2_pk on tc2x_detail2 ( detail2_id ); + +drop table if exists tc2x_detail3; + +create table tc2x_detail3 ( + detail3_id numeric(10,0) not null, + detail_id numeric(10,0) not null, + value1 varchar(200 ) not null +); + +create unique index tc2x_detail3_pk on tc2x_detail3 ( detail3_id ); + +drop table if exists tc2x_group; + +create table tc2x_group ( + id numeric(10,0) not null, + value1 varchar(200) not null +); + +create unique index tc2x_group_pk on tc2x_group ( id ); + +drop table if exists tc2x_depend2; +drop table if exists tc2x_depend_master; +drop table if exists tc2x_depend1; + +create table tc2x_depend1 ( + id int not null primary key +); + +create table tc2x_depend_master ( + id int not null primary key, + depend1_id int, + index tc2x_master_depend1 ( depend1_id ), + foreign key ( depend1_id ) references tc2x_depend1 ( id ) +); + +create table tc2x_depend2 ( + id int not null primary key, + master_id int, + index tc2x_depend2_master ( master_id ), + foreign key ( master_id ) references tc2x_depend_master ( id ) +); + +drop table if exists tc2x_keygen; + +create table tc2x_keygen ( + id int not null, + attr varchar(200) not null +); + +create unique index tc2x_keygen_pk on tc2x_keygen ( id ); + +drop table if exists tc2x_keygen_ext; + +create table tc2x_keygen_ext ( + id int not null, + ext varchar(200) not null +); + +create unique index tc2x_keygen_ext_pk on tc2x_keygen_ext ( id ); + +drop table if exists tc2x_uuid; + +create table tc2x_uuid ( + id char(30) not null, + attr varchar(200) not null +); + +create unique index tc2x_uuid_pk on tc2x_uuid ( id ); + +drop table if exists tc2x_uuid_ext; + +create table tc2x_uuid_ext ( + id char(30) not null, + ext varchar(200) not null +); + +create unique index tc2x_uuid_ext_pk on tc2x_uuid_ext ( id ); + +drop table if exists tc2x_identity; + +create table tc2x_identity ( + id integer not null primary key auto_increment, + attr varchar(200) not null +); + +drop table if exists tc2x_identity_ext; + +create table tc2x_identity_ext ( + id integer not null, + ext varchar(200) not null +); + +create unique index tc2x_ident_ext_pk on tc2x_identity_ext ( id ); + +drop table if exists tc2x_seqtable; + +create table tc2x_seqtable ( + table_name varchar(200) not null, + max_id int +); + +create unique index tc2x_seqtable_pk on tc2x_seqtable ( table_name ); + + + + + + @@ -406,52 +545,6 @@ create unique index test_table_extends_pk on test_table_extends ( id ); -drop table if exists test_master; - -create table test_master ( - id numeric(10,0) not null, - value1 varchar(200) not null, - group_id numeric(10,0) null -); - -create unique index test_master_pk - on test_master ( id ); - - -drop table if exists test_detail; - -create table test_detail ( - detail_id numeric(10,0) not null, - master_id numeric(10,0) not null, - value1 varchar(200) not null -); - -create unique index test_detail_pk - on test_detail ( detail_id ); - - -drop table if exists test_detail2; - -create table test_detail2 ( - detail2_id numeric(10,0) not null, - detail_id numeric(10,0) not null, - value1 varchar(200 ) not null -); - -create unique index test_detail2_pk on test_detail2 ( detail2_id ); - -drop table if exists test_detail3; - -create table test_detail3 -( - detail3_id numeric(10,0) not null, - detail_id numeric(10,0) not null, - value1 varchar(200 ) not null -); - -create unique index test_detail3_pk on test_detail3 ( detail3_id ); - - drop table if exists test_group; create table test_group ( @@ -481,59 +574,6 @@ o_bfile MEDIUMBLOB null ); -drop table if exists test_keygen; - -create table test_keygen ( - id int not null, - attr varchar(200) not null -); - -create unique index test_keygen_pk - on test_keygen ( id ); - - -drop table if exists test_keygen_ext; - -create table test_keygen_ext ( - id int not null, - ext varchar(200) not null -); - -create unique index test_keygen_ext_pk on test_keygen_ext ( id ); - - -drop table if exists test_uuid; - -create table test_uuid ( - id char(30) not null, - attr varchar(200) not null -); - -create unique index test_uuid_pk - on test_uuid ( id ); - - -drop table if exists test_uuid_ext; - -create table test_uuid_ext ( - id char(30) not null, - ext varchar(200) not null -); - -create unique index test_uuid_ext_pk on test_uuid_ext ( id ); - - -drop table if exists test_seqtable; - -create table test_seqtable ( - table_name varchar(200) not null, - max_id int -); - -create unique index test_seqtable_pk - on test_seqtable ( table_name ); - - drop table if exists test_persistent; create table test_persistent ( @@ -556,24 +596,6 @@ ); create unique index test_related_pk on test_related ( id ); - - -drop table if exists test_identity; - -create table test_identity ( - id integer not null primary key auto_increment, - attr varchar(200) not null -); - - -drop table if exists test_identity_ext; - -create table test_identity_ext ( - id integer not null, - ext varchar(200) not null -); - -create unique index test_ident_ext_pk on test_identity_ext ( id ); drop table if exists test_col; Index: tests/jdo/oracle.sql =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/oracle.sql,v retrieving revision 1.9 diff -u -r1.9 oracle.sql --- tests/jdo/oracle.sql 16 Jun 2005 12:13:46 -0000 1.9 +++ tests/jdo/oracle.sql 1 Jul 2005 23:42:46 -0000 @@ -229,6 +229,151 @@ create unique index tc1x_pks_category_pk on tc1x_pks_category( id ); +-- tc2x TESTS + +drop table tc2x_master; + +create table tc2x_master ( + id numeric(10,0) not null, + value1 varchar(200) not null, + group_id numeric(10,0) null +); + +create unique index tc2x_master_pk on tc2x_master ( id ); + +drop table tc2x_detail; + +create table tc2x_detail ( + detail_id numeric(10,0) not null, + master_id numeric(10,0) not null, + value1 varchar(200) not null +); + +create unique index tc2x_detail_pk on tc2x_detail ( detail_id ); + +drop table tc2x_detail2; + +create table tc2x_detail2 ( + detail2_id numeric(10,0) not null, + detail_id numeric(10,0) not null, + value1 varchar(200 ) not null +); + +create unique index tc2x_detail2_pk on tc2x_detail2 ( detail2_id ); + +drop table tc2x_detail3; + +create table tc2x_detail3 ( + detail3_id numeric(10,0) not null, + detail_id numeric(10,0) not null, + value1 varchar(200 ) not null +); + +create unique index tc2x_detail3_pk on tc2x_detail3 ( detail3_id ); + +drop table tc2x_group; + +create table tc2x_group ( + id numeric(10,0) not null, + value1 varchar(200) not null +); + +create unique index tc2x_group_pk on tc2x_group ( id ); + +drop table tc2x_depend1 cascade constraints; +drop table tc2x_depend_master cascade constraints; +drop table tc2x_depend2 cascade constraints; + +create table tc2x_depend1 ( + id int not null, + constraint tc2x_depend1_pk primary key ( id ) +); + +create table tc2x_depend_master ( + id int not null, + depend1_id int, + constraint tc2x_depend_master_pk primary key ( id ) +); + +alter table tc2x_depend_master + add constraint tc2x_master_depend1 + foreign key ( depend1_id ) references tc2x_depend1 ( id ); + +create table tc2x_depend2( + id int not null, + master_id int, + constraint tc2x_depend2_pk primary key ( id ) +); + +alter table tc2x_depend2 + add constraint tc2x_depend2_master + foreign key ( master_id ) references tc2x_depend_master ( id ); + +drop table tc2x_keygen; + +create table tc2x_keygen ( + id int not null, + attr varchar(200) not null +); + +create unique index tc2x_keygen_pk on tc2x_keygen ( id ); + +drop table tc2x_keygen_ext; + +create table tc2x_keygen_ext ( + id int not null, + ext varchar(200) not null +); + +create unique index tc2x_keygen_ext_pk on tc2x_keygen_ext ( id ); + +drop table tc2x_uuid; + +create table tc2x_uuid ( + id char(30) not null, + attr varchar(200) not null +); + +create unique index tc2x_uuid_pk on tc2x_uuid ( id ); + +drop table tc2x_uuid_ext; + +create table tc2x_uuid_ext ( + id char(30) not null, + ext varchar(200) not null +); + +create unique index tc2x_uuid_ext_pk on tc2x_uuid_ext ( id ); + +drop table tc2x_identity; + +create table tc2x_identity ( + id numeric(10,0) not null, + attr varchar(200) not null +); + +drop table tc2x_identity_ext; + +create table tc2x_identity_ext ( + id numeric(10,0) not null, + ext varchar(200) not null +); + +create unique index tc2x_identity_ext_pk on tc2x_identity_ext ( id ); + +drop table tc2x_seqtable; + +create table tc2x_seqtable ( + table_name varchar(200) not null, + max_id int +); + +create unique index tc2x_seqtable_pk on tc2x_seqtable ( table_name ); + + + + + @@ -521,62 +666,6 @@ -- grant all on test_table_ex to test; -drop table test_master; - -create table test_master ( - id numeric(10,0) not null, - value1 varchar(200) not null, - group_id numeric(10,0) null -); - -create unique index test_master_pk - on test_master ( id ); - --- grant all on test_master to test; - - --- test_detail -drop table test_detail; - -create table test_detail ( - detail_id numeric(10,0) not null, - master_id numeric(10,0) not null, - value1 varchar(200) not null -); - -create unique index test_detail_pk - on test_detail ( detail_id ); - --- grant all on test_detail to test; - - --- test_detail2 -drop table test_detail2; - -create table test_detail2 ( - detail2_id numeric(10,0) not null, - detail_id numeric(10,0) not null, - value1 varchar(200 ) not null -); - -create unique index test_detail2_pk on test_detail2 ( detail2_id ); - --- grant all on test_detail2 to test; - -drop table test_detail3; - -create table test_detail3 -( - detail3_id numeric(10,0) not null, - detail_id numeric(10,0) not null, - value1 varchar(200 ) not null -); - -create unique index test_detail3_pk on test_detail3 ( detail3_id ); - --- grant all on test_detail3 to test; - - drop table test_group; create table test_group ( @@ -590,98 +679,11 @@ -- grant all on test_group to test; --- test_keygen -drop table test_keygen; - -create table test_keygen ( - id int not null, - attr varchar(200) not null -); - -create unique index test_keygen_pk - on test_keygen ( id ); - --- grant all on test_keygen to test; - - --- test_keygen_ext -drop table test_keygen_ext; - -create table test_keygen_ext ( - id int not null, - ext varchar(200) not null -); - -create unique index test_keygen_ext_pk on test_keygen_ext ( id ); - --- grant all on test_keygen_ext to test; - - -drop table test_uuid; - -create table test_uuid ( - id char(30) not null, - attr varchar(200) not null -); - -create unique index test_uuid_pk on test_uuid ( id ); - --- grant all on test_uuid to test; - - -drop table test_uuid_ext; - -create table test_uuid_ext ( - id char(30) not null, - ext varchar(200) not null -); - -create unique index test_uuid_ext_pk on test_uuid_ext ( id ); - --- grant all on test_uuid_ext to test; - - -drop table test_seqtable; - -create table test_seqtable ( - table_name varchar(200) not null, - max_id int -); - -create unique index test_seqtable_pk - on test_seqtable ( table_name ); - --- grant all on test_seqtable to test; - - drop sequence test_keygen_seq; create sequence test_keygen_seq; -- grant all on test_keygen_seq to test; - - --- test the identity key generator -drop table test_identity; - -create table test_identity ( - id numeric(10,0) not null, - attr varchar(200) not null -); - --- grant all on test_identity to test; - - -drop table test_identity_ext; - -create table test_identity_ext ( - id numeric(10,0) not null, - ext varchar(200) not null -); - -create unique index test_ident_ext_pk on test_identity_ext ( id ); - --- grant all on test_identity_ext to test; -- test_col Index: tests/jdo/postgres.sql =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/postgres.sql,v retrieving revision 1.3 diff -u -r1.3 postgres.sql --- tests/jdo/postgres.sql 16 Jun 2005 12:13:46 -0000 1.3 +++ tests/jdo/postgres.sql 1 Jul 2005 23:42:47 -0000 @@ -229,6 +229,151 @@ create unique index tc1x_pks_category_pk on tc1x_pks_category( id ); +-- tc2x TESTS + +drop table tc2x_master; + +create table tc2x_master ( + id numeric(10,0) not null, + value1 varchar(200) not null, + group_id numeric(10,0) null +); + +create unique index tc2x_master_pk on tc2x_master ( id ); + +drop table tc2x_detail; + +create table tc2x_detail ( + detail_id numeric(10,0) not null, + master_id numeric(10,0) not null, + value1 varchar(200) not null +); + +create unique index tc2x_detail_pk on tc2x_detail ( detail_id ); + +drop table tc2x_detail2; + +create table tc2x_detail2 ( + detail2_id numeric(10,0) not null, + detail_id numeric(10,0) not null, + value1 varchar(200 ) not null +); + +create unique index tc2x_detail2_pk on tc2x_detail2 ( detail2_id ); + +drop table tc2x_detail3; + +create table tc2x_detail3 ( + detail3_id numeric(10,0) not null, + detail_id numeric(10,0) not null, + value1 varchar(200 ) not null +); + +create unique index tc2x_detail3_pk on tc2x_detail3 ( detail3_id ); + +drop table tc2x_group; + +create table tc2x_group ( + id numeric(10,0) not null, + value1 varchar(200) not null +); + +create unique index tc2x_group_pk on tc2x_group ( id ); + +drop table tc2x_depend2; +drop table tc2x_depend_master; +drop table tc2x_depend1; + +create table tc2x_depend1 ( + id int not null primary key +); + +create table tc2x_depend_master ( + depend1_id int , + id int not null primary key +); + +alter table tc2x_depend_master + add constraint tc2x_master_depend1 + foreign key ( depend1_id ) references tc2x_depend1 ( id ); + +create table tc2x_depend2 ( + master_id int, + id int not null primary key +); + +alter table tc2x_depend2 + add constraint tc2x_depend2_master + foreign key ( master_id ) references tc2x_depend_master ( id ); + +drop table tc2x_keygen; + +create table tc2x_keygen ( + id int not null, + attr varchar(200) not null +); + +create unique index tc2x_keygen_pk on tc2x_keygen ( id ); + +drop table tc2x_keygen_ext; + +create table tc2x_keygen_ext ( + id int not null, + ext varchar(200) not null +); + +create unique index tc2x_keygen_ext_pk on tc2x_keygen_ext ( id ); + +drop table tc2x_uuid; + +create table tc2x_uuid ( + id char(30) not null, + attr varchar(200) not null +); + +create unique index tc2x_uuid_pk on tc2x_uuid ( id ); + +drop table tc2x_uuid_ext; + +create table tc2x_uuid_ext ( + id char(30) not null, + ext varchar(200) not null +); + +create unique index tc2x_uuid_ext_pk on tc2x_uuid_ext ( id ); + +-- Note that 7.2.1 requires the following sequence to be dropped, +-- where as 7.3 version of postgresql will drop it automatically +drop table tc2x_identity; +drop sequence tc2x_identity_id_seq; + +create table tc2x_identity ( + id SERIAL, + attr varchar(200) not null +); + +drop table tc2x_identity_ext; + +create table tc2x_identity_ext ( + id integer not null, + ext varchar(200) not null +); + +create unique index tc2x_ident_ext_pk on tc2x_identity_ext ( id ); + +drop table tc2x_seqtable; + +create table tc2x_seqtable ( + table_name varchar(200) not null, + max_id int +); + +create unique index tc2x_seqtable_pk on tc2x_seqtable ( table_name ); + + + + + @@ -305,53 +450,6 @@ create unique index test_table_extends_pk on test_table_extends ( id ); -drop table test_master; - -create table test_master ( - id numeric(10,0) not null, - value1 varchar(200) not null, - group_id numeric(10,0) null -); - -create unique index test_master_pk - on test_master ( id ); - - -drop table test_detail; - -create table test_detail ( - detail_id numeric(10,0) not null, - master_id numeric(10,0) not null, - value1 varchar(200) not null -); - -create unique index test_detail_pk - on test_detail ( detail_id ); - - -drop table test_detail2; - -create table test_detail2 ( - detail2_id numeric(10,0) not null, - detail_id numeric(10,0) not null, - value1 varchar(200 ) not null -); - -create unique index test_detail2_pk on test_detail2 ( detail2_id ); - - -drop table test_detail3; - -create table test_detail3 -( - detail3_id numeric(10,0) not null, - detail_id numeric(10,0) not null, - value1 varchar(200 ) not null -); - -create unique index test_detail3_pk on test_detail3 ( detail3_id ); - - drop table test_group; create table test_group ( @@ -380,64 +478,11 @@ o_bfile oid null ); -drop table test_keygen; - -create table test_keygen ( - id int not null, - attr varchar(200) not null -); - -create unique index test_keygen_pk - on test_keygen ( id ); - - -drop table test_keygen_ext; - -create table test_keygen_ext ( - id int not null, - ext varchar(200) not null -); - -create unique index test_keygen_ext_pk on test_keygen_ext ( id ); - - drop sequence test_keygen_seq; create sequence test_keygen_seq; -drop table test_uuid; - -create table test_uuid ( - id char(30) not null, - attr varchar(200) not null -); - -create unique index test_uuid_pk - on test_uuid ( id ); - - -drop table test_uuid_ext; - -create table test_uuid_ext ( - id char(30) not null, - ext varchar(200) not null -); - -create unique index test_uuid_ext_pk on test_uuid_ext ( id ); - - -drop table test_seqtable; - -create table test_seqtable ( - table_name varchar(200) not null, - max_id int -); - -create unique index test_seqtable_pk - on test_seqtable ( table_name ); - - drop table test_persistent; create table test_persistent ( @@ -461,30 +506,6 @@ create unique index test_related_pk on test_related ( id ); - -drop table test_identity; - --- --- Note that 7.2.1 requires the following sequence to be dropped, --- where as 7.3 version of postgresql will drop it automatically --- - -drop sequence test_identity_id_seq; - -create table test_identity ( - id SERIAL, - attr varchar(200) not null -); - - -drop table test_identity_ext; - -create table test_identity_ext ( - id integer not null, - ext varchar(200) not null -); - -create unique index test_ident_ext_pk on test_identity_ext ( id ); drop table test_col; Index: tests/jdo/sapdb.sql =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/sapdb.sql,v retrieving revision 1.9 diff -u -r1.9 sapdb.sql --- tests/jdo/sapdb.sql 16 Jun 2005 12:13:46 -0000 1.9 +++ tests/jdo/sapdb.sql 1 Jul 2005 23:42:49 -0000 @@ -285,6 +285,189 @@ // +-- tc2x TESTS + +drop table tc2x_master +// + +create table tc2x_master ( + id fixed(10,0) not null, + value1 varchar(200) not null, + group_id fixed(10,0) null +) +// + +create unique index tc2x_master_pk on tc2x_master ( id ) +// + +drop table tc2x_detail +// + +create table tc2x_detail ( + detail_id fixed(10,0) not null, + master_id fixed(10,0) not null, + value1 varchar(200) not null +) +// + +create unique index tc2x_detail_pk on tc2x_detail ( detail_id ) +// + +drop table tc2x_detail2 +// + +create table tc2x_detail2 ( + detail2_id fixed(10,0) not null, + detail_id fixed(10,0) not null, + value1 varchar(200 ) not null +) +// + +create unique index tc2x_detail2_pk on tc2x_detail2 ( detail2_id ) +// + +drop table tc2x_detail3 +// + +create table tc2x_detail3 ( + detail3_id fixed(10,0) not null, + detail_id fixed(10,0) not null, + value1 varchar(200 ) not null +) +// + +create unique index tc2x_detail3_pk on tc2x_detail3 ( detail3_id ) +// + +drop table tc2x_group +// + +create table tc2x_group ( + id fixed(10,0) not null, + value1 varchar(200) not null +) +// + +create unique index tc2x_group_pk on tc2x_group ( id ) +// + +drop table tc2x_depend1 cascade +// +drop table tc2x_depend_master cascade +// +drop table tc2x_depend2 cascade +// + +create table tc2x_depend1 ( + id int, + primary key ( id ) +) +// + +create table tc2x_depend_master ( + id int, + depend1_id int, + primary key ( id ), + foreign key tc2x_master_depend1 ( depend1_id ) + references tc2x_depend1 ( id ) on delete cascade +) +// + +create table tc2x_depend2 ( + id int, + master_id int, + primary key ( id ), + foreign key tc2x_depend2_master ( master_id ) + references tc2x_depend_master ( id ) on delete cascade +) +// + +drop table tc2x_keygen +// + +create table tc2x_keygen ( + id int not null, + attr varchar(200) not null +) +// + +create unique index tc2x_keygen_pk on tc2x_keygen ( id ) +// + +drop table tc2x_keygen_ext +// + +create table tc2x_keygen_ext ( + id int not null, + ext varchar(200) not null +) +// + +create unique index tc2x_keygen_ext_pk on tc2x_keygen_ext ( id ) +// + +drop table tc2x_uuid +// + +create table tc2x_uuid ( + id char(30) not null, + attr varchar(200) not null +) +// + +create unique index tc2x_uuid_pk on tc2x_uuid ( id ) +// + +drop table tc2x_uuid_ext +// + +create table tc2x_uuid_ext ( + id char(30) not null, + ext varchar(200) not null +) +// + +create unique index tc2x_uuid_ext_pk on tc2x_uuid_ext ( id ) +// + +drop table tc2x_identity +// + +create table tc2x_identity ( + id fixed(10,0) default serial, + attr varchar(200) not null +) +// + +drop table tc2x_identity_ext +// + +create table tc2x_identity_ext ( + id fixed(10,0) not null, + ext varchar(200) not null +) +// + +create unique index tc2x_ident_ext_pk on tc2x_identity_ext ( id ) +// + +drop table tc2x_seqtable +// + +create table tc2x_seqtable ( + table_name varchar(200) not null, + max_id int +) +// + +create unique index tc2x_seqtable_pk on tc2x_seqtable ( table_name ) +// + + + + + + @@ -503,63 +686,6 @@ // -drop table test_master -// - -create table test_master ( - id fixed(10,0) not null, - value1 varchar(200) not null, - group_id fixed(10,0) null -) -// - -create unique index test_master_pk - on test_master ( id ) -// - - -drop table test_detail -// - -create table test_detail ( - detail_id fixed(10,0) not null, - master_id fixed(10,0) not null, - value1 varchar(200) not null -) -// - -create unique index test_detail_pk - on test_detail ( detail_id ) -// - - -drop table test_detail2 -// - -create table test_detail2 ( - detail2_id fixed(10,0) not null, - detail_id fixed(10,0) not null, - value1 varchar(200 ) not null -) -// - -create unique index test_detail2_pk on test_detail2 ( detail2_id ) -// - -drop table test_detail3 -// - -create table test_detail3 -( - detail3_id fixed(10,0) not null, - detail_id fixed(10,0) not null, - value1 varchar(200 ) not null -) -// - -create unique index test_detail3_pk on test_detail3 ( detail3_id ) -// - drop table test_group // @@ -574,59 +700,6 @@ // -drop table test_keygen -// - -create table test_keygen ( - id int not null, - attr varchar(200) not null -) -// - -create unique index test_keygen_pk - on test_keygen ( id ) -// - - -drop table test_keygen_ext -// - -create table test_keygen_ext ( - id int not null, - ext varchar(200) not null -) -// - -create unique index test_keygen_ext_pk on test_keygen_ext ( id ) -// - - -drop table test_uuid -// - -create table test_uuid ( - id char(30) not null, - attr varchar(200) not null -) -// - -create unique index test_uuid_pk on test_uuid ( id ) -// - - -drop table test_uuid_ext -// - -create table test_uuid_ext ( - id char(30) not null, - ext varchar(200) not null -) -// - -create unique index test_uuid_ext_pk on test_uuid_ext ( id ) -// - - drop table list_types // @@ -648,47 +721,10 @@ -drop table test_seqtable -// - -create table test_seqtable ( - table_name varchar(200) not null, - max_id int -) -// - -create unique index test_seqtable_pk - on test_seqtable ( table_name ) -// - - drop sequence test_keygen_seq // create sequence test_keygen_seq -// - - -drop table test_identity -// - -create table test_identity ( - id fixed(10,0) default serial, - attr varchar(200) not null -) -// - - -drop table test_identity_ext -// - -create table test_identity_ext ( - id fixed(10,0) not null, - ext varchar(200) not null -) -// - -create unique index test_ident_ext_pk on test_identity_ext ( id ) // Index: tests/jdo/sybase.sql =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/sybase.sql,v retrieving revision 1.7 diff -u -r1.7 sybase.sql --- tests/jdo/sybase.sql 16 Jun 2005 12:13:46 -0000 1.7 +++ tests/jdo/sybase.sql 1 Jul 2005 23:42:50 -0000 @@ -283,6 +283,191 @@ go +-- tc2x TESTS + +drop table tc2x_master +go +create table tc2x_master ( + id numeric(10,0) not null, + value1 varchar(200) not null, + group_id numeric(10,0) null +) +go +create unique index tc2x_master_pk on tc2x_master ( id ) +go +grant all on tc2x_master to test +go + +drop table tc2x_detail +go +create table tc2x_detail ( + detail_id numeric(10,0) not null, + master_id numeric(10,0) not null, + value1 varchar(200 ) not null +) +go +create unique index tc2x_detail_pk on tc2x_detail ( detail_id ) +go +grant all on tc2x_detail to test +go + +drop table tc2x_detail2 +go +create table tc2x_detail2 +( + detail2_id numeric(10,0) not null, + detail_id numeric(10,0) not null, + value1 varchar(200 ) not null +) +go +create unique index tc2x_detail2_pk on tc2x_detail2 ( detail2_id ) +go +grant all on tc2x_detail2 to test +go + +drop table tc2x_detail3 +go +create table tc2x_detail3 ( + detail3_id numeric(10,0) not null, + detail_id numeric(10,0) not null, + value1 varchar(200 ) not null +) +go +create unique index tc2x_detail3_pk on tc2x_detail3 ( detail3_id ) +go +grant all on tc2x_detail3 to test +go + +drop table tc2x_group +go +create table tc2x_group ( + id numeric(10,0) not null, + value1 varchar(200) not null +) +go +create unique index tc2x_group_pk on tc2x_group ( id ) +go +grant all on tc2x_group to test +go + +drop table tc2x_depend2 +go +drop table tc2x_depend_master +go +drop table tc2x_depend1 +go +create table tc2x_depend1 ( + id int not null primary key +) +go +grant all on tc2x_depend1 to test +go +create table tc2x_depend_master ( + id int not null primary key, + depend1_id int, + index tc2x_master_depend1 ( depend1_id ), + foreign key ( depend1_id ) references tc2x_depend1 ( id ) +) +go +grant all on tc2x_depend_master to test +go +create table tc2x_depend2 ( + id int not null primary key, + master_id int, + index tc2x_depend2_master ( master_id ), + foreign key ( master_id ) references tc2x_depend_master ( id ) +) +go +grant all on tc2x_depend2 to test +go + +drop table tc2x_keygen +go +create table tc2x_keygen ( + id int not null, + attr varchar(200) not null +) +go +create unique index tc2x_keygen_pk on tc2x_keygen ( id ) +go +grant all on tc2x_keygen to test +go + +drop table tc2x_keygen_ext +go +create table tc2x_keygen_ext ( + id int not null, + ext varchar(200) not null +) +go +create unique index tc2x_keygen_ext_pk on tc2x_keygen_ext ( id ) +go +grant all on tc2x_keygen_ext to test +go + +drop table tc2x_uuid +go +create table tc2x_uuid ( + id char(30) not null, + attr varchar(200) not null +) +go +create unique index tc2x_uuid_pk on tc2x_uuid ( id ) +go +grant all on tc2x_uuid to test +go + +drop table tc2x_uuid_ext +go +create table tc2x_uuid_ext ( + id char(30) not null, + ext varchar(200) not null +) +go +create unique index tc2x_uuid_ext_pk on tc2x_uuid_ext ( id ) +go +grant all on tc2x_uuid_ext to test +go + +drop table tc2x_identity +go +create table tc2x_identity ( + id numeric(10,0) identity, + attr varchar(200) not null +) +go +grant all on tc2x_identity to test +go + +drop table tc2x_identity_ext +go +create table tc2x_identity_ext ( + id numeric(10,0) not null, + ext varchar(200) not null +) +go +create unique index tc2x_ident_ext_pk on tc2x_identity_ext ( id ) +go +grant all on tc2x_identity_ext to test +go + +drop table tc2x_seqtable +go +create table tc2x_seqtable ( + table_name varchar(200) not null, + max_id int null +) +go +create unique index tc2x_seqtable_pk on tc2x_seqtable ( table_name ) +go +grant all on tc2x_seqtable to test +go + + + + + + @@ -560,64 +745,6 @@ grant all on test_table_ex to test go --- test_master -drop table test_master -go -create table test_master ( - id numeric(10,0) not null, - value1 varchar(200) not null, - group_id numeric(10,0) null -) -go -create unique index test_master_pk on test_master ( id ) -go -grant all on test_master to test -go - --- test_detail -drop table test_detail -go -create table test_detail ( - detail_id numeric(10,0) not null, - master_id numeric(10,0) not null, - value1 varchar(200 ) not null -) -go -create unique index test_detail_pk on test_detail ( detail_id ) -go -grant all on test_detail to test -go - --- test_detail2 -drop table test_detail2 -go -create table test_detail2 -( - detail2_id numeric(10,0) not null, - detail_id numeric(10,0) not null, - value1 varchar(200 ) not null -) -go -create unique index test_detail2_pk on test_detail2 ( detail2_id ) -go -grant all on test_detail2 to test -go - --- test_detail3 -drop table test_detail3 -go -create table test_detail3 -( - detail3_id numeric(10,0) not null, - detail_id numeric(10,0) not null, - value1 varchar(200 ) not null -) -go -create unique index test_detail3_pk on test_detail3 ( detail3_id ) -go -grant all on test_detail3 to test -go - -- test_group drop table test_group go @@ -629,92 +756,6 @@ create unique index test_group_pk on test_group ( id ) go grant all on test_group to test -go - --- test_keygen -drop table test_keygen -go -create table test_keygen ( - id int not null, - attr varchar(200) not null -) -go -create unique index test_keygen_pk on test_keygen ( id ) -go -grant all on test_keygen to test -go - --- test_keygen_ext -drop table test_keygen_ext -go -create table test_keygen_ext ( - id int not null, - ext varchar(200) not null -) -go -create unique index test_keygen_ext_pk on test_keygen_ext ( id ) -go -grant all on test_keygen_ext to test -go - -drop table test_uuid -go -create table test_uuid ( - id char(30) not null, - attr varchar(200) not null -) -go -create unique index test_uuid_pk on test_uuid ( id ) -go -grant all on test_uuid to test -go - -drop table test_uuid_ext -go -create table test_uuid_ext ( - id char(30) not null, - ext varchar(200) not null -) -go -create unique index test_uuid_ext_pk on test_uuid_ext ( id ) -go -grant all on test_uuid_ext to test -go - --- test_seqtable -drop table test_seqtable -go -create table test_seqtable ( - table_name varchar(200) not null, - max_id int null -) -go -create unique index test_seqtable_pk on test_seqtable ( table_name ) -go -grant all on test_seqtable to test -go - --- test the identity key generator -drop table test_identity -go -create table test_identity ( - id numeric(10,0) identity, - attr varchar(200) not null -) -go -grant all on test_identity to test -go - -drop table test_identity_ext -go -create table test_identity_ext ( - id numeric(10,0) not null, - ext varchar(200) not null -) -go -create unique index test_ident_ext_pk on test_identity_ext ( id ) -go -grant all on test_identity_ext to test go -- The test stored procedure on TransactSQL Index: tests/ctf/jdo/tc2x/AbstractKeyGenObject.java =================================================================== RCS file: tests/ctf/jdo/tc2x/AbstractKeyGenObject.java diff -N tests/ctf/jdo/tc2x/AbstractKeyGenObject.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/AbstractKeyGenObject.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,60 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestKeyGenObject.java,v 1.1.1.1 2003/03/03 07:10:13 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * The base class of all test object for key generators. + */ +public abstract class AbstractKeyGenObject { + private Integer _id; + + public final void setId(final Integer id) { _id = id; } + public final Integer getId() { return _id; } + + public String toString() { + return ((_id == null) ? "null" : _id.toString()); + } +} Index: tests/ctf/jdo/tc2x/Depend1.java =================================================================== RCS file: tests/ctf/jdo/tc2x/Depend1.java diff -N tests/ctf/jdo/tc2x/Depend1.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/Depend1.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,59 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: Depend1.java,v 1.1.1.1 2003/03/03 07:10:02 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * @table DEPEND1 + * @key-generator MAX + * @depends jdo.Master + */ +public final class Depend1 { + /** @primary-key */ + private int _id; + + public int getId() { return _id; } + public void setId(final int id) { _id = id; } +} Index: tests/ctf/jdo/tc2x/Depend2.java =================================================================== RCS file: tests/ctf/jdo/tc2x/Depend2.java diff -N tests/ctf/jdo/tc2x/Depend2.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/Depend2.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,65 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: Depend2.java,v 1.1.1.1 2003/03/03 07:10:02 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * @table DEPEND2 + * @key-generator MAX + * @depends jdo.Master + */ +public final class Depend2 { + /** @sql-name master_oid */ + private DependMaster _master; + + /** @primary-key */ + private int _id; + + public int getId() { return _id; } + public void setId(final int id) { _id = id; } + + public DependMaster getMaster() { return _master; } + public void setMaster(final DependMaster master) { _master = master; } +} Index: tests/ctf/jdo/tc2x/DependMaster.java =================================================================== RCS file: tests/ctf/jdo/tc2x/DependMaster.java diff -N tests/ctf/jdo/tc2x/DependMaster.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/DependMaster.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,81 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: Master.java,v 1.1.1.1 2003/03/03 07:10:07 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +import java.util.ArrayList; + +/** + * @table MASTER + * @key-generator MAX + */ +public final class DependMaster { + /** @primary-key */ + private int _id; + + /** @sql-name depend1_oid */ + private Depend1 _depend1; + + /** @field-type jdo.Depend2 + * @many-key master_oid */ + private ArrayList _depends2 = new ArrayList(); + + public int getId() { return _id; } + public void setId(final int id) { _id = id; } + + public Depend1 getDepend1() { return _depend1; } + public void setDepend1(final Depend1 depend1) { _depend1 = depend1; } + + public ArrayList getDepends2() { return _depends2; } + public void setDepends2(final ArrayList depends2) { _depends2 = depends2; } + public void addDepend2(final Depend2 depend2) { + _depends2.add(depend2); + depend2.setMaster(this); + } + + public String toString() { + return "Master object #" + _id; + } +} Index: tests/ctf/jdo/tc2x/Detail.java =================================================================== RCS file: tests/ctf/jdo/tc2x/Detail.java diff -N tests/ctf/jdo/tc2x/Detail.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/Detail.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,133 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestDetail.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ + */ + +package ctf.jdo.tc2x; + +import java.util.ArrayList; +import java.util.Iterator; + +/** + * Test object mapping to test_detaul used to conduct relation tests. + */ +public final class Detail { + public static final String DEFAULT_VALUE = "group"; + + private int _id; + private String _value; + private Master _master; + private ArrayList _details2; + private Detail3 _detail3; + + public Detail(final int id) { + this(); + _id = id; + } + + public Detail() { + _value = DEFAULT_VALUE; + _details2 = new ArrayList(); + } + + public void setId(final int id) { _id = id; } + public int getId() { return _id; } + + public void setValue1(final String value) { _value = value; } + public String getValue1() { return _value; } + + public void setMaster(final Master master) { _master = master; } + public Master getMaster() { return _master; } + + public Detail2 createDetail2() { return new Detail2(); } + public void setDetails2(final ArrayList list) { _details2 = list; } + public ArrayList getDetails2() { return _details2; } + public void addDetail2(final Detail2 detail2) { + _details2.add(detail2); + detail2.setDetail(this); + } + public Detail2 findDetail2(final int id) { + Iterator enumeration; + Detail2 detail2; + + if (_details2 == null) { return null; } + + enumeration = _details2.iterator(); + while (enumeration.hasNext()) { + detail2 = (Detail2) enumeration.next(); + if (detail2.getId() == id) { return detail2; } + } + return null; + } + + public void setDetail3(final Detail3 detail3) { + if (_detail3 != null) { _detail3.setDetail(null); } + if (detail3 != null) { detail3.setDetail(this); } + _detail3 = detail3; + } + public Detail3 getDetail3() { return _detail3; } + + public String toString() { + String details2 = ""; + + if (_details2 != null) { + for (int i = 0; i < _details2.size(); ++i) { + if (i > 0) { details2 = details2 + ", "; } + details2 = details2 + _details2.get(i).toString(); + } + } + return ""; + } + + public int hashCode() { return _id; } + + public boolean equals(final Object other) { + if (other == this) { return true; } + if ((other != null) && (other instanceof Detail)) { + return (((Detail) other)._id == _id); + } + return false; + } +} Index: tests/ctf/jdo/tc2x/Detail2.java =================================================================== RCS file: tests/ctf/jdo/tc2x/Detail2.java diff -N tests/ctf/jdo/tc2x/Detail2.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/Detail2.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,91 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestDetail2.java,v 1.1.1.1 2003/03/03 07:10:12 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object mapping to test_detail2 used to conduct relation tests. + */ +public final class Detail2 { + public static final int DEFAULT_ID = 5; + public static final String DEFAULT_VALUE = "value"; + + private int _id; + private String _value; + private Detail _detail; + + public Detail2(final int id) { + _id = id; + _value = DEFAULT_VALUE; + } + + public Detail2() { + _value = DEFAULT_VALUE; + } + + public void setId(final int id) { _id = id; } + public int getId() { return _id; } + + public void setValue1(final String value) { _value = value; } + public String getValue1() { return _value; } + + public void setDetail(final Detail detail) { _detail = detail; } + public Detail getDetail() { return _detail; } + + public String toString() { + return _id + " / " + _value + " / " + + (_detail == null ? 0 : _detail.getId()); + } + + public int hashCode() { return _id; } + + public boolean equals(final Object other) { + if (other == this) { return true; } + if (other != null && other instanceof Detail2) { + return (((Detail2) other)._id == _id); + } + return false; + } +} Index: tests/ctf/jdo/tc2x/Detail3.java =================================================================== RCS file: tests/ctf/jdo/tc2x/Detail3.java diff -N tests/ctf/jdo/tc2x/Detail3.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/Detail3.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,91 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 2001 (C) Intalio, Inc. All Rights Reserved. + * + * $Id $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object mapping to test_detail2 used to conduct relation tests. + */ +public final class Detail3 { + public static final int DEFAULT_ID = 100; + public static final String DEFAULT_VALUE = "value"; + + private int _id; + private String _value; + private Detail _detail; + + public Detail3(final int id) { + _id = id; + _value = DEFAULT_VALUE; + } + + public Detail3() { + _value = DEFAULT_VALUE; + } + + public void setId(final int id) { _id = id; } + public int getId() { return _id; } + + public void setValue1(final String value) { _value = value; } + public String getValue1() { return _value; } + + public void setDetail(final Detail detail) { _detail = detail; } + public Detail getDetail() { return _detail; } + + public String toString() { + return _id + " / " + _value + " / " + + (_detail == null ? 0 : _detail.getId()); + } + + public int hashCode() { return _id; } + + public boolean equals(final Object other) { + if (other == this) { return true; } + if (other != null && other instanceof Detail3) { + return (((Detail3) other)._id == _id); + } + return false; + } +} Index: tests/ctf/jdo/tc2x/DetailKeyGen.java =================================================================== RCS file: tests/ctf/jdo/tc2x/DetailKeyGen.java diff -N tests/ctf/jdo/tc2x/DetailKeyGen.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/DetailKeyGen.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,135 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 2001 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestDetailKeyGen.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ + */ + +package ctf.jdo.tc2x; + +import java.util.ArrayList; +import java.util.Iterator; + +/** + * Test object mapping to test_detaul used to conduct relation tests. + */ +public final class DetailKeyGen { + public static final int DEFAULT_ID = 5; + public static final String DEFAULT_VALUE = "group"; + + private int _id; + private String _value; + private MasterKeyGen _master; + private ArrayList _details2; + private DetailKeyGen3 _detail3; + + public DetailKeyGen(final int id) { + this(); + _id = id; + } + + public DetailKeyGen() { + _value = DEFAULT_VALUE; + _details2 = new ArrayList(); + } + + public void setId(final int id) { _id = id; } + public int getId() { return _id; } + + public void setValue1(final String value) { _value = value; } + public String getValue1() { return _value; } + + public void setMaster(final MasterKeyGen master) { _master = master; } + public MasterKeyGen getMaster() { return _master; } + + public DetailKeyGen2 createDetail2() { return new DetailKeyGen2(); } + public void setDetails2(final ArrayList list) { _details2 = list; } + public ArrayList getDetails2() { return _details2; } + public void addDetail2(final DetailKeyGen2 detail2) { + _details2.add(detail2); + detail2.setDetail(this); + } + public DetailKeyGen2 findDetail2(final int id) { + Iterator enumeration; + DetailKeyGen2 detail2; + + if (_details2 == null) { return null; } + + enumeration = _details2.iterator(); + while (enumeration.hasNext()) { + detail2 = (DetailKeyGen2) enumeration.next(); + if (detail2.getId() == id) { return detail2; } + } + return null; + } + + public void setDetail3(final DetailKeyGen3 detail3) { + if (_detail3 != null) { _detail3.setDetail(null); } + if (detail3 != null) { detail3.setDetail(this); } + _detail3 = detail3; + } + public DetailKeyGen3 getDetail3() { return _detail3; } + + public String toString() { + String details2 = ""; + + if (_details2 != null) { + for (int i = 0; i < _details2.size(); ++i) { + if (i > 0) { details2 = details2 + ", "; } + details2 = details2 + _details2.get(i).toString(); + } + } + + return ""; + } + + public int hashCode() { return _id; } + + public boolean equals(final Object other) { + if (other == this) { return true; } + if (other != null && other instanceof DetailKeyGen) { + return (((DetailKeyGen) other)._id == _id); + } + return false; + } +} Index: tests/ctf/jdo/tc2x/DetailKeyGen2.java =================================================================== RCS file: tests/ctf/jdo/tc2x/DetailKeyGen2.java diff -N tests/ctf/jdo/tc2x/DetailKeyGen2.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/DetailKeyGen2.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,91 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 2001 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestDetailKeyGen2.java,v 1.1.1.1 2003/03/03 07:10:12 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object mapping to test_detail2 used to conduct relation tests. + */ +public final class DetailKeyGen2 { + public static final int DEFAULT_ID = 5; + public static final String DEFAULT_VALUE = "value"; + + private int _id; + private String _value; + private DetailKeyGen _detail; + + public DetailKeyGen2(final int id) { + _id = id; + _value = DEFAULT_VALUE; + } + + public DetailKeyGen2() { + _value = DEFAULT_VALUE; + } + + public void setId(final int id) { _id = id; } + public int getId() { return _id; } + + public void setValue1(final String value) { _value = value; } + public String getValue1() { return _value; } + + public void setDetail(final DetailKeyGen detail) { _detail = detail; } + public DetailKeyGen getDetail() { return _detail; } + + public String toString() { + return _id + " / " + _value + " / " + + (_detail == null ? 0 : _detail.getId()); + } + + public int hashCode() { return _id; } + + public boolean equals(final Object other) { + if (other == this) { return true; } + if (other != null && other instanceof DetailKeyGen2) { + return (((DetailKeyGen2) other)._id == _id); + } + return false; + } +} Index: tests/ctf/jdo/tc2x/DetailKeyGen3.java =================================================================== RCS file: tests/ctf/jdo/tc2x/DetailKeyGen3.java diff -N tests/ctf/jdo/tc2x/DetailKeyGen3.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/DetailKeyGen3.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,91 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 2001 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestDetailKeyGen3.java,v 1.1.1.1 2003/03/03 07:10:12 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object mapping to test_detail2 used to conduct relation tests. + */ +public final class DetailKeyGen3 { + public static final int DEFAULT_ID = 5; + public static final String DEFAULT_VALUE = "value"; + + private int _id; + private String _value; + private DetailKeyGen _detail; + + public DetailKeyGen3(final int id) { + _id = id; + _value = DEFAULT_VALUE; + } + + public DetailKeyGen3() { + _value = DEFAULT_VALUE; + } + + public void setId(final int id) { _id = id; } + public int getId() { return _id; } + + public void setValue1(final String value) { _value = value; } + public String getValue1() { return _value; } + + public void setDetail(final DetailKeyGen detail) { _detail = detail; } + public DetailKeyGen getDetail() { return _detail; } + + public String toString() { + return _id + " / " + _value + " / " + + (_detail == null ? 0 : _detail.getId()); + } + + public int hashCode() { return _id; } + + public boolean equals(final Object other) { + if (other == this) { return true; } + if (other != null && other instanceof DetailKeyGen2) { + return (((DetailKeyGen3) other)._id == _id); + } + return false; + } +} Index: tests/ctf/jdo/tc2x/Group.java =================================================================== RCS file: tests/ctf/jdo/tc2x/Group.java diff -N tests/ctf/jdo/tc2x/Group.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/Group.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,72 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestGroup.java,v 1.2 2005/05/11 17:18:50 rjoachim Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object mapping to test_group used to conduct relation the tests. + */ +public final class Group { + public static final int DEFAULT_ID = 4; + public static final String DEFAULT_VALUE = "group"; + + private int _id; + private String _value; + + public Group() { + _id = DEFAULT_ID; + _value = DEFAULT_VALUE; + } + + public void setId(final int id) { _id = id; } + public int getId() { return _id; } + + public void setValue1(final String value) { _value = value; } + public String getValue1() { return _value; } + + public String toString() { + return _id + " / " + _value; + } +} Index: tests/ctf/jdo/tc2x/HighLowExtends.java =================================================================== RCS file: tests/ctf/jdo/tc2x/HighLowExtends.java diff -N tests/ctf/jdo/tc2x/HighLowExtends.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/HighLowExtends.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,67 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestHighLowExtends.java,v 1.1.1.1 2003/03/03 07:10:13 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object for HIGH-LOW key generator. + */ +public final class HighLowExtends extends HighLowObject { + public static final String DEFAULT_EXTENDS = "ext"; + + private String _ext; + + public HighLowExtends() { + super(); + _ext = DEFAULT_EXTENDS; + } + + public void setExt(final String ext) { _ext = ext; } + public String getExt() { return _ext; } + + public String toString() { + return super.toString() + " / " + _ext; + } +} Index: tests/ctf/jdo/tc2x/HighLowExtendsSameConnection.java =================================================================== RCS file: tests/ctf/jdo/tc2x/HighLowExtendsSameConnection.java diff -N tests/ctf/jdo/tc2x/HighLowExtendsSameConnection.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/HighLowExtendsSameConnection.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,67 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestHighLowExtendsSameConnection.java,v 1.1 2004/09/15 21:22:41 wguttmann Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object for HIGH-LOW key generator. + */ +public final class HighLowExtendsSameConnection extends HighLowObjectSameConnection { + public static final String DEFAULT_EXT = "ext"; + + private String _ext; + + public HighLowExtendsSameConnection() { + super(); + _ext = DEFAULT_EXT; + } + + public void setExt(final String ext) { _ext = ext; } + public String getExt() { return _ext; } + + public String toString() { + return super.toString() + " / " + _ext; + } +} Index: tests/ctf/jdo/tc2x/HighLowObject.java =================================================================== RCS file: tests/ctf/jdo/tc2x/HighLowObject.java diff -N tests/ctf/jdo/tc2x/HighLowObject.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/HighLowObject.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,66 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestHighLowObject.java,v 1.1.1.1 2003/03/03 07:10:13 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object for HIGH-LOW key generator. + */ +public class HighLowObject extends AbstractKeyGenObject { + public static final String DEFAULT_ATTR = "attr"; + + private String _attr; + + public HighLowObject() { + _attr = DEFAULT_ATTR; + } + + public final void setAttr(final String attr) { _attr = attr; } + public final String getAttr() { return _attr; } + + public String toString() { + return super.toString() + " / " + _attr; + } +} Index: tests/ctf/jdo/tc2x/HighLowObjectSameConnection.java =================================================================== RCS file: tests/ctf/jdo/tc2x/HighLowObjectSameConnection.java diff -N tests/ctf/jdo/tc2x/HighLowObjectSameConnection.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/HighLowObjectSameConnection.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,66 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestHighLowObjectSameConnection.java,v 1.1 2004/09/15 21:22:54 wguttmann Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object for HIGH-LOW key generator. + */ +public class HighLowObjectSameConnection extends AbstractKeyGenObject { + public static final String DEFAULT_ATTR = "attr"; + + private String _attr; + + public HighLowObjectSameConnection() { + _attr = DEFAULT_ATTR; + } + + public final void setAttr(final String attr) { _attr = attr; } + public final String getAttr() { return _attr; } + + public String toString() { + return super.toString() + " / " + _attr; + } +} Index: tests/ctf/jdo/tc2x/IdentityExtends.java =================================================================== RCS file: tests/ctf/jdo/tc2x/IdentityExtends.java diff -N tests/ctf/jdo/tc2x/IdentityExtends.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/IdentityExtends.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,67 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestIdentityExtends.java,v 1.1.1.1 2003/03/03 07:10:13 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test "extends" relation for IDENTITY key generator. + */ +public final class IdentityExtends extends IdentityObject { + public static final String DEFAULT_EXT = "ext"; + + private String _ext; + + public IdentityExtends() { + super(); + _ext = DEFAULT_EXT; + } + + public void setExt(final String ext) { _ext = ext; } + public String getExt() { return _ext; } + + public String toString() { + return super.toString() + " / " + _ext; + } +} Index: tests/ctf/jdo/tc2x/IdentityObject.java =================================================================== RCS file: tests/ctf/jdo/tc2x/IdentityObject.java diff -N tests/ctf/jdo/tc2x/IdentityObject.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/IdentityObject.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,66 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestIdentityObject.java,v 1.1.1.1 2003/03/03 07:10:13 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object for IDENTITY key generator. + */ +public class IdentityObject extends AbstractKeyGenObject { + public static final String DEFAULT_ATTR = "attr"; + + private String _attr; + + public IdentityObject() { + _attr = DEFAULT_ATTR; + } + + public final void setAttr(final String attr) { _attr = attr; } + public final String getAttr() { return _attr; } + + public String toString() { + return super.toString() + " / " + _attr; + } +} Index: tests/ctf/jdo/tc2x/Master.java =================================================================== RCS file: tests/ctf/jdo/tc2x/Master.java diff -N tests/ctf/jdo/tc2x/Master.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/Master.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,114 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestMaster.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ + */ + +package ctf.jdo.tc2x; + +import java.util.ArrayList; +import java.util.Iterator; + +import org.exolab.castor.jdo.TimeStampable; + +/** + * Test object mapping to test_master used to conduct relation tests. + */ +public final class Master implements TimeStampable { + public static final int DEFAULT_ID = 3; + public static final String DEFAULT_VALUE = "master"; + + private int _id; + private String _value; + private Group _group; + private ArrayList _details; + private long _timeStamp; + + public Master() { + _id = DEFAULT_ID; + _value = DEFAULT_VALUE; + _group = null; + _details = new ArrayList(); + } + + public void setId(final int id) { _id = id; } + public int getId() { return _id; } + + public void setValue1(final String value) { _value = value; } + public String getValue1() { return _value; } + + public Group createGroup() { return new Group(); } + public void setGroup(final Group group) { _group = group; } + public Group getGroup() { return _group; } + + public Detail createDetail() { return new Detail(); } + public ArrayList getDetails() { return _details; } + public void setDetails(final ArrayList array) { _details = array; } + public void addDetail(final Detail detail) { + _details.add(detail); + detail.setMaster(this); + } + public Detail findDetail(final int id) { + Iterator enumeration; + Detail detail; + + enumeration = _details.iterator(); + while (enumeration.hasNext()) { + detail = (Detail) enumeration.next(); + if (detail.getId() == id) { return detail; } + } + return null; + } + + public String toString() { + String details = ""; + + for (int i = 0; i < _details.size(); ++i) { + if (i > 0) { details = details + ", "; } + details = details + _details.get(i).toString(); + } + return _id + " / " + _value + " (" + _group + ") { " + details + " }"; + } + + public void jdoSetTimeStamp(final long timeStamp) { _timeStamp = timeStamp; } + public long jdoGetTimeStamp() { return _timeStamp; } +} Index: tests/ctf/jdo/tc2x/MasterKeyGen.java =================================================================== RCS file: tests/ctf/jdo/tc2x/MasterKeyGen.java diff -N tests/ctf/jdo/tc2x/MasterKeyGen.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/MasterKeyGen.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,114 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 2001 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestMasterKeyGen.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ + */ + +package ctf.jdo.tc2x; + +import java.util.ArrayList; +import java.util.Iterator; + +import org.exolab.castor.jdo.TimeStampable; + +/** + * Test object mapping to test_master used to conduct relation tests. + */ +public final class MasterKeyGen implements TimeStampable { + public static final int DEFAULT_ID = 3; + public static final String DEFAULT_VALUE = "master"; + + private int _id; + private String _value; + private Group _group; + private ArrayList _details; + private long _timeStamp; + + public MasterKeyGen() { + _id = DEFAULT_ID; + _value = DEFAULT_VALUE; + _group = null; + _details = new ArrayList(); + } + + public void setId(final int id) { _id = id; } + public int getId() { return _id; } + + public void setValue1(final String value) { _value = value; } + public String getValue1() { return _value; } + + public Group createGroup() { return new Group(); } + public void setGroup(final Group group) { _group = group; } + public Group getGroup() { return _group; } + + public DetailKeyGen createDetail() { return new DetailKeyGen(); } + public ArrayList getDetails() { return _details; } + public void setDetails(final ArrayList array) { _details = array; } + public void addDetail(final DetailKeyGen detail) { + _details.add(detail); + detail.setMaster(this); + } + public DetailKeyGen findDetail(final int id) { + Iterator enumeration; + DetailKeyGen detail; + + enumeration = _details.iterator(); + while (enumeration.hasNext()) { + detail = (DetailKeyGen) enumeration.next(); + if (detail.getId() == id) { return detail; } + } + return null; + } + + public String toString() { + String details = ""; + + for (int i = 0; i < _details.size(); ++i) { + if (i > 0) { details = details + ", "; } + details = details + _details.get(i).toString(); + } + return _id + " / " + _value + " (" + _group + ") { " + details + " }"; + } + + public void jdoSetTimeStamp(final long timeStamp) { _timeStamp = timeStamp; } + public long jdoGetTimeStamp() { return _timeStamp; } +} Index: tests/ctf/jdo/tc2x/MaxExtends.java =================================================================== RCS file: tests/ctf/jdo/tc2x/MaxExtends.java diff -N tests/ctf/jdo/tc2x/MaxExtends.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/MaxExtends.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,67 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestMaxExtends.java,v 1.1.1.1 2003/03/03 07:10:13 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test "extends" relation for MAX key generator. + */ +public final class MaxExtends extends MaxObject { + public static final String DEFAULT_EXT = "ext"; + + private String _ext; + + public MaxExtends() { + super(); + _ext = DEFAULT_EXT; + } + + public void setExt(final String ext) { _ext = ext; } + public String getExt() { return _ext; } + + public String toString() { + return super.toString() + " / " + _ext; + } +} Index: tests/ctf/jdo/tc2x/MaxObject.java =================================================================== RCS file: tests/ctf/jdo/tc2x/MaxObject.java diff -N tests/ctf/jdo/tc2x/MaxObject.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/MaxObject.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,66 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestMaxObject.java,v 1.1.1.1 2003/03/03 07:10:14 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object for MAX key generator. + */ +public class MaxObject extends AbstractKeyGenObject { + public static final String DEFAULT_ATTR = "attr"; + + private String _attr; + + public MaxObject() { + _attr = DEFAULT_ATTR; + } + + public final void setAttr(final String attr) { _attr = attr; } + public final String getAttr() { return _attr; } + + public String toString() { + return super.toString() + " / " + _attr; + } +} Index: tests/ctf/jdo/tc2x/ReturningExtends.java =================================================================== RCS file: tests/ctf/jdo/tc2x/ReturningExtends.java diff -N tests/ctf/jdo/tc2x/ReturningExtends.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/ReturningExtends.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,67 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestReturningExtends.java,v 1.1.1.1 2003/03/03 07:10:15 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test "extends" relation for RETURNING key generator. + */ +public final class ReturningExtends extends ReturningObject { + public static final String DFEAULT_EXT = "ext"; + + private String _ext; + + public ReturningExtends() { + super(); + _ext = DFEAULT_EXT; + } + + public void setExt(final String ext) { _ext = ext; } + public String getExt() { return _ext; } + + public String toString() { + return super.toString() + " / " + _ext; + } +} Index: tests/ctf/jdo/tc2x/ReturningObject.java =================================================================== RCS file: tests/ctf/jdo/tc2x/ReturningObject.java diff -N tests/ctf/jdo/tc2x/ReturningObject.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/ReturningObject.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,66 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestReturningObject.java,v 1.1.1.1 2003/03/03 07:10:15 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object for RETURNING key generator. + */ +public class ReturningObject extends AbstractKeyGenObject { + public static final String DEFAULT_ATTR = "attr"; + + private String _attr; + + public ReturningObject() { + _attr = DEFAULT_ATTR; + } + + public final void setAttr(final String attr) { _attr = attr; } + public final String getAttr() { return _attr; } + + public String toString() { + return super.toString() + " / " + _attr; + } +} Index: tests/ctf/jdo/tc2x/SequenceExtends.java =================================================================== RCS file: tests/ctf/jdo/tc2x/SequenceExtends.java diff -N tests/ctf/jdo/tc2x/SequenceExtends.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/SequenceExtends.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,67 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestSequenceExtends.java,v 1.1.1.1 2003/03/03 07:10:15 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test "extends" relation for SEQUENCE key generator. + */ +public final class SequenceExtends extends SequenceObject { + public static final String DEFAULT_EXT = "ext"; + + private String _ext; + + public SequenceExtends() { + super(); + _ext = DEFAULT_EXT; + } + + public void setExt(final String ext) { _ext = ext; } + public String getExt() { return _ext; } + + public String toString() { + return super.toString() + " / " + _ext; + } +} Index: tests/ctf/jdo/tc2x/SequenceObject.java =================================================================== RCS file: tests/ctf/jdo/tc2x/SequenceObject.java diff -N tests/ctf/jdo/tc2x/SequenceObject.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/SequenceObject.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,66 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestSequenceObject.java,v 1.1.1.1 2003/03/03 07:10:15 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object for SEQUENCE key generator. + */ +public class SequenceObject extends AbstractKeyGenObject { + public static final String DEFAULT_ATTR = "attr"; + + private String _attr; + + public SequenceObject() { + _attr = DEFAULT_ATTR; + } + + public final void setAttr(final String attr) { _attr = attr; } + public final String getAttr() { return _attr; } + + public String toString() { + return super.toString() + " / " + _attr; + } +} Index: tests/ctf/jdo/tc2x/TestDependent.java =================================================================== RCS file: tests/ctf/jdo/tc2x/TestDependent.java diff -N tests/ctf/jdo/tc2x/TestDependent.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/TestDependent.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,315 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: Dependent.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ + */ + +package ctf.jdo.tc2x; + +import harness.TestHarness; +import harness.CastorTestCase; + +import jdo.JDOCategory; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.exolab.castor.jdo.Database; +import org.exolab.castor.jdo.QueryResults; +import org.exolab.castor.jdo.OQLQuery; +import org.exolab.castor.jdo.PersistenceException; + +/** + * Test for dependent relationship between data objects. + * A dependent object life cycle rely on its master object. + * For example, if the master object is deleted, it will + * be deleted by Castor as well. If the dependent object + * is dereferenced, it will be removed from the database. + */ +public final class TestDependent extends CastorTestCase { + private static final Log LOG = LogFactory.getLog(TestDependent.class); + + private JDOCategory _category; + private Database _db; + + /** + * Constructor + * + * @param category + * The test suite for these tests + */ + public TestDependent(final TestHarness category) { + super(category, "TC25", "Dependent objects tests"); + _category = (JDOCategory) category; + } + + /** + * Get a JDO database + */ + public void setUp() throws PersistenceException { + _db = _category.getDatabase(); + } + + public void runTest() throws PersistenceException { + delete(); + create(); + change(); + } + + public void tearDown() throws PersistenceException { + if (_db.isActive()) { _db.rollback(); } + _db.close(); + } + + private void delete() throws PersistenceException { + OQLQuery oql; + QueryResults qres; + int cnt; + + LOG.debug("Delete everything"); + _db.begin(); + oql = _db.getOQLQuery( + "SELECT master FROM " + Master.class.getName() + " master"); + qres = oql.execute(); + + for (cnt = 0; qres.hasMore(); cnt++) { + _db.remove(qres.next()); + } + oql.close(); + LOG.debug("Deleting " + cnt + " master objects"); + + oql = _db.getOQLQuery("SELECT group FROM " + Group.class.getName() + " group"); + qres = oql.execute(); + for (cnt = 0; qres.hasMore(); cnt++) { + _db.remove(qres.nextElement()); + } + oql.close(); + LOG.debug("Deleting " + cnt + " group objects"); + _db.commit(); + } + + private void create() throws PersistenceException { + Master master; + Detail detail; + Group group; + + LOG.debug("Attempt to create master with details"); + _db.begin(); + master = new Master(); + master.addDetail(new Detail(5)); + detail = new Detail(6); + detail.addDetail2(new Detail2()); + detail.addDetail2(new Detail2()); + master.addDetail(detail); + detail = new Detail(7); + detail.setDetail3(new Detail3(101)); + detail.addDetail2(new Detail2()); + detail.addDetail2(new Detail2()); + master.addDetail(detail); + group = new Group(); + _db.create(group); + master.setGroup(group); + _db.create(master); + _db.commit(); + + _db.begin(); + master = (Master) _db.load(Master.class, + new Integer(Master.DEFAULT_ID)); + if (master != null) { + if (master.getGroup() == null) { + LOG.error("loaded master without group: " + master); + fail("loaded master without group: " + master); + } else if (master.getGroup().getId() != Group.DEFAULT_ID) { + LOG.error("loaded master with wrong group: " + master); + fail("loaded master with wrong group: " + master); + } + if (master.getDetails() == null + || !master.getDetails().contains(new Detail(5)) + || !master.getDetails().contains(new Detail(6)) + || !master.getDetails().contains(new Detail(7))) { + LOG.error("loaded master without three details: " + master); + fail("loaded master without three details: " + master); + } + detail = master.findDetail(5); + if (detail.getDetails2() != null + && detail.getDetails2().size() != 0) { + LOG.error("loaded detail 5 with details2: " + detail); + fail("loaded detail 5 with details2: " + detail); + } + detail = master.findDetail(6); + if (detail.getDetails2() == null + || detail.getDetails2().size() != 2) { + LOG.error("loaded detail 6 without two details: " + detail); + fail("loaded detail 6 without two details: " + detail); + } + detail = master.findDetail(7); + if (detail.getDetails2() == null + || detail.getDetails2().size() != 2) { + LOG.error("loaded detail 7 without two details: " + detail); + fail("loaded detail 7 without two details: " + detail); + } + if (detail.getDetail3() == null + || detail.getDetail3().getId() != 101) { + LOG.error("loaded detail 6 wrong detail3: " + detail); + fail("loaded detail 7 wrong detail3: " + detail); + } + } else { + LOG.error("failed to create master with details and group"); + fail("failed to create master with details and group"); + } + LOG.debug("Created master with details: " + master); + _db.commit(); + } + + private void change() throws PersistenceException { + Master master; + Detail detail; + OQLQuery oql; + QueryResults qres; + + LOG.debug("Attempt to change details"); + _db.begin(); + master = (Master) _db.load(Master.class, + new Integer(Master.DEFAULT_ID)); + if (master == null) { + LOG.error("failed to find master with details group"); + fail("failed to find master with details group"); + } + // remove detail with id == 5 + master.getDetails().remove(master.getDetails().indexOf(master.findDetail(5))); + // remove detail with id == 6 explicitly + detail = master.findDetail(6); + master.getDetails().remove(master.getDetails().indexOf(detail)); + detail = master.findDetail(7); + detail.setDetail3(new Detail3(102)); + // add new detail + master.addDetail(new Detail(8)); + // add new detail and create it explicitely + detail = new Detail(9); + master.addDetail(detail); + // delete, then create detail with id == 7 explicitly + detail = master.findDetail(7); + master.getDetails().remove(master.getDetails().indexOf(detail)); + master.addDetail(detail); + _db.commit(); + + _db.begin(); + master = (Master) _db.load(Master.class, + new Integer(Master.DEFAULT_ID)); + if (master != null) { + if (master.getDetails().size() == 0 + || master.getDetails().contains(new Detail(5)) + || master.getDetails().contains(new Detail(6)) + || !master.getDetails().contains(new Detail(7)) + || !master.getDetails().contains(new Detail(8)) + || !master.getDetails().contains(new Detail(9))) { + LOG.error("loaded master has wrong set of details: " + master); + fail("loaded master has wrong set of details: " + master); + } else { + LOG.debug("Details changed correctly: " + master); + } + detail = master.findDetail(7); + if (detail.getDetail3() == null + || detail.getDetail3().getId() != 102) { + LOG.error("loaded detail y wrong detail3: " + detail); + fail("loaded detail 7 wrong detail3: " + detail); + } + } else { + LOG.error("master not found"); + fail("master not found"); + } + _db.commit(); + + LOG.debug("Test OQL query"); + _db.begin(); + oql = _db.getOQLQuery("SELECT master FROM " + Master.class.getName() + + " master WHERE master.details.value1=$1"); + oql.bind(Detail.DEFAULT_VALUE); + qres = oql.execute(); + if (qres.hasMore()) { + LOG.debug("OK: correct result of query 1 "); + } else { + LOG.error("incorrect result of query 1 "); + fail("incorrect result of query 1"); + } + oql.bind(Detail.DEFAULT_VALUE + "*"); + qres = oql.execute(); + if (qres.hasMore()) { + LOG.error("incorrect result of query 2 "); + fail("incorrect result of query 2"); + } else { + LOG.debug("OK: correct result of query 2 "); + } + oql.close(); + oql = _db.getOQLQuery("SELECT master FROM " + Master.class.getName() + + " master WHERE master.details.details2.value1=$1"); + oql.bind(Detail2.DEFAULT_VALUE); + qres = oql.execute(); + if (qres.hasMore()) { + LOG.debug("OK: correct result of query 3 "); + } else { + LOG.error("incorrect result of query 3 "); + fail("incorrect result of query 3"); + } + oql.bind(Detail2.DEFAULT_VALUE + "*"); + qres = oql.execute(); + if (qres.hasMore()) { + LOG.error("incorrect result of query 4 "); + fail("incorrect result of query 4"); + } else { + LOG.debug("OK: correct result of query 4 "); + } + oql.close(); + oql = _db.getOQLQuery("SELECT master FROM " + Master.class.getName() + + " master WHERE master.group=$1"); + oql.bind(Group.DEFAULT_ID); + qres = oql.execute(); + if (qres.hasMore()) { + LOG.debug("OK: correct result of query 5 "); + } else { + LOG.error("incorrect result of query 5 "); + fail("incorrect result of query 5"); + } + oql.close(); + _db.commit(); + } +} Index: tests/ctf/jdo/tc2x/TestDependentKeyGen.java =================================================================== RCS file: tests/ctf/jdo/tc2x/TestDependentKeyGen.java diff -N tests/ctf/jdo/tc2x/TestDependentKeyGen.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/TestDependentKeyGen.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,339 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 2001 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: DependentKeyGen.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ + */ + +package ctf.jdo.tc2x; + +import harness.TestHarness; +import harness.CastorTestCase; + +import jdo.JDOCategory; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.exolab.castor.jdo.Database; +import org.exolab.castor.jdo.QueryResults; +import org.exolab.castor.jdo.OQLQuery; +import org.exolab.castor.jdo.PersistenceException; + +/** + * Test for dependent relationship between data objects. + * A dependent object life cycle rely on its master object. + * For example, if the master object is deleted, it will + * be deleted by Castor as well. If the dependent object + * is dereferenced, it will be removed from the database. + */ +public final class TestDependentKeyGen extends CastorTestCase { + private static final Log LOG = LogFactory.getLog(TestDependentKeyGen.class); + + private JDOCategory _category; + private Database _db; + private int _masterId, _detailId5, _detailId6, _detailId7; + + /** + * Constructor + * + * @param category The test suite for these tests + */ + public TestDependentKeyGen(final TestHarness category) { + super(category, "TC26", "Dependent objects tests"); + _category = (JDOCategory) category; + } + + /** + * Get a JDO database + */ + public void setUp() throws PersistenceException { + _db = _category.getDatabase(); + } + + public void runTest() throws PersistenceException { + delete(); + create(); + change(); + } + + public void tearDown() throws PersistenceException { + if (_db.isActive()) { _db.rollback(); } + _db.close(); + } + + private void delete() throws PersistenceException { + OQLQuery oql; + QueryResults qres; + int cnt; + + LOG.debug("Delete everything"); + _db.begin(); + oql = _db.getOQLQuery( + "SELECT master FROM " + MasterKeyGen.class.getName() + " master"); + qres = oql.execute(); + + for (cnt = 0; qres.hasMore(); cnt++) { + _db.remove(qres.next()); + } + oql.close(); + LOG.debug("Deleting " + cnt + " master objects"); + + oql = _db.getOQLQuery("SELECT group FROM " + Group.class.getName() + " group"); + qres = oql.execute(); + for (cnt = 0; qres.hasMore(); cnt++) { + _db.remove(qres.nextElement()); + } + oql.close(); + LOG.debug("Deleting " + cnt + " group objects"); + _db.commit(); + } + + private void create() throws PersistenceException { + MasterKeyGen master; + DetailKeyGen detail, detail5, detail6, detail7; + Group group; + + LOG.debug("Attempt to create master with details"); + _db.begin(); + master = new MasterKeyGen(); + detail5 = new DetailKeyGen(); + master.addDetail(detail5); + detail6 = new DetailKeyGen(); + detail6.addDetail2(new DetailKeyGen2()); + detail6.addDetail2(new DetailKeyGen2()); + master.addDetail(detail6); + detail7 = new DetailKeyGen(); + detail7.addDetail2(new DetailKeyGen2()); + detail7.addDetail2(new DetailKeyGen2()); + detail7.setDetail3(new DetailKeyGen3()); + master.addDetail(detail7); + group = new Group(); + _db.create(group); + + master.setGroup(group); + _db.create(master); + _db.commit(); + + _masterId = master.getId(); + _detailId5 = detail5.getId(); + _detailId6 = detail6.getId(); + _detailId7 = detail7.getId(); + + _db.begin(); + master = (MasterKeyGen) _db.load(MasterKeyGen.class, new Integer(_masterId)); + if (master != null) { + if (master.getGroup() == null) { + LOG.error("loaded master without group: " + master); + fail("loaded master without group: " + master); + } else if (master.getGroup().getId() != Group.DEFAULT_ID) { + LOG.error("loaded master with wrong group: " + master); + fail("loaded master with wrong group: " + master); + } + if (master.getDetails() == null + || !master.getDetails().contains( + new DetailKeyGen(_detailId5)) + || !master.getDetails().contains( + new DetailKeyGen(_detailId6)) + || !master.getDetails().contains( + new DetailKeyGen(_detailId7))) { + LOG.error("loaded master without three details: " + master); + fail("loaded master without three details: " + master); + } + detail = master.findDetail(_detailId5); + if (detail.getDetails2() != null + && detail.getDetails2().size() != 0) { + LOG.error("loaded detail 5 with details2: " + detail); + fail("loaded detail 5 with details2: " + detail); + } + if (detail.getDetail3() != null) { + LOG.error("loaded detail 5 with unexpected details3: " + detail); + fail("loaded detail 5 with unexpected details3: " + detail); + } + detail = master.findDetail(_detailId6); + if (detail.getDetails2() == null + || detail.getDetails2().size() != 2) { + LOG.error("loaded detail 6 without two details: " + detail); + fail("loaded detail 6 without two details2: " + detail); + } + if (detail.getDetail3() != null) { + LOG.error("loaded detail 6 with unexpected details3: " + detail); + fail("loaded detail 6 with unexpected details3: " + detail); + } + + detail = master.findDetail(_detailId7); + if (detail.getDetails2() == null + || detail.getDetails2().size() != 2) { + LOG.error("loaded detail 7 without two details: " + detail); + fail("loaded detail 7 without two details2: " + detail); + } + if (detail.getDetail3() == null) { + LOG.error("loaded detail 7 without the expected details3: " + detail); + fail("loaded detail 7 without the expected details3: " + detail); + } + } else { + LOG.error("failed to create master with details and group"); + fail("failed to create master with details and group"); + } + LOG.debug("Created master with details: " + master); + _db.commit(); + } + + private void change() throws PersistenceException { + MasterKeyGen master; + DetailKeyGen detail6, detail7, detail8, detail9; + int detailId8, detailId9; + OQLQuery oql; + QueryResults qres; + + LOG.debug("Attempt to change details"); + _db.begin(); + master = (MasterKeyGen) _db.load(MasterKeyGen.class, new Integer(_masterId)); + if (master == null) { + LOG.error("failed to find master with details group"); + fail("failed to find master with details group"); + } + // remove detail with id == 5 + master.getDetails().remove( + master.getDetails().indexOf(master.findDetail(_detailId5))); + // remove detail with id == 6 explicitly + detail6 = master.findDetail(_detailId6); + master.getDetails().remove(master.getDetails().indexOf(detail6)); + // add new detail + detail8 = new DetailKeyGen(); + master.addDetail(detail8); + // add new detail and create it explicitely + detail9 = new DetailKeyGen(); + master.addDetail(detail9); + // delete, then create detail with id == 7 explicitly + detail7 = master.findDetail(_detailId7); + master.getDetails().remove(master.getDetails().indexOf(detail7)); + master.addDetail(detail7); + _db.commit(); + + detailId8 = detail8.getId(); + detailId9 = detail9.getId(); + + _db.begin(); + master = (MasterKeyGen) _db.load(MasterKeyGen.class, new Integer(_masterId)); + if (master != null) { + if (master.getDetails().size() == 0 + || master.getDetails().contains(new DetailKeyGen(_detailId5)) + || master.getDetails().contains(new DetailKeyGen(_detailId6)) + || !master.getDetails().contains(new DetailKeyGen(_detailId7)) + || !master.getDetails().contains(new DetailKeyGen(detailId8)) + || !master.getDetails().contains(new DetailKeyGen(detailId9))) { + LOG.error("loaded master has wrong set of details: " + master); + fail("loaded master has wrong set of details: " + master); + } else { + LOG.debug("Details changed correctly: " + master); + } + } else { + LOG.error("master not found"); + fail("master not found"); + } + _db.commit(); + + LOG.debug("Test OQL query"); + _db.begin(); + oql = _db.getOQLQuery("SELECT master FROM " + MasterKeyGen.class.getName() + + " master WHERE master.details.value1=$1"); + oql.bind(Detail.DEFAULT_VALUE); + qres = oql.execute(); + if (qres.hasMore()) { + LOG.debug("OK: correct result of query 1 "); + } else { + LOG.error("incorrect result of query 1 "); + fail("incorrect result of query 1"); + } + oql.bind(Detail.DEFAULT_VALUE + "*"); + qres = oql.execute(); + if (qres.hasMore()) { + LOG.error("incorrect result of query 2 "); + fail("incorrect result of query 2"); + } else { + LOG.debug("OK: correct result of query 2 "); + } + oql.close(); + oql = _db.getOQLQuery("SELECT master FROM " + MasterKeyGen.class.getName() + + " master WHERE master.details.details2.value1=$1"); + oql.bind(DetailKeyGen2.DEFAULT_VALUE); + qres = oql.execute(); + if (qres.hasMore()) { + LOG.debug("OK: correct result of query 3 "); + } else { + LOG.error("incorrect result of query 3 "); + fail("incorrect result of query 3"); + } + oql.bind(DetailKeyGen2.DEFAULT_VALUE + "*"); + qres = oql.execute(); + if (qres.hasMore()) { + LOG.error("incorrect result of query 4 "); + fail("incorrect result of query 4"); + } else { + LOG.debug("OK: correct result of query 4 "); + } + oql.close(); + oql = _db.getOQLQuery("SELECT master FROM " + MasterKeyGen.class.getName() + + " master WHERE master.group=$1"); + oql.bind(Group.DEFAULT_ID); + qres = oql.execute(); + if (qres.hasMore()) { + LOG.debug("OK: correct result of query 5 "); + } else { + LOG.error("incorrect result of query 5 "); + fail("incorrect result of query 5"); + } + oql.close(); + _db.commit(); + + LOG.debug("Test rollback"); + _db.begin(); + master = (MasterKeyGen) _db.load(MasterKeyGen.class, new Integer(_masterId)); + int detailsCount = master.getDetails().size(); + _db.rollback(); + if (detailsCount != master.getDetails().size()) { + LOG.error((master.getDetails().size() - detailsCount) + + " details added in rollback"); + fail("Details added in rollback"); + } + } +} Index: tests/ctf/jdo/tc2x/TestDependentKeyGenUpdate.java =================================================================== RCS file: tests/ctf/jdo/tc2x/TestDependentKeyGenUpdate.java diff -N tests/ctf/jdo/tc2x/TestDependentKeyGenUpdate.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/TestDependentKeyGenUpdate.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,450 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999-2001 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: DependentKeyGenUpdate.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ + */ + +package ctf.jdo.tc2x; + +import java.sql.Connection; +import java.sql.SQLException; + +import harness.TestHarness; +import harness.CastorTestCase; + +import jdo.JDOCategory; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.exolab.castor.jdo.Database; +import org.exolab.castor.jdo.QueryResults; +import org.exolab.castor.jdo.OQLQuery; +import org.exolab.castor.jdo.PersistenceException; +import org.exolab.castor.jdo.ObjectModifiedException; + +/** + * Test for dependent relationship between data objects for + * long transaction. A dependent object life cycle rely on + * its master object. For example, if the master object is + * deleted, it will be deleted by Castor as well. If the + * dependent object is dereferenced, it will be removed from + * the database. + */ +public final class TestDependentKeyGenUpdate extends CastorTestCase { + private static final Log LOG = LogFactory.getLog(TestDependent.class); + + private Connection _conn; + private JDOCategory _category; + private Database _db; + private int _masterId, _detailIdA, _detailId2, _detailId3, _detailId5; + private int _detailId6, _detailId7, _detailId8, _detailId9; + + public TestDependentKeyGenUpdate(final TestHarness category) { + super(category, "TC28", "Dependent update objects tests"); + _category = (JDOCategory) category; + } + + public void setUp() throws PersistenceException, SQLException { + _db = _category.getDatabase(); + _conn = _category.getJDBCConnection(); + _conn.setAutoCommit(false); + } + + public void runTest() throws PersistenceException, SQLException { + delete(); + create(); + change(); + update(); + test(); + } + + public void tearDown() throws PersistenceException, SQLException { + if (_db.isActive()) { _db.rollback(); } + _db.close(); + _conn.close(); + } + + private void delete() throws PersistenceException { + OQLQuery oql; + QueryResults qres; + int cnt; + + LOG.debug("Delete everything"); + _db.begin(); + oql = _db.getOQLQuery( + "SELECT master FROM " + MasterKeyGen.class.getName() + " master"); + qres = oql.execute(); + + for (cnt = 0; qres.hasMore(); cnt++) { + _db.remove(qres.next()); + } + LOG.debug("Deleting " + cnt + " master objects"); + + oql = _db.getOQLQuery("SELECT group FROM " + Group.class.getName() + " group"); + qres = oql.execute(); + for (cnt = 0; qres.hasMore(); cnt++) { + _db.remove(qres.nextElement()); + } + LOG.debug("Deleting " + cnt + " group objects"); + _db.commit(); + } + + private void create() throws PersistenceException { + MasterKeyGen master; + DetailKeyGen3 detail3; + DetailKeyGen detail5, detail6, detail7; + Group group; + + LOG.debug("Attempt to create master with details"); + _db.begin(); + master = new MasterKeyGen(); + detail5 = new DetailKeyGen(); + master.addDetail(detail5); + detail6 = new DetailKeyGen(); + detail6.addDetail2(new DetailKeyGen2()); + detail6.addDetail2(new DetailKeyGen2()); + detail3 = new DetailKeyGen3(101); + detail6.setDetail3(detail3); + master.addDetail(detail6); + detail7 = new DetailKeyGen(); + detail7.addDetail2(new DetailKeyGen2()); + detail7.addDetail2(new DetailKeyGen2()); + master.addDetail(detail7); + group = new Group(); + _db.create(group); + master.setGroup(group); + _db.create(master); + _db.commit(); + + _masterId = master.getId(); + _detailId5 = detail5.getId(); + _detailId6 = detail6.getId(); + _detailId7 = detail7.getId(); + _detailId3 = detail3.getId(); + + _db.begin(); + master = (MasterKeyGen) _db.load(MasterKeyGen.class, new Integer(_masterId)); + if (master != null) { + if (master.getGroup() == null) { + LOG.error("loaded master without group: " + master); + fail("expecting group"); + } else if (master.getGroup().getId() != Group.DEFAULT_ID) { + LOG.error("loaded master with wrong group: " + master); + fail("incorrect group" + master); + } + if (master.getDetails() == null + || !master.getDetails().contains(new DetailKeyGen(_detailId5)) + || !master.getDetails().contains(new DetailKeyGen(_detailId6)) + || !master.getDetails().contains(new DetailKeyGen(_detailId7))) { + LOG.error("loaded master without three details: " + master); + fail("incorrect detail(s)" + master + " expecting: " + + _detailId5 + "," + _detailId6 + "," + _detailId7); + } + detail5 = master.findDetail(_detailId5); + if (detail5.getDetails2() != null + && detail5.getDetails2().size() != 0) { + LOG.error("loaded detail 5 with details2: " + detail5); + fail("unexpected element found"); + } + detail6 = master.findDetail(_detailId6); + if (detail6.getDetails2() == null + || detail6.getDetails2().size() != 2) { + LOG.error("loaded detail 6 without two details: " + detail6); + fail("details' size mismatch"); + } + if (detail6.getDetail3() == null + || detail6.getDetail3().getId() != _detailId3) { + LOG.error("loaded detail 6 with wrong detail3: " + detail6); + fail("loaded detail 6 with wrong detail3: " + detail6); + } + detail7 = master.findDetail(_detailId7); + if (detail7.getDetails2() == null + || detail7.getDetails2().size() != 2) { + LOG.error("loaded detail 7 without two details: " + detail7); + fail("details' size mismatch"); + } + } else { + LOG.error("failed to create master with details and group"); + fail("failed to create master with details and group"); + } + _db.commit(); + LOG.debug("Created master with details: " + master); + } + + private void change() throws PersistenceException, SQLException { + MasterKeyGen master; + DetailKeyGen3 detail3; + DetailKeyGen detail6, detail8, detail9; + + LOG.debug("Attempt to change details"); + _db.begin(); + master = (MasterKeyGen) _db.load(MasterKeyGen.class, new Integer(_masterId)); + if (master == null) { + LOG.error("failed to find master with details group"); + fail("master not found"); + } + // remove detail with id == 5 + master.getDetails().remove( + master.getDetails().indexOf(master.findDetail(_detailId5))); + // add new detail + detail8 = new DetailKeyGen(); + master.addDetail(detail8); + // add new detail and create it explicitely + detail9 = new DetailKeyGen(); + master.addDetail(detail9); + detail6 = master.findDetail(_detailId6); + // change 1:1 dependent relationship + detail3 = new DetailKeyGen3(); + detail6.setDetail3(detail3); + _db.commit(); + + _detailId8 = detail8.getId(); + _detailId9 = detail9.getId(); + _detailId3 = detail3.getId(); + + _db.begin(); + master = (MasterKeyGen) _db.load(MasterKeyGen.class, new Integer(_masterId)); + if (master != null) { + if (master.getDetails().size() == 0 + || master.getDetails().contains(new DetailKeyGen(_detailId5)) + || !master.getDetails().contains(new DetailKeyGen(_detailId6)) + || master.findDetail(_detailId6).getDetails2() == null + || master.findDetail(_detailId6).getDetails2().size() != 2 + || master.findDetail(_detailId6).getDetail3() == null + || master.findDetail(_detailId6).getDetail3().getId() != _detailId3 + || !master.getDetails().contains(new DetailKeyGen(_detailId7)) + || !master.getDetails().contains(new DetailKeyGen(_detailId8)) + || !master.getDetails().contains(new DetailKeyGen(_detailId9))) { + LOG.error("loaded master has wrong set of details: " + master); + fail("loaded master has wrong set of details: " + master); + } else { + LOG.debug("Details changed correctly: " + master); + } + } else { + LOG.error("master not found"); + fail("master not found"); + } + _db.commit(); + } + + private void update() throws PersistenceException, SQLException { + MasterKeyGen master, master2; + DetailKeyGen detailA; + DetailKeyGen2 detail2; + + LOG.debug("Test long transaction with dirty checking"); + _db.begin(); + master = (MasterKeyGen) _db.load(MasterKeyGen.class, new Integer(_masterId)); + if (master == null) { + LOG.error("failed to find master with details group"); + fail("master not found"); + } + _db.commit(); + _db.begin(); + master2 = (MasterKeyGen) _db.load(MasterKeyGen.class, new Integer(_masterId)); + master2.setValue1(master2.getValue1() + "2"); + _db.commit(); + + LOG.debug("Test 1"); + try { + _db.begin(); + _db.update(master); + _db.commit(); + LOG.error("Dirty checking doesn't work"); + fail("dirty check failed"); + } catch (ObjectModifiedException exept) { + _db.rollback(); + LOG.debug("OK: Dirty checking works"); + } + + LOG.debug("Test 2"); + detailA = new DetailKeyGen(); + detail2 = new DetailKeyGen2(); + detailA.addDetail2(detail2); + master2.addDetail(detailA); + master2.getDetails().remove(new DetailKeyGen(_detailId8)); + master2.getDetails().remove(new DetailKeyGen(_detailId9)); + try { + _db.begin(); + _db.update(master2); + _db.commit(); + LOG.debug("OK: Dirty checking works"); + } catch (ObjectModifiedException exept) { + _db.rollback(); + LOG.error("Dirty checking doesn't work"); + fail("dirty check failed"); + } + + _detailIdA = detailA.getId(); + _detailId2 = detail2.getId(); + + LOG.debug("Test 3"); + _conn.createStatement().execute( + "UPDATE tc2x_master SET value1='concurrent' WHERE id=" + master2.getId()); + _conn.commit(); + master2.setValue1("long transaction new value"); + try { + _db.begin(); + _db.update(master2); + _db.commit(); + LOG.error("Dirty checking doesn't work"); + fail("dirty check failed"); + } catch (ObjectModifiedException except) { + if (_db.isActive()) { _db.rollback(); } + LOG.debug("OK: Dirty checking works"); + } + } + + private void test() throws PersistenceException, SQLException { + MasterKeyGen master; + DetailKeyGen detailA; + DetailKeyGen3 detail3; + DetailKeyGen detail6; + + LOG.debug("Test 4"); + _db.begin(); + master = (MasterKeyGen) _db.load(MasterKeyGen.class, new Integer(_masterId)); + if (master != null) { + if (master.getDetails().size() == 0 + || !master.getDetails().contains(new DetailKeyGen(_detailIdA)) + || master.findDetail(_detailIdA).findDetail2(_detailId2) == null + || !master.getDetails().contains(new DetailKeyGen(_detailId6)) + || master.findDetail(_detailId6).getDetails2() == null + || master.findDetail(_detailId6).getDetails2().size() != 2 + || !master.getDetails().contains(new DetailKeyGen(_detailId7)) + || master.getDetails().contains(new DetailKeyGen(_detailId8)) + || master.getDetails().contains(new DetailKeyGen(_detailId9))) { + LOG.error("loaded master has wrong set of details: " + master); + fail("unexpect set of details"); + } else { + LOG.debug("Details changed correctly in the long transaction: " + master); + } + } else { + LOG.error("master not found"); + fail("master not found"); + } + _db.commit(); + + // modify an dependent object and see if it got updated + LOG.debug("Test 5"); + detailA = master.findDetail(_detailIdA); + detailA.setValue1("new updated value"); + detailA.findDetail2(_detailId2).setValue1("new detail 2 value"); + detail3 = new DetailKeyGen3(); + detailA.setDetail3(detail3); + detail6 = master.findDetail(_detailId6); + detail6.getDetails2().clear(); + + _db.begin(); + _db.update(master); + _db.commit(); + _detailId3 = detail3.getId(); + + _db.begin(); + master = (MasterKeyGen) _db.load(MasterKeyGen.class, new Integer(_masterId)); + if (master != null) { + if (master.getDetails() == null + || master.getDetails().size() == 0 + || !master.getDetails().contains(new DetailKeyGen(_detailIdA)) + || master.findDetail(_detailIdA).getDetail3() == null + || master.findDetail(_detailIdA).getDetail3().getId() != _detailId3 + || !master.getDetails().contains(new DetailKeyGen(_detailId6)) + || master.findDetail(_detailId6).getDetails2().size() != 0 + || master.findDetail(_detailId6).getDetail3() == null + || !master.getDetails().contains(new DetailKeyGen(_detailId7)) + || master.getDetails().contains(new DetailKeyGen(_detailId8)) + || master.getDetails().contains(new DetailKeyGen(_detailId9)) + || !"new updated value".equals(master + .findDetail(_detailIdA).getValue1()) + || master.findDetail(_detailIdA).findDetail2(_detailId2) == null + || !"new detail 2 value".equals(master + .findDetail(_detailIdA).findDetail2(_detailId2).getValue1())) { + LOG.error("loaded master has wrong set of details: " + master); + fail("unexpected set of details"); + } else { + LOG.debug("Details changed correctly in the long transaction: " + master); + } + } else { + LOG.error("master not found"); + fail("master not found"); + } + _db.commit(); + + // test unsetting one-one relationship + detail6 = master.findDetail(_detailId6); + detail6.setDetail3(null); + _db.begin(); + _db.update(master); + _db.commit(); + + _db.begin(); + master = (MasterKeyGen) _db.load(MasterKeyGen.class, new Integer(_masterId)); + if (master != null) { + if (master.getDetails() == null + || master.getDetails().size() == 0 + || !master.getDetails().contains(new DetailKeyGen(_detailIdA)) + || master.findDetail(_detailIdA).getDetail3() == null + || master.findDetail(_detailIdA).getDetail3().getId() != _detailId3 + || !master.getDetails().contains(new DetailKeyGen(_detailId6)) + || master.findDetail(_detailId6).getDetails2().size() != 0 + || master.findDetail(_detailId6).getDetail3() != null + || !master.getDetails().contains(new DetailKeyGen(_detailId7)) + || master.getDetails().contains(new DetailKeyGen(_detailId8)) + || master.getDetails().contains(new DetailKeyGen(_detailId9)) + || !"new updated value".equals(master + .findDetail(_detailIdA).getValue1()) + || master.findDetail(_detailIdA).findDetail2(_detailId2) == null + || !"new detail 2 value".equals(master + .findDetail(_detailIdA).findDetail2(_detailId2).getValue1())) { + LOG.error("loaded master has wrong set of details: " + master); + fail("unexpected set of details"); + } else { + LOG.debug("Details changed correctly in the long transaction: " + master); + } + } else { + LOG.error("master not found"); + fail("master not found"); + } + _db.commit(); + } +} Index: tests/ctf/jdo/tc2x/TestDependentOrder.java =================================================================== RCS file: tests/ctf/jdo/tc2x/TestDependentOrder.java diff -N tests/ctf/jdo/tc2x/TestDependentOrder.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/TestDependentOrder.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,160 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: DependentOrder.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ + */ + +package ctf.jdo.tc2x; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +import harness.TestHarness; +import harness.CastorTestCase; + +import jdo.JDOCategory; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.exolab.castor.jdo.Database; +import org.exolab.castor.jdo.PersistenceException; + +public final class TestDependentOrder extends CastorTestCase { + private static final Log LOG = LogFactory.getLog(TestDependentOrder.class); + + private JDOCategory _category; + private Database _db; + private Connection _conn; + + /** + * Constructor + * @param category The test suite for these tests + */ + public TestDependentOrder(final TestHarness category) { + super(category, "TC29", "Dependent object order using key-gen"); + _category = (JDOCategory) category; + } + + /** + * Get a JDO database + */ + public void setUp() + throws PersistenceException, SQLException { + _db = _category.getDatabase(); + _conn = _category.getJDBCConnection(); + _conn.setAutoCommit(false); + + LOG.debug("Delete everything"); + Statement stmt = _conn.createStatement(); + stmt.executeUpdate("delete from tc2x_depend2"); + stmt.executeUpdate("delete from tc2x_depend_master"); + stmt.executeUpdate("delete from tc2x_depend1"); + _conn.commit(); + } + + public void runTest() throws PersistenceException { + _db.begin(); + + LOG.debug("Build master object and its dependent objects"); + + // no ids needed, they come from the key-gen + DependMaster master = new DependMaster(); + Depend1 depend1 = new Depend1(); + master.setDepend1(depend1); + Depend2 depend2 = new Depend2(); + master.addDepend2(depend2); + + LOG.debug("Create object tree in db"); + _db.create(master); + _db.commit(); + LOG.debug("depend1_id after creation : " + master.getDepend1().getId()); + + _db.begin(); + try { + LOG.debug("read depend1_id from db"); + PreparedStatement pstmt = _conn.prepareStatement( + "select depend1_id from tc2x_depend_master where id=?"); + LOG.debug("master id: " + master.getId()); + pstmt.setInt(1, master.getId()); + pstmt.execute(); + ResultSet result = pstmt.getResultSet(); + if (!result.next()) { + LOG.error("Master object not created"); + fail("Master object not created"); + } + + LOG.debug("depend1_id in db : " + result.getInt("depend1_id")); + + if (result.getInt("depend1_id") == 0) { + LOG.error("Depend1 object not linked to Master object"); + fail("Depend1 object not linked to Master object"); + } + } catch (SQLException e) { + LOG.error("Exception when checking master object row", e); + fail("Exception when checking master object row: " + e); + } + + _db.commit(); + + // test for bug 973 Dependent objects deletion order problem + try { + LOG.debug("Deleting master object"); + _db.begin(); + master = (DependMaster) _db.load( + DependMaster.class, new Integer(master.getId())); + _db.remove(master); + _db.commit(); + } catch (Exception e) { + LOG.error("Exception thrown", e); + fail("Exception thrown " + e); + } + } + + public void tearDown() throws PersistenceException { + if (_db.isActive()) { _db.rollback(); } + _db.close(); + } +} Index: tests/ctf/jdo/tc2x/TestDependentUpdate.java =================================================================== RCS file: tests/ctf/jdo/tc2x/TestDependentUpdate.java diff -N tests/ctf/jdo/tc2x/TestDependentUpdate.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/TestDependentUpdate.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,386 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999-2001 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: DependentUpdate.java,v 1.3 2005/03/05 13:42:01 mfuchs Exp $ + */ + +package ctf.jdo.tc2x; + +import java.sql.Connection; +import java.sql.SQLException; + +import harness.TestHarness; +import harness.CastorTestCase; + +import jdo.JDOCategory; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.exolab.castor.jdo.Database; +import org.exolab.castor.jdo.QueryResults; +import org.exolab.castor.jdo.OQLQuery; +import org.exolab.castor.jdo.PersistenceException; +import org.exolab.castor.jdo.ObjectModifiedException; + +/** + * Test for dependent relationship between data objects for long transaction. A + * dependent object life cycle rely on its master object. For example, if the + * master object is deleted, it will be deleted by Castor as well. If the + * dependent object is dereferenced, it will be removed from the database. + */ +public final class TestDependentUpdate extends CastorTestCase { + private static final Log LOG = LogFactory.getLog(TestDependentUpdate.class); + + private Connection _conn; + private JDOCategory _category; + private Database _db; + + public TestDependentUpdate(final TestHarness category) { + super(category, "TC27", "Dependent update objects tests"); + _category = (JDOCategory) category; + } + + public void setUp() throws PersistenceException, SQLException { + _db = _category.getDatabase(); + _conn = _category.getJDBCConnection(); + _conn.setAutoCommit(false); + } + + public void runTest() throws PersistenceException, SQLException { + delete(); + create(); + change(); + test(); + } + + public void tearDown() throws PersistenceException, SQLException { + if (_db.isActive()) { _db.rollback(); } + _db.close(); + _conn.close(); + } + + private void delete() throws PersistenceException { + OQLQuery oql; + QueryResults qres; + int cnt; + + LOG.debug("Delete everything"); + _db.begin(); + oql = _db.getOQLQuery("SELECT master FROM " + + Master.class.getName() + " master"); + qres = oql.execute(); + + for (cnt = 0; qres.hasMore(); cnt++) { + _db.remove(qres.next()); + } + LOG.debug("Deleting " + cnt + " master objects"); + + oql = _db.getOQLQuery("SELECT group FROM " + Group.class.getName() + " group"); + qres = oql.execute(); + for (cnt = 0; qres.hasMore(); cnt++) { + _db.remove(qres.nextElement()); + } + LOG.debug("Deleting " + cnt + " group objects"); + _db.commit(); + } + + private void create() throws PersistenceException { + Master master; + Detail detail; + Group group; + + LOG.debug("Attempt to create master with details"); + _db.begin(); + master = new Master(); + master.addDetail(new Detail(5)); + detail = new Detail(6); + detail.addDetail2(new Detail2()); + detail.addDetail2(new Detail2()); + detail.setDetail3(new Detail3(101)); + master.addDetail(detail); + detail = new Detail(7); + detail.addDetail2(new Detail2()); + detail.addDetail2(new Detail2()); + master.addDetail(detail); + group = new Group(); + _db.create(group); + master.setGroup(group); + _db.create(master); + _db.commit(); + + _db.begin(); + master = (Master) _db.load(Master.class, new Integer( + Master.DEFAULT_ID)); + if (master != null) { + if (master.getGroup() == null) { + LOG.error("loaded master without group: " + master); + fail("expecting group"); + } else if (master.getGroup().getId() != Group.DEFAULT_ID) { + LOG.error("loaded master with wrong group: " + master); + fail("incorrect group"); + } + if (master.getDetails() == null + || !master.getDetails().contains(new Detail(5)) + || !master.getDetails().contains(new Detail(6)) + || !master.getDetails().contains(new Detail(7))) { + LOG.error("loaded master without three details: " + master); + fail("incorrect detail(s)"); + } + detail = master.findDetail(5); + if (detail.getDetails2() != null + && detail.getDetails2().size() != 0) { + LOG.error("loaded detail 5 with details2: " + detail); + fail("unexpected element found"); + } + detail = master.findDetail(6); + if (detail.getDetails2() == null + || detail.getDetails2().size() != 2) { + LOG.error("loaded detail 6 without two details: " + detail); + fail("details' size mismatch"); + } + if (detail.getDetail3() == null + || detail.getDetail3().getId() != 101) { + LOG.error("loaded detail 6 with wrong detail3: " + detail); + fail("loaded detail 6 with wrong detail3: " + detail); + } + detail = master.findDetail(7); + if (detail.getDetails2() == null + || detail.getDetails2().size() != 2) { + LOG.error("loaded detail 7 without two details: " + detail); + fail("details' size mismatch"); + } + } else { + LOG.error("failed to create master with details and group"); + fail("failed to create master with details and group"); + } + _db.commit(); + LOG.debug("Created master with details: " + master); + } + + private void change() throws PersistenceException, SQLException { + Master master; + Detail detail; + + LOG.debug("Attempt to change details"); + _db.begin(); + master = (Master) _db.load(Master.class, new Integer( + Master.DEFAULT_ID)); + if (master == null) { + LOG.error("failed to find master with details group"); + fail("master not found"); + } + // remove detail with id == 5 + master.getDetails().remove(master.getDetails().indexOf(master.findDetail(5))); + // add new detail + master.addDetail(new Detail(8)); + // add new detail and create it explicitely + detail = new Detail(9); + master.addDetail(detail); + detail = master.findDetail(6); + // change 1:1 dependent relationship + detail.setDetail3(new Detail3(102)); + // delete, then create detail with id == 7 explicitly + detail = master.findDetail(7); + master.getDetails().remove(master.getDetails().indexOf(detail)); + master.addDetail(detail); + _db.commit(); + + _db.begin(); + master = (Master) _db.load(Master.class, new Integer( + Master.DEFAULT_ID)); + if (master != null) { + if (master.getDetails().size() == 0 + || master.getDetails().contains(new Detail(5)) + || !master.getDetails().contains(new Detail(6)) + || master.findDetail(6).getDetails2() == null + || master.findDetail(6).getDetails2().size() != 2 + || master.findDetail(6).getDetail3() == null + || master.findDetail(6).getDetail3().getId() != 102 + || !master.getDetails().contains(new Detail(7)) + || !master.getDetails().contains(new Detail(8)) + || !master.getDetails().contains(new Detail(9))) { + LOG.error("loaded master has wrong set of details: " + master); + fail("loaded master has wrong set of details"); + } else { + LOG.debug("Details changed correctly: " + master); + } + } else { + LOG.error("master not found"); + fail("master not found"); + } + _db.commit(); + } + + private void test() throws PersistenceException, SQLException { + Master master; + Detail detail; + Master master2; + Detail2 detail2; + int detailId = 0; + + LOG.debug("Test long transaction with dirty checking"); + _db.begin(); + master = (Master) _db.load(Master.class, new Integer( + Master.DEFAULT_ID)); + if (master == null) { + LOG.error("failed to find master with details group"); + fail("master not found"); + } + _db.commit(); + _db.begin(); + master2 = (Master) _db.load(Master.class, new Integer( + Master.DEFAULT_ID)); + master2.setValue1(master2.getValue1() + "2"); + _db.commit(); + + LOG.debug("Test 1"); + try { + _db.begin(); + _db.update(master); + _db.commit(); + LOG.error("Dirty checking doesn't work"); + fail("dirty check failed"); + } catch (ObjectModifiedException exept) { + _db.rollback(); + LOG.debug("OK: Dirty checking works"); + } + + LOG.debug("Test 2"); + detail = new Detail(5); + detail2 = new Detail2(); + detail.addDetail2(detail2); + master2.addDetail(detail); + master2.getDetails().remove(new Detail(8)); + master2.getDetails().remove(new Detail(9)); + try { + _db.begin(); + _db.update(master2); + _db.commit(); + detailId = detail2.getId(); + LOG.debug("OK: Dirty checking works"); + } catch (ObjectModifiedException exept) { + _db.rollback(); + LOG.error("Dirty checking doesn't work"); + fail("dirty check failed"); + } + + LOG.debug("Test 3"); + _conn.createStatement().execute( + "UPDATE tc2x_master SET value1='concurrent' WHERE id=" + master2.getId()); + _conn.commit(); + master2.setValue1("long transaction new value"); + try { + _db.begin(); + _db.update(master2); + _db.commit(); + LOG.error("Dirty checking doesn't work"); + fail("dirty check failed"); + } catch (ObjectModifiedException except) { + if (_db.isActive()) { + _db.rollback(); + } + + LOG.debug("OK: Dirty checking works"); + } + _db.begin(); + master = (Master) _db.load(Master.class, new Integer( + Master.DEFAULT_ID)); + if (master != null) { + if (master.getDetails().size() == 0 + || !master.getDetails().contains(new Detail(5)) + || master.findDetail(5).findDetail2(detailId) == null + || !master.getDetails().contains(new Detail(6)) + || master.findDetail(6).getDetails2() == null + || master.findDetail(6).getDetails2().size() != 2 + || !master.getDetails().contains(new Detail(7)) + || master.getDetails().contains(new Detail(8)) + || master.getDetails().contains(new Detail(9))) { + LOG.error("loaded master has wrong set of details: " + master); + fail("unexpect set of details"); + } else { + LOG.debug("Details changed correctly in the long transaction: " + master); + } + } else { + LOG.error("master not found"); + fail("master not found"); + } + _db.commit(); + + // modify an dependent object and see if it got updated + LOG.debug("Test 3"); + detail = master.findDetail(5); + detail.setValue1("new updated value"); + detail.findDetail2(detailId).setValue1("new detail 2 value"); + _db.begin(); + _db.update(master); + _db.commit(); + + _db.begin(); + master = (Master) _db.load(Master.class, new Integer( + Master.DEFAULT_ID)); + if (master != null) { + if (master.getDetails() == null + || master.getDetails().size() == 0 + || !master.getDetails().contains(new Detail(5)) + || !master.getDetails().contains(new Detail(6)) + || !master.getDetails().contains(new Detail(7)) + || master.getDetails().contains(new Detail(8)) + || master.getDetails().contains(new Detail(9)) + || !"new updated value".equals(master.findDetail(5) + .getValue1()) + || master.findDetail(5).findDetail2(detailId) == null + || !"new detail 2 value".equals(master.findDetail(5) + .findDetail2(detailId).getValue1())) { + + LOG.error("loaded master has wrong set of details: " + master); + fail("unexpected set of details"); + } else { + LOG.debug("Details changed correctly in the long transaction: " + master); + } + } else { + LOG.error("master not found"); + fail("master not found"); + } + _db.commit(); + } +} Index: tests/ctf/jdo/tc2x/TestKeyGenGeneric.java =================================================================== RCS file: tests/ctf/jdo/tc2x/TestKeyGenGeneric.java diff -N tests/ctf/jdo/tc2x/TestKeyGenGeneric.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/TestKeyGenGeneric.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,164 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: KeyGenGeneric.java,v 1.5 2004/10/05 22:26:41 wguttmann Exp $ + */ + +package ctf.jdo.tc2x; + +import harness.TestHarness; +import harness.CastorTestCase; + +import jdo.JDOCategory; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.exolab.castor.jdo.Database; +import org.exolab.castor.jdo.OQLQuery; +import org.exolab.castor.jdo.QueryResults; + +/** + * Test for generic key generators (MAX and HIGH-LOW). + */ +public class TestKeyGenGeneric extends CastorTestCase { + private static final Log LOG = LogFactory.getLog(TestKeyGenGeneric.class); + + private JDOCategory _category; + private Database _db; + + public TestKeyGenGeneric(final TestHarness category) { + this(category, "TC20", "Key generators: MAX, HIGH-LOW"); + } + + public TestKeyGenGeneric(final TestHarness category, final String name, + final String description) { + + super(category, name, description); + _category = (JDOCategory) category; + } + + public final void setUp() throws Exception { + _db = _category.getDatabase(); + } + + public void runTest() throws Exception { + testOneKeyGen(MaxObject.class, MaxExtends.class); + testOneKeyGen(HighLowObject.class, HighLowExtends.class); + testOneKeyGen(HighLowObjectSameConnection.class, + HighLowExtendsSameConnection.class); + } + + public final void tearDown() throws Exception { + if (_db.isActive()) { _db.rollback(); } + _db.close(); + } + + /** + * The main goal of the test is to verify key generators in the case + * of "extends" relation between two classes. + * For each key generator we have a pair of classes: TestXXXObject and + * TestXXXExtends which use key generator XXX. + */ + protected final void testOneKeyGen(final Class objClass, final Class extClass) + throws Exception { + + OQLQuery oql; + AbstractKeyGenObject object; + AbstractKeyGenObject ext; + QueryResults enumeration; + + // Open transaction in order to perform JDO operations + _db.begin(); + + // Create first object + object = (AbstractKeyGenObject) objClass.newInstance(); + LOG.debug("Creating first object: " + object); + _db.create(object); + LOG.debug("Created first object: " + object); + + // Create second object + ext = (AbstractKeyGenObject) extClass.newInstance(); + LOG.debug("Creating second object: " + ext); + _db.create(ext); + LOG.debug("Created second object: " + ext); + + _db.commit(); + + _db.begin(); + + // Find the first object and remove it + //object = (TestKeyGenObject) _db.load( objClass, object.getId() ); + oql = _db.getOQLQuery(); + oql.create("SELECT object FROM " + objClass.getName() + + " object WHERE id = $1"); + oql.bind(object.getId()); + enumeration = oql.execute(); + LOG.debug("Removing first object: " + object); + if (enumeration.hasMore()) { + object = (AbstractKeyGenObject) enumeration.next(); + _db.remove(object); + LOG.debug("OK: Removed"); + } else { + LOG.error("first object not found"); + fail("first object not found"); + } + + // Find the second object and remove it + //ext = (TestKeyGenObject) _db.load( extClass, ext.getId() ); + oql = _db.getOQLQuery(); + oql.create("SELECT ext FROM " + extClass.getName() + + " ext WHERE id = $1"); + oql.bind(ext.getId()); + enumeration = oql.execute(); + LOG.debug("Removing second object: " + ext); + if (enumeration.hasMore()) { + ext = (AbstractKeyGenObject) enumeration.next(); + _db.remove(ext); + LOG.debug("OK: Removed"); + } else { + LOG.error("second object not found"); + fail("second object not found"); + } + + _db.commit(); + } +} Index: tests/ctf/jdo/tc2x/TestKeyGenIdentity.java =================================================================== RCS file: tests/ctf/jdo/tc2x/TestKeyGenIdentity.java diff -N tests/ctf/jdo/tc2x/TestKeyGenIdentity.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/TestKeyGenIdentity.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,63 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: KeyGenIdentity.java,v 1.2 2004/06/08 10:15:59 wguttmann Exp $ + */ + +package ctf.jdo.tc2x; + +import harness.TestHarness; + +/** + * Test for IDENTITY key generator. An IDENTITY key generator + * make uses of the RDBMS auto - increment features to generate + * a primary key for a newly created object. + */ +public final class TestKeyGenIdentity extends TestKeyGenGeneric { + public TestKeyGenIdentity(final TestHarness category) { + super(category, "TC23", "Key generator: IDENTITY"); + } + + public void runTest() throws Exception { + testOneKeyGen(IdentityObject.class, IdentityExtends.class); + } +} Index: tests/ctf/jdo/tc2x/TestKeyGenReturning.java =================================================================== RCS file: tests/ctf/jdo/tc2x/TestKeyGenReturning.java diff -N tests/ctf/jdo/tc2x/TestKeyGenReturning.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/TestKeyGenReturning.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,62 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: KeyGenReturning.java,v 1.3 2005/05/11 17:18:50 rjoachim Exp $ + */ + +package ctf.jdo.tc2x; + +import harness.TestHarness; + +/** + * Test for RETURNING key generator. + */ +public final class TestKeyGenReturning extends TestKeyGenGeneric { + public TestKeyGenReturning(final TestHarness category) { + super(category, "TC22", "Key generator: RETURNING"); + } + + public void runTest() throws Exception { + testOneKeyGen(ReturningObject.class, ReturningExtends.class); + } +} + Index: tests/ctf/jdo/tc2x/TestKeyGenSequence.java =================================================================== RCS file: tests/ctf/jdo/tc2x/TestKeyGenSequence.java diff -N tests/ctf/jdo/tc2x/TestKeyGenSequence.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/TestKeyGenSequence.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,61 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: KeyGenSequence.java,v 1.2 2004/06/08 10:17:29 wguttmann Exp $ + */ + +package ctf.jdo.tc2x; + +import harness.TestHarness; + +/** + * Test for SEQUENCE key generator. + */ +public final class TestKeyGenSequence extends TestKeyGenGeneric { + public TestKeyGenSequence(final TestHarness category) { + super(category, "TC21", "Key generator: SEQUENCE"); + } + + public void runTest() throws Exception { + testOneKeyGen(SequenceObject.class, SequenceExtends.class); + } +} Index: tests/ctf/jdo/tc2x/TestKeyGenUuid.java =================================================================== RCS file: tests/ctf/jdo/tc2x/TestKeyGenUuid.java diff -N tests/ctf/jdo/tc2x/TestKeyGenUuid.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/TestKeyGenUuid.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,158 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999-2001 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: KeyGenUuid.java,v 1.4 2004/10/05 22:26:41 wguttmann Exp $ + */ + +package ctf.jdo.tc2x; + +import harness.TestHarness; +import harness.CastorTestCase; + +import jdo.JDOCategory; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.exolab.castor.jdo.Database; +import org.exolab.castor.jdo.OQLQuery; +import org.exolab.castor.jdo.QueryResults; + +/** + * Test for generic key generators (UUID). + */ +public final class TestKeyGenUuid extends CastorTestCase { + private static final Log LOG = LogFactory.getLog(TestKeyGenUuid.class); + + private JDOCategory _category; + private Database _db; + + public TestKeyGenUuid(final TestHarness category) { + this("TC24", "Key generator: UUID", category); + } + + public TestKeyGenUuid(final String name, final String description, + final TestHarness category) { + super(category, name, description); + _category = (JDOCategory) category; + } + + public void setUp() throws Exception { + _db = _category.getDatabase(); + } + + public void runTest() throws Exception { + testOneKeyGen(UuidObject.class, UuidExtends.class); + } + + public void tearDown() throws Exception { + if (_db.isActive()) { _db.rollback(); } + _db.close(); + } + + /** + * The main goal of the test is to verify key generators in the case + * of "extends" relation between two classes. + * For each key generator we have a pair of classes: TestXXXObject and + * TestXXXExtends which use key generator XXX. + */ + protected void testOneKeyGen(final Class objClass, final Class extClass) + throws Exception { + OQLQuery oql; + UuidObject object; + UuidObject ext; + QueryResults enumeration; + + // Open transaction in order to perform JDO operations + _db.begin(); + + // Create first object + object = (UuidObject) objClass.newInstance(); + LOG.debug("Creating first object: " + object); + _db.create(object); + LOG.debug("Created first object: " + object); + + // Create second object + ext = (UuidObject) extClass.newInstance(); + LOG.debug("Creating second object: " + ext); + _db.create(ext); + LOG.debug("Created second object: " + ext); + + _db.commit(); + + _db.begin(); + + // Find the first object and remove it + //object = (TestUuidObject) _db.load( objClass, object.getId() ); + oql = _db.getOQLQuery(); + oql.create("SELECT object FROM " + objClass.getName() + + " object WHERE id = $1"); + oql.bind(object.getId()); + enumeration = oql.execute(); + LOG.debug("Removing first object: " + object); + if (enumeration.hasMore()) { + object = (UuidObject) enumeration.next(); + _db.remove(object); + LOG.debug("OK: Removed"); + } else { + LOG.error("first object not found"); + fail("first object not found"); + } + + // Find the second object and remove it + //ext = (TestUuidObject) _db.load( extClass, ext.getId() ); + oql = _db.getOQLQuery(); + oql.create("SELECT ext FROM " + extClass.getName() + + " ext WHERE id = $1"); + oql.bind(ext.getId()); + enumeration = oql.execute(); + LOG.debug("Removing second object: " + ext); + if (enumeration.hasMore()) { + ext = (UuidObject) enumeration.next(); + _db.remove(ext); + LOG.debug("OK: Removed"); + } else { + LOG.error("second object not found"); + fail("second object not found"); + } + _db.commit(); + } +} Index: tests/ctf/jdo/tc2x/UuidExtends.java =================================================================== RCS file: tests/ctf/jdo/tc2x/UuidExtends.java diff -N tests/ctf/jdo/tc2x/UuidExtends.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/UuidExtends.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,67 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestUuidExtends.java,v 1.1.1.1 2003/03/03 07:10:16 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test "extends" relation for UUID key generator. + */ +public final class UuidExtends extends UuidObject { + public static final String DEFAULT_EXT = "ext"; + + private String _ext; + + public UuidExtends() { + super(); + _ext = DEFAULT_EXT; + } + + public void setExt(final String ext) { _ext = ext; } + public String getExt() { return _ext; } + + public String toString() { + return super.toString() + " / " + _ext; + } +} Index: tests/ctf/jdo/tc2x/UuidObject.java =================================================================== RCS file: tests/ctf/jdo/tc2x/UuidObject.java diff -N tests/ctf/jdo/tc2x/UuidObject.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/UuidObject.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,70 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 1999 (C) Intalio, Inc. All Rights Reserved. + * + * $Id: TestUuidObject.java,v 1.1.1.1 2003/03/03 07:10:16 kvisco Exp $ + */ + +package ctf.jdo.tc2x; + +/** + * Test object for UUID key generator. + */ +public class UuidObject { + public static final String DEFAULT_ATTR = "attr"; + + private String _id; + private String _attr; + + public UuidObject() { + _attr = DEFAULT_ATTR; + } + + public final void setId(final String id) { _id = id; } + public final String getId() { return _id; } + + public final void setAttr(final String attr) { _attr = attr; } + public final String getAttr() { return _attr; } + + public String toString() { + return (_id == null ? "null" : _id.toString()) + " / " + _attr; + } +} Index: tests/ctf/jdo/tc2x/mapping.xml =================================================================== RCS file: tests/ctf/jdo/tc2x/mapping.xml diff -N tests/ctf/jdo/tc2x/mapping.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/ctf/jdo/tc2x/mapping.xml 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,326 @@ + + + + Test master table + + + + + + + + + + + + + + + + + Test detail table + + + + + + + + + + + + + + + + + + + + Test detail2 table + + + + + + + + + + + + + + Test detail3 table + + + + + + + + + + + + + + Test master table + + + + + + + + + + + + + + + + + Test detail table + + + + + + + + + + + + + + + + + + + + Test detail2 table + + + + + + + + + + + + + + Test detail3 table + + + + + + + + + + + + + + Test groups table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Table used for MAX key generator testing + + + + + + + + + + + Table used for MAX key generator testing + + + + + + + + Table used for HIGH-LOW key generator testing + + + + + + + + + + + Table used for HIGH-LOW key generator testing + + + + + + + + Table used for HIGH-LOW key generator testing with same-connection=true + + + + + + + + + + + Table used for HIGH-LOW key generator testing with same-connection=true + + + + + + + + Table used for SEQUENCE key generator testing + + + + + + + + + + + Table used for SEQUENCE key generator testing + + + + + + + + Table used for IDENTITY key generator testing + + + + + + + + + + + Table used for IDENTITY key generator testing + + + + + + + + Table used for SEQUENCE key generator testing in RETURNING mode for Oracle8i + + + + + + + + + + + Table used for SEQUENCE key generator testing in RETURNING mode for Oracle8i + + + + + + + + Table used for UUID key generator testing + + + + + + + + + + + Table used for UUID key generator testing + + + + + + + + + + + + + + + + + + + + + + + + +