INT-881, Added ControlBusBindingMessageDistributionListener, fixed template.mf (after real OSGi testing), added tests

This commit is contained in:
Oleg Zhurakousky
2009-11-18 00:12:15 +00:00
parent 0f5b6dfd20
commit 1ed307765e
14 changed files with 316 additions and 45 deletions

View File

@@ -23,4 +23,9 @@ package org.springframework.integration.osgi;
*/
public interface IntegrationOSGiConstants {
public final String OSGI_BEAN_NAME = "org.springframework.osgi.bean.name";
public final String INTEGRATION_EVENT_TYPE = "INTEGRATION_EVENT_TYPE";
public final String REGISTRATION = "REGISTRATION";
public final String UNREGISTRATION = "UNREGISTRATION";
public final String BINDING = "BINDING";
public final String UNBINDING= "UNBINDING";
}

View File

@@ -18,7 +18,8 @@ package org.springframework.integration.osgi.config.xml;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.integration.osgi.extender.IntegrationServiceRegistrationListener;
import org.springframework.integration.osgi.extender.ControlBusBindingMessageDistributionListener;
import org.springframework.integration.osgi.extender.ControlBusRegistrationMessageDistributionListener;
import org.springframework.osgi.service.exporter.support.AutoExport;
import org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean;
import org.springframework.osgi.service.importer.support.Cardinality;
@@ -81,10 +82,14 @@ public class AbstractOSGiServiceManagingParserUtil {
if (publishedIntefaces != null && publishedIntefaces.length > 0){
serviceBuilder.addPropertyValue("interfaces", publishedIntefaces);
}
// will make sure it uses exporter's bean name when building a relationship with importer
serviceBuilder.addPropertyValue("serviceBeanName", beanName);
//TODO: pf.setTimeout(timeoutInMillis)
// OsgiServiceProxyFactoryBean b = null;
// b.setListeners(listeners)
return serviceBuilder;
}
/**
@@ -99,15 +104,37 @@ public class AbstractOSGiServiceManagingParserUtil {
public static AbstractBeanDefinition defineRegistrationListenerForBus(BeanDefinitionRegistry registry,
BeanDefinitionBuilder exporterBuilder,
String busBeanName){
// create listener builder
BeanDefinitionBuilder listenerBuilder =
BeanDefinitionBuilder.genericBeanDefinition(IntegrationServiceRegistrationListener.class);
BeanDefinitionBuilder.genericBeanDefinition(ControlBusRegistrationMessageDistributionListener.class);
String busGroupName = busBeanName;
// if reference to the bus doesn't exist yet, create one
// corresponding bean is not the actual bus but a ControlBusListentingDecorator
if (!registry.containsBeanDefinition(busGroupName)){
ControlBusOSGiUtils.registerImporterForControlBus(registry, busGroupName);
}
listenerBuilder.addConstructorArgReference(busGroupName);
AbstractBeanDefinition listenerDefinition = listenerBuilder.getBeanDefinition();
exporterBuilder.addPropertyValue("listeners", listenerDefinition);
//exporterBuilder.addPropertyValue("listeners", listenerDefinition);
return listenerDefinition;
}
public static AbstractBeanDefinition defineBindingListenerForBus(BeanDefinitionRegistry registry,
BeanDefinitionBuilder exporterBuilder,
String busBeanName){
// create listener builder
BeanDefinitionBuilder listenerBuilder =
BeanDefinitionBuilder.genericBeanDefinition(ControlBusBindingMessageDistributionListener.class);
String busGroupName = busBeanName;
// if reference to the bus doesn't exist yet, create one
// corresponding bean is not the actual bus but a ControlBusListentingDecorator
if (!registry.containsBeanDefinition(busGroupName)){
ControlBusOSGiUtils.registerImporterForControlBus(registry, busGroupName);
}
listenerBuilder.addConstructorArgReference(busGroupName);
AbstractBeanDefinition listenerDefinition = listenerBuilder.getBeanDefinition();
//exporterBuilder.addPropertyValue("listeners", listenerDefinition);
return listenerDefinition;
}
}

View File

@@ -16,17 +16,26 @@
package org.springframework.integration.osgi.config.xml;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.PropertyValue;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanReference;
import org.springframework.beans.factory.config.RuntimeBeanNameReference;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.ManagedList;
import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.osgi.extender.IntegrationServiceRegistrationListener;
import org.springframework.integration.osgi.extender.ControlBusBindingMessageDistributionListener;
import org.springframework.integration.osgi.extender.ControlBusRegistrationMessageDistributionListener;
import org.springframework.osgi.service.exporter.OsgiServiceRegistrationListener;
import org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean;
import org.springframework.util.Assert;
import org.springframework.util.xml.DomUtils;
import org.w3c.dom.Element;
@@ -83,6 +92,15 @@ public class ConfigParser implements BeanDefinitionParser {
Class[] interfaces = this.discoverInterfaces(serviceName, element);
BeanDefinitionBuilder importerBuilder =
AbstractOSGiServiceManagingParserUtil.defineServiceImporterFor(serviceName, null, registry, interfaces);
//
if (element.hasAttribute(CONTROL_BUS)){
String busBeanName = element.getAttribute(CONTROL_BUS);
BeanDefinition listenerDefinition =
AbstractOSGiServiceManagingParserUtil.defineBindingListenerForBus(registry, importerBuilder, busBeanName);
importerBuilder.addPropertyValue("listeners", listenerDefinition);
}
//
registry.registerBeanDefinition(serviceName, importerBuilder.getBeanDefinition());
}
/**
@@ -114,26 +132,34 @@ public class ConfigParser implements BeanDefinitionParser {
private void generateServiceExorterDefinition(String beanName, Element element, BeanDefinitionRegistry registry){
BeanDefinitionBuilder exportedElementBuilder =
AbstractOSGiServiceManagingParserUtil.defineServiceExporterFor(beanName, registry);
this.connectWithControlBusIfRequired(element, exportedElementBuilder, registry, beanName);
BeanDefinition controlBusMessageDistributorDefinition =
this.defineControlBusMessageDistributor(element, exportedElementBuilder, registry, beanName);
ManagedList<BeanDefinition> listenerDefinitions = new ManagedList<BeanDefinition>();
listenerDefinitions.add(controlBusMessageDistributorDefinition);
// NOTE: add more listeners here if needed
exportedElementBuilder.addPropertyValue("listeners", listenerDefinitions);
registry.registerBeanDefinition(beanName+EXPORTER_SUFFIX, exportedElementBuilder.getBeanDefinition());
}
/**
* If element specifies 'control-bus' attribute, this method will register {@link IntegrationServiceRegistrationListener}
* If element specifies 'control-bus' attribute, this method will register {@link ControlBusRegistrationMessageDistributionListener}
* which will send registration messages to the ControlBus
*/
private void connectWithControlBusIfRequired(Element originalElement,
private BeanDefinition defineControlBusMessageDistributor(Element originalElement,
BeanDefinitionBuilder exportedElementBuilder,
BeanDefinitionRegistry registry,
String componentName) {
//String beanName = null;
AbstractBeanDefinition listenerDefinition = null;
if (originalElement.hasAttribute(CONTROL_BUS)){
String controlBusAttributeValue = originalElement.getAttribute(CONTROL_BUS);
Assert.hasText(controlBusAttributeValue, "You must provide control bus name when defining 'control-bus' attribute");
log.trace("Adding registration listener for exported OSGi service for:" + componentName);
AbstractBeanDefinition listenerDefinition =
listenerDefinition =
AbstractOSGiServiceManagingParserUtil.defineRegistrationListenerForBus(registry, exportedElementBuilder, controlBusAttributeValue);
BeanDefinitionReaderUtils.registerWithGeneratedName(listenerDefinition, registry);
}
return listenerDefinition;
}
/**
*/

View File

@@ -18,8 +18,7 @@ package org.springframework.integration.osgi.config.xml;
import java.util.HashMap;
import java.util.Map;
import org.springframework.integration.channel.PublishSubscribeChannel;
import org.springframework.osgi.util.internal.ClassUtils;
import org.springframework.integration.channel.SubscribableChannel;
import org.springframework.util.Assert;
/**
@@ -32,7 +31,7 @@ class SiTypeToJavaTypeMaper {
private static Map<String, Class[]> siTypeMappings = new HashMap<String, Class[]>();
static {
siTypeMappings.put(PUB_SUB_CHANNEL, ClassUtils.getClassHierarchy(PublishSubscribeChannel.class, ClassUtils.INCLUDE_INTERFACES));
siTypeMappings.put(PUB_SUB_CHANNEL, new Class[]{SubscribableChannel.class});
}
public static Class[] mapSiType(String siType){

View File

@@ -0,0 +1,73 @@
/*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.osgi.extender;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.integration.controlbus.ControlBus;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.integration.osgi.IntegrationOSGiConstants;
import org.springframework.osgi.service.importer.OsgiServiceLifecycleListener;
/**
* TODO - insert COMMENT
* @author Oleg Zhurakousky
* @since 2.0
*/
public class ControlBusBindingMessageDistributionListener implements
OsgiServiceLifecycleListener {
private static final Log log = LogFactory.getLog(ControlBusBindingMessageDistributionListener.class);
private ControlBus controlBus;
public ControlBusBindingMessageDistributionListener(ControlBus controlBus){
this.controlBus = controlBus;
}
/* (non-Javadoc)
* @see org.springframework.osgi.service.importer.OsgiServiceLifecycleListener#bind(java.lang.Object, java.util.Map)
*/
@SuppressWarnings("unchecked")
public void bind(Object service, Map properties) throws Exception {
if (controlBus.isBusAvailable()){
log.info("Dispatching BINDING Message for: " + properties.get(IntegrationOSGiConstants.OSGI_BEAN_NAME) +
"- " + properties + " to: " +
controlBus.getName());
MessageBuilder builder = MessageBuilder.withPayload(properties.get(IntegrationOSGiConstants.OSGI_BEAN_NAME));
builder.copyHeaders(properties);
builder.setHeader(IntegrationOSGiConstants.INTEGRATION_EVENT_TYPE, IntegrationOSGiConstants.BINDING);
controlBus.send(builder.build());
}
}
/* (non-Javadoc)
* @see org.springframework.osgi.service.importer.OsgiServiceLifecycleListener#unbind(java.lang.Object, java.util.Map)
*/
@SuppressWarnings("unchecked")
public void unbind(Object service, Map properties) throws Exception {
if (controlBus.isBusAvailable()){
log.info("Dispatching UNBINDING Message for: " + properties.get(IntegrationOSGiConstants.OSGI_BEAN_NAME) +
"- " + properties + " to: " +
controlBus.getName());
MessageBuilder builder = MessageBuilder.withPayload(properties.get(IntegrationOSGiConstants.OSGI_BEAN_NAME));
builder.copyHeaders(properties);
builder.setHeader(IntegrationOSGiConstants.INTEGRATION_EVENT_TYPE, IntegrationOSGiConstants.UNBINDING);
controlBus.send(builder.build());
}
}
}

View File

@@ -20,7 +20,8 @@ import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.integration.controlbus.ControlBus;
import org.springframework.integration.message.StringMessage;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.integration.osgi.IntegrationOSGiConstants;
import org.springframework.osgi.service.exporter.OsgiServiceRegistrationListener;
/**
@@ -30,12 +31,12 @@ import org.springframework.osgi.service.exporter.OsgiServiceRegistrationListener
* @author Oleg Zhurakousky
* @since 2.0
*/
public class IntegrationServiceRegistrationListener implements OsgiServiceRegistrationListener {
private static final Log log = LogFactory.getLog(IntegrationServiceRegistrationListener.class);
private ControlBusListeningDecorator controlBusDecorator;
public class ControlBusRegistrationMessageDistributionListener implements OsgiServiceRegistrationListener {
private static final Log log = LogFactory.getLog(ControlBusRegistrationMessageDistributionListener.class);
private ControlBus controlBus;
public IntegrationServiceRegistrationListener(ControlBusListeningDecorator controlBusDecorator){
this.controlBusDecorator = controlBusDecorator;
public ControlBusRegistrationMessageDistributionListener(ControlBus controlBus){
this.controlBus = controlBus;
}
/**
* Will send a notification message to the named {@link ControlBus} notifying that service
@@ -43,11 +44,13 @@ public class IntegrationServiceRegistrationListener implements OsgiServiceRegist
*/
@SuppressWarnings("unchecked")
public void registered(Object service, Map properties){
if (controlBusDecorator.isBusAvailable()){
if (controlBus.isBusAvailable()){
log.info("Dispatching REGISTRATION Message for: " + service + "- " + properties + " to: " +
controlBusDecorator.getName());
//TODO: change to structural message
controlBusDecorator.send(new StringMessage("Dispatching REGISTRATION Message for: " + service + "- " + properties));
controlBus.getName());
MessageBuilder builder = MessageBuilder.withPayload(service);
builder.copyHeaders(properties);
builder.setHeader(IntegrationOSGiConstants.INTEGRATION_EVENT_TYPE, IntegrationOSGiConstants.REGISTRATION);
controlBus.send(builder.build());
}
}
/**
@@ -56,11 +59,13 @@ public class IntegrationServiceRegistrationListener implements OsgiServiceRegist
*/
@SuppressWarnings("unchecked")
public void unregistered(Object service, Map properties){
if (controlBusDecorator.isBusAvailable()){
if (controlBus.isBusAvailable()){
log.info("Dispatching UN-REGISTRATION Message for: " + service + "- " + properties + " to: " +
controlBusDecorator.getName());
//TODO: change to structural message
controlBusDecorator.send(new StringMessage("Dispatching UN-REGISTRATION Message for: " + service + "- " + properties));
controlBus.getName());
MessageBuilder builder = MessageBuilder.withPayload(service);
builder.copyHeaders(properties);
builder.setHeader(IntegrationOSGiConstants.INTEGRATION_EVENT_TYPE, IntegrationOSGiConstants.UNREGISTRATION);
controlBus.send(builder.build());
}
}
}

View File

@@ -0,0 +1,67 @@
/*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.osgi.extender;
import java.util.List;
import java.util.Map;
import org.springframework.context.Lifecycle;
import org.springframework.osgi.service.importer.OsgiServiceLifecycleListener;
/**
* TODO - insert COMMENT
* @author Oleg Zhurakousky
* @since 2.0
*/
public class IntegrationServiceBindingListener implements
OsgiServiceLifecycleListener {
private List<?> dependentSources;
/* (non-Javadoc)
* @see org.springframework.osgi.service.importer.OsgiServiceLifecycleListener#bind(java.lang.Object, java.util.Map)
*/
public void bind(Object service, Map properties) throws Exception {
for (Object dependentSource : dependentSources) {
if (dependentSource instanceof Lifecycle){
Lifecycle lifecycle = (Lifecycle) dependentSource;
if (lifecycle.isRunning()){
lifecycle.stop();
}
}
}
}
/* (non-Javadoc)
* @see org.springframework.osgi.service.importer.OsgiServiceLifecycleListener#unbind(java.lang.Object, java.util.Map)
*/
public void unbind(Object service, Map properties) throws Exception {
for (Object dependentSource : dependentSources) {
if (dependentSource instanceof Lifecycle){
Lifecycle lifecycle = (Lifecycle) dependentSource;
if (!lifecycle.isRunning()){
lifecycle.start();
}
}
}
}
public List getDependentSources() {
return dependentSources;
}
public void setDependentSources(List dependentSources) {
this.dependentSources = dependentSources;
}
}

View File

@@ -24,10 +24,10 @@
<!-- END SERVICE BINDING CONFIG-->
<!-- CONTROL BUS channel, exposed as an OSGi service -->
<si:publish-subscribe-channel id="controlMessagesDistributionChannel"/>
<si:publish-subscribe-channel id="DEFAULT_CONTROL_DIST_CHANNEL"/>
<!-- END CONTROL BUS channel, exposed as an OSGi service -->
<si:header-value-router input-channel="controlMessagesDistributionChannel" header-name="INTEGRATION_EVENT_TYPE">
<si:header-value-router input-channel="DEFAULT_CONTROL_DIST_CHANNEL" header-name="INTEGRATION_EVENT_TYPE">
<si:mapping value="REGISTRATION" channel="serviceRegistrationControlChannel"/>
<si:mapping value="UNREGISTRATION" channel="serviceRegistrationControlChannel"/>
<si:mapping value="BINDING" channel="serviceBindingControlChannel"/>

View File

@@ -75,14 +75,6 @@
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="channel">
<xsd:annotation>
<xsd:documentation>
Will export all components of type
&lt;channel&gt; as SI Services
s</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
@@ -97,7 +89,7 @@
'control-bus'.
(OPTIONAL if no
control is necessary)
</xsd:documentation>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>

View File

@@ -10,7 +10,7 @@
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
<si-service:config>
<si-service:import name="channelA" si-type="publish-subscribe-channel"/>
<si-service:import name="channelA" si-type="publish-subscribe-channel" control-bus="DEFAULT_CONTROL_GROUP"/>
</si-service:config>
</beans>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si-service="http://www.springframework.org/schema/integration/integration-service-extender"
xmlns:si="http://www.springframework.org/schema/integration"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/integration/integration-service-extender http://www.springframework.org/schema/integration/integration-service-extender/spring-integration-service-extender-1.0.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
<si-service:config>
<si-service:export si-type="publish-subscribe-channel"/>
</si-service:config>
<si:publish-subscribe-channel id="channelA"/>
</beans>

View File

@@ -18,10 +18,18 @@ package org.springframework.integration.osgi.config.xml;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.mockito.Mockito;
import org.osgi.framework.BundleContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.integration.channel.SubscribableChannel;
import org.springframework.integration.controlbus.ControlBus;
import org.springframework.integration.core.Message;
import org.springframework.integration.message.MessageHandler;
import org.springframework.integration.message.StringMessage;
import org.springframework.integration.osgi.AbstractSIConfigBundleTestDeployer;
import org.springframework.integration.osgi.stubs.SIBundleContextStub;
import org.springframework.osgi.service.ServiceUnavailableException;
/**
* Tests 'config' element.
@@ -32,13 +40,67 @@ import org.springframework.integration.osgi.stubs.SIBundleContextStub;
public class ConfigParserImporterTests extends AbstractSIConfigBundleTestDeployer {
@Test
public void testBasicSIServiceConfig() throws Exception {
public void testBasicSIServiceConfigNoBackingService() throws Exception {
BundleContext bundleContext = SIBundleContextStub.getNewInstance();
ApplicationContext ac = this.deploySIConfig(bundleContext,
"org/springframework/integration/osgi/config/xml/",
"ConfigParserImporterTests-default.xml");
SubscribableChannel channel = ac.getBean("channelA", SubscribableChannel.class);
assertNotNull(channel);
}
@Test(expected=ServiceUnavailableException.class)
public void testBasicSIServiceConfigNoBackingServiceError() throws Exception {
BundleContext bundleContext = SIBundleContextStub.getNewInstance();
ApplicationContext ac = this.deploySIConfig(bundleContext,
"org/springframework/integration/osgi/config/xml/",
"ConfigParserImporterTests-default.xml");
SubscribableChannel channel = ac.getBean("channelA", SubscribableChannel.class);
assertNotNull(channel);
// try to use it and see error
channel.send(null);
}
/**
* Will register AC with service importer, then it will register another AC with service exporter
*
* @throws Exception
*/
@Test
public void testBasicSIServiceConfigWithBackingService() throws Exception {
BundleContext bundleContext = SIBundleContextStub.getNewInstance();
ApplicationContext ac = this.deploySIConfig(bundleContext,
"org/springframework/integration/osgi/config/xml/",
"ConfigParserImporterTests-default.xml");
SubscribableChannel channel = ac.getBean("channelA", SubscribableChannel.class);
assertNotNull(channel);
this.deploySIConfig(bundleContext,
"org/springframework/integration/osgi/config/xml/",
"ConfigParserImporterTests-exporter.xml");
MessageHandler handler = Mockito.mock(MessageHandler.class);
Message<String> message = new StringMessage("hello");
channel.subscribe(handler);
channel.send(message);
Mockito.verify(handler, Mockito.times(1)).handleMessage(message);
}
@Test
public void testControlBusAttributeWithBusPresent() throws Exception {
BundleContext bundleContext = SIBundleContextStub.getNewInstance();
ConfigurableApplicationContext busAC = this.deploySIConfig(bundleContext,
"org/springframework/integration/osgi/config/xml/",
"BusConfigParserTests-default.xml");
ConfigurableApplicationContext exporterAC = this.deploySIConfig(bundleContext,
"org/springframework/integration/osgi/config/xml/",
"ConfigParserImporterTests-exporter.xml");
ConfigurableApplicationContext ac = this.deploySIConfig(bundleContext,
"org/springframework/integration/osgi/config/xml/",
"ConfigParserImporterTests-default.xml");
assertNotNull(ac.getBean("channelA"));
ControlBus bus = (ControlBus) ac.getBean("DEFAULT_CONTROL_GROUP");
assertNotNull(bus);
MessageHandler handler = Mockito.mock(MessageHandler.class);
bus.subscribe(handler);
exporterAC.close();
// should be 3 notification messages sent to the bus
Mockito.verify(handler, Mockito.times(1)).handleMessage((Message<?>) Mockito.any());
}
}