MessageProcessor implements ITask, IMessageProcessor, IManagedTask, IShutdownAwareTask { @Override public void signal(final String signalName) throws InvalidArgumentException { if (null == signalName) { throw new InvalidArgumentException("Signal name should not be null."); } try { Object signal = IOC.resolve(Keys.getOrAdd(signalName)); if (!(signal instanceof Signal)) { throw new InvalidArgumentException("Resolved signal is not a signal."); } this.signalException = (Signal) signal; } catch (ResolutionException e) { throw new InvalidArgumentException("Could not resolve a signal throwable.", e); } } MessageProcessor(final IQueue<ITask> taskQueue, final IMessageProcessingSequence messageProcessingSequence, final IObject config); @Override void process(final IObject theMessage, final IObject theContext); @Override void pauseProcess(); @Override void continueProcess(final Throwable e); @Override void signal(final String signalName); @Override IObject getContext(); @Override IObject getResponse(); @Override IObject getMessage(); @Override IMessageProcessingSequence getSequence(); @Override IObject getEnvironment(); @Override void pushEnvironment(final IObject newEnvironment); @Override void resetEnvironment(); @Override void setConfig(final IObject config); @Override void execute(); @Override T getAs(final Class<T> clazz); @Override void notifyShuttingDown(); @Override void notifyIgnored(); @Override void setShutdownStatus(final Object status); @Override Object getShutdownStatus();  }
@Test(expected = InvalidArgumentException.class) public void Should_throwWhenSignalNameIsNull() throws Exception { MessageProcessor messageProcessor = new MessageProcessor(taskQueueMock, messageProcessingSequenceMock, configurationMock); messageProcessor.signal(null); }
@Test(expected = InvalidArgumentException.class) public void Should_throwWhenSignalNameIsInvalid() throws Exception { MessageProcessor messageProcessor = new MessageProcessor(taskQueueMock, messageProcessingSequenceMock, configurationMock); messageProcessor.signal("invalid key"); }
@Test(expected = InvalidArgumentException.class) public void Should_throwWhenSignalIsNotSignal() throws Exception { MessageProcessor messageProcessor = new MessageProcessor(taskQueueMock, messageProcessingSequenceMock, configurationMock); messageProcessor.signal("info.smart_tools.smartactors.iobject.iobject.IObject"); }