Permalink
Browse files

Add /healthz explicitly to login server

[#35826849] [cfid-66] Extract /varz into a separate application
  • Loading branch information...
1 parent da6f12a commit d50a16486e6979e37b100a90d9ccacfe61c4898a @dsyer dsyer committed Sep 27, 2012
View
@@ -0,0 +1,5 @@
+language: java
+
+install: mvn -U install --quiet -DskipTests=true
+script: mvn clean test
+
@@ -18,7 +18,11 @@
<context:mbean-server id="mbeanServer" />
- <security:http pattern="/healthz/**" security="none"/>
+ <http pattern="/healthz/**" create-session="stateless" entry-point-ref="authenticationEntryPoint"
+ security-context-repository-ref="securityContextRepository" xmlns="http://www.springframework.org/schema/security">
+ <intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
+ <anonymous enabled="true" />
+ </http>
<http pattern="/varz/**" create-session="stateless" entry-point-ref="authenticationEntryPoint"
security-context-repository-ref="securityContextRepository" xmlns="http://www.springframework.org/schema/security">
@@ -57,6 +61,8 @@
<property name="order" value="-1"/>
</bean>
+ <bean id="healthzEndpoint" class="org.cloudfoundry.identity.uaa.varz.HealthzEndpoint"/>
+
<bean id="varzEndpoint" class="org.cloudfoundry.identity.uaa.varz.VarzEndpoint">
<property name="server" ref="mbeanServer" />
<property name="staticValues">
@@ -35,6 +35,16 @@
</filter-mapping>
<filter-mapping>
+ <filter-name>varzSecurityFilterChain</filter-name>
+ <url-pattern>/healthz/*</url-pattern>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>varzSecurityFilterChain</filter-name>
+ <url-pattern>/healthz</url-pattern>
+ </filter-mapping>
+
+ <filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
@@ -0,0 +1,47 @@
+/*
+ * Cloud Foundry 2012.02.03 Beta
+ * Copyright (c) [2009-2012] VMware, Inc. All Rights Reserved.
+ *
+ * This product is licensed to you under the Apache License, Version 2.0 (the "License").
+ * You may not use this product except in compliance with the License.
+ *
+ * This product includes a number of subcomponents with
+ * separate copyright notices and license terms. Your use of these
+ * subcomponents is subject to the terms and conditions of the
+ * subcomponent's license, as noted in the LICENSE file.
+ */
+package org.cloudfoundry.identity.uaa.login.integration;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+/**
+ * @author Dave Syer
+ */
+public class HealthzEndpointIntegrationTests {
+
+ @Rule
+ public ServerRunning serverRunning = ServerRunning.isRunning();
+
+ /**
+ * tests a happy-day flow of the <code>/healthz</code> endpoint
+ */
+ @Test
+ public void testHappyDay() throws Exception {
+
+ HttpHeaders headers = new HttpHeaders();
+ ResponseEntity<String> response = serverRunning.getForString("/healthz/", headers);
+ assertEquals(HttpStatus.OK, response.getStatusCode());
+
+ String body = response.getBody();
+ assertTrue(body.contains("ok"));
+
+ }
+
+}

0 comments on commit d50a164

Please sign in to comment.