Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-42437] Use not deprecated constructors.
  • Loading branch information
Evaristo Gutiérrez committed Mar 9, 2017
1 parent aa86361 commit 056e905
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Expand Up @@ -7,6 +7,7 @@
import java.util.Collections;
import java.util.List;

import com.cloudbees.plugins.credentials.SecretBytes;
import org.apache.commons.fileupload.disk.DiskFileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.jenkinsci.plugins.plaincredentials.impl.FileCredentialsImpl;
Expand All @@ -22,7 +23,6 @@
import com.cloudbees.plugins.credentials.domains.Domain;
import com.cloudbees.plugins.credentials.domains.DomainRequirement;
import com.cloudbees.plugins.credentials.impl.BaseStandardCredentials;
import com.trilead.ssh2.crypto.Base64;

import hudson.security.ACL;
import hudson.util.Secret;
Expand Down Expand Up @@ -56,7 +56,7 @@ public void secretTextBaseTest() throws IOException {
public void secretFileBaseTest() throws IOException, URISyntaxException {
DiskFileItem fileItem = createEmptyFileItem();

FileCredentialsImpl credential = new FileCredentialsImpl(CredentialsScope.GLOBAL, CRED_ID, "Test Secret file", fileItem, "keys.txt", Base64.encode(fileItem.get()).toString());
FileCredentialsImpl credential = new FileCredentialsImpl(CredentialsScope.GLOBAL, CRED_ID, "Test Secret file", fileItem, "keys.txt", SecretBytes.fromBytes(fileItem.get()));
FileCredentialsImpl updatedCredential = new FileCredentialsImpl(credential.getScope(), UPDATED_CRED_ID, credential.getDescription(), fileItem, credential.getFileName(), credential.getSecretBytes());
testCreateUpdateDelete(credential, updatedCredential);
}
Expand Down
Expand Up @@ -24,6 +24,7 @@
package org.jenkinsci.plugins.plaincredentials;

import com.cloudbees.plugins.credentials.CredentialsScope;
import com.cloudbees.plugins.credentials.SecretBytes;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemHeaders;
import org.jenkinsci.plugins.plaincredentials.impl.FileCredentialsImpl;
Expand All @@ -46,7 +47,7 @@ public class FileCredentialsTest {
@Test(expected = IllegalArgumentException.class)
@Issue("JENKINS-30926")
public void shouldThrowAnExceptionIfFileNameIsBlank() throws IOException {
new FileCredentialsImpl(CredentialsScope.GLOBAL, "1", "", new StubFileItem(), "", "");
new FileCredentialsImpl(CredentialsScope.GLOBAL, "1", "", new StubFileItem(), "", SecretBytes.fromString(""));
}

private class StubFileItem implements FileItem {
Expand Down

0 comments on commit 056e905

Please sign in to comment.