Search in sources :

Example 1 with ExpressionDescriber

use of com.agical.rmock.core.describe.ExpressionDescriber in project tomee by apache.

the class BasicClusterableRequestHandlerTest method testUpdateServerWhenRequestHashDiffersFromServerSideHash.

public void testUpdateServerWhenRequestHashDiffersFromServerSideHash() throws Exception {
    final int port = SystemInstance.get().getOptions().get("ejbd.port", 4201);
    final URI[] locations = new URI[] { new URI("ejbd://localhost:" + port) };
    ServerMetaData server = new ServerMetaData(locations);
    beanContext.setContainer(clusteredContainer);
    request.getServerHash();
    modify().returnValue(server.buildHash() + 1);
    response.setServer(null);
    modify().args(new AbstractExpression() {

        @Override
        public void describeWith(ExpressionDescriber arg0) throws IOException {
        }

        @Override
        public boolean passes(Object arg0) {
            ServerMetaData actualServer = (ServerMetaData) arg0;
            assertSame(locations, actualServer.getLocations());
            return true;
        }
    });
    clusteredContainer.getLocations(beanContext);
    modify().returnValue(locations);
    startVerification();
    requestHandler.updateServer(beanContext, request, response);
}
Also used : ExpressionDescriber(com.agical.rmock.core.describe.ExpressionDescriber) AbstractExpression(com.agical.rmock.core.match.operator.AbstractExpression) IOException(java.io.IOException) URI(java.net.URI) ServerMetaData(org.apache.openejb.client.ServerMetaData)

Aggregations

ExpressionDescriber (com.agical.rmock.core.describe.ExpressionDescriber)1 AbstractExpression (com.agical.rmock.core.match.operator.AbstractExpression)1 IOException (java.io.IOException)1 URI (java.net.URI)1 ServerMetaData (org.apache.openejb.client.ServerMetaData)1