@Test @SuppressWarnings( "unchecked" ) public void testUnregister_withRegistration() { IMessagingClient messagingClient = Mockito.mock( IMessagingClient.class ); JmxWrapperForMessagingClient client = new JmxWrapperForMessagingClient( messagingClient ); ServiceRegistration<MessagingApiMBean> serviceReg = Mockito.mock( ServiceRegistration.class ); client.serviceReg = serviceReg; client.unregisterService(); Assert.assertNull( client.serviceReg ); Mockito.verify( serviceReg, Mockito.only()).unregister(); }
public void unregisterService() { try { if( this.serviceReg != null ) { this.logger.finer( "Running in an OSGi environment. Trying to unregister a MBean for the messaging." ); this.serviceReg.unregister(); this.logger.finer( "Running in an OSGi environment. The MBean was unregistered." ); } } catch( Exception e ) { this.logger.severe( "A MBean could not be unregistered for the messaging." ); Utils.logException( this.logger, e ); } finally { this.serviceReg = null; } }
JmxWrapperForMessagingClient implements IMessagingClient, MessagingApiMBean { public void unregisterService() { try { if( this.serviceReg != null ) { this.logger.finer( "Running in an OSGi environment. Trying to unregister a MBean for the messaging." ); this.serviceReg.unregister(); this.logger.finer( "Running in an OSGi environment. The MBean was unregistered." ); } } catch( Exception e ) { this.logger.severe( "A MBean could not be unregistered for the messaging." ); Utils.logException( this.logger, e ); } finally { this.serviceReg = null; } } }
JmxWrapperForMessagingClient implements IMessagingClient, MessagingApiMBean { public void unregisterService() { try { if( this.serviceReg != null ) { this.logger.finer( "Running in an OSGi environment. Trying to unregister a MBean for the messaging." ); this.serviceReg.unregister(); this.logger.finer( "Running in an OSGi environment. The MBean was unregistered." ); } } catch( Exception e ) { this.logger.severe( "A MBean could not be unregistered for the messaging." ); Utils.logException( this.logger, e ); } finally { this.serviceReg = null; } } JmxWrapperForMessagingClient( IMessagingClient messagingClient );   JmxWrapperForMessagingClient( IMessagingClient messagingClient, OsgiHelper osgiHelper ); }
JmxWrapperForMessagingClient implements IMessagingClient, MessagingApiMBean { public void unregisterService() { try { if( this.serviceReg != null ) { this.logger.finer( "Running in an OSGi environment. Trying to unregister a MBean for the messaging." ); this.serviceReg.unregister(); this.logger.finer( "Running in an OSGi environment. The MBean was unregistered." ); } } catch( Exception e ) { this.logger.severe( "A MBean could not be unregistered for the messaging." ); Utils.logException( this.logger, e ); } finally { this.serviceReg = null; } } JmxWrapperForMessagingClient( IMessagingClient messagingClient );   JmxWrapperForMessagingClient( IMessagingClient messagingClient, OsgiHelper osgiHelper ); void unregisterService(); boolean isDismissClient(); @Override synchronized void reset(); @Override String getId(); @Override synchronized long getFailedSendingCount(); @Override synchronized long getSentMessagesCount(); @Override synchronized long getTimestampOfLastSendingFailure(); @Override synchronized long getTimestampOfLastSentMessage(); @Override synchronized long getFailedReceptionCount(); @Override synchronized long getReceivedMessagesCount(); @Override synchronized long getTimestampOfLastReceptionFailure(); @Override synchronized long getTimestampOfLastReceivedMessage(); @Override void closeConnection(); @Override void openConnection(); @Override void deleteMessagingServerArtifacts( Application application ); @Override Map<String,String> getConfiguration(); @Override String getMessagingType(); @Override boolean isConnected(); @Override void subscribe( MessagingContext ctx ); @Override void unsubscribe( MessagingContext ctx ); @Override void setMessageQueue( RoboconfMessageQueue messageQueue ); @Override void publish( MessagingContext ctx, Message msg ); @Override void setOwnerProperties(
			RecipientKind ownerKind,
			String domain,
			String applicationName,
			String scopedInstancePath ); }
JmxWrapperForMessagingClient implements IMessagingClient, MessagingApiMBean { public void unregisterService() { try { if( this.serviceReg != null ) { this.logger.finer( "Running in an OSGi environment. Trying to unregister a MBean for the messaging." ); this.serviceReg.unregister(); this.logger.finer( "Running in an OSGi environment. The MBean was unregistered." ); } } catch( Exception e ) { this.logger.severe( "A MBean could not be unregistered for the messaging." ); Utils.logException( this.logger, e ); } finally { this.serviceReg = null; } } JmxWrapperForMessagingClient( IMessagingClient messagingClient );   JmxWrapperForMessagingClient( IMessagingClient messagingClient, OsgiHelper osgiHelper ); void unregisterService(); boolean isDismissClient(); @Override synchronized void reset(); @Override String getId(); @Override synchronized long getFailedSendingCount(); @Override synchronized long getSentMessagesCount(); @Override synchronized long getTimestampOfLastSendingFailure(); @Override synchronized long getTimestampOfLastSentMessage(); @Override synchronized long getFailedReceptionCount(); @Override synchronized long getReceivedMessagesCount(); @Override synchronized long getTimestampOfLastReceptionFailure(); @Override synchronized long getTimestampOfLastReceivedMessage(); @Override void closeConnection(); @Override void openConnection(); @Override void deleteMessagingServerArtifacts( Application application ); @Override Map<String,String> getConfiguration(); @Override String getMessagingType(); @Override boolean isConnected(); @Override void subscribe( MessagingContext ctx ); @Override void unsubscribe( MessagingContext ctx ); @Override void setMessageQueue( RoboconfMessageQueue messageQueue ); @Override void publish( MessagingContext ctx, Message msg ); @Override void setOwnerProperties(
			RecipientKind ownerKind,
			String domain,
			String applicationName,
			String scopedInstancePath );  }