Package org.apache.ojb.odmg.shared

Examples of org.apache.ojb.odmg.shared.TestClassB


  }

  public void testSerializedCopy() throws LockingException
  {
    TestClassA tca = generateTestData();
    TestClassB tcb = tca.getB();
    internalTest(m_scs, tca, tcb);
  }
View Full Code Here


  }

  public void testReflectiveCopy() throws LockingException
  {
    TestClassA tca = generateTestData();
    TestClassB tcb = tca.getB();
    internalTest(m_rcs, tca, tcb);
  }
View Full Code Here

  {
    long start = System.currentTimeMillis();
    for (int i = 0; i < ITERATIONS; i++)
    {
      TestClassA tca = generateTestData();
      TestClassB tcb = tca.getB();
      TestClassA copy = (TestClassA) m_scs.copy(tca, m_pb);
    }
    long stop = System.currentTimeMillis();
    System.out.println("testSerializedCopy took: " + (stop - start));
    start = System.currentTimeMillis();
    for (int i = 0; i < ITERATIONS; i++)
    {
      TestClassA tca = generateTestData();
      TestClassB tcb = tca.getB();
      TestClassA copy = (TestClassA) m_mdcs.copy(tca, m_pb);
    }
    stop = System.currentTimeMillis();
    System.out.println("testMetadataCopy took: " + (stop - start));
    start = System.currentTimeMillis();
    for (int i = 0; i < ITERATIONS; i++)
    {
      TestClassA tca = generateTestData();
      TestClassB tcb = tca.getB();
      TestClassA copy = (TestClassA) m_rcs.copy(tca, m_pb);
    }
    stop = System.currentTimeMillis();
    System.out.println("testReflectiveCopy took: " + (stop - start));
  }
View Full Code Here

        tca.setOid("someoid");
        tca.setValue1("abc");
        tca.setValue2("123");
        tca.setValue3(5);
        _conn.makePersistent(tca);
        TestClassB tcb = new TestClassB();
        tcb.setOid("boid");
        tcb.setValue1("hi there");
        _conn.makePersistent(tcb);
        tca.setB(tcb);
      }
      tx.commit();
      m_tca = tca;
View Full Code Here

        deleteData(TestClassB.class);

    TestClassA a1 = new TestClassA();
    TestClassA a2 = new TestClassA();

    TestClassB b1 = new TestClassB();
    TestClassB b2 = new TestClassB();
    a1.setB(b1);
    a2.setB(b2);

    Transaction tx = odmg.newTransaction();
    tx.begin();
View Full Code Here

    protected void setUp() throws Exception
    {
      super.setUp();

      m_a = new TestClassA();
      m_b = new TestClassB();

      // init a
      m_a.setValue1("A.One");
      m_a.setValue2("B.Two");
      m_a.setValue3(3);
View Full Code Here

        TestClassA a = generateTestData();
        Transaction tx = _kit.getTransaction(_conn);
        tx.begin();
        _conn.makePersistent(a.getB());
        _conn.makePersistent(a);
    TestClassB b = a.getB();
        tx.commit();
        /**
        * clear to start test
        */
        _conn.invalidateAll();
        tx = _kit.getTransaction(_conn);
        tx.begin();
        /**
     * load B
     */
    Identity oidb = _conn.getIdentity(b);
        TestClassB b1 = (TestClassB) _conn.getObjectByIdentity(oidb);
        assertTrue(b1 != null);
    /**
     * load A
      */
    Identity oida = _conn.getIdentity(a);
View Full Code Here

        * now get B and update it, do NOT get it by traversing A
        */
        tx = _kit.getTransaction(_conn);
        tx.begin();
        Identity boid = _conn.getIdentity(a.getB());
        TestClassB b1 = (TestClassB) _conn.getObjectByIdentity(boid);
        assertTrue(b1 != null);
        assertTrue(b1.getValue1().equals("hi there"));
        /**
        * everything is good, update b
        */
        _conn.lockForWrite(b1);
        b1.setValue1("goodbye there");
        tx.commit();
        /**
        * make sure b was updated
        */
        tx = _kit.getTransaction(_conn);
        tx.begin();
        boid = _conn.getIdentity(a.getB());
        b1 = (TestClassB) _conn.getObjectByIdentity(boid);
        assertTrue(b1 != null);
        assertTrue(b1.getValue1().equals("goodbye there"));
        tx.commit();

        /**
        * now get A again and make sure the related B is updated to reflect
        * the new value.
View Full Code Here

    public void testSwizzleNto1() throws Exception
    {
        clearTestData();
        TestClassA a = generateTestData();
        TestClassB b2 = generateAnotherB();
        Transaction tx = _kit.getTransaction(_conn);
        tx.begin();
        _conn.makePersistent(a.getB());
        _conn.makePersistent(a);
        tx.commit();
View Full Code Here

   public void testSwizzle4() throws TransactionException, LockingException, PBFactoryException, PersistenceBrokerException
    {
        clearTestData();
        TestClassA a = generateTestData();
    TestClassB b = a.getB();
        Transaction tx = _kit.getTransaction(_conn);

        tx.begin();
        _conn.makePersistent(b);
        _conn.makePersistent(a);
        b.setA(a);
        tx.commit();
        /**
        * clear to start test
        */
        _conn.invalidateAll();
        tx = _kit.getTransaction(_conn);
        tx.begin();
        /**
     * load B
     */
    Identity oidb = _conn.getIdentity(b);
        TestClassB b1 = (TestClassB) _conn.getObjectByIdentity(oidb);
    /**
     * load A
      */
    Identity oida = _conn.getIdentity(a);
    TestClassA a1 = (TestClassA) _conn.getObjectByIdentity(oida);
    assertTrue(a1 != null);
    assertTrue(a1.getB().equals(b1));
    assertTrue(b1.getA().equals(a1));
        /**
     * update B
     */
        a.setValue1("a");
        _conn.makePersistent(a);
View Full Code Here

TOP

Related Classes of org.apache.ojb.odmg.shared.TestClassB

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.