Skip to content

Commit

Permalink
Use a valid keystore
Browse files Browse the repository at this point in the history
  • Loading branch information
jtnord committed Jul 8, 2024
1 parent a43b0b7 commit 9552a40
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import static io.jenkins.plugins.casc.misc.Util.toYamlString;
import io.jenkins.plugins.casc.model.CNode;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;

import jenkins.model.GlobalConfiguration;
import jenkins.model.GlobalConfigurationCategory;
import static org.hamcrest.CoreMatchers.equalTo;
Expand Down Expand Up @@ -101,12 +103,13 @@ public void exportUsernamePasswordCredentialsImplConfiguration() throws Exceptio

@Test
public void exportCertificateCredentialsImplConfiguration() throws Exception {
byte[] p12Bytes = CertificateCredentialsImpl.class.getResourceAsStream("test.p12").readAllBytes();
CertificateCredentialsImpl certificateCredentials =
new CertificateCredentialsImpl(CredentialsScope.GLOBAL,
"credential-certificate",
"Credential with certificate",
"password",
new CertificateCredentialsImpl.UploadedKeyStoreSource(null, SecretBytes.fromBytes("Testing not real certificate".getBytes())));
new CertificateCredentialsImpl.UploadedKeyStoreSource(null, SecretBytes.fromBytes(p12Bytes)));

SystemCredentialsProvider.getInstance().getCredentials().add(certificateCredentials);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Expand Down

0 comments on commit 9552a40

Please sign in to comment.