@Test public void testOnServerInstanceUpdated() { final ServerTemplate serverTemplate = new ServerTemplate( "ServerTemplateId", "ServerTemplateName" ); presenter.setup( serverTemplate, null ); assertEquals( serverTemplate, presenter.getCurrentServerTemplate() ); final ServerInstance serverInstance = new ServerInstance( serverTemplate.getId(), "serverName", "serverInstanceId", "url", "1.0", Collections.<Message>emptyList(), Collections.<Container>emptyList() ); presenter.onServerInstanceUpdated( new ServerInstanceUpdated( serverInstance ) ); presenter.onServerInstanceUpdated( new ServerInstanceUpdated( serverInstance ) ); verify( view ).addServerInstance( eq( serverInstance.getServerTemplateId() ), eq( serverInstance.getServerInstanceId() ), eq( serverInstance.getServerName() ), any( Command.class ) ); presenter.onServerInstanceDeleted( new ServerInstanceDeleted( serverInstance.getServerInstanceId() ) ); presenter.onServerInstanceUpdated( new ServerInstanceUpdated( serverInstance ) ); verify( view, times( 2 ) ).addServerInstance( eq( serverInstance.getServerTemplateId() ), eq( serverInstance.getServerInstanceId() ), eq( serverInstance.getServerName() ), any( Command.class ) ); }
public void onServerInstanceUpdated( @Observes final ServerInstanceUpdated serverInstanceUpdated ) { if ( serverInstanceUpdated != null && serverInstanceUpdated.getServerInstance() != null ) { final ServerInstance updatedServerInstance = serverInstanceUpdated.getServerInstance(); if ( serverTemplate != null && updatedServerInstance.getServerTemplateId().equals( serverTemplate.getId() ) && !serverInstances.contains( updatedServerInstance.getServerInstanceId() ) ) { addServerInstance( updatedServerInstance ); } } else { logger.warn( "Illegal event argument." ); } }
ServerTemplatePresenter { public void onServerInstanceUpdated( @Observes final ServerInstanceUpdated serverInstanceUpdated ) { if ( serverInstanceUpdated != null && serverInstanceUpdated.getServerInstance() != null ) { final ServerInstance updatedServerInstance = serverInstanceUpdated.getServerInstance(); if ( serverTemplate != null && updatedServerInstance.getServerTemplateId().equals( serverTemplate.getId() ) && !serverInstances.contains( updatedServerInstance.getServerInstanceId() ) ) { addServerInstance( updatedServerInstance ); } } else { logger.warn( "Illegal event argument." ); } } }
ServerTemplatePresenter { public void onServerInstanceUpdated( @Observes final ServerInstanceUpdated serverInstanceUpdated ) { if ( serverInstanceUpdated != null && serverInstanceUpdated.getServerInstance() != null ) { final ServerInstance updatedServerInstance = serverInstanceUpdated.getServerInstance(); if ( serverTemplate != null && updatedServerInstance.getServerTemplateId().equals( serverTemplate.getId() ) && !serverInstances.contains( updatedServerInstance.getServerInstanceId() ) ) { addServerInstance( updatedServerInstance ); } } else { logger.warn( "Illegal event argument." ); } } @Inject  ServerTemplatePresenter( final Logger logger,
                                    final View view,
                                    final CopyPopupPresenter copyPresenter,
                                    final Caller<SpecManagementService> specManagementService,
                                    final Event<NotificationEvent> notification,
                                    final Event<AddNewContainer> addNewContainerEvent,
                                    final Event<ContainerSpecSelected> containerSpecSelectedEvent,
                                    final Event<ServerInstanceSelected> serverInstanceSelectedEvent,
                                    final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); }
ServerTemplatePresenter { public void onServerInstanceUpdated( @Observes final ServerInstanceUpdated serverInstanceUpdated ) { if ( serverInstanceUpdated != null && serverInstanceUpdated.getServerInstance() != null ) { final ServerInstance updatedServerInstance = serverInstanceUpdated.getServerInstance(); if ( serverTemplate != null && updatedServerInstance.getServerTemplateId().equals( serverTemplate.getId() ) && !serverInstances.contains( updatedServerInstance.getServerInstanceId() ) ) { addServerInstance( updatedServerInstance ); } } else { logger.warn( "Illegal event argument." ); } } @Inject  ServerTemplatePresenter( final Logger logger,
                                    final View view,
                                    final CopyPopupPresenter copyPresenter,
                                    final Caller<SpecManagementService> specManagementService,
                                    final Event<NotificationEvent> notification,
                                    final Event<AddNewContainer> addNewContainerEvent,
                                    final Event<ContainerSpecSelected> containerSpecSelectedEvent,
                                    final Event<ServerInstanceSelected> serverInstanceSelectedEvent,
                                    final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); @PostConstruct void init(); View getView(); ServerTemplate getCurrentServerTemplate(); void setup( final ServerTemplate serverTemplate,
                       final ContainerSpec firstContainerSpec ); void onContainerSelect( @Observes final ContainerSpecSelected containerSpecSelected ); void onServerInstanceSelect( @Observes final ServerInstanceSelected serverInstanceSelected ); void onServerInstanceUpdated( @Observes final ServerInstanceUpdated serverInstanceUpdated ); void onServerInstanceDeleted( @Observes final ServerInstanceDeleted serverInstanceDeleted ); void addNewContainer(); void copyTemplate(); void removeTemplate(); }
ServerTemplatePresenter { public void onServerInstanceUpdated( @Observes final ServerInstanceUpdated serverInstanceUpdated ) { if ( serverInstanceUpdated != null && serverInstanceUpdated.getServerInstance() != null ) { final ServerInstance updatedServerInstance = serverInstanceUpdated.getServerInstance(); if ( serverTemplate != null && updatedServerInstance.getServerTemplateId().equals( serverTemplate.getId() ) && !serverInstances.contains( updatedServerInstance.getServerInstanceId() ) ) { addServerInstance( updatedServerInstance ); } } else { logger.warn( "Illegal event argument." ); } } @Inject  ServerTemplatePresenter( final Logger logger,
                                    final View view,
                                    final CopyPopupPresenter copyPresenter,
                                    final Caller<SpecManagementService> specManagementService,
                                    final Event<NotificationEvent> notification,
                                    final Event<AddNewContainer> addNewContainerEvent,
                                    final Event<ContainerSpecSelected> containerSpecSelectedEvent,
                                    final Event<ServerInstanceSelected> serverInstanceSelectedEvent,
                                    final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); @PostConstruct void init(); View getView(); ServerTemplate getCurrentServerTemplate(); void setup( final ServerTemplate serverTemplate,
                       final ContainerSpec firstContainerSpec ); void onContainerSelect( @Observes final ContainerSpecSelected containerSpecSelected ); void onServerInstanceSelect( @Observes final ServerInstanceSelected serverInstanceSelected ); void onServerInstanceUpdated( @Observes final ServerInstanceUpdated serverInstanceUpdated ); void onServerInstanceDeleted( @Observes final ServerInstanceDeleted serverInstanceDeleted ); void addNewContainer(); void copyTemplate(); void removeTemplate();  }