use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.
the class DeliveryAssuranceOnewayTest method testOnewayExactlyOnce.
private void testOnewayExactlyOnce(Executor executor) throws Exception {
init("org/apache/cxf/systest/ws/rm/exactlyonce.xml", executor);
greeterBus.getOutInterceptors().add(new MessageLossSimulator());
RMManager manager = greeterBus.getExtension(RMManager.class);
manager.getConfiguration().setBaseRetransmissionInterval(new Long(2000));
String[] callArgs = new String[] { "one", "two", "three", "four" };
for (int i = 0; i < callArgs.length; i++) {
greeter.greetMeOneWay(callArgs[i]);
}
awaitMessages(callArgs.length, 1000, 60000);
List<String> actualArgs = GreeterProvider.CALL_ARGS;
assertEquals("Wrong message count", callArgs.length, actualArgs.size());
for (int i = 0; i < callArgs.length; i++) {
boolean match = false;
for (int j = 0; j < actualArgs.size(); j++) {
if (actualArgs.get(j).equals(callArgs[i])) {
match = true;
break;
}
}
if (!match) {
fail("No match for request " + callArgs[i]);
}
}
}
use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.
the class ManagedEndpointsTest method testManagedEndpointsOneway12.
@Test
public void testManagedEndpointsOneway12() throws Exception {
prepareClient();
RMManager clientManager = clientBus.getExtension(RMManager.class);
RMManager serverManager = serverBus.getExtension(RMManager.class);
InstrumentationManager serverIM = serverBus.getExtension(InstrumentationManager.class);
MBeanServer mbs = serverIM.getMBeanServer();
assertNotNull("MBeanServer must be available.", mbs);
ObjectName clientManagerName = RMUtils.getManagedObjectName(clientManager);
ObjectName serverManagerName = RMUtils.getManagedObjectName(serverManager);
Object o;
GreeterService gs = new GreeterService();
final Greeter greeter = gs.getGreeterPort();
updateAddressPort(greeter, ManagedEndpointsTest.PORT);
LOG.fine("Created greeter client.");
ClientProxy.getClient(greeter).getRequestContext().put(RMManager.WSRM_VERSION_PROPERTY, RM11Constants.NAMESPACE_URI);
org.apache.cxf.endpoint.Endpoint ep = ClientProxy.getClient(greeter).getEndpoint();
String epId = RMUtils.getEndpointIdentifier(ep, clientBus);
// sent
greeter.greetMeOneWay("one");
o = mbs.invoke(clientManagerName, "getEndpointIdentifiers", null, null);
verifyArray("Expected endpoint identifier", o, new String[] { epId }, true);
o = mbs.invoke(serverManagerName, "getEndpointIdentifiers", null, null);
verifyArray("Expected endpoint identifier", o, new String[] { epId }, true);
ObjectName clientEndpointName = RMUtils.getManagedObjectName(clientManager, ep);
// we need to find out serverEndpointName by using the query name
ObjectName serverEndpointName = getEndpointName(mbs, serverManager);
String sseqId = getSingleSourceSequenceId(mbs, clientEndpointName);
o = mbs.invoke(clientEndpointName, "getCurrentSourceSequenceId", null, null);
assertTrue("Expected sequence identifier", o instanceof String && sseqId.equals(o));
o = mbs.invoke(serverEndpointName, "getDestinationSequenceIds", null, null);
verifyArray("Expected sequence identifier", o, new String[] { sseqId }, false);
String dseqId = getSingleDestinationSequenceId(mbs, clientEndpointName);
testOperation(mbs, greeter, clientEndpointName, serverEndpointName, sseqId, dseqId);
mbs.invoke(clientEndpointName, "closeSourceSequence", new Object[] { sseqId }, ONESTRING_SIGNATURE);
o = mbs.invoke(clientEndpointName, "getSourceSequenceIds", new Object[] { true }, ONEBOOLEAN_SIGNATURE);
verifyArray("Expected sequence identifier", o, new String[] { sseqId }, true);
mbs.invoke(clientEndpointName, "terminateSourceSequence", new Object[] { sseqId }, ONESTRING_SIGNATURE);
o = mbs.invoke(clientEndpointName, "getSourceSequenceIds", new Object[] { true }, ONEBOOLEAN_SIGNATURE);
assertTrue("Source sequence terminated", o instanceof String[] && 0 == ((String[]) o).length);
mbs.invoke(clientEndpointName, "terminateDestinationSequence", new Object[] { dseqId }, ONESTRING_SIGNATURE);
o = mbs.invoke(clientEndpointName, "getDestinationSequenceIds", new Object[] {}, EMPTY_SIGNATURE);
assertTrue("Destination sequence terminated", o instanceof String[] && 0 == ((String[]) o).length);
}
use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.
the class ManagedEndpointsTest method testManagedEndpointsOneway.
@Test
public void testManagedEndpointsOneway() throws Exception {
prepareClient();
RMManager clientManager = clientBus.getExtension(RMManager.class);
RMManager serverManager = serverBus.getExtension(RMManager.class);
InstrumentationManager serverIM = serverBus.getExtension(InstrumentationManager.class);
MBeanServer mbs = serverIM.getMBeanServer();
assertNotNull("MBeanServer must be available.", mbs);
ObjectName clientManagerName = RMUtils.getManagedObjectName(clientManager);
ObjectName serverManagerName = RMUtils.getManagedObjectName(serverManager);
Object o;
GreeterService gs = new GreeterService();
final Greeter greeter = gs.getGreeterPort();
updateAddressPort(greeter, ManagedEndpointsTest.PORT);
LOG.fine("Created greeter client.");
org.apache.cxf.endpoint.Endpoint ep = ClientProxy.getClient(greeter).getEndpoint();
String epId = RMUtils.getEndpointIdentifier(ep, clientBus);
// sent
greeter.greetMeOneWay("one");
o = mbs.invoke(clientManagerName, "getEndpointIdentifiers", null, null);
verifyArray("Expected endpoint identifier", o, new String[] { epId }, true);
o = mbs.invoke(serverManagerName, "getEndpointIdentifiers", null, null);
verifyArray("Expected endpoint identifier", o, new String[] { epId }, true);
ObjectName clientEndpointName = RMUtils.getManagedObjectName(clientManager, ep);
// we need to find out serverEndpointName by using the query name
ObjectName serverEndpointName = getEndpointName(mbs, serverManager);
String sseqId = getSingleSourceSequenceId(mbs, clientEndpointName);
o = mbs.invoke(clientEndpointName, "getCurrentSourceSequenceId", null, null);
assertTrue("Expected sequence identifier", o instanceof String && sseqId.equals(o));
o = mbs.invoke(serverEndpointName, "getDestinationSequenceIds", null, null);
verifyArray("Expected sequence identifier", o, new String[] { sseqId }, false);
String dseqId = getSingleDestinationSequenceId(mbs, clientEndpointName);
testOperation(mbs, greeter, clientEndpointName, serverEndpointName, sseqId, dseqId);
mbs.invoke(clientEndpointName, "terminateSourceSequence", new Object[] { sseqId }, ONESTRING_SIGNATURE);
o = mbs.invoke(clientEndpointName, "getSourceSequenceIds", new Object[] { true }, ONEBOOLEAN_SIGNATURE);
assertTrue("Source sequence terminated", o instanceof String[] && 0 == ((String[]) o).length);
mbs.invoke(clientEndpointName, "terminateDestinationSequence", new Object[] { dseqId }, ONESTRING_SIGNATURE);
o = mbs.invoke(clientEndpointName, "getDestinationSequenceIds", new Object[] {}, EMPTY_SIGNATURE);
assertTrue("Destination sequence terminated", o instanceof String[] && 0 == ((String[]) o).length);
}
use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.
the class MessageCallbackOnewayTest method testOnewayAtLeastOnce.
private void testOnewayAtLeastOnce(Executor executor) throws Exception {
init("org/apache/cxf/systest/ws/rm/atleastonce.xml", executor);
greeterBus.getOutInterceptors().add(new MessageLossSimulator());
RMManager manager = greeterBus.getExtension(RMManager.class);
manager.getConfiguration().setBaseRetransmissionInterval(RETRANSMISSION_INTERVAL);
String[] callArgs = new String[] { "one", "two", "three", "four" };
for (int i = 0; i < callArgs.length; i++) {
greeter.greetMeOneWay(callArgs[i]);
}
callback.waitDone(8, 3000, 60000);
verifyCallbacks();
}
use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.
the class MessageCallbackOnewayTest method testOnewayExactlyOnce.
private void testOnewayExactlyOnce(Executor executor) throws Exception {
init("org/apache/cxf/systest/ws/rm/exactlyonce.xml", executor);
greeterBus.getOutInterceptors().add(new MessageLossSimulator());
RMManager manager = greeterBus.getExtension(RMManager.class);
manager.getConfiguration().setBaseRetransmissionInterval(RETRANSMISSION_INTERVAL);
String[] callArgs = new String[] { "one", "two", "three", "four" };
for (int i = 0; i < callArgs.length; i++) {
greeter.greetMeOneWay(callArgs[i]);
}
callback.waitDone(8, 3000, 60000);
verifyCallbacks();
}
Aggregations