Search in sources :

Example 11 with SWTBotToolbarButton

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton in project linuxtools by eclipse.

the class DockerComposeSWTBotTest method shouldStartDockerComposeWithExistingLaunchConfiguration.

@Test
@RunWithProject("foo")
public void shouldStartDockerComposeWithExistingLaunchConfiguration() throws CoreException {
    // given
    final DockerClient client = MockDockerClientFactory.build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    final IFile dockerComposeScript = projectInit.getProject().getFile("docker-compose.yml");
    LaunchConfigurationUtils.createDockerComposeUpLaunchConfiguration(dockerConnection, dockerComposeScript);
    // when
    SWTUtils.asyncExec(() -> getRunAsDockerComposeContextMenu("foo", "docker-compose.yml").click());
    // then confirm the connection
    final SWTBotToolbarButton consoleToolbarStopButton = SWTUtils.getConsoleToolbarButtonWithTooltipText(bot, ConsoleMessages.getString("DockerComposeStopAction.tooltip"));
    ToolbarButtonAssertions.assertThat(consoleToolbarStopButton).isEnabled();
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) IFile(org.eclipse.core.resources.IFile) DockerClient(com.spotify.docker.client.DockerClient) SWTBotToolbarButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton) Test(org.junit.Test) RunWithProject(org.eclipse.linuxtools.internal.docker.ui.testutils.RunWithProject)

Example 12 with SWTBotToolbarButton

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton in project linuxtools by eclipse.

the class DockerComposeSWTBotTest method shouldStartDockerComposeFromScratch.

@Test
@RunWithProject("foo")
public void shouldStartDockerComposeFromScratch() throws CoreException {
    // given
    final DockerClient client = MockDockerClientFactory.build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    // when
    SWTUtils.asyncExec(() -> getRunAsDockerComposeContextMenu("foo", "docker-compose.yml").click());
    // then confirm the connection
    bot.button("OK").click();
    // wait for the job to run
    SWTUtils.waitForJobsToComplete();
    // then expect the console to be displayed
    assertThat(SWTUtils.isConsoleViewVisible(this.bot)).isTrue();
    // expect the 'stop' button to be enabled
    final SWTBotToolbarButton consoleToolbarStopButton = SWTUtils.getConsoleToolbarButtonWithTooltipText(bot, ConsoleMessages.getString("DockerComposeStopAction.tooltip"));
    ToolbarButtonAssertions.assertThat(consoleToolbarStopButton).isEnabled();
    // verify that the launch configuration was saved
    final ILaunchConfiguration launchConfiguration = LaunchConfigurationUtils.getLaunchConfigurationByName(IDockerComposeLaunchConfigurationConstants.CONFIG_TYPE_ID, "Docker Compose [foo]");
    assertThat(launchConfiguration).isNotNull();
    // verify the latch
    assertThat(latch.getCount()).isEqualTo(1);
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) DockerClient(com.spotify.docker.client.DockerClient) SWTBotToolbarButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton) Test(org.junit.Test) RunWithProject(org.eclipse.linuxtools.internal.docker.ui.testutils.RunWithProject)

Example 13 with SWTBotToolbarButton

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton in project linuxtools by eclipse.

the class DockerComposeSWTBotTest method shouldRestartDockerCompose.

@Test
@RunWithProject("foo")
public void shouldRestartDockerCompose() throws InterruptedException, DockerException {
    // given
    final DockerClient client = MockDockerClientFactory.build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    // when starting without launch config
    SWTUtils.asyncExec(() -> getRunAsDockerComposeContextMenu("foo", "docker-compose.yml").click());
    bot.button("OK").click();
    // wait for the job to run
    SWTUtils.waitForJobsToComplete();
    // when stopping
    final SWTBotToolbarButton consoleToolbarStopButton = SWTUtils.getConsoleToolbarButtonWithTooltipText(bot, ConsoleMessages.getString("DockerComposeStopAction.tooltip"));
    ToolbarButtonAssertions.assertThat(consoleToolbarStopButton).isEnabled();
    consoleToolbarStopButton.click();
    // redo the setup to get a new mock process
    setupMockedProcessLauncher();
    // when restarting
    SWTUtils.asyncExec(() -> getRunAsDockerComposeContextMenu("foo", "docker-compose.yml").click());
    // wait for the job to run
    SWTUtils.waitForJobsToComplete();
    // then
    ToolbarButtonAssertions.assertThat(consoleToolbarStopButton).isEnabled();
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) DockerClient(com.spotify.docker.client.DockerClient) SWTBotToolbarButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton) Test(org.junit.Test) RunWithProject(org.eclipse.linuxtools.internal.docker.ui.testutils.RunWithProject)

Aggregations

SWTBotToolbarButton (org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton)13 Test (org.junit.Test)8 DockerClient (com.spotify.docker.client.DockerClient)4 DockerConnection (org.eclipse.linuxtools.internal.docker.core.DockerConnection)4 RunWithProject (org.eclipse.linuxtools.internal.docker.ui.testutils.RunWithProject)4 MarkdownViewBot (code.satyagraha.gfm.viewer.bots.MarkdownViewBot)3 ProjectBot (code.satyagraha.gfm.viewer.bots.ProjectBot)3 EditorBot (code.satyagraha.gfm.viewer.bots.EditorBot)2 ProjectFileBot (code.satyagraha.gfm.viewer.bots.ProjectBot.ProjectFileBot)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IsEditorLayoutHorizontal (net.heartsome.cat.ts.test.ui.waits.IsEditorLayoutHorizontal)1 IsEditorLayoutVertical (net.heartsome.cat.ts.test.ui.waits.IsEditorLayoutVertical)1 IFile (org.eclipse.core.resources.IFile)1 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)1 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)1 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 AfterClass (org.junit.AfterClass)1