Skip to content

Commit

Permalink
Merge pull request #710 from basil/JENKINS-68450
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlatombe authored May 10, 2022
2 parents eb6ce41 + 78dcdaa commit 923207a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aws-java-sdk-minimal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
<artifactId>aws-java-sdk-sts</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>jaxb</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jackson2-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.amazonaws.util;

import static org.junit.Assert.assertArrayEquals;

import java.nio.charset.StandardCharsets;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.RealJenkinsRule;

public class Base64Test {

private static final String sample1 = "mO4TyLWG7vjFWdKT8IJcVbZ/jwc=";
private static final byte[] sample1Bytes;
private static final String sample2 = "F4I4p8Vf/mS+Kxvri3FPoMcqmJ1f";
private static final byte[] sample2Bytes;
private static final String sample3 = "UJmEdJYodqHJmd7Rtv6/OP29/jUEFw==";
private static final byte[] sample3Bytes;

static {
try {
sample1Bytes = Hex.decodeHex("98ee13c8b586eef8c559d293f0825c55b67f8f07");
sample2Bytes = Hex.decodeHex("178238a7c55ffe64be2b1beb8b714fa0c72a989d5f");
sample3Bytes = Hex.decodeHex("50998474962876a1c999ded1b6febf38fdbdfe350417");
} catch (DecoderException e) {
throw new RuntimeException(e);
}
}

@Rule public RealJenkinsRule rr = new RealJenkinsRule();

@Test
public void smokes() throws Throwable {
rr.then(Base64Test::_smokes);
}

private static void _smokes(JenkinsRule r) {
assertArrayEquals("1".getBytes(StandardCharsets.US_ASCII), Base64.decode("MQ=="));
assertArrayEquals(sample1Bytes, Base64.decode(sample1));
assertArrayEquals(sample2Bytes, Base64.decode(sample2));
assertArrayEquals(sample3Bytes, Base64.decode(sample3));
}
}

0 comments on commit 923207a

Please sign in to comment.