brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [32/34] brooklyn-server git commit: clarify when /v1/ is or is not required, fixing many integration tests
Date Thu, 18 Feb 2016 15:47:50 GMT
clarify when /v1/ is or is not required, fixing many integration tests

and remove warnings


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/96d804a7
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/96d804a7
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/96d804a7

Branch: refs/heads/master
Commit: 96d804a75a660a618e0083fe1863006056406703
Parents: 3ab0040
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Thu Feb 18 13:40:15 2016 +0000
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Thu Feb 18 13:40:15 2016 +0000

----------------------------------------------------------------------
 .../rest/transform/CatalogTransformer.java      |  5 ++
 .../util/json/BrooklynJacksonJsonProvider.java  |  2 +-
 .../json/ConfigurableSerializerProvider.java    |  1 +
 .../rest/resources/ApplicationResourceTest.java |  4 +-
 .../SensorResourceIntegrationTest.java          |  6 +--
 .../rest/resources/ServerShutdownTest.java      |  2 +-
 .../brooklynnode/DeployBlueprintTest.java       |  8 +--
 .../rest/testing/mocks/RestMockAppBuilder.java  |  1 +
 .../testing/mocks/RestMockSimpleEntity.java     |  8 +--
 .../BrooklynPropertiesSecurityFilterTest.java   | 12 ++---
 .../rest/BrooklynRestApiLauncherTest.java       |  8 +--
 .../BrooklynRestApiLauncherTestFixture.java     | 19 ++++++--
 .../brooklyn/rest/HaMasterCheckFilterTest.java  | 51 ++++++++++----------
 .../AbstractRestApiEntitlementsTest.java        |  8 +--
 .../ServerResourceIntegrationTest.java          |  8 +--
 .../java/org/apache/brooklyn/test/Asserts.java  |  4 +-
 16 files changed, 84 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/CatalogTransformer.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/CatalogTransformer.java
b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/CatalogTransformer.java
index e584a9a..7e0d8bc 100644
--- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/CatalogTransformer.java
+++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/CatalogTransformer.java
@@ -56,14 +56,19 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Sets;
+
 import javax.ws.rs.core.UriBuilder;
+
 import org.apache.brooklyn.rest.api.CatalogApi;
+
 import static org.apache.brooklyn.rest.util.WebResourceUtils.serviceUriBuilder;
 
