Search in sources :

Example 21 with RMManager

use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.

the class RMTxStoreConfigurationTest method testSetCustomTableExistsState.

@Test
public void testSetCustomTableExistsState() {
    SpringBusFactory factory = new SpringBusFactory();
    Bus bus = factory.createBus("org/apache/cxf/ws/rm/persistence/jdbc/txstore-custom-error-bean.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)));
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) RMManager(org.apache.cxf.ws.rm.RMManager) SQLException(java.sql.SQLException) Test(org.junit.Test)

Example 22 with RMManager

use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.

the class RMTxStoreConfigurationTest method testTxStoreBean.

@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);
    assertNotNull("Connection should be null", store.getConnection());
    assertEquals("org.apache.derby.jdbc.EmbeddedDriver", store.getDriverClassName());
    assertEquals("scott", store.getUserName());
    assertEquals("tiger", store.getPassword());
    assertEquals("jdbc:derby:target/wsrmdb3;create=true", store.getUrl());
    assertNull("schema should be unset", store.getSchemaName());
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) RMManager(org.apache.cxf.ws.rm.RMManager) Test(org.junit.Test)

Example 23 with RMManager

use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.

the class RMTxStoreConfigurationTest method testTxStoreWithDataSource.

@Test
public void testTxStoreWithDataSource() {
    SpringBusFactory factory = new SpringBusFactory();
    Bus bus = factory.createBus("org/apache/cxf/ws/rm/persistence/jdbc/txstore-ds-bean.xml");
    RMManager manager = bus.getExtension(RMManager.class);
    assertNotNull(manager);
    RMTxStore store = (RMTxStore) manager.getStore();
    assertNotNull(store.getDataSource());
    assertNotNull(store.getConnection());
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) RMManager(org.apache.cxf.ws.rm.RMManager) Test(org.junit.Test)

Example 24 with RMManager

use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.

the class RMTxStoreConfigurationTest method testTxStoreWithDataSource2.

@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());
    assertNotNull(store.getConnection());
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) RMManager(org.apache.cxf.ws.rm.RMManager) Test(org.junit.Test)

Example 25 with RMManager

use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.

the class AbstractClientPersistenceTest method verifyRecovery.

void verifyRecovery() throws Exception {
    RMManager manager = bus.getExtension(RMManager.class);
    assertNotNull(manager);
    RMStore store = manager.getStore();
    assertNotNull(store);
    Client client = ClientProxy.getClient(greeter);
    String id = RMUtils.getEndpointIdentifier(client.getEndpoint());
    Collection<DestinationSequence> dss = store.getDestinationSequences(id);
    assertEquals(1, dss.size());
    Collection<SourceSequence> sss = store.getSourceSequences(id);
    assertEquals(1, sss.size());
    int i = 0;
    while (store.getMessages(sss.iterator().next().getIdentifier(), true).size() > 0 && i < 10) {
        Thread.sleep(200);
        i++;
    }
    assertEquals(0, store.getMessages(sss.iterator().next().getIdentifier(), true).size());
    assertEquals(0, store.getMessages(sss.iterator().next().getIdentifier(), false).size());
}
Also used : DestinationSequence(org.apache.cxf.ws.rm.DestinationSequence) RMManager(org.apache.cxf.ws.rm.RMManager) RMStore(org.apache.cxf.ws.rm.persistence.RMStore) Client(org.apache.cxf.endpoint.Client) SourceSequence(org.apache.cxf.ws.rm.SourceSequence) Endpoint(javax.xml.ws.Endpoint)

Aggregations

RMManager (org.apache.cxf.ws.rm.RMManager)43 Test (org.junit.Test)26 Endpoint (javax.xml.ws.Endpoint)12 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)12 GreeterService (org.apache.cxf.greeter_control.GreeterService)10 Greeter (org.apache.cxf.greeter_control.Greeter)9 MessageFlow (org.apache.cxf.systest.ws.util.MessageFlow)8 Bus (org.apache.cxf.Bus)7 Client (org.apache.cxf.endpoint.Client)4 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)4 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)4 MBeanServer (javax.management.MBeanServer)3 ObjectName (javax.management.ObjectName)3 WebServiceException (javax.xml.ws.WebServiceException)3 InstrumentationManager (org.apache.cxf.management.InstrumentationManager)3 Message (org.apache.cxf.message.Message)3 RMProperties (org.apache.cxf.ws.rm.RMProperties)3 RMMessage (org.apache.cxf.ws.rm.persistence.RMMessage)3 SQLException (java.sql.SQLException)2 SoapFault (org.apache.cxf.binding.soap.SoapFault)2