Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
114 additions
and 27 deletions.
- +1 −14 pom.xml
- +8 −1 ...ain/java/jp/ikedam/jenkins/plugins/updatesitesmanager/internal/ExtendedCertJsonSignValidator.java
- +5 −0 src/test/java/jp/ikedam/jenkins/plugins/updatesitesmanager/DescribedUpdateSiteJenkinsTest.java
- +77 −0 src/test/java/jp/ikedam/jenkins/plugins/updatesitesmanager/ManagedUpdateSiteJenkinsTest.java
- +2 −0 src/test/java/jp/ikedam/jenkins/plugins/updatesitesmanager/UpdateSitesManagerJenkinsTest.java
- +21 −12 ...java/jp/ikedam/jenkins/plugins/updatesitesmanager/internal/ExtendedCertJsonSignValidatorTest.java
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
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
@@ -1,29 +1,38 @@ | ||
package jp.ikedam.jenkins.plugins.updatesitesmanager.internal; | ||
|
||
import net.sf.json.JSONObject; | ||
|
||
import org.apache.commons.io.Charsets; | ||
import org.apache.commons.io.IOUtils; | ||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
import hudson.util.FormValidation; | ||
|
||
import jenkins.util.JSONSignatureValidator; | ||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* @author lanwen (Merkushev Kirill) | ||
*/ | ||
public class ExtendedCertJsonSignValidatorTest { | ||
|
||
@ClassRule | ||
public static JenkinsRule j = new JenkinsRule(); | ||
|
||
@Test | ||
public void shouldAddCustomCertToTrustAnchors() throws Exception { | ||
String RESOURCE_BASE = "jp/ikedam/jenkins/plugins/updatesitesmanager/ManagedUpdateSiteJenkinsTest"; | ||
|
||
String cert = IOUtils.toString(getClass().getClassLoader() | ||
.getResourceAsStream(RESOURCE_BASE + "/caCertificate.crt"), Charsets.UTF_8); | ||
JSONSignatureValidator validator = new ExtendedCertJsonSignValidator("test", cert); | ||
//JSONSignatureValidator validator = new JSONSignatureValidator("test"); | ||
JSONObject ucToTest = JSONObject.fromObject(IOUtils.toString( | ||
getClass().getClassLoader().getResourceAsStream(RESOURCE_BASE + "/update-center.json"), | ||
Charsets.UTF_8 | ||
)); | ||
assertEquals(FormValidation.Kind.OK, validator.verifySignature(ucToTest).kind); | ||
} | ||
} |