/** * Wait for a message. * @return MockHandler mockhandler */ public MockHandler waitForOKMessage() { waitFor(_messages, 1); return this; }
/** * Replaces an existing service registration (e.g. reference binding) with a test handler using * the same contract as the existing service provider. If multiple services are registered with * the specified name, the first one found is used. Generally speaking, it's not a good idea * to use this method if you have multiple services registered with the same name. In that * situation, use the removeService() and registerService() methods instead. * @param name name of the service to replace * @return mock service handler representing the service provider * @throws SwitchYardException if a service with the specified name does not exist */ public MockHandler replaceService(QName name) throws SwitchYardException { MockHandler handler = new MockHandler(); replaceService(name, handler); return handler; }
/** * Wait for a number of messages. * @param eventQueue event queue * @param numMessages number of messages */ private void waitFor(final LinkedBlockingQueue<Exchange> eventQueue, final int numMessages) { long start = System.currentTimeMillis(); while (System.currentTimeMillis() < start + _waitTimeout) { if (eventQueue.size() >= numMessages) { return; } sleep(); } TestCase.fail("Timed out waiting on event queue length to be " + numMessages + " or greater."); }
/** * Replaces an existing service registration (e.g. reference binding) with a test handler using * the same contract as the existing service provider. If multiple services are registered with * the specified name, the first one found is used. Generally speaking, it's not a good idea * to use this method if you have multiple services registered with the same name. In that * situation, use the removeService() and registerService() methods instead. * @param name name of the service to replace * @return mock service handler representing the service provider * @throws SwitchYardException if a service with the specified name does not exist */ public MockHandler replaceService(QName name) throws SwitchYardException { MockHandler handler = new MockHandler(); replaceService(name, handler); return handler; }
/** * Wait for a number of messages. * @param eventQueue event queue * @param numMessages number of messages */ private void waitFor(final LinkedBlockingQueue<Exchange> eventQueue, final int numMessages) { long start = System.currentTimeMillis(); while (System.currentTimeMillis() < start + _waitTimeout) { if (eventQueue.size() >= numMessages) { return; } sleep(); } TestCase.fail("Timed out waiting on event queue length to be " + numMessages + " or greater."); }
/** * Register an IN_ONLY Service. * <p/> * Registers a {@link MockHandler} as the fault service handler. * * @param serviceName The Service name. * @return The {@link MockHandler} service fault handler. */ public MockHandler registerInOnlyService(String serviceName) { MockHandler handler = new MockHandler(); getServiceDomain().registerService(createQName(serviceName), new InOnlyService(), handler); return handler; }
/** * Wait for a number of messages. * @return MockHandler mockhandler */ public MockHandler waitForFaultMessage() { waitFor(_faults, 1); return this; }
/** * Register an IN_OUT Service. * <p/> * Registers a {@link MockHandler} as the service handler. * * @param serviceName The Service name. * @return The {@link MockHandler} service handler. */ public MockHandler registerInOutService(String serviceName) { MockHandler handler = new MockHandler(); getServiceDomain().registerService(createQName(serviceName), new InOutService(), handler); return handler; }
/** * Wait for a message. * @return MockHandler mockhandler */ public MockHandler waitForOKMessage() { waitFor(_messages, 1); return this; }
/** * Register an IN_OUT Service. * <p/> * Registers a {@link MockHandler} as the service handler. * * @param serviceName The Service name. * @return The {@link MockHandler} service handler. */ public MockHandler registerInOutService(String serviceName) { MockHandler handler = new MockHandler(); getServiceDomain().registerService(createQName(serviceName), new InOutService(), handler); return handler; }
/** * Wait for a number of messages. * @return MockHandler mockhandler */ public MockHandler waitForFaultMessage() { waitFor(_faults, 1); return this; }
/** * Register an IN_ONLY Service. * <p/> * Registers a {@link MockHandler} as the fault service handler. * * @param serviceName The Service name. * @return The {@link MockHandler} service fault handler. */ public MockHandler registerInOnlyService(String serviceName) { MockHandler handler = new MockHandler(); getServiceDomain().registerService(createQName(serviceName), new InOnlyService(), handler); return handler; }