Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from jenkinsci/security_fix_and-_test
Security fix and testcase
- Loading branch information
Showing
8 changed files
with
80 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
src/test/java/io/jenkins/plugins/delphix/DeleteVDBTest.java
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
src/test/java/io/jenkins/plugins/delphix/GlobalConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package io.jenkins.plugins.delphix; | ||
|
||
import com.cloudbees.plugins.credentials.CredentialsProvider; | ||
import com.cloudbees.plugins.credentials.CredentialsScope; | ||
import com.cloudbees.plugins.credentials.domains.Domain; | ||
import hudson.model.FreeStyleBuild; | ||
import hudson.model.FreeStyleProject; | ||
import hudson.util.Secret; | ||
import hudson.model.Result; | ||
import jenkins.model.GlobalConfiguration; | ||
import org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
public class GlobalConfigurationTest { | ||
|
||
@Rule | ||
public JenkinsRule jenkins = new JenkinsRule(); | ||
|
||
@Test | ||
public void GlobalConfigSSLDisable() throws Exception { | ||
DelphixGlobalConfiguration globalConfig1 = | ||
GlobalConfiguration.all().get(DelphixGlobalConfiguration.class); | ||
globalConfig1.setDctUrl("https://self-signed.badssl.com"); | ||
globalConfig1.setDisableSsl(true); //disable ssl | ||
globalConfig1.save(); | ||
|
||
StringCredentialsImpl c = | ||
new StringCredentialsImpl(CredentialsScope.USER, "test123", "description", | ||
Secret.fromString("api key")); | ||
CredentialsProvider.lookupStores(jenkins).iterator().next().addCredentials(Domain.global(), c); | ||
|
||
FreeStyleProject project = jenkins.createFreeStyleProject(); | ||
ProvisionVDBFromSnapshot builder = new ProvisionVDBFromSnapshot(); | ||
builder.setSourceDataId("4-ORACLE_DB_CONTAINER-6"); | ||
builder.setCredentialId("test123"); | ||
builder.setAutoSelectRepository(true); | ||
project.getBuildersList().add(builder); | ||
|
||
FreeStyleBuild b1 = project.scheduleBuild2(0).get(); | ||
System.out.println(b1.toString()); | ||
jenkins.assertLogContains("<head><title>404 Not Found</title></head>", b1); | ||
jenkins.assertBuildStatus(Result.FAILURE, b1); | ||
} | ||
|
||
|
||
@Test | ||
public void GlobalConfigDefault() throws Exception { | ||
DelphixGlobalConfiguration globalConfig1 = | ||
GlobalConfiguration.all().get(DelphixGlobalConfiguration.class); | ||
globalConfig1.setDctUrl("https://self-signed.badssl.com"); | ||
globalConfig1.save(); | ||
|
||
StringCredentialsImpl c = | ||
new StringCredentialsImpl(CredentialsScope.USER, "test123", "description", | ||
Secret.fromString("api key")); | ||
CredentialsProvider.lookupStores(jenkins).iterator().next().addCredentials(Domain.global(), c); | ||
|
||
FreeStyleProject project = jenkins.createFreeStyleProject(); | ||
ProvisionVDBFromSnapshot builder = new ProvisionVDBFromSnapshot(); | ||
builder.setSourceDataId("4-ORACLE_DB_CONTAINER-6"); | ||
builder.setCredentialId("test123"); | ||
builder.setAutoSelectRepository(true); | ||
project.getBuildersList().add(builder); | ||
|
||
FreeStyleBuild b1 = project.scheduleBuild2(0).get(); | ||
System.out.println(b1.toString()); | ||
jenkins.assertLogContains("javax.net.ssl.SSLHandshakeException:", b1); | ||
jenkins.assertBuildStatus(Result.FAILURE, b1); | ||
} | ||
} |
164 changes: 0 additions & 164 deletions
164
src/test/java/io/jenkins/plugins/delphix/ProvisionVDBFromBookmarkTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.