Skip to content

Commit

Permalink
Add dependency to jackson2-api plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
repolevedavaj committed Jan 6, 2023
1 parent fb03761 commit a3d98e4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 26 deletions.
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<assertj-core.version>3.23.1</assertj-core.version>
<testcontainers.version>1.17.6</testcontainers.version>
<zstd-jni.version>1.5.2-5</zstd-jni.version>
<jackson2-api.version>2.14.1-313.v504cdd45c18b</jackson2-api.version>
</properties>

<name>Jenkins Job Cacher plugin</name>
Expand Down Expand Up @@ -70,6 +71,12 @@
<version>${aws-java-sdk.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jackson2-api</artifactId>
<version>${jackson2-api.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>aws-credentials</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private S3Profile createS3Profile() {
return new S3Profile(lookupCredentials(), endpoint, region, signerVersion, pathStyleAccess, parallelDownloads);
}

@OptionalExtension(requirePlugins = {"aws-java-sdk", "aws-credentials"})
@OptionalExtension(requirePlugins = {"aws-java-sdk", "aws-credentials", "jackson2-api"})
public static final class DescriptorImpl extends ItemStorageDescriptor<S3ObjectPath> {

@NonNull
Expand Down Expand Up @@ -175,7 +175,7 @@ public ListBoxModel doFillSignerVersionItems() {
}
}

@OptionalExtension(requirePlugins = {"aws-java-sdk", "aws-credentials"})
@OptionalExtension(requirePlugins = {"aws-java-sdk", "aws-credentials", "jackson2-api"})
public static final class S3ItemListener extends ItemListener {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import jenkins.plugins.itemstorage.ItemStorage;
import jenkins.plugins.itemstorage.ItemStorageDescriptor;
import jenkins.plugins.itemstorage.Messages;

import org.jenkinsci.plugins.variant.OptionalExtension;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
Expand Down Expand Up @@ -108,7 +107,7 @@ private S3Profile createS3Profile() {
return new S3Profile(lookupCredentials(), null, region, null, false, true);
}

@OptionalExtension(requirePlugins={"aws-java-sdk", "aws-credentials"})
@OptionalExtension(requirePlugins = {"aws-java-sdk", "aws-credentials", "jackson2-api"})
public static final class DescriptorImpl extends ItemStorageDescriptor<S3ObjectPath> {

@NonNull
Expand Down Expand Up @@ -137,7 +136,7 @@ public ListBoxModel doFillRegionItems() {
}
}

@OptionalExtension(requirePlugins={"aws-java-sdk", "aws-credentials"})
@OptionalExtension(requirePlugins = {"aws-java-sdk", "aws-credentials", "jackson2-api"})
public static final class S3ItemListener extends ItemListener {

@Override
Expand Down
25 changes: 4 additions & 21 deletions src/test/java/minio/MinioMcContainer.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package minio;

import static java.lang.String.format;
import com.github.dockerjava.api.command.InspectContainerResponse;
import org.testcontainers.containers.GenericContainer;

import java.io.IOException;
import java.util.UUID;

import org.json.JSONObject;
import org.testcontainers.containers.GenericContainer;

import com.github.dockerjava.api.command.InspectContainerResponse;
import static java.lang.String.format;

public class MinioMcContainer extends GenericContainer<MinioMcContainer> {

Expand Down Expand Up @@ -43,7 +40,7 @@ public ExecResult execSecure(String command, Object... args) throws IOException,
}

public ExecResult exec(String command, Object... args) throws IOException, InterruptedException {
return execInContainer("/bin/sh", "-c", format(command, args));
return execInContainer("/bin/sh", "-c", format(command, args));
}

public void deleteBucket(String bucket) throws IOException, InterruptedException {
Expand All @@ -57,18 +54,4 @@ public void createBucket(String bucket) throws IOException, InterruptedException
public void createObject(String bucket, String key, String content) throws IOException, InterruptedException {
execSecure("echo -n \"%s\" | mc pipe test-minio/%s/%s", content, bucket, key);
}

public void createObject(String bucket, String key, int megabytes) throws IOException, InterruptedException {
execSecure("dd if=/dev/urandom of=tmp.rnd bs=1000000 count=%s", megabytes);
execSecure("mc cp tmp.rnd test-minio/%s/%s", bucket, key);
}

public void createObject(String bucket, String key) throws IOException, InterruptedException {
createObject(bucket, key, UUID.randomUUID().toString());
}

public long getBucketSize(String bucket) throws IOException, InterruptedException {
String result = execSecure(format("mc du --json test-minio/%s", bucket)).getStdout();
return Long.parseLong(new JSONObject(result).optString("size"));
}
}

0 comments on commit a3d98e4

Please sign in to comment.