Package org.apache.jdo.tck.pc.company

Examples of org.apache.jdo.tck.pc.company.Company


    protected void localSetUp() {
        addTearDownClass(Company.class);
    }

    private Company getPersistentNewInstance(long companyid) {
        Company obj = new Company(companyid, "MyCompany", expectedDate,
                new Address(0,"","","","",""));
        pm.makePersistent(obj); // obj should transition to persistent-new
        int curr = currentState(obj);
        if( curr != PERSISTENT_NEW ){
            fail(ASSERTION_FAILED,
View Full Code Here


     */
    public void testEmbeddedField() {
        String testZip = "94040";
        pm = getPM();
        pm.currentTransaction().begin();
        Company comp = getPersistentNewInstance(0);
        pm.currentTransaction().commit();

        // Select address, modify, and commit
        pm.currentTransaction().begin();
        Query query = pm.newQuery(Company.class,
View Full Code Here

     *  and modified, there is no change in the owned instance.
     */
    public void testDateField() {
        pm = getPM();
        pm.currentTransaction().begin();
        Company comp = getPersistentNewInstance(0);
        pm.currentTransaction().commit();

        // Select date, modify, and commit
        pm.currentTransaction().begin();
        Query query = pm.newQuery(Company.class,
View Full Code Here

    protected void localSetUp() {
        addTearDownClass(Company.class);
    }

    private Company getPersistentNewInstance(long companyid) {
        Company obj = new Company(companyid, "MyCompany", expectedDate,
                new Address(0,"","","","",""));
        pm.makePersistent(obj); // obj should transition to persistent-new
        int curr = currentState(obj);
        if( curr != PERSISTENT_NEW ){
            fail(ASSERTION_FAILED,
View Full Code Here

     */
    public void testEmbeddedField() {
        String testZip = "94040";
        pm = getPM();
        pm.currentTransaction().begin();
        Company comp = getPersistentNewInstance(0);
        pm.currentTransaction().commit();

        // Select address, modify, and commit
        pm.currentTransaction().begin();
        Query query = pm.newQuery(Company.class,
View Full Code Here

     *  and modified, there is no change in the owned instance.
     */
    public void testDateField() {
        pm = getPM();
        pm.currentTransaction().begin();
        Company comp = getPersistentNewInstance(0);
        pm.currentTransaction().commit();

        // Select date, modify, and commit
        pm.currentTransaction().begin();
        Query query = pm.newQuery(Company.class,
View Full Code Here

    /** This tests that persistence-capable instances track changes
     * or notify their owning instance that they are dirty */
    public void testPCInstance() {
        pm = getPM();
        pm.currentTransaction().begin();
        Company comp = getPersistentNewInstance(0);
        pm.currentTransaction().commit(); // obj should transition to hollow
        testHollowInstance(comp);
        pm.currentTransaction().begin();
        makePersistentCleanInstance(comp);

        Address addr = (Address)comp.getAddress();
        // comp or addr should transition to persistent-dirty
        addr.setStreet("200 Orange Street");
        int currComp = currentState(comp);
        int currAddr = currentState(addr);
        if ((currComp != PERSISTENT_DIRTY) && (currAddr != PERSISTENT_DIRTY)){
View Full Code Here

    /** This tests that mutable system class instances track changes
      * or notify their owning instance that they are dirty */
    public void testMutableSystemClass() {
        pm = getPM();
        pm.currentTransaction().begin();
        Company comp = getPersistentNewInstance(1);
        pm.currentTransaction().commit(); // obj should transition to hollow
        testHollowInstance(comp);
        pm.currentTransaction().begin();
        makePersistentCleanInstance(comp);

        Set depts = comp.getDepartments();
        // comp or depts should transition to persistent-dirty
        comp.addDepartment(new Department(0, "HR", comp));
        int currComp = currentState(comp);
        int currDepts = currentState(depts);
        if ((currComp != PERSISTENT_DIRTY) && (currDepts != PERSISTENT_DIRTY)){
            fail(ASSERTION_FAILED,
                "Unable to create persistent-dirty instance "
View Full Code Here

                + states[currDepts]);
        }
    }

    public Company getPersistentNewInstance(long companyid) {
        Company obj = new Company(companyid, "MyCompany", new Date(),
                new Address(0,"","","","",""));
        pm.makePersistent(obj); // obj should transition to persistent-new
        int curr = currentState(obj);
        if( curr != PERSISTENT_NEW ){
            fail(ASSERTION_FAILED,
View Full Code Here

        pmf = JDOHelper.getPersistenceManagerFactory(PMFPropertiesObject);
        //Try to get a PersistenceManager and begin and commit a transaction
        pm = pmf.getPersistenceManager();
        Transaction tx = pm.currentTransaction();
        tx.begin();
        Company comp = new Company(1L, "Sun Microsystems", new Date(), new Address(0,"","","","",""));
        pm.makePersistent(comp);
        tx.commit();
    }
View Full Code Here

TOP

Related Classes of org.apache.jdo.tck.pc.company.Company

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.