@Test @SuppressWarnings( "unchecked" ) public void testRun_appWithAllStates() throws Exception { TestApplication app = new TestApplication(); ManagedApplication ma = new ManagedApplication( app ); TestUtils.getInternalField( this.appManager, "nameToManagedApplication", Map.class ).put( ma.getName(), ma ); InstanceStatus[] statuses = new InstanceStatus[] { InstanceStatus.NOT_DEPLOYED, InstanceStatus.DEPLOYING, InstanceStatus.DEPLOYED_STARTED, InstanceStatus.DEPLOYED_STOPPED, InstanceStatus.PROBLEM }; for( InstanceStatus status : statuses ) { Mockito.reset( this.messagingMngr ); CheckerForStoredMessagesTask task = new CheckerForStoredMessagesTask( this.appManager, this.messagingMngr ); app.getMySqlVm().setStatus( status ); Mockito.verifyZeroInteractions( this.messagingMngr ); task.run(); Mockito.verify( this.messagingMngr, Mockito.times( 1 )).sendStoredMessages( Mockito.eq( ma ), Mockito.eq( app.getMySqlVm())); Mockito.verify( this.messagingMngr, Mockito.times( 1 )).sendStoredMessages( Mockito.eq( ma ), Mockito.eq( app.getTomcatVm())); } }
@Override public void run() { this.logger.finest( "The task that checks stored messages runs." ); for( ManagedApplication ma : this.appManager.getManagedApplications()) { for( Instance scopedInstance : InstanceHelpers.findAllScopedInstances( ma.getApplication())) this.messagingMngr.sendStoredMessages( ma, scopedInstance ); } }
CheckerForStoredMessagesTask extends TimerTask { @Override public void run() { this.logger.finest( "The task that checks stored messages runs." ); for( ManagedApplication ma : this.appManager.getManagedApplications()) { for( Instance scopedInstance : InstanceHelpers.findAllScopedInstances( ma.getApplication())) this.messagingMngr.sendStoredMessages( ma, scopedInstance ); } } }
CheckerForStoredMessagesTask extends TimerTask { @Override public void run() { this.logger.finest( "The task that checks stored messages runs." ); for( ManagedApplication ma : this.appManager.getManagedApplications()) { for( Instance scopedInstance : InstanceHelpers.findAllScopedInstances( ma.getApplication())) this.messagingMngr.sendStoredMessages( ma, scopedInstance ); } } CheckerForStoredMessagesTask( IApplicationMngr appManager, IMessagingMngr messagingMngr ); }
CheckerForStoredMessagesTask extends TimerTask { @Override public void run() { this.logger.finest( "The task that checks stored messages runs." ); for( ManagedApplication ma : this.appManager.getManagedApplications()) { for( Instance scopedInstance : InstanceHelpers.findAllScopedInstances( ma.getApplication())) this.messagingMngr.sendStoredMessages( ma, scopedInstance ); } } CheckerForStoredMessagesTask( IApplicationMngr appManager, IMessagingMngr messagingMngr ); @Override void run(); }
CheckerForStoredMessagesTask extends TimerTask { @Override public void run() { this.logger.finest( "The task that checks stored messages runs." ); for( ManagedApplication ma : this.appManager.getManagedApplications()) { for( Instance scopedInstance : InstanceHelpers.findAllScopedInstances( ma.getApplication())) this.messagingMngr.sendStoredMessages( ma, scopedInstance ); } } CheckerForStoredMessagesTask( IApplicationMngr appManager, IMessagingMngr messagingMngr ); @Override void run();  }