+@SuppressWarnings("deprecation")
 public class CatalogTransformer {
 
     private static final org.slf4j.Logger log = LoggerFactory.getLogger(CatalogTransformer.class);
     
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public static <T extends Entity> CatalogEntitySummary catalogEntitySummary(BrooklynRestResourceUtils
b, CatalogItem<T,EntitySpec<? extends T>> item, UriBuilder ub) {
         Set<EntityConfigSummary> config = Sets.newLinkedHashSet();
         Set<SensorSummary> sensors = Sets.newTreeSet(SummaryComparators.nameComparator());

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonJsonProvider.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonJsonProvider.java
b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonJsonProvider.java
index 9c6704d..7083eb6 100644
--- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonJsonProvider.java
+++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonJsonProvider.java
@@ -158,7 +158,7 @@ public class BrooklynJacksonJsonProvider extends JacksonJsonProvider implements
         mapper.setSerializerProvider(sp);
         mapper.setVisibilityChecker(new PossiblyStrictPreferringFieldsVisibilityChecker());
 
-        SimpleModule mapperModule = new SimpleModule("Brooklyn", new Version(0, 0, 0, "ignored"));
+        SimpleModule mapperModule = new SimpleModule("Brooklyn", new Version(0, 0, 0, "ignored",
null, null));
 
         new BidiSerialization.ManagementContextSerialization(mgmt).install(mapperModule);
         new BidiSerialization.EntitySerialization(mgmt).install(mapperModule);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/json/ConfigurableSerializerProvider.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/json/ConfigurableSerializerProvider.java
b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/json/ConfigurableSerializerProvider.java
index 1b87e76..b77202f 100644
--- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/json/ConfigurableSerializerProvider.java
+++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/json/ConfigurableSerializerProvider.java
@@ -33,6 +33,7 @@ import com.fasterxml.jackson.databind.ser.SerializerFactory;
 /** allows the serializer-of-last-resort to be customized, ie used for unknown-types */
 final class ConfigurableSerializerProvider extends DefaultSerializerProvider {
 
+    private static final long serialVersionUID = 6094990395562170217L;
     protected JsonSerializer<Object> unknownTypeSerializer;
 
     public ConfigurableSerializerProvider() {}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ApplicationResourceTest.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ApplicationResourceTest.java
b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ApplicationResourceTest.java
index b9a6e9b..a6abe0f 100644
--- a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ApplicationResourceTest.java
+++ b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ApplicationResourceTest.java
@@ -64,7 +64,6 @@ import org.apache.brooklyn.rest.testing.BrooklynRestResourceTest;
 import org.apache.brooklyn.rest.testing.mocks.CapitalizePolicy;
 import org.apache.brooklyn.rest.testing.mocks.NameMatcherGroup;
 import org.apache.brooklyn.rest.testing.mocks.RestMockApp;
-import org.apache.brooklyn.rest.testing.mocks.RestMockAppBuilder;
 import org.apache.brooklyn.rest.testing.mocks.RestMockSimpleEntity;
 import org.apache.brooklyn.test.Asserts;
 import org.apache.brooklyn.util.collections.CollectionFunctionals;
@@ -209,10 +208,11 @@ public class ApplicationResourceTest extends BrooklynRestResourceTest
{
         assertEquals(client().path(appUri).get(ApplicationSummary.class).getSpec().getName(),
"simple-app-interface");
     }
 
+    @SuppressWarnings("deprecation")
     @Test(dependsOnMethods = { "testDeployApplication", "testLocatedLocation" })
     public void testDeployApplicationFromBuilder() throws Exception {
         ApplicationSpec spec = ApplicationSpec.builder()
-                .type(RestMockAppBuilder.class.getCanonicalName())
+                .type(org.apache.brooklyn.rest.testing.mocks.RestMockAppBuilder.class.getCanonicalName())
                 .name("simple-app-builder")
                 .locations(ImmutableSet.of("localhost"))
                 .build();

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/SensorResourceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/SensorResourceIntegrationTest.java
b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/SensorResourceIntegrationTest.java
index 9b7214d..2a6b564 100644
--- a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/SensorResourceIntegrationTest.java
+++ b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/SensorResourceIntegrationTest.java
@@ -26,9 +26,10 @@ import org.apache.brooklyn.api.mgmt.ManagementContext;
 import org.apache.brooklyn.core.entity.EntityInternal;
 import org.apache.brooklyn.core.entity.EntityPredicates;
 import org.apache.brooklyn.entity.stock.BasicApplication;
+import org.apache.brooklyn.rest.testing.BrooklynRestResourceTest;
 import org.apache.brooklyn.rest.testing.mocks.RestMockSimpleEntity;
-import org.apache.brooklyn.test.HttpTestUtils;
 import org.apache.brooklyn.util.collections.MutableList;
+import org.apache.brooklyn.util.http.HttpAsserts;
 import org.apache.brooklyn.util.http.HttpTool;
 import org.apache.brooklyn.util.http.HttpToolResponse;
 import org.apache.brooklyn.util.net.Urls;
@@ -39,7 +40,6 @@ import org.testng.annotations.Test;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Iterables;
-import org.apache.brooklyn.rest.testing.BrooklynRestResourceTest;
 
 public class SensorResourceIntegrationTest extends BrooklynRestResourceTest {
 
@@ -67,7 +67,7 @@ public class SensorResourceIntegrationTest extends BrooklynRestResourceTest
{
         // Uses explicit "application/json" because failed on jenkins as though "text/plain"
was the default on Ubuntu jenkins!
         HttpClient client = HttpTool.httpClientBuilder().uri(baseUri).build();
         HttpToolResponse response = HttpTool.httpGet(client, url, ImmutableMap.<String,
String>of("Accept", "application/json"));
-        HttpTestUtils.assertHealthyStatusCode(response.getResponseCode());
+        HttpAsserts.assertHealthyStatusCode(response.getResponseCode());
         Assert.assertEquals(response.getContentAsString(), "\"12345 frogs\"");
     }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerShutdownTest.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerShutdownTest.java
b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerShutdownTest.java
index 9d55482..18c3deb 100644
--- a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerShutdownTest.java
+++ b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerShutdownTest.java
@@ -65,7 +65,7 @@ public class ServerShutdownTest extends BrooklynRestResourceTest {
         assertTrue(getManagementContext().isRunning());
         assertFalse(shutdownListener.isRequested());
 
-        MultivaluedMap<String, String> formData = new MultivaluedHashMap();
+        MultivaluedMap<String, String> formData = new MultivaluedHashMap<String,String>();
         formData.add("requestTimeout", "0");
         formData.add("delayForHttpReturn", "0");
         client().path("/server/shutdown").type(MediaType.APPLICATION_FORM_URLENCODED).post(formData);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/test/entity/brooklynnode/DeployBlueprintTest.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/test/entity/brooklynnode/DeployBlueprintTest.java
b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/test/entity/brooklynnode/DeployBlueprintTest.java
index 0113d39..87d4604 100644
--- a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/test/entity/brooklynnode/DeployBlueprintTest.java
+++ b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/test/entity/brooklynnode/DeployBlueprintTest.java
@@ -30,8 +30,9 @@ import org.apache.brooklyn.entity.brooklynnode.BrooklynNode;
 import org.apache.brooklyn.entity.brooklynnode.BrooklynNode.DeployBlueprintEffector;
 import org.apache.brooklyn.entity.stock.BasicApplication;
 import org.apache.brooklyn.feed.http.JsonFunctions;
-import org.apache.brooklyn.test.HttpTestUtils;
+import org.apache.brooklyn.rest.testing.BrooklynRestResourceTest;
 import org.apache.brooklyn.util.guava.Functionals;
+import org.apache.brooklyn.util.http.HttpTool;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.Test;
@@ -39,7 +40,6 @@ import org.testng.annotations.Test;
 import com.google.common.base.Function;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
-import org.apache.brooklyn.rest.testing.BrooklynRestResourceTest;
 
 public class DeployBlueprintTest extends BrooklynRestResourceTest {
 
@@ -77,11 +77,11 @@ public class DeployBlueprintTest extends BrooklynRestResourceTest {
 
         log.info("got: "+id);
 
-        String apps = HttpTestUtils.getContent(getEndpointAddress() + "/applications");
+        String apps = HttpTool.getContent(getEndpointAddress() + "/applications");
         List<String> appType = parseJsonList(apps, ImmutableList.of("spec", "type"),
String.class);
         assertEquals(appType, ImmutableList.of(BasicApplication.class.getName()));
 
-        String status = HttpTestUtils.getContent(getEndpointAddress()+"/applications/"+id+"/entities/"+id+"/sensors/service.status");
+        String status = HttpTool.getContent(getEndpointAddress()+"/applications/"+id+"/entities/"+id+"/sensors/service.status");
         log.info("STATUS: "+status);
     }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/testing/mocks/RestMockAppBuilder.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/testing/mocks/RestMockAppBuilder.java
b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/testing/mocks/RestMockAppBuilder.java
index 1ca10bd..e4ae595 100644
--- a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/testing/mocks/RestMockAppBuilder.java
+++ b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/testing/mocks/RestMockAppBuilder.java
@@ -24,6 +24,7 @@ import org.apache.brooklyn.core.entity.StartableApplication;
 import org.apache.brooklyn.core.entity.factory.ApplicationBuilder;
 import org.apache.brooklyn.util.javalang.Reflections;
 
+/** @deprecated since 0.9.0 don't use {@link ApplicationBuilder} */
 public class RestMockAppBuilder extends ApplicationBuilder {
 
     public RestMockAppBuilder() {

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/testing/mocks/RestMockSimpleEntity.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/testing/mocks/RestMockSimpleEntity.java
b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/testing/mocks/RestMockSimpleEntity.java
index 58d24aa..4a49e45 100644
--- a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/testing/mocks/RestMockSimpleEntity.java
+++ b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/testing/mocks/RestMockSimpleEntity.java
@@ -21,7 +21,6 @@ package org.apache.brooklyn.rest.testing.mocks;
 import java.util.Map;
 
 import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityLocal;
 import org.apache.brooklyn.api.sensor.AttributeSensor;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.core.annotation.Effector;
@@ -31,10 +30,10 @@ import org.apache.brooklyn.core.effector.MethodEffector;
 import org.apache.brooklyn.core.sensor.BasicAttributeSensor;
 import org.apache.brooklyn.entity.software.base.AbstractSoftwareProcessSshDriver;
 import org.apache.brooklyn.entity.software.base.SoftwareProcessImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.brooklyn.location.ssh.SshMachineLocation;
 import org.apache.brooklyn.util.core.flags.SetFromFlag;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class RestMockSimpleEntity extends SoftwareProcessImpl {
 
@@ -87,7 +86,8 @@ public class RestMockSimpleEntity extends SoftwareProcessImpl {
     }
     
     public static class MockSshDriver extends AbstractSoftwareProcessSshDriver {
-        public MockSshDriver(EntityLocal entity, SshMachineLocation machine) {
+        @SuppressWarnings("deprecation")
+        public MockSshDriver(org.apache.brooklyn.api.entity.EntityLocal entity, SshMachineLocation
machine) {
             super(entity, machine);
         }
         public boolean isRunning() { return true; }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynPropertiesSecurityFilterTest.java
----------------------------------------------------------------------
diff --git a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynPropertiesSecurityFilterTest.java
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynPropertiesSecurityFilterTest.java
index 6fe610b..f89acf0 100644
--- a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynPropertiesSecurityFilterTest.java
+++ b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynPropertiesSecurityFilterTest.java
@@ -105,12 +105,12 @@ public class BrooklynPropertiesSecurityFilterTest extends BrooklynRestApiLaunche
             String appId = startAppAtNode(server);
             String entityId = getTestEntityInApp(server, appId);
             HttpClient client = HttpTool.httpClientBuilder()
-                    .uri(getBaseUri(server))
+                    .uri(getBaseUriRest())
                     .build();
             List<? extends NameValuePair> nvps = Lists.newArrayList(
                     new BasicNameValuePair("arg", "bar"));
             String effector = String.format("/applications/%s/entities/%s/effectors/identityEffector",
appId, entityId);
-            HttpToolResponse response = HttpTool.httpPost(client, URI.create(getBaseUri()
+ effector),
+            HttpToolResponse response = HttpTool.httpPost(client, URI.create(getBaseUriRest()
+ effector),
                     ImmutableMap.of(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_FORM_URLENCODED.getMimeType()),
                     URLEncodedUtils.format(nvps, Charsets.UTF_8).getBytes());
 
@@ -127,9 +127,9 @@ public class BrooklynPropertiesSecurityFilterTest extends BrooklynRestApiLaunche
                 "services:\n" +
                 "- type: org.apache.brooklyn.test.entity.TestEntity";
         HttpClient client = HttpTool.httpClientBuilder()
-                .uri(getBaseUri(server))
+                .uri(getBaseUriRest(server))
                 .build();
-        HttpToolResponse response = HttpTool.httpPost(client, URI.create(getBaseUri() + "/applications"),
+        HttpToolResponse response = HttpTool.httpPost(client, URI.create(getBaseUriRest()
+ "applications"),
                 ImmutableMap.of(HttpHeaders.CONTENT_TYPE, "application/x-yaml"),
                 blueprint.getBytes());
         assertTrue(HttpTool.isStatusCodeHealthy(response.getResponseCode()), "error creating
app. response code=" + response.getResponseCode());
@@ -141,10 +141,10 @@ public class BrooklynPropertiesSecurityFilterTest extends BrooklynRestApiLaunche
     @SuppressWarnings("rawtypes")
     private String getTestEntityInApp(Server server, String appId) throws Exception {
         HttpClient client = HttpTool.httpClientBuilder()
-                .uri(getBaseUri(server))
+                .uri(getBaseUriRest(server))
                 .build();
         List entities = new ObjectMapper().readValue(
-                HttpTool.httpGet(client, URI.create(getBaseUri() + "/applications/" + appId
+ "/entities"), MutableMap.<String, String>of()).getContent(), List.class);
+                HttpTool.httpGet(client, URI.create(getBaseUriRest(server) + "applications/"
+ appId + "/entities"), MutableMap.<String, String>of()).getContent(), List.class);
         LOG.info((String) ((Map) entities.get(0)).get("id"));
         return (String) ((Map) entities.get(0)).get("id");
     }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTest.java
----------------------------------------------------------------------
diff --git a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTest.java
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTest.java
index e73fab4..d64b9a6 100644
--- a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTest.java
+++ b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTest.java
@@ -29,7 +29,6 @@ import org.apache.brooklyn.test.Asserts;
 import org.apache.brooklyn.util.http.HttpAsserts;
 import org.apache.brooklyn.util.http.HttpTool;
 import org.apache.http.HttpStatus;
-import org.eclipse.jetty.server.NetworkConnector;
 import org.eclipse.jetty.server.Server;
 import org.testng.annotations.Test;
 
@@ -41,6 +40,7 @@ public class BrooklynRestApiLauncherTest extends BrooklynRestApiLauncherTestFixt
     }
 
     @Test
+    // doesn't work from IDE
     public void testWebAppStart() throws Exception {
         checkRestCatalogEntities(useServerForTest(baseLauncher().mode(WEB_XML).start()));
     }
@@ -52,11 +52,11 @@ public class BrooklynRestApiLauncherTest extends BrooklynRestApiLauncherTestFixt
     }
     
     private static void checkRestCatalogEntities(Server server) throws Exception {
-        final String rootUrl = "http://localhost:"+((NetworkConnector)server.getConnectors()[0]).getLocalPort();
+        final String rootUrl = getBaseUriRest(server);
         int code = Asserts.succeedsEventually(new Callable<Integer>() {
             @Override
             public Integer call() throws Exception {
-                int code = HttpTool.getHttpStatusCode(rootUrl+"/v1/catalog/entities");
+                int code = HttpTool.getHttpStatusCode(rootUrl+"catalog/entities");
                 if (code == HttpStatus.SC_FORBIDDEN) {
                     throw new RuntimeException("Retry request");
                 } else {
@@ -65,7 +65,7 @@ public class BrooklynRestApiLauncherTest extends BrooklynRestApiLauncherTestFixt
             }
         });
         HttpAsserts.assertHealthyStatusCode(code);
-        HttpAsserts.assertContentContainsText(rootUrl+"/v1/catalog/entities", BrooklynNode.class.getSimpleName());
+        HttpAsserts.assertContentContainsText(rootUrl+"catalog/entities", BrooklynNode.class.getSimpleName());
     }
     
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTestFixture.java
----------------------------------------------------------------------
diff --git a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTestFixture.java
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTestFixture.java
index 4ca48df..1893d4a 100644
--- a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTestFixture.java
+++ b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTestFixture.java
@@ -69,12 +69,25 @@ public abstract class BrooklynRestApiLauncherTestFixture {
         return server;
     }
     
-    protected String getBaseUri() {
-        return getBaseUri(server);
-    }
+    /** @deprecated since 0.9.0 use {@link #getBaseUriHostAndPost(Server)} or {@link #getBaseUriRest(Server)}
*/
     public static String getBaseUri(Server server) {
+        return getBaseUriHostAndPost(server);
+    }
+    
+    protected String getBaseUriHostAndPost() {
+        return getBaseUriHostAndPost(server);
+    }
+    /** returns base of server, without trailing slash - e.g. <code>http://localhost:8081</code>
*/
+    public static String getBaseUriHostAndPost(Server server) {
         return "http://localhost:"+((NetworkConnector)server.getConnectors()[0]).getLocalPort();
     }
+    protected String getBaseUriRest() {
+        return getBaseUriRest(server);
+    }
+    /** returns REST endpoint, with trailing slash */
+    public static String getBaseUriRest(Server server) {
+        return getBaseUriHostAndPost(server)+"/v1/";
+    }
     
     public static void forceUseOfDefaultCatalogWithJavaClassPath(Server server) {
         ManagementContext mgmt = getManagementContextFromJettyServerAttributes(server);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-server/src/test/java/org/apache/brooklyn/rest/HaMasterCheckFilterTest.java
----------------------------------------------------------------------
diff --git a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/HaMasterCheckFilterTest.java
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/HaMasterCheckFilterTest.java
index 90e7957..db58f99 100644
--- a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/HaMasterCheckFilterTest.java
+++ b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/HaMasterCheckFilterTest.java
@@ -35,17 +35,16 @@ import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatformLauncherNoServer;
 import org.apache.brooklyn.core.entity.Entities;
 import org.apache.brooklyn.core.mgmt.rebind.RebindTestUtils;
 import org.apache.brooklyn.entity.stock.BasicApplication;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.HttpClient;
-import org.eclipse.jetty.server.Server;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
 import org.apache.brooklyn.rest.security.provider.AnyoneSecurityProvider;
 import org.apache.brooklyn.test.Asserts;
 import org.apache.brooklyn.util.http.HttpTool;
 import org.apache.brooklyn.util.http.HttpToolResponse;
 import org.apache.brooklyn.util.os.Os;
 import org.apache.brooklyn.util.time.Duration;
+import org.apache.http.client.HttpClient;
+import org.eclipse.jetty.server.Server;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
 
 import com.google.common.base.Predicates;
 import com.google.common.base.Supplier;
@@ -63,7 +62,6 @@ public class HaMasterCheckFilterTest extends BrooklynRestApiLauncherTestFixture
 
     @AfterMethod(alwaysRun=true)
     public void tearDown() throws Exception {
-System.err.println("TEAR DOWN");
         server.stop();
         Entities.destroyAll(writeMgmt);
         Entities.destroyAll(readMgmt);
@@ -74,23 +72,25 @@ System.err.println("TEAR DOWN");
     public void testEntitiesExistOnDisabledHA() throws Exception {
         initHaCluster(HighAvailabilityMode.DISABLED, HighAvailabilityMode.DISABLED);
         assertReadIsMaster();
-        assertEntityExists(new ReturnCodeCheck());
+        assertEntityExists(new ReturnCodeNotRetry());
     }
 
     @Test(groups = "Integration")
     public void testEntitiesExistOnMasterPromotion() throws Exception {
         initHaCluster(HighAvailabilityMode.AUTO, HighAvailabilityMode.AUTO);
+        assertEntityNotFound(new ReturnCodeNotRetry());
         stopWriteNode();
-        assertEntityExists(new ReturnCodeCheck());
+        assertEntityExists(new ReturnCodeNotRetryAndNodeIsMaster());
         assertReadIsMaster();
     }
 
     @Test(groups = "Integration")
     public void testEntitiesExistOnHotStandbyAndPromotion() throws Exception {
         initHaCluster(HighAvailabilityMode.AUTO, HighAvailabilityMode.HOT_STANDBY);
-        assertEntityExists(new ReturnCodeCheck());
+        assertEntityExists(new ReturnCodeNotRetry());
         stopWriteNode();
-        assertEntityExists(new ReturnCodeAndNodeState());
+        // once the node claims master we should get a 200
+        assertEntityExists(new ReturnCodeNotRetryAndNodeIsMaster());
         assertReadIsMaster();
     }
 
@@ -98,23 +98,23 @@ System.err.println("TEAR DOWN");
     public void testEntitiesExistOnHotBackup() throws Exception {
         initHaCluster(HighAvailabilityMode.AUTO, HighAvailabilityMode.HOT_BACKUP);
         Asserts.continually(
-                ImmutableMap.<String,Object>of(
-                        "timeout", Duration.THIRTY_SECONDS,
-                        "period", Duration.ZERO),
                 new ReturnCodeSupplier(),
-                Predicates.or(Predicates.equalTo(200), Predicates.equalTo(403)));
+                Predicates.or(Predicates.equalTo(200), Predicates.equalTo(403)),
+                Duration.THIRTY_SECONDS, 
+                null,
+                null);
     }
 
     private HttpClient getClient(Server server) {
         HttpClient client = HttpTool.httpClientBuilder()
-                .uri(getBaseUri(server))
+                .uri(getBaseUriRest(server))
                 .build();
         return client;
     }
 
     private int getAppResponseCode() {
         HttpToolResponse response = HttpTool.httpGet(
-                client, URI.create(getBaseUri(server) + "/applications/" + appId),
+                client, URI.create(getBaseUriRest() + "applications/" + appId),
                 ImmutableMap.<String,String>of());
         return response.getResponseCode();
     }
@@ -173,6 +173,10 @@ System.err.println("TEAR DOWN");
     private void assertEntityExists(Callable<Integer> c) {
         assertEquals((int)Asserts.succeedsEventually(c), 200);
     }
+    
+    private void assertEntityNotFound(Callable<Integer> c) {
+        assertEquals((int)Asserts.succeedsEventually(c), 404);
+    }
 
     private void assertReadIsMaster() {
         assertEquals(readMgmt.getHighAvailabilityManager().getNodeState(), ManagementNodeState.MASTER);
@@ -182,7 +186,7 @@ System.err.println("TEAR DOWN");
         writeMgmt.getHighAvailabilityManager().stop();
     }
 
-    private class ReturnCodeCheck implements Callable<Integer> {
+    private class ReturnCodeNotRetry implements Callable<Integer> {
         @Override
         public Integer call() {
             int retCode = getAppResponseCode();
@@ -194,17 +198,14 @@ System.err.println("TEAR DOWN");
         }
     }
 
-    private class ReturnCodeAndNodeState extends ReturnCodeCheck {
+    private class ReturnCodeNotRetryAndNodeIsMaster extends ReturnCodeNotRetry {
         @Override
         public Integer call() {
-            Integer ret = super.call();
-            if (ret == HttpStatus.SC_OK) {
-                ManagementNodeState state = readMgmt.getHighAvailabilityManager().getNodeState();
-                if (state != ManagementNodeState.MASTER) {
-                    throw new RuntimeException("Not master yet " + state);
-                }
+            ManagementNodeState state = readMgmt.getHighAvailabilityManager().getNodeState();
+            if (state != ManagementNodeState.MASTER) {
+                throw new RuntimeException("Not master yet " + state);
             }
-            return ret;
+            return super.call();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-server/src/test/java/org/apache/brooklyn/rest/entitlement/AbstractRestApiEntitlementsTest.java
----------------------------------------------------------------------
diff --git a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/entitlement/AbstractRestApiEntitlementsTest.java
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/entitlement/AbstractRestApiEntitlementsTest.java
index 73449ea..7331b39 100644
--- a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/entitlement/AbstractRestApiEntitlementsTest.java
+++ b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/entitlement/AbstractRestApiEntitlementsTest.java
@@ -84,13 +84,13 @@ public abstract class AbstractRestApiEntitlementsTest extends BrooklynRestApiLau
     
     protected HttpClient newClient(String user) throws Exception {
         return httpClientBuilder()
-                .uri(getBaseUri())
+                .uri(getBaseUriRest())
                 .credentials(new UsernamePasswordCredentials(user, "ignoredPassword"))
                 .build();
     }
 
     protected String httpGet(String user, String path) throws Exception {
-        HttpToolResponse response = HttpTool.httpGet(newClient(user), URI.create(getBaseUri()).resolve(path),
ImmutableMap.<String, String>of());
+        HttpToolResponse response = HttpTool.httpGet(newClient(user), URI.create(getBaseUriRest()).resolve(path),
ImmutableMap.<String, String>of());
         assertTrue(HttpAsserts.isHealthyStatusCode(response.getResponseCode()), "code="+response.getResponseCode()+";
reason="+response.getReasonPhrase());
         return response.getContentAsString();
     }
@@ -100,12 +100,12 @@ public abstract class AbstractRestApiEntitlementsTest extends BrooklynRestApiLau
     }
 
     protected void assertForbidden(String user, String path) throws Exception {
-        HttpToolResponse response = HttpTool.httpGet(newClient(user), URI.create(getBaseUri()).resolve(path),
ImmutableMap.<String, String>of());
+        HttpToolResponse response = HttpTool.httpGet(newClient(user), URI.create(getBaseUriRest()).resolve(path),
ImmutableMap.<String, String>of());
         assertEquals(response.getResponseCode(), 403, "code="+response.getResponseCode()+";
reason="+response.getReasonPhrase()+"; content="+response.getContentAsString());
     }
 
     protected void assert404(String user, String path) throws Exception {
-        HttpToolResponse response = HttpTool.httpGet(newClient(user), URI.create(getBaseUri()).resolve(path),
ImmutableMap.<String, String>of());
+        HttpToolResponse response = HttpTool.httpGet(newClient(user), URI.create(getBaseUriRest()).resolve(path),
ImmutableMap.<String, String>of());
         assertEquals(response.getResponseCode(), 404, "code="+response.getResponseCode()+";
reason="+response.getReasonPhrase()+"; content="+response.getContentAsString());
     }
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceIntegrationTest.java
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceIntegrationTest.java
index 74fbe3c..604d1eb 100644
--- a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceIntegrationTest.java
+++ b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceIntegrationTest.java
@@ -68,10 +68,10 @@ public class ServerResourceIntegrationTest extends BrooklynRestApiLauncherTestFi
                     .withoutJsgui()
                     .securityProvider(TestSecurityProvider.class)
                     .start());
-            String baseUri = getBaseUri(server);
+            String baseUri = getBaseUriRest(server);
     
             HttpToolResponse response;
-            final URI uri = URI.create(getBaseUri() + "/server/properties/reload");
+            final URI uri = URI.create(getBaseUriRest() + "server/properties/reload");
             final Map<String, String> args = Collections.emptyMap();
     
             // Unauthorised when no credentials, and when default credentials.
@@ -112,11 +112,11 @@ public class ServerResourceIntegrationTest extends BrooklynRestApiLauncherTestFi
 
     private String getServerUser(Server server) throws Exception {
         HttpClient client = httpClientBuilder()
-                .uri(getBaseUri(server))
+                .uri(getBaseUriRest(server))
                 .credentials(TestSecurityProvider.CREDENTIAL)
                 .build();
         
-        HttpToolResponse response = HttpTool.httpGet(client, URI.create(getBaseUri(server)
+ "/server/user"),
+        HttpToolResponse response = HttpTool.httpGet(client, URI.create(getBaseUriRest(server)
+ "server/user"),
                 ImmutableMap.<String, String>of());
         HttpAsserts.assertHealthyStatusCode(response.getResponseCode());
         return response.getContentAsString();

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/96d804a7/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java b/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
index fac3142..3ad5bda 100644
--- a/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
+++ b/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
@@ -798,12 +798,12 @@ public class Asserts {
         continually(ImmutableMap.<String,Object>of(), supplier, predicate);
     }
 
-    /** @deprecated since 0.9.0 use {@link #eventually(Supplier, Predicate, Duration, Duration,
String)} */ @Deprecated
+    /** @deprecated since 0.9.0 use {@link #continually(Supplier, Predicate, Duration, Duration,
String)} */ @Deprecated
     public static <T> void continually(Map<String,?> flags, Supplier<? extends
T> supplier, Predicate<? super T> predicate) {
         continually(flags, supplier, predicate, null);
     }
 
-    /** @deprecated since 0.9.0 use {@link #eventually(Supplier, Predicate, Duration, Duration,
String)} */ @Deprecated
+    /** @deprecated since 0.9.0 use {@link #continually(Supplier, Predicate, Duration, Duration,
String)} */ @Deprecated
     public static <T> void continually(Map<String,?> flags, Supplier<? extends
T> supplier, Predicate<T> predicate, String errMsg) {
         continually(supplier, predicate, toDuration(flags.get("timeout"), toDuration(flags.get("duration"),
null)), 
             toDuration(flags.get("period"), null), null);


Mime
View raw message