From 9fb833e4a90f4d20b9e01c595b21c3a683f898ca Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Wed, 4 Feb 2015 11:54:08 +0100 Subject: [PATCH] Fix paths in /hystrix HTML pages When running from /hystrix or from / (with a forward) the webjars and the monitor endpoint need to be resolvable, so we need to use the FTL macros again. Fixes gh-193 --- .../src/main/resources/templates/hystrix/index.ftl | 7 ++++--- .../src/main/resources/templates/hystrix/monitor.ftl | 7 ++++--- .../netflix/hystrix/dashboard/HystrixDashboardTests.java | 6 +++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/spring-cloud-netflix-hystrix-dashboard/src/main/resources/templates/hystrix/index.ftl b/spring-cloud-netflix-hystrix-dashboard/src/main/resources/templates/hystrix/index.ftl index 9a20d202..e71bbc82 100644 --- a/spring-cloud-netflix-hystrix-dashboard/src/main/resources/templates/hystrix/index.ftl +++ b/spring-cloud-netflix-hystrix-dashboard/src/main/resources/templates/hystrix/index.ftl @@ -1,18 +1,19 @@ +<#import "/spring.ftl" as spring /> - + Hystrix Dashboard - + + - + diff --git a/spring-cloud-netflix-hystrix-dashboard/src/test/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardTests.java b/spring-cloud-netflix-hystrix-dashboard/src/test/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardTests.java index ed552320..c196ce05 100644 --- a/spring-cloud-netflix-hystrix-dashboard/src/test/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardTests.java +++ b/spring-cloud-netflix-hystrix-dashboard/src/test/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardTests.java @@ -32,6 +32,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * @author Dave Syer @@ -50,7 +51,10 @@ public class HystrixDashboardTests { ResponseEntity entity = new TestRestTemplate().getForEntity( "http://localhost:" + this.port + "/hystrix", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - entity.getBody().contains(""); + String body = entity.getBody(); + assertTrue(body.contains("")); + assertTrue(body.contains("\"/webjars")); + assertTrue(body.contains("= \"/hystrix/monitor")); } @Test