Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Person.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Person.java?view=auto&rev=158179 ============================================================================== --- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Person.java (added) +++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Person.java Fri Mar 18 17:07:39 2005 @@ -0,0 +1,359 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.jdo.tck.pc.company; + +import java.io.Serializable; + +import java.text.SimpleDateFormat; + +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.apache.jdo.tck.util.DeepEquality; +import org.apache.jdo.tck.util.EqualityHelper; + +/** + * This class represents a person. + */ +public class Person + implements Serializable, Comparable, DeepEquality { + + private long personid; + private String firstname; + private String lastname; + private String middlename; + private Date birthdate; + private Address address; + + // maps phone number types ("home", "work", "mobile", etc.) + // to phone numbers specified as String + private Map phoneNumbers = new HashMap(); + + protected static SimpleDateFormat formatter = + new SimpleDateFormat("d/MMM/yyyy"); + + /** This is the JDO-required no-args constructor. */ + protected Person() {} + + /** + * Initialize a <code>Person</code> instance. + * @param personid The person identifier. + * @param firstname The person's first name. + * @param lastname The person's last name. + * @param middlename The person's middle name. + * @param birthdate The person's birthdate. + * @param address The person's address. + */ + public Person(long personid, String firstname, String lastname, + String middlename, Date birthdate, Address address) { + this.personid = personid; + this.firstname = firstname; + this.lastname = lastname; + this.middlename = middlename; + this.address = address; + this.birthdate = birthdate; + } + + /** + * Get the person's id. + * @return The personid. + */ + public long getPersonid() { + return personid; + } + + /** + * Set the person's id. + * @param personid The personid. + */ + public void setLastname(long personid) { + this.personid = personid; + } + + /** + * Get the person's last name. + * @return The last name. + */ + public String getLastname() { + return lastname; + } + + /** + * Set the person's last name. + * @param lastname The last name. + */ + public void setLastname(String lastname) { + this.lastname = lastname; + } + + /** + * Get the person's first name. + * @return The first name. + */ + public String getFirstname() { + return firstname; + } + + /** + * Set the person's first name. + * @param firstname The first name. + */ + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + /** + * Get the person's middle name. + * @return The middle name. + */ + public String getMiddlename() { + return middlename; + } + + /** + * Set the person's middle name. + * @param middlename The middle name. + */ + public void setMiddlename(String middlename) { + this.middlename = middlename; + } + + /** + * Get the address. + * @return The address. + */ + public Address getAddress() { + return address; + } + + /** + * Set the address. + * @param address The address. + */ + public void setAddress(Address address) { + this.address = address; + } + + /** + * Get the person's birthdate. + * @return The person's birthdate. + */ + public Date getBirthdate() { + return birthdate; + } + + /** + * Set the person's birthdate. + * @param birthdate The person's birthdate. + */ + public void setBirthdate(Date birthdate) { + this. birthdate = birthdate; + } + + /** + * Get the map of phone numbers as an unmodifiable map. + * @return The map of phone numbers, as an unmodifiable map. + */ + public Map getPhoneNumbers() { + return Collections.unmodifiableMap(phoneNumbers); + } + + /** + * Get the phone number for the specified phone number type. + * @param type The phone number type ("home", "work", "mobile", etc.). + * @return The phone number associated with specified type, or + * <code>null</code> if there was no phone number for the type. + */ + public String getPhoneNumber(String type) { + return (String)phoneNumbers.get(type); + } + + /** + * Associates the specified phone number with the specified type in the + * map of phone numbers of this person. + * @param type The phone number type ("home", "work", "mobile", etc.). + * @param phoneNumber The phone number + * @return The previous phone number associated with specified type, or + * <code>null</code> if there was no phone number for the type. + */ + public String putPhoneNumber(String type, String phoneNumber) { + return (String)phoneNumbers.put(type, phoneNumber); + } + + /** + * Remove a phoneNumber from the map of phone numbers. + * @param type The phone number type ("home", "work", "mobile", etc.). + * @return The previous phone number associated with specified type, or + * <code>null</code> if there was no phone number for the type. + */ + public String removePhoneNumber(String type) { + return (String)phoneNumbers.remove(type); + } + + /** + * Set the phoneNumber map to be in this person. + * @param phoneNumbers The map of phoneNumbers for this person. + */ + public void setPhoneNumbers(Map phoneNumbers) { + // workaround: create a new HashMap, because fostore does not + // support LinkedHashMap + this.phoneNumbers = + (phoneNumbers != null) ? new HashMap(phoneNumbers) : null; + } + + /** + * Return a String representation of a <code>Person</code> object. + */ + public String toString() { + StringBuffer rc = new StringBuffer("Person: "); + rc.append(personid); + rc.append(", "); + rc.append(lastname); + rc.append(", " + firstname); + rc.append(", born " + formatter.format(birthdate)); + rc.append(", phone " + phoneNumbers); + return rc.toString(); + } + + /** + * Returns <code>true</code> if all the fields of this instance are + * deep equal to the coresponding fields of the specified Person. + * @param other the object with which to compare. + * @param helper EqualityHelper to keep track of instances that have + * already been processed. + * @return <code>true</code> if all the fields are deep equal; + * <code>false</code> otherwise. + * @throws ClassCastException if the specified instances' type prevents + * it from being compared to this instance. + */ + public boolean deepCompareFields(DeepEquality other, + EqualityHelper helper) { + Person otherPerson = (Person)other; + return (personid == otherPerson.personid) && + helper.equals(firstname, otherPerson.firstname) && + helper.equals(lastname, otherPerson.lastname) && + helper.equals(middlename, otherPerson.middlename) && + helper.equals(birthdate, otherPerson.birthdate) && + helper.deepEquals(address, otherPerson.address) && + helper.deepEquals(phoneNumbers, otherPerson.phoneNumbers); + } + + /** + * Compares this object with the specified object for order. Returns a + * negative integer, zero, or a positive integer as this object is less + * than, equal to, or greater than the specified object. + * @param o The Object to be compared. + * @return a negative integer, zero, or a positive integer as this + * object is less than, equal to, or greater than the specified object. + * @throws ClassCastException - if the specified object's type prevents + * it from being compared to this Object. + */ + public int compareTo(Object o) { + return compareTo((Person)o); + } + + /** + * Compares this object with the specified Person object for + * order. Returns a negative integer, zero, or a positive integer as + * this object is less than, equal to, or greater than the specified + * object. + * @param other The Person object to be compared. + * @return a negative integer, zero, or a positive integer as this + * object is less than, equal to, or greater than the specified Person + * object. + */ + public int compareTo(Person other) { + long otherId = other.personid; + return (personid < otherId ? -1 : (personid == otherId ? 0 : 1)); + } + + + /** + * Indicates whether some other object is "equal to" this one. + * @param obj the object with which to compare. + * @return <code>true</code> if this object is the same as the obj + * argument; <code>false</code> otherwise. + */ + public boolean equals(Object obj) { + if (obj instanceof Person) { + return compareTo((Person)obj) == 0; + } + return false; + } + + /** + * Returns a hash code value for the object. + * @return a hash code value for this object. + */ + public int hashCode() { + return (int)personid; + } + /** + * This class is used to represent the application identifier + * for the <code>Person</code> class. + */ + public static class Oid implements Serializable, Comparable { + + /** + * This field represents the identifier for the <code>Person</code> + * class. It must match a field in the <code>Person</code> class in + * both name and type. + */ + public long personid; + + /** + * The required public no-arg constructor. + */ + public Oid() { } + + /** + * Initialize the identifier. + * @param personid The person identifier. + */ + public Oid(long personid) { + this.personid = personid; + } + + /** */ + public boolean equals(java.lang.Object obj) { + if( obj==null || + !this.getClass().equals(obj.getClass()) ) return( false ); + Oid o = (Oid) obj; + if( this.personid != o.personid ) return( false ); + return( true ); + } + + /** */ + public int hashCode() { + return( (int) personid ); + } + + /** */ + public int compareTo(Object obj) { + // may throw ClassCastException which the user must handle + Oid other = (Oid) obj; + if( personid < other.personid ) return -1; + if( personid > other.personid ) return 1; + return 0; + } + + } + +}
Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Project.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Project.java?view=auto&rev=158179 ============================================================================== --- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Project.java (added) +++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Project.java Fri Mar 18 17:07:39 2005 @@ -0,0 +1,300 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company; + +import java.io.Serializable; +import java.io.ObjectInputStream; +import java.io.IOException; + +import java.util.Collections; +import java.util.Set; +import java.util.HashSet; +import java.math.BigDecimal; + +import org.apache.jdo.tck.util.DeepEquality; +import org.apache.jdo.tck.util.EqualityHelper; + +/** + * This class represents a project, a budgeted task with one or more + * employees working on it. + */ +public class Project + implements Serializable, Comparable, DeepEquality { + + private long projid; + private String name; + private BigDecimal budget; + private transient Set reviewers = new HashSet(); // element type is Employee + private transient Set members = new HashSet(); // element type is Employee + + /** This is the JDO-required no-args constructor. */ + protected Project() {} + + /** + * Initialize a project. + * @param projid The project identifier. + * @param name The name of the project. + * @param budget The budget for the project. + */ + public Project(long projid, String name, BigDecimal budget) { + this.projid = projid; + this.name = name; + this.budget = budget; + } + + /** + * Get the project ID. + * @return The project ID. + */ + public long getProjid() { + return projid; + } + + /** + * Get the name of the project. + * @return The name of the project. + */ + public String getName() { + return name; + } + + /** + * Set the name of the project. + * @param name The name of the project. + */ + public void setName(String name) { + this.name = name; + } + + /** + * Get the project's budget. + * @return The project's budget. + */ + public BigDecimal getBudget() { + return budget; + } + + /** + * Set the project's budget. + * @param budget The project's budget. + */ + public void setBudget(BigDecimal budget) { + this.budget = budget; + } + + /** + * Get the reviewers associated with this project. + */ + public Set getReviewers() { + return Collections.unmodifiableSet(reviewers); + } + + /** + * Add a reviewer to the project. + * @param emp The employee to add as a reviewer. + */ + public void addReviewer(Employee emp) { + reviewers.add(emp); + } + + /** + * Remove a reviewer from the project. + * @param emp The employee to remove as a reviewer of this project. + */ + public void removeReviewer(Employee emp) { + reviewers.remove(emp); + } + + /** + * Set the reviewers associated with this project. + * @param reviewers The set of reviewers to associate with this project. + */ + public void setReviewers(Set reviewers) { + // workaround: create a new HashSet, because fostore does not + // support LinkedHashSet + this.reviewers = (reviewers != null) ? new HashSet(reviewers) : null; + } + + /** + * Get the project members. + * @return The members of the project is returned as an unmodifiable + * set of <code>Employee</code>s. + */ + public Set getMembers() { + return Collections.unmodifiableSet(members); + } + + /** + * Add a new member to the project. + * @param emp The employee to add to the project. + */ + public void addMember(Employee emp) { + members.add(emp); + } + + /** + * Remove a member from the project. + * @param emp The employee to remove from the project. + */ + public void removeMember(Employee emp) { + members.remove(emp); + } + + /** + * Set the members of the project. + * @param employees The set of employees to be the members of this + * project. + */ + public void setMembers(Set employees) { + // workaround: create a new HashSet, because fostore does not + // support LinkedHashSet + this.members = (members != null) ? new HashSet(employees) : null; + } + + /** Serialization support: initialize transient fields. */ + private void readObject(ObjectInputStream in) + throws IOException, ClassNotFoundException { + in.defaultReadObject(); + reviewers = new HashSet(); + members = new HashSet(); + } + + /** + * Returns <code>true</code> if all the fields of this instance are + * deep equal to the coresponding fields of the specified Person. + * @param other the object with which to compare. + * @param helper EqualityHelper to keep track of instances that have + * already been processed. + * @return <code>true</code> if all the fields are deep equal; + * <code>false</code> otherwise. + * @throws ClassCastException if the specified instances' type prevents + * it from being compared to this instance. + */ + public boolean deepCompareFields(DeepEquality other, + EqualityHelper helper) { + Project otherProject = (Project)other; + return (projid == otherProject.projid) && + helper.equals(name, otherProject.name) && + helper.equals(budget, otherProject.budget) && + helper.deepEquals(reviewers, otherProject.reviewers) && + helper.deepEquals(members, otherProject.members); + } + + /** + * Compares this object with the specified object for order. Returns a + * negative integer, zero, or a positive integer as this object is less + * than, equal to, or greater than the specified object. + * @param o The Object to be compared. + * @return a negative integer, zero, or a positive integer as this + * object is less than, equal to, or greater than the specified object. + * @throws ClassCastException - if the specified object's type prevents + * it from being compared to this Object. + */ + public int compareTo(Object o) { + return compareTo((Project)o); + } + + /** + * Compares this object with the specified Project object for + * order. Returns a negative integer, zero, or a positive integer as + * this object is less than, equal to, or greater than the specified + * object. + * @param other The Project object to be compared. + * @return a negative integer, zero, or a positive integer as this + * object is less than, equal to, or greater than the specified Project + * object. + */ + public int compareTo(Project other) { + long otherId = other.projid; + return (projid < otherId ? -1 : (projid == otherId ? 0 : 1)); + } + + + /** + * Indicates whether some other object is "equal to" this one. + * @param obj the object with which to compare. + * @return <code>true</code> if this object is the same as the obj + * argument; <code>false</code> otherwise. + */ + public boolean equals(Object obj) { + if (obj instanceof Project) { + return compareTo((Project)obj) == 0; + } + return false; + } + + /** + * Returns a hash code value for the object. + * @return a hash code value for this object. + */ + public int hashCode() { + return (int)projid; + } + + /** + * This class is used to represent the application identity + * for the <code>Project</code> class. + */ + public static class Oid implements Serializable, Comparable { + + /** + * This field represents the identifier for the + * <code>Project</code> class. It must match a field in the + * <code>Project</code> class in both name and type. + */ + public long projid; + + /** + * The required public no-arg constructor. + */ + public Oid() { } + + /** + * Initialize the application identifier with a project ID. + * @param projid The id of the project. + */ + public Oid(long projid) { + this.projid = projid; + } + + /** */ + public boolean equals(java.lang.Object obj) { + if( obj==null || !this.getClass().equals(obj.getClass()) ) + return( false ); + Oid o = (Oid) obj; + if( this.projid != o.projid ) return( false ); + return( true ); + } + + /** */ + public int hashCode() { + return( (int) projid ); + } + + /** */ + public int compareTo(Object obj) { + // may throw ClassCastException which the user must handle + Oid other = (Oid) obj; + if( projid < other.projid ) return -1; + if( projid > other.projid ) return 1; + return 0; + } + + } + +} + Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/company.jpg URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/company.jpg?view=auto&rev=158179 ============================================================================== Binary file - no diff available. Propchange: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/company.jpg ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/company.jpg ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/AllTypes.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/AllTypes.java?view=auto&rev=158179 ============================================================================== --- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/AllTypes.java (added) +++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/AllTypes.java Fri Mar 18 17:07:39 2005 @@ -0,0 +1,316 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.fieldtypes; + +import java.io.Serializable; +import java.util.Date; +import java.util.Locale; +import java.util.GregorianCalendar; +import java.util.Calendar; +import java.util.TimeZone; +import java.math.BigDecimal; +import java.math.BigInteger; + +import javax.jdo.*; + +public class AllTypes { + private int id; + private boolean fld_boolean; + private byte fld_byte; + private char fld_char; + private double fld_double; + private float fld_float; + private int fld_int; + private long fld_long; + private short fld_short; + + private Boolean fld_Boolean; + private Byte fld_Byte; + private Character fld_Character; + private Double fld_Double; + private Float fld_Float; + private Integer fld_Integer; + private Long fld_Long; + private Short fld_Short; + + private String fld_String; + private Locale fld_Locale; + private Date fld_Date; + private BigDecimal fld_BigDecimal; + private BigInteger fld_BigInteger; + + public static int veryLargePositiveInt = Integer.MAX_VALUE - 511; + public static int veryLargeNegativeInt = Integer.MIN_VALUE + 512; + + public static int NUM_VALUES = 10; // should equal number of elements in the following arrays + // DO NOT CHANGE THE FOLLOWING VALUES, OR MANY LINES OF CODE IN TESTS MUST CHANGE!!! + public static final boolean[] boolean_values = + { false, true, true, false, true, false, false, false, true, false }; + public static final byte[] byte_values = + { Byte.MIN_VALUE, Byte.MAX_VALUE, 0, -100, 100, -10, 10, 50, 50, 75 }; + public static final char[] char_values = + { Character.MIN_VALUE, Character.MAX_VALUE, ' ', 'A', 'z', 'B', 'F', 'z', 'M', 'M'}; + public static final double DOUBLE_SMALLEST = -9999999999999.9; + public static final double DOUBLE_LARGEST = 9999999999999.9; + public static final double[] double_values = + { DOUBLE_SMALLEST, DOUBLE_LARGEST, 0.0, 100.0, 100.0, + 50000000.0, -234234.234, 1000000000.0, 350.5, -25.5 }; + public static final float FLOAT_SMALLEST = -999999999999.9f; + public static final float FLOAT_LARGEST = 999999999999.9f; + public static final float[] float_values = + { FLOAT_SMALLEST, FLOAT_LARGEST, 0.0f, 100.0f, 100.0f, + 50000000.0f, -234.23f, 1000000000.0f, 350.5f, -25.5f }; + public static final int[] int_values = + { veryLargeNegativeInt, veryLargePositiveInt, 0, 100, 100, 1000, -1000, 1000000, -1000000, 10000}; + public static final long[] long_values = + { Long.MIN_VALUE, Long.MAX_VALUE, 0, 100, 100, 1000, -1000, 1000000, -1000, -1000000}; + public static final short[] short_values = + { Short.MIN_VALUE, Short.MAX_VALUE, 0, 100, 100, 1000, -1000, 10000, -10000, -500}; + + public static final Boolean[] Boolean_values = { + new Boolean(false), new Boolean(true), new Boolean(true), new Boolean(false), new Boolean(true), + new Boolean(false), new Boolean(false), new Boolean(false), new Boolean(true), new Boolean(false) + }; + public static final Byte[] Byte_values = { + new Byte(Byte.MIN_VALUE), new Byte(Byte.MAX_VALUE), new Byte((byte)0), new Byte((byte)-100), new Byte((byte)100), + new Byte((byte)-10), new Byte((byte)10), new Byte((byte)50), new Byte((byte)50), new Byte((byte)75) + }; + public static final Character[] Character_values = { + new Character(Character.MIN_VALUE), new Character(Character.MAX_VALUE), + new Character(' '), new Character('A'), + new Character('z'), new Character('B'), + new Character('F'), new Character('z'), + new Character('M'), new Character('M') + }; + public static final Double[] Double_values = { + new Double(DOUBLE_SMALLEST), new Double(DOUBLE_LARGEST), + new Double(0.0), new Double(100.0), + new Double(100.0), new Double(50000000.0), + new Double(-234234.234), new Double(1000000000.0), + new Double(350.5), new Double(-25.5) + }; + public static final Float[] Float_values = { + new Float(FLOAT_SMALLEST), new Float(FLOAT_LARGEST), + new Float(0.0f), new Float(100.0f), + new Float(100.0f), new Float(50000000.0f), + new Float(234234.234f), new Float(1000000000.0f), + new Float(350.5f), new Float(-25.5f) + }; + public static final Integer[] Integer_values = { + new Integer(veryLargeNegativeInt), new Integer(veryLargePositiveInt), + new Integer(0), new Integer(10000), + new Integer(100), new Integer(100), + new Integer(1000000), new Integer(-1000000), + new Integer(-1000), new Integer(1000) + }; + public static final Long[] Long_values = { + new Long(Long.MIN_VALUE), new Long(Long.MAX_VALUE), + new Long(0), new Long(100), + new Long(-1000), new Long(1000), + new Long(-1000), new Long(1000000), + new Long(100), new Long(-1000000) + }; + public static final Short[] Short_values = { + new Short(Short.MIN_VALUE), new Short(Short.MAX_VALUE), + new Short((short)0), new Short((short)100), + new Short((short)100), new Short((short)1000), + new Short((short)-1000), new Short((short)10000), + new Short((short)-10000), new Short((short)-500) + }; + + public static final String[] String_values = { + new String(""), new String("hello world"), + new String("JDO has a very nice persistence API"), new String("JDO"), + new String("Java"), new String("abcde"), + new String("abcdef"), new String("JDO is a breeze to use"), + new String("Java"), new String("Long-live JDO") + }; + public static final Locale[] Locale_values = { + Locale.US, Locale.UK, Locale.FRANCE, Locale.GERMANY, Locale.CANADA, + Locale.JAPAN, Locale.ITALY, Locale.CHINA, Locale.KOREA, Locale.TAIWAN + }; + + public static final BigDecimal[] BigDecimal_values = { + new BigDecimal("24323423423.234234"), new BigDecimal("-1123123.22"), + new BigDecimal("100.0"), new BigDecimal("100.0"), + new BigDecimal("0"), new BigDecimal("123232.22"), + new BigDecimal("-234234.23333"), new BigDecimal("98345983475.23"), + new BigDecimal("-23.000034"), new BigDecimal("989899.98889") + }; + public static final BigInteger[] BigInteger_values = { + new BigInteger("-999999999999999999"), new BigInteger("987034534985043985"), + new BigInteger("0"), new BigInteger("39582"), + new BigInteger("39582"), new BigInteger("1000000000"), + new BigInteger("-1000000000"), new BigInteger("153"), + new BigInteger("-27345"), new BigInteger("1333330") + }; + + public static final Date[] Date_values = new Date[10]; + static { + GregorianCalendar gc = new GregorianCalendar(TimeZone.getTimeZone("GMT"), Locale.UK); + gc.clear(); + gc.set(1999, Calendar.DECEMBER, 31, 9, 0, 0); + Date_values[0] = gc.getTime(); + gc.set(1957, Calendar.FEBRUARY, 1, 9, 0, 0); + Date_values[1] = gc.getTime(); + gc.set(2032, Calendar.MARCH, 15, 9, 0, 0); + Date_values[2] = gc.getTime(); + gc.set(1957, Calendar.FEBRUARY, 1, 9, 0, 0); + Date_values[3] = gc.getTime(); + gc.set(1995, Calendar.JUNE, 14, 9, 0, 0); + Date_values[4] = gc.getTime(); + gc.set(1992, Calendar.NOVEMBER, 22, 9, 0, 0); + Date_values[5] = gc.getTime(); + gc.set(1900, Calendar.JANUARY, 1, 9, 0, 0); + Date_values[6] = gc.getTime(); + gc.set(2015, Calendar.SEPTEMBER, 15, 9, 0, 0); + Date_values[7] = gc.getTime(); + gc.set(1979, Calendar.AUGUST, 12, 9, 0, 0); + Date_values[8] = gc.getTime(); + gc.set(1979, Calendar.AUGUST, 13, 9, 0, 0); + Date_values[9] = gc.getTime(); + } + +public AllTypes() +{ + id = 0; +} + +public AllTypes(int id) +{ + this.id = id; +} + +public void setId(int id) { this.id = id; } +public boolean getboolean() { return fld_boolean;} +public void setboolean(boolean b) { fld_boolean = b;} + +public byte getbyte() { return fld_byte;} +public void setbyte(byte b) { fld_byte = b;} + +public char getchar() { return fld_char;} +public void setchar(char c) { fld_char = c;} + +public double getdouble() { return fld_double;} +public void setdouble(double d) { fld_double = d;} + +public float getfloat() { return fld_float;} +public void setfloat(float f) { fld_float = f;} + +public int getint() { return fld_int;} +public void setint(int i) { fld_int = i;} + +public long getlong() { return fld_long;} +public void setlong(long l) { fld_long = l;} + +public short getshort() { return fld_short;} +public void setshort(short s) { fld_short = s;} + +public Boolean getBoolean() { return fld_Boolean;} +public void setBoolean(Boolean b) { fld_Boolean = b;} + +public Byte getByte() { return fld_Byte;} +public void setByte(Byte b) { fld_Byte = b;} + +public Character getCharacter() { return fld_Character;} +public void setCharacter(Character c){ fld_Character = c;} + +public Double getDouble() { return fld_Double;} +public void setDouble(Double d) { fld_Double = d;} + +public Float getFloat() { return fld_Float;} +public void setFloat(Float f) { fld_Float = f;} + +public Integer getInteger() { return fld_Integer;} +public void setInteger(Integer i) { fld_Integer = i;} + +public Long getLong() { return fld_Long;} +public void setLong(Long l) { fld_Long = l;} + +public Short getShort() { return fld_Short;} +public void setShort(Short s) { fld_Short = s;} + +public String getString() { return fld_String;} +public void setString(String s) { fld_String = s;} + +public Locale getLocale() { return fld_Locale;} +public void setLocale(Locale l) { fld_Locale = l;} + +public Date getDate() { return fld_Date;} +public void setDate(Date d) { fld_Date = d;} + +public BigDecimal getBigDecimal() { return fld_BigDecimal;} +public void setBigDecimal(BigDecimal bd) { fld_BigDecimal = bd;} + +public BigInteger getBigInteger() { return fld_BigInteger;} +public void setBigInteger(BigInteger bi) { fld_BigInteger = bi;} + + +public static void load(PersistenceManager pm) +{ + Transaction t = pm.currentTransaction(); + t.begin(); + for( int i = 0; i < NUM_VALUES; ++i){ + AllTypes o = new AllTypes(i); + pm.makePersistent(o); + o.setboolean(boolean_values[i]); + o.setBoolean(Boolean_values[i]); + o.setbyte(byte_values[i]); + o.setByte(Byte_values[i]); + o.setchar(char_values[i]); + o.setCharacter(Character_values[i]); + o.setdouble(double_values[i]); + o.setDouble(Double_values[i]); + o.setfloat(float_values[i]); + o.setFloat(Float_values[i]); + o.setint(int_values[i]); + o.setInteger(Integer_values[i]); + o.setlong(long_values[i]); + o.setLong(Long_values[i]); + o.setshort(short_values[i]); + o.setShort(Short_values[i]); + o.setString(String_values[i]); + o.setLocale(Locale_values[i]); + o.setDate(Date_values[i]); + o.setBigDecimal(BigDecimal_values[i]); + o.setBigInteger(BigInteger_values[i]); + } + t.commit(); +} + + public static class Oid implements Serializable { + public int id; + + public Oid() { + } + + public Oid(String s) { id = Integer.parseInt(s); } + + public String toString() { return this.getClass().getName() + ": " + id;} + + public int hashCode() { return (int)id ; } + + public boolean equals(Object other) { + if (other != null && (other instanceof Oid)) { + Oid k = (Oid)other; + return k.id == this.id; + } + return false; + } + + } +} Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/ArrayCollections.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/ArrayCollections.java?view=auto&rev=158179 ============================================================================== --- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/ArrayCollections.java (added) +++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/ArrayCollections.java Fri Mar 18 17:07:39 2005 @@ -0,0 +1,269 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.fieldtypes; + +import java.io.Serializable; +import java.util.*; +import java.math.*; + +public class ArrayCollections { + public int identifier; + public Object [] ArrayOfObject0; + public Object [] ArrayOfObject1; + public SimpleClass [] ArrayOfSimpleClass2; + public SimpleClass [] ArrayOfSimpleClass3; + public SimpleInterface [] ArrayOfSimpleInterface4; + public SimpleInterface [] ArrayOfSimpleInterface5; + public String [] ArrayOfString6; + public String [] ArrayOfString7; + public Date [] ArrayOfDate8; + public Date [] ArrayOfDate9; + public Locale [] ArrayOfLocale10; + public Locale [] ArrayOfLocale11; + public BigDecimal [] ArrayOfBigDecimal12; + public BigDecimal [] ArrayOfBigDecimal13; + public BigInteger [] ArrayOfBigInteger14; + public BigInteger [] ArrayOfBigInteger15; + public Byte [] ArrayOfByte16; + public Byte [] ArrayOfByte17; + public Double [] ArrayOfDouble18; + public Double [] ArrayOfDouble19; + public Float [] ArrayOfFloat20; + public Float [] ArrayOfFloat21; + public Integer [] ArrayOfInteger22; + public Integer [] ArrayOfInteger23; + public Long [] ArrayOfLong24; + public Long [] ArrayOfLong25; + public Short [] ArrayOfShort26; + public Short [] ArrayOfShort27; + + public static final String [] fieldSpecs = { + "embedded-element=true public Object [] ArrayOfObject0", + "embedded-element=false public Object [] ArrayOfObject1", + "embedded-element=true public SimpleClass [] ArrayOfSimpleClass2", + "embedded-element=false public SimpleClass [] ArrayOfSimpleClass3", + "embedded-element=true public SimpleInterface [] ArrayOfSimpleInterface4", + "embedded-element=false public SimpleInterface [] ArrayOfSimpleInterface5", + "embedded-element=true public String [] ArrayOfString6", + "embedded-element=false public String [] ArrayOfString7", + "embedded-element=true public Date [] ArrayOfDate8", + "embedded-element=false public Date [] ArrayOfDate9", + "embedded-element=true public Locale [] ArrayOfLocale10", + "embedded-element=false public Locale [] ArrayOfLocale11", + "embedded-element=true public BigDecimal [] ArrayOfBigDecimal12", + "embedded-element=false public BigDecimal [] ArrayOfBigDecimal13", + "embedded-element=true public BigInteger [] ArrayOfBigInteger14", + "embedded-element=false public BigInteger [] ArrayOfBigInteger15", + "embedded-element=true public Byte [] ArrayOfByte16", + "embedded-element=false public Byte [] ArrayOfByte17", + "embedded-element=true public Double [] ArrayOfDouble18", + "embedded-element=false public Double [] ArrayOfDouble19", + "embedded-element=true public Float [] ArrayOfFloat20", + "embedded-element=false public Float [] ArrayOfFloat21", + "embedded-element=true public Integer [] ArrayOfInteger22", + "embedded-element=false public Integer [] ArrayOfInteger23", + "embedded-element=true public Long [] ArrayOfLong24", + "embedded-element=false public Long [] ArrayOfLong25", + "embedded-element=true public Short [] ArrayOfShort26", + "embedded-element=false public Short [] ArrayOfShort27" + }; + public int getLength() + { + return fieldSpecs.length; + } + public Object [] get(int index) + { + switch (index) + { + case(0): + return ArrayOfObject0; + case(1): + return ArrayOfObject1; + case(2): + return ArrayOfSimpleClass2; + case(3): + return ArrayOfSimpleClass3; + case(4): + return ArrayOfSimpleInterface4; + case(5): + return ArrayOfSimpleInterface5; + case(6): + return ArrayOfString6; + case(7): + return ArrayOfString7; + case(8): + return ArrayOfDate8; + case(9): + return ArrayOfDate9; + case(10): + return ArrayOfLocale10; + case(11): + return ArrayOfLocale11; + case(12): + return ArrayOfBigDecimal12; + case(13): + return ArrayOfBigDecimal13; + case(14): + return ArrayOfBigInteger14; + case(15): + return ArrayOfBigInteger15; + case(16): + return ArrayOfByte16; + case(17): + return ArrayOfByte17; + case(18): + return ArrayOfDouble18; + case(19): + return ArrayOfDouble19; + case(20): + return ArrayOfFloat20; + case(21): + return ArrayOfFloat21; + case(22): + return ArrayOfInteger22; + case(23): + return ArrayOfInteger23; + case(24): + return ArrayOfLong24; + case(25): + return ArrayOfLong25; + case(26): + return ArrayOfShort26; + case(27): + return ArrayOfShort27; + default: + throw new IndexOutOfBoundsException(); + } + } + public boolean set(int index,Object [] value) + { + if(fieldSpecs[index].indexOf("final") != -1) + return false; + switch (index) + { + case(0): + ArrayOfObject0= (Object []) value ; + break; + case(1): + ArrayOfObject1= (Object []) value ; + break; + case(2): + ArrayOfSimpleClass2= (SimpleClass []) value ; + break; + case(3): + ArrayOfSimpleClass3= (SimpleClass []) value ; + break; + case(4): + ArrayOfSimpleInterface4= (SimpleInterface []) value ; + break; + case(5): + ArrayOfSimpleInterface5= (SimpleInterface []) value ; + break; + case(6): + ArrayOfString6= (String []) value ; + break; + case(7): + ArrayOfString7= (String []) value ; + break; + case(8): + ArrayOfDate8= (Date []) value ; + break; + case(9): + ArrayOfDate9= (Date []) value ; + break; + case(10): + ArrayOfLocale10= (Locale []) value ; + break; + case(11): + ArrayOfLocale11= (Locale []) value ; + break; + case(12): + ArrayOfBigDecimal12= (BigDecimal []) value ; + break; + case(13): + ArrayOfBigDecimal13= (BigDecimal []) value ; + break; + case(14): + ArrayOfBigInteger14= (BigInteger []) value ; + break; + case(15): + ArrayOfBigInteger15= (BigInteger []) value ; + break; + case(16): + ArrayOfByte16= (Byte []) value ; + break; + case(17): + ArrayOfByte17= (Byte []) value ; + break; + case(18): + ArrayOfDouble18= (Double []) value ; + break; + case(19): + ArrayOfDouble19= (Double []) value ; + break; + case(20): + ArrayOfFloat20= (Float []) value ; + break; + case(21): + ArrayOfFloat21= (Float []) value ; + break; + case(22): + ArrayOfInteger22= (Integer []) value ; + break; + case(23): + ArrayOfInteger23= (Integer []) value ; + break; + case(24): + ArrayOfLong24= (Long []) value ; + break; + case(25): + ArrayOfLong25= (Long []) value ; + break; + case(26): + ArrayOfShort26= (Short []) value ; + break; + case(27): + ArrayOfShort27= (Short []) value ; + break; + default: + throw new IndexOutOfBoundsException(); + } + return true; + } + + public static class Oid implements Serializable { + public int identifier; + + public Oid() { + } + + public Oid(String s) { identifier = Integer.parseInt(s); } + + public String toString() { return this.getClass().getName() + ": " + identifier;} + + public int hashCode() { return (int)identifier ; } + + public boolean equals(Object other) { + if (other != null && (other instanceof Oid)) { + Oid k = (Oid)other; + return k.identifier == this.identifier; + } + return false; + } + + } +} Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/ArrayListCollections.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/ArrayListCollections.java?view=auto&rev=158179 ============================================================================== --- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/ArrayListCollections.java (added) +++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/ArrayListCollections.java Fri Mar 18 17:07:39 2005 @@ -0,0 +1,366 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.fieldtypes; + +import java.io.Serializable; +import java.util.ArrayList; + +public class ArrayListCollections { + public int identifier; + public ArrayList ArrayListOfObject0; + public ArrayList ArrayListOfObject1; + public ArrayList ArrayListOfObject2; + public ArrayList ArrayListOfSimpleClass3; + public ArrayList ArrayListOfSimpleClass4; + public ArrayList ArrayListOfSimpleClass5; + public ArrayList ArrayListOfSimpleInterface6; + public ArrayList ArrayListOfSimpleInterface7; + public ArrayList ArrayListOfSimpleInterface8; + public ArrayList ArrayListOfString9; + public ArrayList ArrayListOfString10; + public ArrayList ArrayListOfString11; + public ArrayList ArrayListOfDate12; + public ArrayList ArrayListOfDate13; + public ArrayList ArrayListOfDate14; + public ArrayList ArrayListOfLocale15; + public ArrayList ArrayListOfLocale16; + public ArrayList ArrayListOfLocale17; + public ArrayList ArrayListOfBigDecimal18; + public ArrayList ArrayListOfBigDecimal19; + public ArrayList ArrayListOfBigDecimal20; + public ArrayList ArrayListOfBigInteger21; + public ArrayList ArrayListOfBigInteger22; + public ArrayList ArrayListOfBigInteger23; + public ArrayList ArrayListOfByte24; + public ArrayList ArrayListOfByte25; + public ArrayList ArrayListOfByte26; + public ArrayList ArrayListOfDouble27; + public ArrayList ArrayListOfDouble28; + public ArrayList ArrayListOfDouble29; + public ArrayList ArrayListOfFloat30; + public ArrayList ArrayListOfFloat31; + public ArrayList ArrayListOfFloat32; + public ArrayList ArrayListOfInteger33; + public ArrayList ArrayListOfInteger34; + public ArrayList ArrayListOfInteger35; + public ArrayList ArrayListOfLong36; + public ArrayList ArrayListOfLong37; + public ArrayList ArrayListOfLong38; + public ArrayList ArrayListOfShort39; + public ArrayList ArrayListOfShort40; + public ArrayList ArrayListOfShort41; + + public static final String [] fieldSpecs = { + "public ArrayList ArrayListOfObject0", + "embedded-element=true public ArrayList ArrayListOfObject1", + "embedded-element=false public ArrayList ArrayListOfObject2", + "public ArrayList ArrayListOfSimpleClass3", + "embedded-element=true public ArrayList ArrayListOfSimpleClass4", + "embedded-element=false public ArrayList ArrayListOfSimpleClass5", + "public ArrayList ArrayListOfSimpleInterface6", + "embedded-element=true public ArrayList ArrayListOfSimpleInterface7", + "embedded-element=false public ArrayList ArrayListOfSimpleInterface8", + "public ArrayList ArrayListOfString9", + "embedded-element=true public ArrayList ArrayListOfString10", + "embedded-element=false public ArrayList ArrayListOfString11", + "public ArrayList ArrayListOfDate12", + "embedded-element=true public ArrayList ArrayListOfDate13", + "embedded-element=false public ArrayList ArrayListOfDate14", + "public ArrayList ArrayListOfLocale15", + "embedded-element=true public ArrayList ArrayListOfLocale16", + "embedded-element=false public ArrayList ArrayListOfLocale17", + "public ArrayList ArrayListOfBigDecimal18", + "embedded-element=true public ArrayList ArrayListOfBigDecimal19", + "embedded-element=false public ArrayList ArrayListOfBigDecimal20", + "public ArrayList ArrayListOfBigInteger21", + "embedded-element=true public ArrayList ArrayListOfBigInteger22", + "embedded-element=false public ArrayList ArrayListOfBigInteger23", + "public ArrayList ArrayListOfByte24", + "embedded-element=true public ArrayList ArrayListOfByte25", + "embedded-element=false public ArrayList ArrayListOfByte26", + "public ArrayList ArrayListOfDouble27", + "embedded-element=true public ArrayList ArrayListOfDouble28", + "embedded-element=false public ArrayList ArrayListOfDouble29", + "public ArrayList ArrayListOfFloat30", + "embedded-element=true public ArrayList ArrayListOfFloat31", + "embedded-element=false public ArrayList ArrayListOfFloat32", + "public ArrayList ArrayListOfInteger33", + "embedded-element=true public ArrayList ArrayListOfInteger34", + "embedded-element=false public ArrayList ArrayListOfInteger35", + "public ArrayList ArrayListOfLong36", + "embedded-element=true public ArrayList ArrayListOfLong37", + "embedded-element=false public ArrayList ArrayListOfLong38", + "public ArrayList ArrayListOfShort39", + "embedded-element=true public ArrayList ArrayListOfShort40", + "embedded-element=false public ArrayList ArrayListOfShort41" + }; + public int getLength() + { + return fieldSpecs.length; + } + public ArrayList get(int index) + { + switch (index) + { + case(0): + return ArrayListOfObject0; + case(1): + return ArrayListOfObject1; + case(2): + return ArrayListOfObject2; + case(3): + return ArrayListOfSimpleClass3; + case(4): + return ArrayListOfSimpleClass4; + case(5): + return ArrayListOfSimpleClass5; + case(6): + return ArrayListOfSimpleInterface6; + case(7): + return ArrayListOfSimpleInterface7; + case(8): + return ArrayListOfSimpleInterface8; + case(9): + return ArrayListOfString9; + case(10): + return ArrayListOfString10; + case(11): + return ArrayListOfString11; + case(12): + return ArrayListOfDate12; + case(13): + return ArrayListOfDate13; + case(14): + return ArrayListOfDate14; + case(15): + return ArrayListOfLocale15; + case(16): + return ArrayListOfLocale16; + case(17): + return ArrayListOfLocale17; + case(18): + return ArrayListOfBigDecimal18; + case(19): + return ArrayListOfBigDecimal19; + case(20): + return ArrayListOfBigDecimal20; + case(21): + return ArrayListOfBigInteger21; + case(22): + return ArrayListOfBigInteger22; + case(23): + return ArrayListOfBigInteger23; + case(24): + return ArrayListOfByte24; + case(25): + return ArrayListOfByte25; + case(26): + return ArrayListOfByte26; + case(27): + return ArrayListOfDouble27; + case(28): + return ArrayListOfDouble28; + case(29): + return ArrayListOfDouble29; + case(30): + return ArrayListOfFloat30; + case(31): + return ArrayListOfFloat31; + case(32): + return ArrayListOfFloat32; + case(33): + return ArrayListOfInteger33; + case(34): + return ArrayListOfInteger34; + case(35): + return ArrayListOfInteger35; + case(36): + return ArrayListOfLong36; + case(37): + return ArrayListOfLong37; + case(38): + return ArrayListOfLong38; + case(39): + return ArrayListOfShort39; + case(40): + return ArrayListOfShort40; + case(41): + return ArrayListOfShort41; + default: + throw new IndexOutOfBoundsException(); + } + } + public boolean set(int index,ArrayList value) + { + if(fieldSpecs[index].indexOf("final") != -1) + return false; + switch (index) + { + case(0): + ArrayListOfObject0= value; + break; + case(1): + ArrayListOfObject1= value; + break; + case(2): + ArrayListOfObject2= value; + break; + case(3): + ArrayListOfSimpleClass3= value; + break; + case(4): + ArrayListOfSimpleClass4= value; + break; + case(5): + ArrayListOfSimpleClass5= value; + break; + case(6): + ArrayListOfSimpleInterface6= value; + break; + case(7): + ArrayListOfSimpleInterface7= value; + break; + case(8): + ArrayListOfSimpleInterface8= value; + break; + case(9): + ArrayListOfString9= value; + break; + case(10): + ArrayListOfString10= value; + break; + case(11): + ArrayListOfString11= value; + break; + case(12): + ArrayListOfDate12= value; + break; + case(13): + ArrayListOfDate13= value; + break; + case(14): + ArrayListOfDate14= value; + break; + case(15): + ArrayListOfLocale15= value; + break; + case(16): + ArrayListOfLocale16= value; + break; + case(17): + ArrayListOfLocale17= value; + break; + case(18): + ArrayListOfBigDecimal18= value; + break; + case(19): + ArrayListOfBigDecimal19= value; + break; + case(20): + ArrayListOfBigDecimal20= value; + break; + case(21): + ArrayListOfBigInteger21= value; + break; + case(22): + ArrayListOfBigInteger22= value; + break; + case(23): + ArrayListOfBigInteger23= value; + break; + case(24): + ArrayListOfByte24= value; + break; + case(25): + ArrayListOfByte25= value; + break; + case(26): + ArrayListOfByte26= value; + break; + case(27): + ArrayListOfDouble27= value; + break; + case(28): + ArrayListOfDouble28= value; + break; + case(29): + ArrayListOfDouble29= value; + break; + case(30): + ArrayListOfFloat30= value; + break; + case(31): + ArrayListOfFloat31= value; + break; + case(32): + ArrayListOfFloat32= value; + break; + case(33): + ArrayListOfInteger33= value; + break; + case(34): + ArrayListOfInteger34= value; + break; + case(35): + ArrayListOfInteger35= value; + break; + case(36): + ArrayListOfLong36= value; + break; + case(37): + ArrayListOfLong37= value; + break; + case(38): + ArrayListOfLong38= value; + break; + case(39): + ArrayListOfShort39= value; + break; + case(40): + ArrayListOfShort40= value; + break; + case(41): + ArrayListOfShort41= value; + break; + default: + throw new IndexOutOfBoundsException(); + } + return true; + } + + public static class Oid implements Serializable { + public int identifier; + + public Oid() { + } + + public Oid(String s) { identifier = Integer.parseInt(s); } + + public String toString() { return this.getClass().getName() + ": " + identifier;} + + public int hashCode() { return (int)identifier ; } + + public boolean equals(Object other) { + if (other != null && (other instanceof Oid)) { + Oid k = (Oid)other; + return k.identifier == this.identifier; + } + return false; + } + + } +} Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/CollectionCollections.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/CollectionCollections.java?view=auto&rev=158179 ============================================================================== --- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/CollectionCollections.java (added) +++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/fieldtypes/CollectionCollections.java Fri Mar 18 17:07:39 2005 @@ -0,0 +1,366 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.fieldtypes; + +import java.io.Serializable; +import java.util.Collection; + +public class CollectionCollections { + public int identifier; + public Collection CollectionOfObject0; + public Collection CollectionOfObject1; + public Collection CollectionOfObject2; + public Collection CollectionOfSimpleClass3; + public Collection CollectionOfSimpleClass4; + public Collection CollectionOfSimpleClass5; + public Collection CollectionOfSimpleInterface6; + public Collection CollectionOfSimpleInterface7; + public Collection CollectionOfSimpleInterface8; + public Collection CollectionOfString9; + public Collection CollectionOfString10; + public Collection CollectionOfString11; + public Collection CollectionOfDate12; + public Collection CollectionOfDate13; + public Collection CollectionOfDate14; + public Collection CollectionOfLocale15; + public Collection CollectionOfLocale16; + public Collection CollectionOfLocale17; + public Collection CollectionOfBigDecimal18; + public Collection CollectionOfBigDecimal19; + public Collection CollectionOfBigDecimal20; + public Collection CollectionOfBigInteger21; + public Collection CollectionOfBigInteger22; + public Collection CollectionOfBigInteger23; + public Collection CollectionOfByte24; + public Collection CollectionOfByte25; + public Collection CollectionOfByte26; + public Collection CollectionOfDouble27; + public Collection CollectionOfDouble28; + public Collection CollectionOfDouble29; + public Collection CollectionOfFloat30; + public Collection CollectionOfFloat31; + public Collection CollectionOfFloat32; + public Collection CollectionOfInteger33; + public Collection CollectionOfInteger34; + public Collection CollectionOfInteger35; + public Collection CollectionOfLong36; + public Collection CollectionOfLong37; + public Collection CollectionOfLong38; + public Collection CollectionOfShort39; + public Collection CollectionOfShort40; + public Collection CollectionOfShort41; + + public static final String [] fieldSpecs = { + "public Collection CollectionOfObject0", + "embedded-element=true public Collection CollectionOfObject1", + "embedded-element=false public Collection CollectionOfObject2", + "public Collection CollectionOfSimpleClass3", + "embedded-element=true public Collection CollectionOfSimpleClass4", + "embedded-element=false public Collection CollectionOfSimpleClass5", + "public Collection CollectionOfSimpleInterface6", + "embedded-element=true public Collection CollectionOfSimpleInterface7", + "embedded-element=false public Collection CollectionOfSimpleInterface8", + "public Collection CollectionOfString9", + "embedded-element=true public Collection CollectionOfString10", + "embedded-element=false public Collection CollectionOfString11", + "public Collection CollectionOfDate12", + "embedded-element=true public Collection CollectionOfDate13", + "embedded-element=false public Collection CollectionOfDate14", + "public Collection CollectionOfLocale15", + "embedded-element=true public Collection CollectionOfLocale16", + "embedded-element=false public Collection CollectionOfLocale17", + "public Collection CollectionOfBigDecimal18", + "embedded-element=true public Collection CollectionOfBigDecimal19", + "embedded-element=false public Collection CollectionOfBigDecimal20", + "public Collection CollectionOfBigInteger21", + "embedded-element=true public Collection CollectionOfBigInteger22", + "embedded-element=false public Collection CollectionOfBigInteger23", + "public Collection CollectionOfByte24", + "embedded-element=true public Collection CollectionOfByte25", + "embedded-element=false public Collection CollectionOfByte26", + "public Collection CollectionOfDouble27", + "embedded-element=true public Collection CollectionOfDouble28", + "embedded-element=false public Collection CollectionOfDouble29", + "public Collection CollectionOfFloat30", + "embedded-element=true public Collection CollectionOfFloat31", + "embedded-element=false public Collection CollectionOfFloat32", + "public Collection CollectionOfInteger33", + "embedded-element=true public Collection CollectionOfInteger34", + "embedded-element=false public Collection CollectionOfInteger35", + "public Collection CollectionOfLong36", + "embedded-element=true public Collection CollectionOfLong37", + "embedded-element=false public Collection CollectionOfLong38", + "public Collection CollectionOfShort39", + "embedded-element=true public Collection CollectionOfShort40", + "embedded-element=false public Collection CollectionOfShort41" + }; + public int getLength() + { + return fieldSpecs.length; + } + public Collection get(int index) + { + switch (index) + { + case(0): + return CollectionOfObject0; + case(1): + return CollectionOfObject1; + case(2): + return CollectionOfObject2; + case(3): + return CollectionOfSimpleClass3; + case(4): + return CollectionOfSimpleClass4; + case(5): + return CollectionOfSimpleClass5; + case(6): + return CollectionOfSimpleInterface6; + case(7): + return CollectionOfSimpleInterface7; + case(8): + return CollectionOfSimpleInterface8; + case(9): + return CollectionOfString9; + case(10): + return CollectionOfString10; + case(11): + return CollectionOfString11; + case(12): + return CollectionOfDate12; + case(13): + return CollectionOfDate13; + case(14): + return CollectionOfDate14; + case(15): + return CollectionOfLocale15; + case(16): + return CollectionOfLocale16; + case(17): + return CollectionOfLocale17; + case(18): + return CollectionOfBigDecimal18; + case(19): + return CollectionOfBigDecimal19; + case(20): + return CollectionOfBigDecimal20; + case(21): + return CollectionOfBigInteger21; + case(22): + return CollectionOfBigInteger22; + case(23): + return CollectionOfBigInteger23; + case(24): + return CollectionOfByte24; + case(25): + return CollectionOfByte25; + case(26): + return CollectionOfByte26; + case(27): + return CollectionOfDouble27; + case(28): + return CollectionOfDouble28; + case(29): + return CollectionOfDouble29; + case(30): + return CollectionOfFloat30; + case(31): + return CollectionOfFloat31; + case(32): + return CollectionOfFloat32; + case(33): + return CollectionOfInteger33; + case(34): + return CollectionOfInteger34; + case(35): + return CollectionOfInteger35; + case(36): + return CollectionOfLong36; + case(37): + return CollectionOfLong37; + case(38): + return CollectionOfLong38; + case(39): + return CollectionOfShort39; + case(40): + return CollectionOfShort40; + case(41): + return CollectionOfShort41; + default: + throw new IndexOutOfBoundsException(); + } + } + public boolean set(int index,Collection value) + { + if(fieldSpecs[index].indexOf("final") != -1) + return false; + switch (index) + { + case(0): + CollectionOfObject0= value; + break; + case(1): + CollectionOfObject1= value; + break; + case(2): + CollectionOfObject2= value; + break; + case(3): + CollectionOfSimpleClass3= value; + break; + case(4): + CollectionOfSimpleClass4= value; + break; + case(5): + CollectionOfSimpleClass5= value; + break; + case(6): + CollectionOfSimpleInterface6= value; + break; + case(7): + CollectionOfSimpleInterface7= value; + break; + case(8): + CollectionOfSimpleInterface8= value; + break; + case(9): + CollectionOfString9= value; + break; + case(10): + CollectionOfString10= value; + break; + case(11): + CollectionOfString11= value; + break; + case(12): + CollectionOfDate12= value; + break; + case(13): + CollectionOfDate13= value; + break; + case(14): + CollectionOfDate14= value; + break; + case(15): + CollectionOfLocale15= value; + break; + case(16): + CollectionOfLocale16= value; + break; + case(17): + CollectionOfLocale17= value; + break; + case(18): + CollectionOfBigDecimal18= value; + break; + case(19): + CollectionOfBigDecimal19= value; + break; + case(20): + CollectionOfBigDecimal20= value; + break; + case(21): + CollectionOfBigInteger21= value; + break; + case(22): + CollectionOfBigInteger22= value; + break; + case(23): + CollectionOfBigInteger23= value; + break; + case(24): + CollectionOfByte24= value; + break; + case(25): + CollectionOfByte25= value; + break; + case(26): + CollectionOfByte26= value; + break; + case(27): + CollectionOfDouble27= value; + break; + case(28): + CollectionOfDouble28= value; + break; + case(29): + CollectionOfDouble29= value; + break; + case(30): + CollectionOfFloat30= value; + break; + case(31): + CollectionOfFloat31= value; + break; + case(32): + CollectionOfFloat32= value; + break; + case(33): + CollectionOfInteger33= value; + break; + case(34): + CollectionOfInteger34= value; + break; + case(35): + CollectionOfInteger35= value; + break; + case(36): + CollectionOfLong36= value; + break; + case(37): + CollectionOfLong37= value; + break; + case(38): + CollectionOfLong38= value; + break; + case(39): + CollectionOfShort39= value; + break; + case(40): + CollectionOfShort40= value; + break; + case(41): + CollectionOfShort41= value; + break; + default: + throw new IndexOutOfBoundsException(); + } + return true; + } + + public static class Oid implements Serializable { + public int identifier; + + public Oid() { + } + + public Oid(String s) { identifier = Integer.parseInt(s); } + + public String toString() { return this.getClass().getName() + ": " + identifier;} + + public int hashCode() { return (int)identifier ; } + + public boolean equals(Object other) { + if (other != null && (other instanceof Oid)) { + Oid k = (Oid)other; + return k.identifier == this.identifier; + } + return false; + } + + } +}