use of org.eclipse.linuxtools.docker.core.IDockerImage in project linuxtools by eclipse.
the class PushImageCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
final IDockerImage selectedImage = CommandUtils.getSelectedImage(activePart);
final ImagePush wizard = new ImagePush(selectedImage, selectedImage.repo() + ":" + selectedImage.tags().get(0));
final boolean pushImage = CommandUtils.openWizard(wizard, HandlerUtil.getActiveShell(event));
if (pushImage) {
final IDockerConnection connection = CommandUtils.getCurrentConnection(activePart);
performPushImage(wizard, connection);
}
return null;
}
use of org.eclipse.linuxtools.docker.core.IDockerImage in project linuxtools by eclipse.
the class RemoveTagCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
final List<IDockerImage> selectedImages = CommandUtils.getSelectedImages(activePart);
final IDockerConnection connection = CommandUtils.getCurrentConnection(activePart);
if (selectedImages.size() != 1 || connection == null) {
Activator.log(new DockerException(CommandMessages.getString(// $NON-NLS-1$
"Command.missing.selection.failure")));
return null;
}
final IDockerImage image = selectedImages.get(0);
final ImageRemoveTag wizard = new ImageRemoveTag(image);
final boolean removeTag = CommandUtils.openWizard(wizard, HandlerUtil.getActiveShell(event));
if (removeTag) {
performRemoveTagImage(connection, wizard.getTag());
}
return null;
}
use of org.eclipse.linuxtools.docker.core.IDockerImage 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 org.eclipse.linuxtools.docker.core.IDockerImage in project linuxtools by eclipse.
the class DockerImageTest method shouldDuplicateImageByRepo.
@Test
public void shouldDuplicateImageByRepo() {
// given
final IDockerImage fooImage = MockDockerImageFactory.id("sha256:foo_image").name("foo_image", "foo_image_alias:alias").build();
// when
final List<IDockerImage> result = DockerImage.duplicateImageByRepo(fooImage).collect(Collectors.toList());
// then
assertThat(result).hasSize(2);
assertThat(result.get(0).id()).isEqualTo("sha256:foo_image");
assertThat(result.get(0).repo()).isEqualTo("foo_image");
assertThat(result.get(0).tags()).isEmpty();
assertThat(result.get(1).id()).isEqualTo("sha256:foo_image");
assertThat(result.get(1).repo()).isEqualTo("foo_image_alias");
assertThat(result.get(1).tags()).containsExactly("alias");
}
use of org.eclipse.linuxtools.docker.core.IDockerImage in project jbosstools-openshift by jbosstools.
the class DeployImageWizardModelTest method mockSingleImage.
private static IDockerImage mockSingleImage(IDockerConnection dockerConnection, String imageName, String tag) {
IDockerImage image = mock(IDockerImage.class);
when(image.repoTags()).thenReturn(Collections.singletonList(imageName + ":" + tag));
when(dockerConnection.getImages()).thenReturn(Collections.singletonList(image));
return image;
}
Aggregations