Examples of PersistenceBroker


Examples of org.apache.ojb.broker.PersistenceBroker

    pbControl.verify();
  }

  public void testRemoveFromCache() {
    MockControl pbControl = MockControl.createControl(PersistenceBroker.class);
    final PersistenceBroker pb = (PersistenceBroker) pbControl.getMock();
    Object entity = new Object();
    pb.removeFromCache(entity);
    pbControl.setVoidCallable(1);
    pb.close();
    pbControl.setReturnValue(true, 1);
    pbControl.replay();

    PersistenceBrokerTemplate template = new PersistenceBrokerTemplate() {
      protected PersistenceBroker getPersistenceBroker() {
View Full Code Here

Examples of org.apache.ojb.broker.PersistenceBroker

    pbControl.verify();
  }

  public void testClearCache() {
    MockControl pbControl = MockControl.createControl(PersistenceBroker.class);
    final PersistenceBroker pb = (PersistenceBroker) pbControl.getMock();
    pb.clearCache();
    pbControl.setVoidCallable(1);
    pb.close();
    pbControl.setReturnValue(true, 1);
    pbControl.replay();

    PersistenceBrokerTemplate template = new PersistenceBrokerTemplate() {
      protected PersistenceBroker getPersistenceBroker() {
View Full Code Here

Examples of org.apache.ojb.broker.PersistenceBroker

    pbControl.verify();
  }

  public void testStore() {
    MockControl pbControl = MockControl.createControl(PersistenceBroker.class);
    final PersistenceBroker pb = (PersistenceBroker) pbControl.getMock();
    Object entity = new Object();
    pb.store(entity);
    pbControl.setVoidCallable(1);
    pb.close();
    pbControl.setReturnValue(true, 1);
    pbControl.replay();

    PersistenceBrokerTemplate template = new PersistenceBrokerTemplate() {
      protected PersistenceBroker getPersistenceBroker() {
View Full Code Here

Examples of org.apache.ojb.broker.PersistenceBroker

    pbControl.verify();
  }

  public void testDelete() {
    MockControl pbControl = MockControl.createControl(PersistenceBroker.class);
    final PersistenceBroker pb = (PersistenceBroker) pbControl.getMock();
    Object entity = new Object();
    pb.delete(entity);
    pbControl.setVoidCallable(1);
    pb.close();
    pbControl.setReturnValue(true, 1);
    pbControl.replay();

    PersistenceBrokerTemplate template = new PersistenceBrokerTemplate() {
      protected PersistenceBroker getPersistenceBroker() {
View Full Code Here

Examples of org.apache.ojb.broker.PersistenceBroker

    pbControl.verify();
  }

  public void testDeleteByQuery() {
    MockControl pbControl = MockControl.createControl(PersistenceBroker.class);
    final PersistenceBroker pb = (PersistenceBroker) pbControl.getMock();
    Query query = new QueryByCriteria(TestBean.class);
    pb.deleteByQuery(query);
    pbControl.setVoidCallable(1);
    pb.close();
    pbControl.setReturnValue(true, 1);
    pbControl.replay();

    PersistenceBrokerTemplate template = new PersistenceBrokerTemplate() {
      protected PersistenceBroker getPersistenceBroker() {
View Full Code Here

Examples of org.apache.ojb.broker.PersistenceBroker

    System.setProperty("OJB.properties", res.getFile().getAbsolutePath());
  }

  public void testTransactionCommit() throws LookupException, SQLException {
    MockControl pbControl = MockControl.createControl(PersistenceBroker.class);
    final PersistenceBroker pb = (PersistenceBroker) pbControl.getMock();
    MockControl cmControl = MockControl.createControl(ConnectionManagerIF.class);
    final ConnectionManagerIF cm = (ConnectionManagerIF) cmControl.getMock();
    final Object entity = new Object();
    MockControl conControl = MockControl.createControl(Connection.class);
    Connection con = (Connection) conControl.getMock();

    pb.serviceConnectionManager();
    pbControl.setReturnValue(cm, 2);
    cm.getConnection();
    cmControl.setReturnValue(con, 2);
    con.isReadOnly();
    conControl.setReturnValue(false, 1);
    pb.beginTransaction();
    pbControl.setVoidCallable(1);
    pb.delete(entity);
    pbControl.setVoidCallable(1);
    pb.commitTransaction();
    pbControl.setVoidCallable(1);
    pb.close();
    pbControl.setReturnValue(true, 1);

    pbControl.replay();
    cmControl.replay();
    conControl.replay();
View Full Code Here

Examples of org.apache.ojb.broker.PersistenceBroker

    conControl.verify();
  }

  public void testTransactionRollback() throws LookupException, SQLException {
    MockControl pbControl = MockControl.createControl(PersistenceBroker.class);
    final PersistenceBroker pb = (PersistenceBroker) pbControl.getMock();
    MockControl cmControl = MockControl.createControl(ConnectionManagerIF.class);
    final ConnectionManagerIF cm = (ConnectionManagerIF) cmControl.getMock();
    final Object entity = new Object();
    MockControl conControl = MockControl.createControl(Connection.class);
    Connection con = (Connection) conControl.getMock();

    pb.serviceConnectionManager();
    pbControl.setReturnValue(cm, 2);
    cm.getConnection();
    cmControl.setReturnValue(con, 2);
    con.setReadOnly(true);
    conControl.setVoidCallable(1);
    con.getTransactionIsolation();
    conControl.setReturnValue(Connection.TRANSACTION_READ_COMMITTED, 1);
    con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
    conControl.setVoidCallable(1);
    con.isReadOnly();
    conControl.setReturnValue(true, 1);
    con.setReadOnly(false);
    conControl.setVoidCallable(1);
    con.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    conControl.setVoidCallable(1);
    pb.beginTransaction();
    pbControl.setVoidCallable(1);
    pb.delete(entity);
    pbControl.setVoidCallable(1);
    pb.abortTransaction();
    pbControl.setVoidCallable(1);
    pb.close();
    pbControl.setReturnValue(true, 1);

    pbControl.replay();
    cmControl.replay();
    conControl.replay();
View Full Code Here

Examples of org.apache.ojb.broker.PersistenceBroker

    conControl.verify();
  }

  public void testParticipatingTransactionWithCommit() throws LookupException, SQLException {
    MockControl pbControl = MockControl.createControl(PersistenceBroker.class);
    final PersistenceBroker pb = (PersistenceBroker) pbControl.getMock();
    MockControl cmControl = MockControl.createControl(ConnectionManagerIF.class);
    final ConnectionManagerIF cm = (ConnectionManagerIF) cmControl.getMock();
    final Object entity = new Object();
    MockControl conControl = MockControl.createControl(Connection.class);
    Connection con = (Connection) conControl.getMock();

    pb.serviceConnectionManager();
    pbControl.setReturnValue(cm, 2);
    cm.getConnection();
    cmControl.setReturnValue(con, 2);
    con.isReadOnly();
    conControl.setReturnValue(false, 1);
    pb.beginTransaction();
    pbControl.setVoidCallable(1);
    pb.delete(entity);
    pbControl.setVoidCallable(1);
    pb.commitTransaction();
    pbControl.setVoidCallable(1);
    pb.close();
    pbControl.setReturnValue(true, 1);

    pbControl.replay();
    cmControl.replay();
    conControl.replay();
View Full Code Here

Examples of org.apache.ojb.broker.PersistenceBroker

    conControl.verify();
  }

  public void testParticipatingTransactionWithRollbackOnly() throws LookupException, SQLException {
    MockControl pbControl = MockControl.createControl(PersistenceBroker.class);
    final PersistenceBroker pb = (PersistenceBroker) pbControl.getMock();
    MockControl cmControl = MockControl.createControl(ConnectionManagerIF.class);
    final ConnectionManagerIF cm = (ConnectionManagerIF) cmControl.getMock();
    final Object entity = new Object();
    MockControl conControl = MockControl.createControl(Connection.class);
    Connection con = (Connection) conControl.getMock();

    pb.serviceConnectionManager();
    pbControl.setReturnValue(cm, 2);
    cm.getConnection();
    cmControl.setReturnValue(con, 2);
    con.isReadOnly();
    conControl.setReturnValue(false, 1);
    pb.beginTransaction();
    pbControl.setVoidCallable(1);
    pb.delete(entity);
    pbControl.setVoidCallable(1);
    pb.abortTransaction();
    pbControl.setVoidCallable(1);
    pb.close();
    pbControl.setReturnValue(true, 1);

    pbControl.replay();
    cmControl.replay();
    conControl.replay();
View Full Code Here

Examples of org.apache.ojb.broker.PersistenceBroker

    conControl.verify();
  }

  public void testParticipatingTransactionWithRequiresNew() throws LookupException, SQLException {
    MockControl pb1Control = MockControl.createControl(PersistenceBroker.class);
    final PersistenceBroker pb1 = (PersistenceBroker) pb1Control.getMock();
    MockControl pb2Control = MockControl.createControl(PersistenceBroker.class);
    final PersistenceBroker pb2 = (PersistenceBroker) pb2Control.getMock();
    MockControl cmControl = MockControl.createControl(ConnectionManagerIF.class);
    final ConnectionManagerIF cm = (ConnectionManagerIF) cmControl.getMock();
    MockControl conControl = MockControl.createControl(Connection.class);
    Connection con = (Connection) conControl.getMock();

    pb1.serviceConnectionManager();
    pb1Control.setReturnValue(cm, 2);
    cm.getConnection();
    cmControl.setReturnValue(con, 4);
    con.isReadOnly();
    conControl.setReturnValue(false, 2);
    pb1.beginTransaction();
    pb1Control.setVoidCallable(1);
    pb2.serviceConnectionManager();
    pb2Control.setReturnValue(cm, 2);
    pb2.beginTransaction();
    pb2Control.setVoidCallable(1);
    pb2.commitTransaction();
    pb2Control.setVoidCallable(1);
    pb2.close();
    pb2Control.setReturnValue(true, 1);
    pb1.commitTransaction();
    pb1Control.setVoidCallable(1);
    pb1.close();
    pb1Control.setReturnValue(true, 1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.