use of com.spotify.docker.client.DockerClient in project linuxtools by eclipse.
the class ImageSearchSWTBotTest method shouldTriggerSearchIfTermWasGiven.
@Test
public void shouldTriggerSearchIfTermWasGiven() {
// given
final DockerClient client = MockDockerClientFactory.onSearch("foo", MockImageSearchResultFactory.name("foo").build()).build();
// when opening the pull wizard...
openPullWizard(client);
// ... and specifying a term...
bot.textWithLabel(WizardMessages.getString("ImagePullPushPage.name.label")).setText("foo");
// ... and then opening the search wizard
openSearchWizard();
// then the search should have been triggered and results should be available
assertThat(bot.table().rowCount()).isEqualTo(1);
}
use of com.spotify.docker.client.DockerClient in project linuxtools by eclipse.
the class DockerClientFactoryTest method shouldNotFailWithNullTcpHost.
@Test
public void shouldNotFailWithNullTcpHost() throws DockerCertificateException {
// when
final DockerClient client = new DockerClientFactory().getClient(new TCPConnectionSettings(null, null));
// then
assertThat(client).isNull();
}
use of com.spotify.docker.client.DockerClient in project linuxtools by eclipse.
the class DockerConnectionTest method shouldLoadImages.
@Test
public void shouldLoadImages() throws DockerException {
// given
final Image fooImage = MockImageFactory.id("foo").build();
final Image barImage = MockImageFactory.id("bar").build();
final DockerClient client = MockDockerClientFactory.image(fooImage).image(barImage).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
dockerConnection.open(false);
// when
final List<IDockerImage> images = dockerConnection.getImages();
// then
assertThat(images).hasSize(2);
}
use of com.spotify.docker.client.DockerClient in project linuxtools by eclipse.
the class DockerConnectionTest method shouldLoadContainers.
@Test
public void shouldLoadContainers() throws DockerException {
// given
final Container fooContainer = MockContainerFactory.id("foo").build();
final Container barContainer = MockContainerFactory.id("bar").build();
final DockerClient client = MockDockerClientFactory.container(fooContainer).container(barContainer).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
dockerConnection.open(false);
// when
final List<IDockerContainer> containers = dockerConnection.getContainers();
// then
assertThat(containers).hasSize(2);
}
use of com.spotify.docker.client.DockerClient in project linuxtools by eclipse.
the class CommandUtilsSWTBotTest method shouldRetrieveConnectionFromSelectedImage.
@Test
public void shouldRetrieveConnectionFromSelectedImage() {
// given
final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("foo").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
final SWTBotTreeItem image = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), "Test", "Images", "foo");
// when selecting the images
image.select();
// then current connection should be found
Assertions.assertThat(CommandUtils.getCurrentConnection(dockerExplorerView)).isEqualTo(dockerConnection);
}
Aggregations