@Test
  public void testTxStoreWithDataSource2() {
    SpringBusFactory factory = new SpringBusFactory();
    Bus bus = factory.createBus("org/apache/cxf/ws/rm/persistence/jdbc/txstore-ds-bean2.xml");
    RMManager manager = bus.getExtension(RMManager.class);
    assertNotNull(manager);
    RMTxStore store = (RMTxStore) manager.getStore();

    assertNotNull(store.getDataSource());

    assertNull(store.getConnection());
  }
  @Test
  public void testSetCustomTableExistsState2() {
    SpringBusFactory factory = new SpringBusFactory();
    Bus bus =
        factory.createBus("org/apache/cxf/ws/rm/persistence/jdbc/txstore-custom-error-bean2.xml");
    RMManager manager = bus.getExtension(RMManager.class);
    assertNotNull(manager);
    RMTxStore store = (RMTxStore) manager.getStore();

    assertTrue(store.isTableExistsError(new SQLException("Table exists", "I6000", 288)));

    assertFalse(store.isTableExistsError(new SQLException("Unknown error", "00000", -1)));
  }
 @Test
 public void testTxStoreBean() {
   // connect exception only results in a log message
   SpringBusFactory factory = new SpringBusFactory();
   Bus bus = factory.createBus("org/apache/cxf/ws/rm/persistence/jdbc/txstore-bean.xml");
   RMManager manager = bus.getExtension(RMManager.class);
   assertNotNull(manager);
   RMTxStore store = (RMTxStore) manager.getStore();
   assertNotNull(store);
   assertNull("Connection should be null", store.getConnection());
   assertEquals("org.apache.derby.jdbc.NoDriver", store.getDriverClassName());
   assertEquals("scott", store.getUserName());
   assertEquals("tiger", store.getPassword());
   assertEquals("jdbc:derby://localhost:1527/rmdb;create=true", store.getUrl());
   assertNull("schema should be unset", store.getSchemaName());
 }
Ejemplo n.º 4
0
 private void purgeCandidates(SourceSequence seq, boolean any) {
   Collection<Long> purged = new ArrayList<Long>();
   Collection<ResendCandidate> resends = new ArrayList<ResendCandidate>();
   Identifier sid = seq.getIdentifier();
   synchronized (this) {
     LOG.fine("Start purging resend candidates.");
     List<ResendCandidate> sequenceCandidates = getSequenceCandidates(seq);
     if (null != sequenceCandidates) {
       for (int i = sequenceCandidates.size() - 1; i >= 0; i--) {
         ResendCandidate candidate = sequenceCandidates.get(i);
         long m = candidate.getNumber();
         if (any || seq.isAcknowledged(m)) {
           sequenceCandidates.remove(i);
           candidate.resolved();
           unacknowledgedCount--;
           purged.add(m);
           resends.add(candidate);
         }
       }
       if (sequenceCandidates.isEmpty()) {
         candidates.remove(sid.getValue());
       }
     }
     LOG.fine("Completed purging resend candidates.");
   }
   if (purged.size() > 0) {
     RMStore store = manager.getStore();
     if (null != store) {
       store.removeMessages(sid, purged, true);
     }
     RMEndpoint rmEndpoint = seq.getSource().getReliableEndpoint();
     for (ResendCandidate resend : resends) {
       rmEndpoint.handleAcknowledgment(sid.getValue(), resend.getNumber(), resend.getMessage());
     }
   }
 }