use of org.kie.workbench.common.screens.server.management.client.util.ContentChangeHandler in project kie-wb-common by kiegroup.
the class NewContainerFormPresenterTest method init.
@Before
public void init() {
contentChangeHandlers.clear();
m2RepoServiceCaller = new CallerMock<M2RepoService>(m2RepoService);
specManagementServiceCaller = new CallerMock<SpecManagementService>(specManagementService);
doNothing().when(wizardPageStatusChangeEvent).fire(any(WizardPageStatusChangeEvent.class));
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
final ContentChangeHandler handler = (ContentChangeHandler) invocation.getArguments()[0];
contentChangeHandlers.add(handler);
return null;
}
}).when(view).addContentChangeHandler(any(ContentChangeHandler.class));
doAnswer(contentHandlerAnswer).when(view).setArtifactId(anyString());
doAnswer(contentHandlerAnswer).when(view).setGroupId(anyString());
doAnswer(contentHandlerAnswer).when(view).setVersion(anyString());
presenter = spy(new NewContainerFormPresenter(logger, view, presenterProvider, m2RepoServiceCaller, specManagementServiceCaller, wizardPageStatusChangeEvent));
doReturn(artifactListWidgetPresenter).when(presenterProvider).get();
}
use of org.kie.workbench.common.screens.server.management.client.util.ContentChangeHandler in project kie-wb-common by kiegroup.
the class NewTemplatePresenterTest method testAddContentChangeHandler.
@Test
public void testAddContentChangeHandler() {
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
final ContentChangeHandler handler = (ContentChangeHandler) invocation.getArguments()[0];
if (handler != null) {
handler.onContentChange();
}
return null;
}
}).when(view).addContentChangeHandler(any(ContentChangeHandler.class));
presenter.addContentChangeHandler(mock(ContentChangeHandler.class));
final ArgumentCaptor<WizardPageStatusChangeEvent> eventCaptor = ArgumentCaptor.forClass(WizardPageStatusChangeEvent.class);
verify(wizardPageStatusChangeEvent).fire(eventCaptor.capture());
assertEquals(presenter, eventCaptor.getValue().getPage());
}
use of org.kie.workbench.common.screens.server.management.client.util.ContentChangeHandler in project kie-wb-common by kiegroup.
the class NewContainerFormPresenter method init.
@PostConstruct
public void init() {
view.init(this);
view.addContentChangeHandler(new ContentChangeHandler() {
@Override
public void onContentChange() {
wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this));
}
});
}
use of org.kie.workbench.common.screens.server.management.client.util.ContentChangeHandler in project kie-wb-common by kiegroup.
the class NewTemplatePresenter method addContentChangeHandler.
public void addContentChangeHandler(final ContentChangeHandler contentChangeHandler) {
checkNotNull("contentChangeHandler", contentChangeHandler);
view.addContentChangeHandler(new ContentChangeHandler() {
@Override
public void onContentChange() {
contentChangeHandler.onContentChange();
wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewTemplatePresenter.this));
}
});
}
use of org.kie.workbench.common.screens.server.management.client.util.ContentChangeHandler in project kie-wb-common by kiegroup.
the class NewServerTemplateWizardTest method setup.
@Before
public void setup() throws IllegalAccessException, NoSuchFieldException {
specManagementServiceCaller = new CallerMock<SpecManagementService>(specManagementService);
when(newTemplatePresenter.getView()).thenReturn(newTemplatePresenterView);
final Answer addContentChangeHandler = new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
final ContentChangeHandler handler = (ContentChangeHandler) invocation.getArguments()[0];
contentChangeHandlers.add(handler);
return null;
}
};
doAnswer(addContentChangeHandler).when(newTemplatePresenter).addContentChangeHandler(any(ContentChangeHandler.class));
doAnswer(addContentChangeHandler).when(newContainerFormPresenter).addContentChangeHandler(any(ContentChangeHandler.class));
newServerTemplateWizard = new NewServerTemplateWizard(newTemplatePresenter, newContainerFormPresenter, processConfigPagePresenter, specManagementServiceCaller, notification, serverTemplateListRefreshEvent);
final Field field = AbstractWizard.class.getDeclaredField("view");
field.setAccessible(true);
field.set(newServerTemplateWizard, view);
newServerTemplateWizard = spy(newServerTemplateWizard);
}
Aggregations