Renamed ApplicationEventSourceAdapter to ApplicationEventSource and ApplicationEventTargetAdapter to ApplicationEventTarget.
This commit is contained in:
@@ -33,12 +33,12 @@ import org.springframework.util.CollectionUtils;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class ApplicationEventSourceAdapter extends ChannelPublisher implements ApplicationListener {
|
||||
public class ApplicationEventSource extends ChannelPublisher implements ApplicationListener {
|
||||
|
||||
private List<Class<? extends ApplicationEvent>> eventTypes = new ArrayList<Class<? extends ApplicationEvent>>();
|
||||
|
||||
|
||||
public ApplicationEventSourceAdapter(MessageChannel channel) {
|
||||
public ApplicationEventSource(MessageChannel channel) {
|
||||
super(channel);
|
||||
}
|
||||
|
||||
@@ -24,13 +24,13 @@ import org.springframework.integration.message.MessageMapper;
|
||||
import org.springframework.integration.message.Target;
|
||||
|
||||
/**
|
||||
* A target adapter for publishing {@link MessagingEvent MessagingEvents}. The
|
||||
* A message target for publishing {@link MessagingEvent MessagingEvents}. The
|
||||
* {@link MessagingEvent} is a subclass of Spring's {@link ApplicationEvent}
|
||||
* used by this adapter to wrap any {@link Message} sent to this target.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class ApplicationEventTargetAdapter<T> implements Target, ApplicationEventPublisherAware {
|
||||
public class ApplicationEventTarget<T> implements Target, ApplicationEventPublisherAware {
|
||||
|
||||
private final MessageMapper<T, MessagingEvent<T>> mapper = new MessagingEventMapper<T>();
|
||||
|
||||
@@ -38,12 +38,12 @@ import org.springframework.integration.message.Message;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class ApplicationEventSourceAdapterTests {
|
||||
public class ApplicationEventSourceTests {
|
||||
|
||||
@Test
|
||||
public void testAnyApplicationEventSentByDefault() {
|
||||
MessageChannel channel = new QueueChannel();
|
||||
ApplicationEventSourceAdapter adapter = new ApplicationEventSourceAdapter(channel);
|
||||
ApplicationEventSource adapter = new ApplicationEventSource(channel);
|
||||
Message<?> message1 = channel.receive(0);
|
||||
assertNull(message1);
|
||||
adapter.onApplicationEvent(new TestApplicationEvent1());
|
||||
@@ -59,7 +59,7 @@ public class ApplicationEventSourceAdapterTests {
|
||||
@Test
|
||||
public void testOnlyConfiguredEventTypesAreSent() {
|
||||
MessageChannel channel = new QueueChannel();
|
||||
ApplicationEventSourceAdapter adapter = new ApplicationEventSourceAdapter(channel);
|
||||
ApplicationEventSource adapter = new ApplicationEventSource(channel);
|
||||
List<Class<? extends ApplicationEvent>> eventTypes = new ArrayList<Class<? extends ApplicationEvent>>();
|
||||
eventTypes.add(TestApplicationEvent1.class);
|
||||
adapter.setEventTypes(eventTypes);
|
||||
@@ -76,7 +76,7 @@ public class ApplicationEventSourceAdapterTests {
|
||||
|
||||
@Test
|
||||
public void testApplicationContextEvents() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationEventSourceAdapterTests.xml", this.getClass());
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationEventSourceTests.xml", this.getClass());
|
||||
MessageChannel channel = (MessageChannel) context.getBean("channel");
|
||||
Message<?> refreshedEventMessage = channel.receive(0);
|
||||
assertNotNull(refreshedEventMessage);
|
||||
@@ -35,7 +35,7 @@ import org.springframework.integration.scheduling.Subscription;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class ApplicationEventTargetAdapterTests {
|
||||
public class ApplicationEventTargetTests {
|
||||
|
||||
@Test
|
||||
public void testSendingEvent() throws InterruptedException {
|
||||
@@ -46,7 +46,7 @@ public class ApplicationEventTargetAdapterTests {
|
||||
}
|
||||
};
|
||||
MessageChannel channel = new QueueChannel();
|
||||
ApplicationEventTargetAdapter adapter = new ApplicationEventTargetAdapter();
|
||||
ApplicationEventTarget adapter = new ApplicationEventTarget();
|
||||
adapter.setApplicationEventPublisher(publisher);
|
||||
MessageBus bus = new MessageBus();
|
||||
bus.registerChannel("channel", channel);
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<bean id="channel" class="org.springframework.integration.channel.QueueChannel"/>
|
||||
|
||||
<bean id="adapter" class="org.springframework.integration.adapter.event.ApplicationEventSourceAdapter">
|
||||
<bean id="source" class="org.springframework.integration.adapter.event.ApplicationEventSource">
|
||||
<constructor-arg ref="channel"/>
|
||||
</bean>
|
||||
|
||||
Reference in New Issue
Block a user