use of org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent in project kie-wb-common by kiegroup.
the class SourceRepositoryPage method onCustomRepositorySelected.
@Override
public void onCustomRepositorySelected() {
view.showRepositoryUrlInputForm();
model.setSelectedRepository(null);
pageStatusChangedEvent.fire(new WizardPageStatusChangeEvent(this));
}
use of org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent in project kie-wb-common by kiegroup.
the class SourceRepositoryPage method onCustomRepositoryValueChanged.
@Override
public void onCustomRepositoryValueChanged() {
model.setSelectedRepository(new ExampleRepository(view.getCustomRepositoryValue()));
pageStatusChangedEvent.fire(new WizardPageStatusChangeEvent(this));
}
use of org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent in project kie-wb-common by kiegroup.
the class NewDeployWizardTest method testOnStatusChangePipelinePageChangeNoPipelineSelected.
@Test
public void testOnStatusChangePipelinePageChangeNoPipelineSelected() {
when(selectPipelinePage.getPipeline()).thenReturn(null);
wizard.onStatusChange(new WizardPageStatusChangeEvent(selectPipelinePage));
assertEquals(1, wizard.getPages().size());
assertEquals(selectPipelinePage, wizard.getPages().get(0));
}
use of org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent in project kie-wb-common by kiegroup.
the class NewDeployWizardTest method testOnStatusChangePipelinePageSelectedWithParamForms.
@Test
public void testOnStatusChangePipelinePageSelectedWithParamForms() {
when(selectPipelinePage.getPipeline()).thenReturn(PIPELINE1_KEY);
when(descriptor1.accept(PIPELINE1_KEY)).thenReturn(true);
when(descriptor2.accept(PIPELINE1_KEY)).thenReturn(false);
when(descriptor1.getParamForms()).thenReturn(paramsForms);
wizard.onStatusChange(new WizardPageStatusChangeEvent(selectPipelinePage));
verify(descriptor1, times(1)).accept(PIPELINE1_KEY);
int totalPages = 1 + paramsForms.size();
assertEquals(totalPages, wizard.getPages().size());
paramsForms.forEach(paramsForm -> {
verify(paramsForm, times(1)).clear();
verify(paramsForm, times(1)).initialise();
});
verify(pipelineParamsPageInstance, times(paramsForms.size())).get();
assertEquals(paramsForms.size(), paramsPages.size());
for (int i = 0; i < paramsForms.size(); i++) {
PipelineParamsPagePresenter pagePresenter = paramsPages.get(i);
verify(pagePresenter, times(1)).setPipelineParamsForm(paramsForms.get(i));
}
}
use of org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent in project kie-wb-common by kiegroup.
the class SearchAnnotationPageTest method testSearchAnnotationFound.
@Test
public void testSearchAnnotationFound() {
modelerServiceCaller = new CallerMock<DataModelerService>(modelerService);
SearchAnnotationPage searchPage = new SearchAnnotationPage(view, modelerServiceCaller, wizardPageStatusChangeEvent);
searchPage.init(kieModule, ElementType.FIELD);
searchPage.prepareView();
searchPage.addSearchAnnotationHandler(searchAnnotationHandler);
// emulates the user is typing
searchPage.onSearchClassChanged();
// the wizard page should be automatically invalidated since the annotation class name to search
// has changed.
verify(wizardPageStatusChangeEvent, times(1)).fire(any(WizardPageStatusChangeEvent.class));
WizardTestUtil.assertPageComplete(false, searchPage);
assertEquals(CreateAnnotationWizardPage.PageStatus.NOT_VALIDATED, searchPage.getStatus());
// the handler should also have been invocked.
verify(searchAnnotationHandler, times(1)).onSearchClassChanged();
// emulate the user is searching the javax.persistence.Entity annotation.
AnnotationDefinitionRequest request = new AnnotationDefinitionRequest(Entity.class.getName());
// the response has a definition
AnnotationDefinitionResponse response = new AnnotationDefinitionResponse(DriverUtils.buildAnnotationDefinition(Entity.class));
when(view.getClassName()).thenReturn(Entity.class.getName());
when(modelerService.resolveDefinitionRequest(request, kieModule)).thenReturn(response);
// emulate the user click on the search button
searchPage.onSearchClass();
// now the page should be completed
WizardTestUtil.assertPageComplete(true, searchPage);
verify(wizardPageStatusChangeEvent, times(2)).fire(any(WizardPageStatusChangeEvent.class));
// the handler should also have been invoked with the expected annotation definition.
verify(searchAnnotationHandler, times(1)).onAnnotationDefinitionChange(response.getAnnotationDefinition());
}
Aggregations