use of com.adaptris.core.stubs.StubAdapterStartUpEvent in project interlok by adaptris.
the class AdapterTest method createAdapter.
/**
* <p>
* Creates a valid Adapter to use in tests. Uese Mock aka Memory MessageConsumer / Producer.
* </p>
*
* @param uniqueId a uniqure identifier for this <code>Adapter</code>
*/
public static Adapter createAdapter(String uniqueId) throws Exception {
// Yes that's right we use the no-arg constructor due to
// what happens if you use the unique-id constructor...
// Behaviour is changed when it calls setEventHandler();
Adapter result = new Adapter();
// XStream sometimes throws a java.util.ConcurrentModificationException when
// marshalling, in DefaultAdapterStartupEvent#setAdapter()
// This *works* round the symptom; but it's not clear as to exactly why it occurs;
// It's clearly a timing issue, but I don't really understand why, as it is single threaded; so the lists shouldn't be
// being modified by anything else.
// So, let's use a StubAdapterStartupEvent that does nothing, doesn't even save the adapter. as we don't care about it.
// redmineID #2557
result.setStartUpEventImp(StubAdapterStartUpEvent.class.getCanonicalName());
StandardWorkflow workflow1 = createWorkflow(uniqueId + "_workflow");
workflow1.setConsumer(new MockMessageConsumer());
workflow1.setProducer(new MockMessageProducer());
Channel channel = new Channel();
channel.setUniqueId(uniqueId + "_channel1");
channel.getWorkflowList().add(workflow1);
result.getChannelList().add(channel);
result.setUniqueId(uniqueId);
return result;
}
Aggregations