@Test public void testOnStatusChangePipelinePageSelectedWithNoParamForms() { when(selectPipelinePage.getPipeline()).thenReturn(PIPELINE1_KEY); when(descriptor1.accept(PIPELINE1_KEY)).thenReturn(false); when(descriptor2.accept(PIPELINE1_KEY)).thenReturn(false); wizard.onStatusChange(new WizardPageStatusChangeEvent(selectPipelinePage)); verify(descriptor1, times(1)).accept(PIPELINE1_KEY); verify(descriptor2, times(1)).accept(PIPELINE1_KEY); assertEquals(1, wizard.getPages().size()); assertEquals(selectPipelinePage, wizard.getPages().get(0)); verify(pipelineParamsPageInstance, never()).get(); }
@Override public void onStatusChange(final @Observes WizardPageStatusChangeEvent event) { boolean restart = false; if (event.getPage() == selectPipelinePage) { List<PipelineParamsForm> oldParamsForms = new ArrayList<>(); oldParamsForms.addAll(paramsForms); if (selectPipelinePage.getPipeline() != null) { paramsForms = getParamsForms(selectPipelinePage.getPipeline()); if (!paramsForms.isEmpty()) { paramsForms.forEach(PipelineParamsForm::clear); paramsForms.forEach(PipelineParamsForm::initialise); destroyPipelineParamPages(paramsPages); paramsForms.forEach(form -> paramsPages.add(newPipelineParamsPage(form))); setDefaultPages(); pages.addAll(paramsPages); restart = true; } else if (!oldParamsForms.isEmpty()) { setDefaultPages(); restart = true; } } else if (pages.size() > 1) { paramsForms.clear(); setDefaultPages(); restart = true; } if (!oldParamsForms.isEmpty()) { oldParamsForms.forEach(PipelineParamsForm::clear); } } if (restart) { super.start(); } else { super.onStatusChange(event); } }
NewDeployWizard extends AbstractMultiPageWizard { @Override public void onStatusChange(final @Observes WizardPageStatusChangeEvent event) { boolean restart = false; if (event.getPage() == selectPipelinePage) { List<PipelineParamsForm> oldParamsForms = new ArrayList<>(); oldParamsForms.addAll(paramsForms); if (selectPipelinePage.getPipeline() != null) { paramsForms = getParamsForms(selectPipelinePage.getPipeline()); if (!paramsForms.isEmpty()) { paramsForms.forEach(PipelineParamsForm::clear); paramsForms.forEach(PipelineParamsForm::initialise); destroyPipelineParamPages(paramsPages); paramsForms.forEach(form -> paramsPages.add(newPipelineParamsPage(form))); setDefaultPages(); pages.addAll(paramsPages); restart = true; } else if (!oldParamsForms.isEmpty()) { setDefaultPages(); restart = true; } } else if (pages.size() > 1) { paramsForms.clear(); setDefaultPages(); restart = true; } if (!oldParamsForms.isEmpty()) { oldParamsForms.forEach(PipelineParamsForm::clear); } } if (restart) { super.start(); } else { super.onStatusChange(event); } } }
NewDeployWizard extends AbstractMultiPageWizard { @Override public void onStatusChange(final @Observes WizardPageStatusChangeEvent event) { boolean restart = false; if (event.getPage() == selectPipelinePage) { List<PipelineParamsForm> oldParamsForms = new ArrayList<>(); oldParamsForms.addAll(paramsForms); if (selectPipelinePage.getPipeline() != null) { paramsForms = getParamsForms(selectPipelinePage.getPipeline()); if (!paramsForms.isEmpty()) { paramsForms.forEach(PipelineParamsForm::clear); paramsForms.forEach(PipelineParamsForm::initialise); destroyPipelineParamPages(paramsPages); paramsForms.forEach(form -> paramsPages.add(newPipelineParamsPage(form))); setDefaultPages(); pages.addAll(paramsPages); restart = true; } else if (!oldParamsForms.isEmpty()) { setDefaultPages(); restart = true; } } else if (pages.size() > 1) { paramsForms.clear(); setDefaultPages(); restart = true; } if (!oldParamsForms.isEmpty()) { oldParamsForms.forEach(PipelineParamsForm::clear); } } if (restart) { super.start(); } else { super.onStatusChange(event); } } @Inject  NewDeployWizard(final SelectPipelinePagePresenter selectPipelinePage,
                           final ManagedInstance<PipelineParamsPagePresenter> pipelineParamsPageInstance,
                           final @Any Instance<PipelineDescriptor> pipelineDescriptorInstance,
                           final PopupHelper popupHelper,
                           final TranslationService translationService,
                           final Caller<RuntimeService> runtimeService,
                           final Event<NotificationEvent> notification,
                           final Event<RefreshRuntimeEvent> refreshRuntimeEvent); }
