diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2014-03-21 13:35:48 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2014-03-21 13:35:48 +0100 |
commit | 331c51a0f95d35f70957ecbad5d23ebe3686894a (patch) | |
tree | 61b8f44a2c50e5dd43f794f2c4bb8e6d7014497f /sonar-application/src/test | |
parent | eb82fbda433db06dca9295f089e6c95b3c671014 (diff) | |
parent | 2e7d7dc516b88eed2515eebe41117a220c16dd63 (diff) | |
download | sonarqube-331c51a0f95d35f70957ecbad5d23ebe3686894a.tar.gz sonarqube-331c51a0f95d35f70957ecbad5d23ebe3686894a.zip |
Merge branch 'master' of github.com:jdigweed/sonar into jdigweed-master
Diffstat (limited to 'sonar-application/src/test')
-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 b207e98441e..c2ac054a808 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; |