diff options
author | John W <jjw-github@johntology.org> | 2014-03-13 21:41:40 -0400 |
---|---|---|
committer | John W <jjw-github@johntology.org> | 2014-03-20 00:18:20 -0400 |
commit | 0b346f7c683e0da7e9a8dda695df92838322bb54 (patch) | |
tree | 83b2ac3c9e5f92f6d0e7d98306e3a5b10abf0d5f /sonar-application/src/test/java/org/sonar | |
parent | f264a8ec40e64689e41a60087838fb3cc513f1b1 (diff) | |
download | sonarqube-0b346f7c683e0da7e9a8dda695df92838322bb54.tar.gz sonarqube-0b346f7c683e0da7e9a8dda695df92838322bb54.zip |
Adding clientauth tests
Diffstat (limited to 'sonar-application/src/test/java/org/sonar')
-rw-r--r-- | sonar-application/src/test/java/org/sonar/application/ConnectorsTest.java | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/sonar-application/src/test/java/org/sonar/application/ConnectorsTest.java b/sonar-application/src/test/java/org/sonar/application/ConnectorsTest.java index 4d8e9b4773c..20c2bfca4f9 100644 --- a/sonar-application/src/test/java/org/sonar/application/ConnectorsTest.java +++ b/sonar-application/src/test/java/org/sonar/application/ConnectorsTest.java @@ -124,7 +124,8 @@ public class ConnectorsTest { @Override public boolean matches(Object o) { Connector c = (Connector) o; - return c.getScheme().equals("https") && c.getPort() == 9443; + return c.getScheme().equals("https") && c.getPort() == 9443 + && c.getProperty("clientAuth").equals("false"); } })); } @@ -256,6 +257,52 @@ public class ConnectorsTest { verify(tomcat.getServer(), never()).setShutdown(anyString()); } + @Test + public void enable_client_auth() throws Exception { + + Properties p = new Properties(); + + p.setProperty("sonar.web.port", "-1"); + p.setProperty("sonar.web.https.port", "9443"); + p.setProperty("sonar.web.https.clientAuth", "want"); + + Props props = new Props(p); + + Connectors.configure(tomcat, props); + + verify(tomcat).setConnector(argThat(new ArgumentMatcher<Connector>() { + @Override + public boolean matches(Object o) { + Connector c = (Connector) o; + return c.getScheme().equals("https") && c.getProperty("clientAuth").equals("want"); + } + })); + } + + @Test + public void require_client_auth() throws Exception { + + Properties p = new Properties(); + + p.setProperty("sonar.web.port", "-1"); + p.setProperty("sonar.web.https.port", "9443"); + p.setProperty("sonar.web.https.clientAuth", "true"); + + Props props = new Props(p); + + Connectors.configure(tomcat, props); + + verify(tomcat).setConnector(argThat(new ArgumentMatcher<Connector>() { + @Override + public boolean matches(Object o) { + Connector c = (Connector) o; + return c.getScheme().equals("https") && c.getProperty("clientAuth").equals("true"); + } + })); + } + + + private static class PropertiesMatcher extends ArgumentMatcher<Connector> { private final Map<String, Object> expected; |