@Override public PerspectiveDefinition getDefaultPerspectiveLayout() { return realPresenter.buildPerspective(); }
@Override public String getTitle() { return realPresenter.getTitle(); }
@Override public IsWidget getWidget() { return realPresenter.getView(); }
@Test public void testOnNewContainer() { final ServerTemplate template = mock( ServerTemplate.class ); perspective.onNewContainer( new AddNewContainer( template ) ); verify( newContainerWizard ).clear(); verify( newContainerWizard ).setServerTemplate( eq( template ) ); verify( newContainerWizard ).start(); }
@Test public void testSetupEmpty() { final ServerEmptyPresenter.View serverEmptyView = mock( ServerEmptyPresenter.View.class ); when( serverEmptyPresenter.getView() ).thenReturn( serverEmptyView ); presenter.setup( Collections.<ServerTemplateKey>emptyList(), null ); verify( view ).setEmptyView( serverEmptyView ); verify( navigationPresenter ).clear(); }
@Test public void testInit() { presenter.init(); verify( view ).setNavigation( navigationPresenter.getView() ); assertEquals( view, presenter.getView() ); }
@Test public void testOnSelectedServerInstance() { final RemotePresenter.View remoteView = mock( RemotePresenter.View.class ); when( remotePresenter.getView() ).thenReturn( remoteView ); presenter.onSelected( new ServerInstanceSelected( new ServerInstanceKey() ) ); verify( view ).setContent( remoteView ); }
@Test public void testOnSelectedContainerSpec() { final ContainerPresenter.View containerView = mock( ContainerPresenter.View.class ); when( containerPresenter.getView() ).thenReturn( containerView ); presenter.onSelected( new ContainerSpecSelected( new ContainerSpecKey() ) ); verify( view ).setContent( containerView ); }
public void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ) { if ( containerSpecSelected != null && containerSpecSelected.getContainerSpecKey() != null ) { this.view.setContent( containerPresenter.getView() ); } else { logger.warn( "Illegal event argument." ); } }
public void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ) { if ( serverInstanceSelected != null && serverInstanceSelected.getServerInstanceKey() != null ) { this.view.setContent( remotePresenter.getView() ); } else { logger.warn( "Illegal event argument." ); } }
public void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ) { if ( serverTemplateSelected != null && serverTemplateSelected.getServerTemplateKey() != null && serverTemplateSelected.getServerTemplateKey().getId() != null ) { selectServerTemplate( serverTemplateSelected.getServerTemplateKey().getId(), serverTemplateSelected.getContainerId() ); } else { logger.warn( "Illegal event argument." ); } }
@PostConstruct public void init() { this.view.setNavigation( navigationPresenter.getView() ); }
@Test public void testOnContainerUpdateFailed() { when( view.getErrorMessage( ClientContainerRuntimeOperation.START_CONTAINER, 2 ) ).thenReturn( "Error" ); presenter.onContainerUpdate( new ContainerUpdateEvent( mock( ServerTemplateKey.class ), mock( ContainerSpec.class ), new ArrayList<ServerInstanceKey>() {{ add( mock( ServerInstanceKey.class ) ); add( mock( ServerInstanceKey.class ) ); }}, ContainerRuntimeState.OFFLINE, ContainerRuntimeOperation.START_CONTAINER ) ); verify( notification ).fire( new NotificationEvent( "Error", NotificationEvent.NotificationType.ERROR ) ); }
@Test public void testOnContainerUpdateSuccess() { when( view.getSuccessMessage( ClientContainerRuntimeOperation.START_CONTAINER, 2 ) ).thenReturn( "Success" ); presenter.onContainerUpdate( new ContainerUpdateEvent( mock( ServerTemplateKey.class ), mock( ContainerSpec.class ), new ArrayList<ServerInstanceKey>() {{ add( mock( ServerInstanceKey.class ) ); add( mock( ServerInstanceKey.class ) ); }}, ContainerRuntimeState.ONLINE, ContainerRuntimeOperation.START_CONTAINER ) ); verify( notification ).fire( new NotificationEvent( "Success", NotificationEvent.NotificationType.SUCCESS ) ); }
@Test public void testOnContainerUpdateWarn() { when( view.getWarnMessage( ClientContainerRuntimeOperation.START_CONTAINER, 2 ) ).thenReturn( "Warn" ); presenter.onContainerUpdate( new ContainerUpdateEvent( mock( ServerTemplateKey.class ), mock( ContainerSpec.class ), new ArrayList<ServerInstanceKey>() {{ add( mock( ServerInstanceKey.class ) ); add( mock( ServerInstanceKey.class ) ); }}, ContainerRuntimeState.PARTIAL_ONLINE, ContainerRuntimeOperation.START_CONTAINER ) ); verify( notification ).fire( new NotificationEvent( "Warn", NotificationEvent.NotificationType.WARNING ) ); }
public void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ) { if ( serverTemplateDeleted != null ) { refreshList( new ServerTemplateListRefresh() ); } else { logger.warn( "Illegal event argument." ); } }
public void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ) { if ( serverTemplateUpdated != null && serverTemplateUpdated.getServerTemplate() != null ) { final ServerTemplate serverTemplate = serverTemplateUpdated.getServerTemplate(); if ( isEmpty ) { setup( new ArrayList<ServerTemplateKey>() {{ add( serverTemplate ); }}, serverTemplate.getId() ); } } else { logger.warn( "Illegal event argument." ); } }
@Override public void onOpen() { super.onOpen(); realPresenter.onOpen(); }
@Before public void init() { perspective = new ServerManagementPerspective( logger, newServerTemplateWizard, newContainerWizard ); }
@OnOpen public void onOpen() { refreshList( new ServerTemplateListRefresh() ); }