use of org.kie.workbench.common.screens.server.management.client.events.DependencyPathSelectedEvent in project kie-wb-common by kiegroup.
the class ArtifactListWidgetPresenterTest method testOnSelect.
@Test
public void testOnSelect() {
presenter.onSelect("some path");
verify(dependencyPathSelectedEvent).fire(new DependencyPathSelectedEvent(presenter, "some path"));
}
use of org.kie.workbench.common.screens.server.management.client.events.DependencyPathSelectedEvent in project kie-wb-common by kiegroup.
the class NewContainerFormPresenterTest method testOnDependencyPathSelectedEventWithDefaultContainerNameWhenContainerNameIsEmpty.
@Test
public void testOnDependencyPathSelectedEventWithDefaultContainerNameWhenContainerNameIsEmpty() {
final String path = "org:kie:1.0";
final String templateId = "templateId";
final GAV gav = new GAV(path);
final ServerTemplate serverTemplate = mock(ServerTemplate.class);
when(serverTemplate.getId()).thenReturn(templateId);
when(m2RepoService.loadGAVFromJar(path)).thenReturn(gav);
when(specManagementService.validContainerId(templateId, path)).thenReturn(path);
when(view.getContainerName()).thenReturn("");
presenter.setServerTemplate(serverTemplate);
presenter.asWidget();
presenter.onDependencyPathSelectedEvent(new DependencyPathSelectedEvent(artifactListWidgetPresenter, path));
verify(view).setContainerName(path);
}
use of org.kie.workbench.common.screens.server.management.client.events.DependencyPathSelectedEvent in project kie-wb-common by kiegroup.
the class NewContainerFormPresenterTest method testOnDependencyPathSelectedEventWithDefaultContainerNameWhenServerTemplateIsNull.
@Test
public void testOnDependencyPathSelectedEventWithDefaultContainerNameWhenServerTemplateIsNull() {
final String path = "org:kie:1.0";
final GAV gav = new GAV(path);
when(m2RepoService.loadGAVFromJar(path)).thenReturn(gav);
when(view.getContainerName()).thenReturn("");
presenter.setServerTemplate(null);
presenter.asWidget();
presenter.onDependencyPathSelectedEvent(new DependencyPathSelectedEvent(artifactListWidgetPresenter, path));
verify(view).setContainerName(path);
verify(specManagementService, never()).validContainerId(anyString(), anyString());
}
use of org.kie.workbench.common.screens.server.management.client.events.DependencyPathSelectedEvent in project kie-wb-common by kiegroup.
the class NewContainerFormPresenterTest method testOnDependencyPathSelectedEventWithDefaultContainerNameWhenContainerNameIsNotEmpty.
@Test
public void testOnDependencyPathSelectedEventWithDefaultContainerNameWhenContainerNameIsNotEmpty() {
final String path = "org:kie:1.0";
final String templateId = "templateId";
final GAV gav = new GAV(path);
final ServerTemplate serverTemplate = mock(ServerTemplate.class);
when(serverTemplate.getId()).thenReturn(templateId);
when(m2RepoService.loadGAVFromJar(path)).thenReturn(gav);
when(specManagementService.validContainerId(templateId, path)).thenReturn(path);
when(view.getContainerName()).thenReturn("custom");
presenter.setServerTemplate(serverTemplate);
presenter.asWidget();
presenter.onDependencyPathSelectedEvent(new DependencyPathSelectedEvent(artifactListWidgetPresenter, path));
verify(view, never()).setContainerName(path);
}
use of org.kie.workbench.common.screens.server.management.client.events.DependencyPathSelectedEvent in project kie-wb-common by kiegroup.
the class NewContainerFormPresenterTest method testOnDependencyPathSelectedEvent.
@Test
public void testOnDependencyPathSelectedEvent() {
final String path = "org:kie:1.0";
final GAV gav = new GAV(path);
when(m2RepoService.loadGAVFromJar(path)).thenReturn(gav);
when(view.getContainerName()).thenReturn("containerName");
when(view.getContainerAlias()).thenReturn("containerAlias");
when(view.getGroupId()).thenReturn(gav.getGroupId());
when(view.getArtifactId()).thenReturn(gav.getArtifactId());
when(view.getVersion()).thenReturn(gav.getVersion());
presenter.asWidget();
presenter.onDependencyPathSelectedEvent(new DependencyPathSelectedEvent(artifactListWidgetPresenter, path));
verify(m2RepoService).loadGAVFromJar(path);
verify(view).setGroupId(gav.getGroupId());
verify(view).setArtifactId(gav.getArtifactId());
verify(view).setVersion(gav.getVersion());
verify(wizardPageStatusChangeEvent).fire(any(WizardPageStatusChangeEvent.class));
final ContainerSpec containerSpec = presenter.buildContainerSpec("templateId", Collections.<Capability, ContainerConfig>emptyMap());
assertEquals(new ReleaseId(gav.getGroupId(), gav.getArtifactId(), gav.getVersion()), containerSpec.getReleasedId());
assertEquals(KieContainerStatus.STOPPED, containerSpec.getStatus());
assertEquals("containerAlias", containerSpec.getContainerName());
assertEquals("containerName", containerSpec.getId());
}
Aggregations