Search in sources :

Example 1 with RuleCapabilitiesService

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

the class ContainerRulesConfigPresenterTest method init.

@Before
public void init() {
    releaseId = new ReleaseId();
    releaseId.setVersion("0.1");
    doNothing().when(notification).fire(any(NotificationEvent.class));
    ruleCapabilitiesServiceCaller = new CallerMock<RuleCapabilitiesService>(ruleCapabilitiesService);
    when(containerSpec.getReleasedId()).thenReturn(releaseId);
    when(view.getUpgradeSuccessMessage()).thenReturn(SUCCESS_UPGRADE);
    presenter = new ContainerRulesConfigPresenter(logger, view, ruleCapabilitiesServiceCaller, notification);
    doAnswer(new Answer() {

        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            releaseId.setVersion(invocation.getArgumentAt(1, ReleaseId.class).getVersion());
            return null;
        }
    }).when(ruleCapabilitiesService).upgradeContainer(any(ContainerSpecKey.class), any(ReleaseId.class));
}
Also used : Answer(org.mockito.stubbing.Answer) InvocationOnMock(org.mockito.invocation.InvocationOnMock) RuleCapabilitiesService(org.kie.workbench.common.screens.server.management.service.RuleCapabilitiesService) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) ReleaseId(org.kie.server.api.model.ReleaseId) ContainerSpecKey(org.kie.server.controller.api.model.spec.ContainerSpecKey) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 ReleaseId (org.kie.server.api.model.ReleaseId)1 ContainerSpecKey (org.kie.server.controller.api.model.spec.ContainerSpecKey)1 RuleCapabilitiesService (org.kie.workbench.common.screens.server.management.service.RuleCapabilitiesService)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 Answer (org.mockito.stubbing.Answer)1 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)1