Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion maven-resolver-transport-minio/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,22 @@

<properties>
<javaVersion>8</javaVersion>

<okhttpVersion>5.1.0</okhttpVersion>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-bom</artifactId>
<version>${okhttpVersion}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down Expand Up @@ -63,10 +77,15 @@
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.5.17</version>
<version>8.6.0</version>
</dependency>

<!-- Overrides/Updates for Minio Java -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-jvm</artifactId>
<version>${okhttpVersion}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class MinioTransporterIT {
private static final String OBJECT_CONTENT = "content";

private MinIOContainer minioContainer;
private MinioClient minioClient;
private RepositorySystemSession session;
private ObjectNameMapperFactory objectNameMapperFactory;

Expand All @@ -69,19 +68,19 @@ void startSuite() throws Exception {

minioContainer = new MinIOContainer("minio/minio:latest");
minioContainer.start();
minioClient = MinioClient.builder()
try (MinioClient minioClient = MinioClient.builder()
.endpoint(minioContainer.getS3URL())
.credentials(minioContainer.getUserName(), minioContainer.getPassword())
.build();

minioClient.makeBucket(MakeBucketArgs.builder().bucket(BUCKET_NAME).build());
try (FileUtils.TempFile tempFile = FileUtils.newTempFile()) {
Files.write(tempFile.getPath(), OBJECT_CONTENT.getBytes(StandardCharsets.UTF_8));
minioClient.uploadObject(UploadObjectArgs.builder()
.bucket(BUCKET_NAME)
.object(OBJECT_NAME)
.filename(tempFile.getPath().toString())
.build());
.build()) {
minioClient.makeBucket(MakeBucketArgs.builder().bucket(BUCKET_NAME).build());
try (FileUtils.TempFile tempFile = FileUtils.newTempFile()) {
Files.write(tempFile.getPath(), OBJECT_CONTENT.getBytes(StandardCharsets.UTF_8));
minioClient.uploadObject(UploadObjectArgs.builder()
.bucket(BUCKET_NAME)
.object(OBJECT_NAME)
.filename(tempFile.getPath().toString())
.build());
}
}

session = new DefaultRepositorySystemSession(h -> true);
Expand Down Expand Up @@ -135,7 +134,7 @@ void peekWithWrongAuth() throws NoTransporterException {
fail("Should throw");
} catch (Exception e) {
assertInstanceOf(ErrorResponseException.class, e);
assertEquals(transporter.classify(e), Transporter.ERROR_OTHER);
assertEquals(Transporter.ERROR_OTHER, transporter.classify(e));
}
}
}
Expand All @@ -149,7 +148,7 @@ void peekNonexistent() throws NoTransporterException {
fail("Should throw");
} catch (Exception e) {
assertInstanceOf(ErrorResponseException.class, e);
assertEquals(transporter.classify(e), Transporter.ERROR_NOT_FOUND);
assertEquals(Transporter.ERROR_NOT_FOUND, transporter.classify(e));
}
}
}
Expand All @@ -172,7 +171,7 @@ void getNonexistent() throws NoTransporterException {
fail("Should throw");
} catch (Exception e) {
assertInstanceOf(ErrorResponseException.class, e);
assertEquals(transporter.classify(e), Transporter.ERROR_NOT_FOUND);
assertEquals(Transporter.ERROR_NOT_FOUND, transporter.classify(e));
}
}
}
Expand Down
Loading