Skip to content

Commit

Permalink
Checking OldDataMonitor.
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Nov 14, 2018
1 parent e50a5f5 commit fe1540c
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
package org.jenkinsci.plugins.plaincredentials;

import com.cloudbees.plugins.credentials.CredentialsMatchers;
import com.cloudbees.plugins.credentials.CredentialsNameProvider;
import com.cloudbees.plugins.credentials.CredentialsProvider;
import com.cloudbees.plugins.credentials.SecretBytes;
import com.cloudbees.plugins.credentials.SystemCredentialsProvider;
import com.cloudbees.plugins.credentials.cli.CreateCredentialsByXmlCommand;
import com.cloudbees.plugins.credentials.domains.DomainRequirement;
import hudson.ExtensionList;
import hudson.cli.CLICommandInvoker;
import hudson.security.ACL;
import java.io.ByteArrayInputStream;
Expand All @@ -47,6 +47,7 @@
import org.jvnet.hudson.test.recipes.LocalData;

import static hudson.cli.CLICommandInvoker.Matcher.succeededSilently;
import hudson.diagnosis.OldDataMonitor;
import java.util.stream.Collectors;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
Expand Down Expand Up @@ -110,7 +111,7 @@ public void migrateLegacyData() throws Exception {
assertThat(FileUtils.readFileToString(new File(r.jenkins.getRootDir(), "credentials.xml")),
allOf(containsString("</data>"), not(containsString("</secretBytes>"))));

System.out.println("Loaded: " + SystemCredentialsProvider.getInstance().getCredentials().stream().map(CredentialsNameProvider::name).collect(Collectors.toList()));
assertThat(ExtensionList.lookup(OldDataMonitor.class).get(0).getData().entrySet().stream().map(e -> e.getKey() + ": " + e.getValue().extra).collect(Collectors.toList()), empty());

// get the credential instance under test
FileCredentials c = CredentialsMatchers.firstOrNull(
Expand Down

0 comments on commit fe1540c

Please sign in to comment.