use of org.kie.server.controller.api.model.spec.ContainerSpec in project kie-wb-common by kiegroup.
the class BuildExecutor method saveContainerSpec.
private void saveContainerSpec(final String containerId, final String containerAlias, final ServerTemplate serverTemplate, final Boolean startContainer, final Map<String, String> parameters) {
if (containerId != null && serverTemplate != null && serverTemplate.getId() != null) {
final ContainerSpec containerSpec = makeContainerSpec(containerId, containerAlias, serverTemplate, parameters);
specManagementService.call(aVoid -> {
notificationEvent.fire(new NotificationEvent(ProjectEditorResources.CONSTANTS.DeploySuccessful(), NotificationEvent.NotificationType.SUCCESS));
if (startContainer) {
startContainer(containerSpec);
}
}).saveContainerSpec(serverTemplate.getId(), containerSpec);
}
}
use of org.kie.server.controller.api.model.spec.ContainerSpec in project kie-wb-common by kiegroup.
the class BuildExecutor method makeContainerSpec.
private ContainerSpec makeContainerSpec(final String containerId, final String containerAlias, final ServerTemplate serverTemplate, final Map<String, String> parameters) {
final ReleaseId releaseId = makeReleaseId();
final KieContainerStatus status = KieContainerStatus.STOPPED;
final ServerTemplateKey serverTemplateKey = new ServerTemplateKey(serverTemplate.getId(), serverTemplate.getId());
return new ContainerSpec(containerId, containerAlias, serverTemplateKey, releaseId, status, makeConfigs(serverTemplate, parameters));
}
use of org.kie.server.controller.api.model.spec.ContainerSpec in project kie-wb-common by kiegroup.
the class BuildExecutorTest method testBuildAndDeployCommandSingleServerTemplate.
@Test
public void testBuildAndDeployCommandSingleServerTemplate() {
final ServerTemplate serverTemplate = new ServerTemplate("id", "name");
when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Collections.singletonList(serverTemplate)));
buildExecutor.triggerBuildAndDeploy();
ArgumentCaptor<ContainerSpec> containerSpecArgumentCaptor = ArgumentCaptor.forClass(ContainerSpec.class);
verify(specManagementServiceMock).saveContainerSpec(eq(serverTemplate.getId()), containerSpecArgumentCaptor.capture());
final ContainerSpec containerSpec = containerSpecArgumentCaptor.getValue();
assertEquals(module.getPom().getGav().getArtifactId(), containerSpec.getContainerName());
verifyNotification(ProjectEditorResources.CONSTANTS.BuildSuccessful(), NotificationEvent.NotificationType.SUCCESS);
verifyNotification(ProjectEditorResources.CONSTANTS.DeploySuccessful(), NotificationEvent.NotificationType.SUCCESS);
verify(notificationEvent, times(2)).fire(any(NotificationEvent.class));
verifyBusyShowHideAnyString(1, 1);
}
use of org.kie.server.controller.api.model.spec.ContainerSpec in project kie-wb-common by kiegroup.
the class DeploymentPopupBuilderTest method serverTemplate.
private ServerTemplate serverTemplate(final String id, final String... containerNames) {
final ServerTemplate serverTemplate = mock(ServerTemplate.class);
final ArrayList<ContainerSpec> containersSpec = new ArrayList<ContainerSpec>() {
{
for (final String containerName : containerNames) {
add(containerSpec(containerName));
}
}
};
doReturn(id).when(serverTemplate).getId();
doReturn(containersSpec).when(serverTemplate).getContainersSpec();
return serverTemplate;
}
use of org.kie.server.controller.api.model.spec.ContainerSpec in project kie-wb-common by kiegroup.
the class SpecManagementServiceCDITest method testValidContainerIdWhenContainerIdIsValidInTheSecondAttempt.
@Test
public void testValidContainerIdWhenContainerIdIsValidInTheSecondAttempt() {
final SpecManagementServiceCDI service = spy(new SpecManagementServiceCDI());
final ServerTemplate template = mock(ServerTemplate.class);
final ContainerSpec containerSpec = mock(ContainerSpec.class);
when(template.getContainerSpec("org.jbpm:Evaluation:1.0")).thenReturn(containerSpec);
when(template.getContainerSpec("org.jbpm:Evaluation:1.0-2")).thenReturn(null);
doReturn(template).when(service).getServerTemplate("templateId");
final String containerId = service.validContainerId("templateId", "org.jbpm:Evaluation:1.0");
assertEquals(containerId, "org.jbpm:Evaluation:1.0-2");
}
Aggregations