Search in sources :

Example 1 with SpecManagementService

use of org.kie.workbench.common.screens.server.management.service.SpecManagementService 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();
}
Also used : Answer(org.mockito.stubbing.Answer) InvocationOnMock(org.mockito.invocation.InvocationOnMock) ContentChangeHandler(org.kie.workbench.common.screens.server.management.client.util.ContentChangeHandler) M2RepoService(org.guvnor.m2repo.service.M2RepoService) WizardPageStatusChangeEvent(org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent) SpecManagementService(org.kie.workbench.common.screens.server.management.service.SpecManagementService) Before(org.junit.Before)

Example 2 with SpecManagementService

use of org.kie.workbench.common.screens.server.management.service.SpecManagementService in project kie-wb-common by kiegroup.

the class ContainerPresenterTest method init.

@Before
public void init() {
    runtimeManagementServiceCaller = new CallerMock<RuntimeManagementService>(runtimeManagementService);
    specManagementServiceCaller = new CallerMock<SpecManagementService>(specManagementService);
    doNothing().when(serverTemplateSelectedEvent).fire(any(ServerTemplateSelected.class));
    doNothing().when(notification).fire(any(NotificationEvent.class));
    when(containerStatusEmptyPresenter.getView()).thenReturn(containerStatusEmptyPresenterView);
    when(containerRemoteStatusPresenter.getView()).thenReturn(containerRemoteStatusPresenterView);
    presenter = spy(new ContainerPresenter(logger, view, containerRemoteStatusPresenter, containerStatusEmptyPresenter, containerProcessConfigPresenter, containerRulesConfigPresenter, runtimeManagementServiceCaller, specManagementServiceCaller, serverTemplateSelectedEvent, notification));
    releaseId = new ReleaseId("org.kie", "container", "1.0.0");
    serverTemplateKey = new ServerTemplateKey("serverTemplateKeyId", "serverTemplateKeyName");
    containerSpec = new ContainerSpec("containerId", "containerName", serverTemplateKey, releaseId, KieContainerStatus.STOPPED, new HashMap<Capability, ContainerConfig>());
    containerSpec.addConfig(Capability.PROCESS, new ProcessConfig());
    containerSpec.addConfig(Capability.RULE, new RuleConfig());
    containers = new ArrayList<Container>();
    containerSpecData = new ContainerSpecData(containerSpec, containers);
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) ProcessConfig(org.kie.server.controller.api.model.spec.ProcessConfig) HashMap(java.util.HashMap) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) ServerTemplateSelected(org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) ReleaseId(org.kie.server.api.model.ReleaseId) Container(org.kie.server.controller.api.model.runtime.Container) RuntimeManagementService(org.kie.workbench.common.screens.server.management.service.RuntimeManagementService) RuleConfig(org.kie.server.controller.api.model.spec.RuleConfig) ContainerSpecData(org.kie.workbench.common.screens.server.management.model.ContainerSpecData) SpecManagementService(org.kie.workbench.common.screens.server.management.service.SpecManagementService) Before(org.junit.Before)

Example 3 with SpecManagementService

use of org.kie.workbench.common.screens.server.management.service.SpecManagementService in project kie-wb-common by kiegroup.

the class NewContainerWizardTest method setup.

@Before
public void setup() throws IllegalAccessException, NoSuchFieldException {
    doNothing().when(notification).fire(any(NotificationEvent.class));
    doNothing().when(serverTemplateSelectedEvent).fire(any(ServerTemplateSelected.class));
    specManagementServiceCaller = new CallerMock<SpecManagementService>(specManagementService);
    when(newContainerFormPresenter.getView()).thenReturn(newContainerFormPresenterView);
    newContainerWizard = spy(new NewContainerWizard(newContainerFormPresenter, processConfigPagePresenter, specManagementServiceCaller, notification, serverTemplateSelectedEvent));
    final Field field = AbstractWizard.class.getDeclaredField("view");
    field.setAccessible(true);
    field.set(newContainerWizard, view);
}
Also used : Field(java.lang.reflect.Field) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) ServerTemplateSelected(org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected) SpecManagementService(org.kie.workbench.common.screens.server.management.service.SpecManagementService) Before(org.junit.Before)

Example 4 with SpecManagementService

use of org.kie.workbench.common.screens.server.management.service.SpecManagementService 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);
}
Also used : Answer(org.mockito.stubbing.Answer) Field(java.lang.reflect.Field) InvocationOnMock(org.mockito.invocation.InvocationOnMock) ContentChangeHandler(org.kie.workbench.common.screens.server.management.client.util.ContentChangeHandler) SpecManagementService(org.kie.workbench.common.screens.server.management.service.SpecManagementService) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)4 SpecManagementService (org.kie.workbench.common.screens.server.management.service.SpecManagementService)4 Field (java.lang.reflect.Field)2 ServerTemplateSelected (org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected)2 ContentChangeHandler (org.kie.workbench.common.screens.server.management.client.util.ContentChangeHandler)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 Answer (org.mockito.stubbing.Answer)2 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)2 HashMap (java.util.HashMap)1 M2RepoService (org.guvnor.m2repo.service.M2RepoService)1 ReleaseId (org.kie.server.api.model.ReleaseId)1 Container (org.kie.server.controller.api.model.runtime.Container)1 ContainerSpec (org.kie.server.controller.api.model.spec.ContainerSpec)1 ProcessConfig (org.kie.server.controller.api.model.spec.ProcessConfig)1 RuleConfig (org.kie.server.controller.api.model.spec.RuleConfig)1 ServerTemplateKey (org.kie.server.controller.api.model.spec.ServerTemplateKey)1 ContainerSpecData (org.kie.workbench.common.screens.server.management.model.ContainerSpecData)1 RuntimeManagementService (org.kie.workbench.common.screens.server.management.service.RuntimeManagementService)1 WizardPageStatusChangeEvent (org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent)1