use of org.kie.server.controller.api.model.spec.ContainerSpec in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnSelectedNonEmptyServerTemplate.
@Test
public void testOnSelectedNonEmptyServerTemplate() {
final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateId", "ServerTemplateName");
final ContainerSpec toBeSelected = mock(ContainerSpec.class);
serverTemplate.addContainerSpec(toBeSelected);
when(toBeSelected.getId()).thenReturn("other-id");
final ContainerSpec forcedToBeSelected = mock(ContainerSpec.class);
when(forcedToBeSelected.getId()).thenReturn("container-id");
serverTemplate.addContainerSpec(forcedToBeSelected);
final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
when(specManagementService.getServerTemplate(serverTemplateKey.getId())).thenReturn(serverTemplate);
final ServerTemplatePresenter.View serverView = mock(ServerTemplatePresenter.View.class);
when(serverTemplatePresenter.getView()).thenReturn(serverView);
presenter.onSelected(new ServerTemplateSelected(serverTemplateKey));
verify(view).setServerTemplate(serverView);
verify(specManagementService).getServerTemplate(serverTemplateKey.getId());
verify(serverTemplatePresenter).setup(serverTemplate, toBeSelected);
presenter.onSelected(new ServerTemplateSelected(serverTemplateKey, "container-id"));
verify(serverTemplatePresenter).setup(serverTemplate, forcedToBeSelected);
}
use of org.kie.server.controller.api.model.spec.ContainerSpec 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);
}
use of org.kie.server.controller.api.model.spec.ContainerSpec in project kie-wb-common by kiegroup.
the class ContainerRemoteStatusPresenterTest method testOnDelete.
@Test
public void testOnDelete() {
final ContainerCardPresenter cardPresenter = mock(ContainerCardPresenter.class);
when(cardPresenter.getView()).thenReturn(mock(ContainerCardPresenter.View.class));
when(presenterProvider.get()).thenReturn(cardPresenter);
final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("templateId", "serverName", "serverInstanceId", "url");
final Container container = new Container("containerSpecId", "containerName", serverInstanceKey, Collections.<Message>emptyList(), null, null);
container.setStatus(KieContainerStatus.STARTED);
presenter.setup(new ContainerSpec(), Collections.singletonList(container));
verify(view).clear();
verify(cardPresenter).setup(container.getServerInstanceKey(), container);
verify(view).addCard(any(IsWidget.class));
presenter.onDelete(new ServerInstanceDeleted(serverInstanceKey.getServerInstanceId()));
verify(cardPresenter).delete();
presenter.onDelete(new ServerInstanceDeleted("randomKey"));
verify(cardPresenter).delete();
}
use of org.kie.server.controller.api.model.spec.ContainerSpec in project kie-wb-common by kiegroup.
the class BuildExecutorTest method testBuildAndDeployCommandSingleServerTemplateContainerExists.
@Test
public void testBuildAndDeployCommandSingleServerTemplateContainerExists() {
final String containerId = module.getPom().getGav().getArtifactId() + "_" + module.getPom().getGav().getVersion();
final String containerName = module.getPom().getGav().getArtifactId();
final ServerTemplate serverTemplate = new ServerTemplate("id", "name");
serverTemplate.addContainerSpec(new ContainerSpec(containerId, containerName, null, null, null, null));
when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Collections.singletonList(serverTemplate)));
buildExecutor.triggerBuildAndDeploy();
verify(deploymentScreenPopupView).setValidateExistingContainerCallback(any(DeploymentScreenPopupViewImpl.ValidateExistingContainerCallback.class));
verify(deploymentScreenPopupView).setContainerId(containerId);
verify(deploymentScreenPopupView).setContainerAlias(containerName);
verify(deploymentScreenPopupView).setStartContainer(true);
verify(deploymentScreenPopupView).configure(any(com.google.gwt.user.client.Command.class));
verify(deploymentScreenPopupView).show();
verifyNoMoreInteractions(deploymentScreenPopupView);
}
use of org.kie.server.controller.api.model.spec.ContainerSpec in project kie-wb-common by kiegroup.
the class DeploymentPopupBuilderTest method containerSpec.
private ContainerSpec containerSpec(final String containerName) {
final ContainerSpec containerSpec = mock(ContainerSpec.class);
doReturn(containerName).when(containerSpec).getContainerName();
return containerSpec;
}
Aggregations