NewDeployWizard extends AbstractMultiPageWizard { @Override public void onStatusChange(final @Observes WizardPageStatusChangeEvent event) { boolean restart = false; if (event.getPage() == selectPipelinePage) { List<PipelineParamsForm> oldParamsForms = new ArrayList<>(); oldParamsForms.addAll(paramsForms); if (selectPipelinePage.getPipeline() != null) { paramsForms = getParamsForms(selectPipelinePage.getPipeline()); if (!paramsForms.isEmpty()) { paramsForms.forEach(PipelineParamsForm::clear); paramsForms.forEach(PipelineParamsForm::initialise); destroyPipelineParamPages(paramsPages); paramsForms.forEach(form -> paramsPages.add(newPipelineParamsPage(form))); setDefaultPages(); pages.addAll(paramsPages); restart = true; } else if (!oldParamsForms.isEmpty()) { setDefaultPages(); restart = true; } } else if (pages.size() > 1) { paramsForms.clear(); setDefaultPages(); restart = true; } if (!oldParamsForms.isEmpty()) { oldParamsForms.forEach(PipelineParamsForm::clear); } } if (restart) { super.start(); } else { super.onStatusChange(event); } } @Inject  NewDeployWizard(final SelectPipelinePagePresenter selectPipelinePage,
                           final ManagedInstance<PipelineParamsPagePresenter> pipelineParamsPageInstance,
                           final @Any Instance<PipelineDescriptor> pipelineDescriptorInstance,
                           final PopupHelper popupHelper,
                           final TranslationService translationService,
                           final Caller<RuntimeService> runtimeService,
                           final Event<NotificationEvent> notification,
                           final Event<RefreshRuntimeEvent> refreshRuntimeEvent); @PostConstruct void init(); void start(final Provider provider,
                      final Collection<PipelineKey> pipelines); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); @Override void complete(); @Override void onStatusChange(final @Observes WizardPageStatusChangeEvent event); }
NewDeployWizard extends AbstractMultiPageWizard { @Override public void onStatusChange(final @Observes WizardPageStatusChangeEvent event) { boolean restart = false; if (event.getPage() == selectPipelinePage) { List<PipelineParamsForm> oldParamsForms = new ArrayList<>(); oldParamsForms.addAll(paramsForms); if (selectPipelinePage.getPipeline() != null) { paramsForms = getParamsForms(selectPipelinePage.getPipeline()); if (!paramsForms.isEmpty()) { paramsForms.forEach(PipelineParamsForm::clear); paramsForms.forEach(PipelineParamsForm::initialise); destroyPipelineParamPages(paramsPages); paramsForms.forEach(form -> paramsPages.add(newPipelineParamsPage(form))); setDefaultPages(); pages.addAll(paramsPages); restart = true; } else if (!oldParamsForms.isEmpty()) { setDefaultPages(); restart = true; } } else if (pages.size() > 1) { paramsForms.clear(); setDefaultPages(); restart = true; } if (!oldParamsForms.isEmpty()) { oldParamsForms.forEach(PipelineParamsForm::clear); } } if (restart) { super.start(); } else { super.onStatusChange(event); } } @Inject  NewDeployWizard(final SelectPipelinePagePresenter selectPipelinePage,
                           final ManagedInstance<PipelineParamsPagePresenter> pipelineParamsPageInstance,
                           final @Any Instance<PipelineDescriptor> pipelineDescriptorInstance,
                           final PopupHelper popupHelper,
                           final TranslationService translationService,
                           final Caller<RuntimeService> runtimeService,
                           final Event<NotificationEvent> notification,
                           final Event<RefreshRuntimeEvent> refreshRuntimeEvent); @PostConstruct void init(); void start(final Provider provider,
                      final Collection<PipelineKey> pipelines); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); @Override void complete(); @Override void onStatusChange(final @Observes WizardPageStatusChangeEvent event); static final String RUNTIME_NAME; }