Remove APIs deprecated for removal in 3.5

Closes gh-43788
This commit is contained in:
Andy Wilkinson
2025-01-14 12:34:43 +00:00
parent f301b2a123
commit 2f29a49a1d
61 changed files with 29 additions and 3522 deletions

View File

@@ -23,10 +23,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
@@ -392,21 +389,6 @@ class DockerApiTests {
assertThat(image.getLayers()).hasSize(46);
}
@Test
@SuppressWarnings("removal")
void exportLayersWhenReferenceIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.api.exportLayerFiles(null, (name, archive) -> {
})).withMessage("'reference' must not be null");
}
@Test
@SuppressWarnings("removal")
void exportLayersWhenExportsIsNullThrowsException() {
ImageReference reference = ImageReference.of("gcr.io/paketo-buildpacks/builder:base");
assertThatIllegalArgumentException().isThrownBy(() -> this.api.exportLayerFiles(reference, null))
.withMessage("'exports' must not be null");
}
@Test
void exportLayersExportsLayerTars() throws Exception {
ImageReference reference = ImageReference.of("gcr.io/paketo-buildpacks/builder:base");
@@ -463,29 +445,6 @@ class DockerApiTests {
.containsExactly("/cnb/stack.toml");
}
@Test
@SuppressWarnings("removal")
void exportLayerFilesDeletesTempFiles() throws Exception {
ImageReference reference = ImageReference.of("gcr.io/paketo-buildpacks/builder:base");
URI exportUri = new URI(IMAGES_URL + "/gcr.io/paketo-buildpacks/builder:base/get");
given(DockerApiTests.this.http.get(exportUri)).willReturn(responseOf("export.tar"));
List<Path> layerFilePaths = new ArrayList<>();
this.api.exportLayerFiles(reference, (name, path) -> layerFilePaths.add(path));
layerFilePaths.forEach((path) -> assertThat(path.toFile()).doesNotExist());
}
@Test
@SuppressWarnings("removal")
void exportLayersWithNoManifestThrowsException() throws Exception {
ImageReference reference = ImageReference.of("gcr.io/paketo-buildpacks/builder:base");
URI exportUri = new URI(IMAGES_URL + "/gcr.io/paketo-buildpacks/builder:base/get");
given(DockerApiTests.this.http.get(exportUri)).willReturn(responseOf("export-no-manifest.tar"));
String expectedMessage = "Exported image '%s' does not contain 'index.json' or 'manifest.json'"
.formatted(reference);
assertThatIllegalStateException().isThrownBy(() -> this.api.exportLayerFiles(reference, (name, archive) -> {
})).withMessageContaining(expectedMessage);
}
@Test
void tagWhenReferenceIsNullThrowsException() {
ImageReference tag = ImageReference.of("localhost:5000/ubuntu");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,20 +39,14 @@ abstract class ProgressUpdateEventTests<E extends ProgressUpdateEvent> {
}
@Test
@SuppressWarnings("removal")
void getProgressDetailsReturnsProgressDetails() {
ProgressUpdateEvent event = createEvent();
assertThat(event.getProgressDetail().getCurrent()).isOne();
assertThat(event.getProgressDetail().getTotal()).isEqualTo(2);
assertThat(event.getProgressDetail().asPercentage()).isEqualTo(50);
}
@Test
@SuppressWarnings("removal")
void getProgressDetailsReturnsProgressDetailsForLongNumbers() {
ProgressUpdateEvent event = createEvent("status", new ProgressDetail(4000000000L, 8000000000L), "progress");
assertThat(event.getProgressDetail().getCurrent()).isEqualTo(Integer.MAX_VALUE);
assertThat(event.getProgressDetail().getTotal()).isEqualTo(Integer.MAX_VALUE);
assertThat(event.getProgressDetail().asPercentage()).isEqualTo(50);
}
@@ -62,27 +56,6 @@ abstract class ProgressUpdateEventTests<E extends ProgressUpdateEvent> {
assertThat(event.getProgress()).isEqualTo("progress");
}
@Test
@SuppressWarnings("removal")
void progressDetailIsEmptyWhenCurrentIsNullReturnsTrue() {
ProgressDetail detail = new ProgressDetail(null, 2L);
assertThat(ProgressDetail.isEmpty(detail)).isTrue();
}
@Test
@SuppressWarnings("removal")
void progressDetailIsEmptyWhenTotalIsNullReturnsTrue() {
ProgressDetail detail = new ProgressDetail(1L, null);
assertThat(ProgressDetail.isEmpty(detail)).isTrue();
}
@Test
@SuppressWarnings("removal")
void progressDetailIsEmptyWhenTotalAndCurrentAreNotNullReturnsFalse() {
ProgressDetail detail = new ProgressDetail(1L, 2L);
assertThat(ProgressDetail.isEmpty(detail)).isFalse();
}
protected E createEvent() {
return createEvent("status", new ProgressDetail(1L, 2L), "progress");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,8 +36,6 @@ class PullUpdateEventTests extends AbstractJsonTests {
PullImageUpdateEvent.class);
assertThat(event.getId()).isEqualTo("4f4fb700ef54");
assertThat(event.getStatus()).isEqualTo("Extracting");
assertThat(event.getProgressDetail().getCurrent()).isEqualTo(16);
assertThat(event.getProgressDetail().getTotal()).isEqualTo(32);
assertThat(event.getProgressDetail().asPercentage()).isEqualTo(50);
assertThat(event.getProgress()).isEqualTo("[==================================================>] 32B/32B");
}