http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/MultimapSerializer.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/MultimapSerializer.java
 
b/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/MultimapSerializer.java
deleted file mode 100644
index c264e22..0000000
--- 
a/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/MultimapSerializer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.rest.util.json;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Map;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.ser.std.StdSerializer;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Multimap;
-
-/**
- * Provides a serializer for {@link Multimap} instances.
- * <p>
- * When Brooklyn's Jackson dependency is updated from 
org.codehaus.jackson:1.9.13 to
- * com.fasterxml.jackson:2.3+ then this class should be replaced with a 
dependency on
- * jackson-datatype-guava and a GuavaModule registered with Brooklyn's 
ObjectMapper.
- */
-@Beta
-public class MultimapSerializer extends StdSerializer<Multimap<?, ?>> {
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    protected MultimapSerializer() {
-        super((Class<Multimap<?, ?>>) (Class) Multimap.class);
-    }
-
-    @Override
-    public void serialize(Multimap<?, ?> value, JsonGenerator jgen, 
SerializerProvider provider) throws IOException {
-        jgen.writeStartObject();
-        writeEntries(value, jgen, provider);
-        jgen.writeEndObject();
-    }
-
-    private void writeEntries(Multimap<?, ?> value, JsonGenerator jgen, 
SerializerProvider provider) throws IOException {
-        for (Map.Entry<?, ? extends Collection<?>> entry : 
value.asMap().entrySet()) {
-            provider.findKeySerializer(provider.constructType(String.class), 
null)
-                    .serialize(entry.getKey(), jgen, provider);
-            
provider.defaultSerializeValue(Lists.newArrayList(entry.getValue()), jgen);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/PossiblyStrictPreferringFieldsVisibilityChecker.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/PossiblyStrictPreferringFieldsVisibilityChecker.java
 
b/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/PossiblyStrictPreferringFieldsVisibilityChecker.java
deleted file mode 100644
index e474467..0000000
--- 
a/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/PossiblyStrictPreferringFieldsVisibilityChecker.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.rest.util.json;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.PropertyAccessor;
-import com.fasterxml.jackson.databind.introspect.AnnotatedField;
-import com.fasterxml.jackson.databind.introspect.AnnotatedMember;
-import com.fasterxml.jackson.databind.introspect.AnnotatedMethod;
-import com.fasterxml.jackson.databind.introspect.VisibilityChecker;
-
-import static com.fasterxml.jackson.annotation.JsonAutoDetect.*;
-
-/** a visibility checker which disables getters, but allows private access,
- * unless {@link BidiSerialization#isStrictSerialization()} is enabled in 
which case public fields or annotations must be used.
- * <p>
- * the reason for this change to visibility
- * is that getters might generate a copy, resulting in infinite loops, whereas 
field access should never do so.
- * (see e.g. test in {@link BrooklynJacksonSerializerTest} which uses a 
sensor+config object whose getTypeToken
- * causes infinite recursion)
- **/
-public class PossiblyStrictPreferringFieldsVisibilityChecker implements 
VisibilityChecker<PossiblyStrictPreferringFieldsVisibilityChecker> {
-    VisibilityChecker<?>
-        vizDefault = new VisibilityChecker.Std(Visibility.NONE, 
Visibility.NONE, Visibility.NONE, Visibility.ANY, Visibility.ANY),
-        vizStrict = new VisibilityChecker.Std(Visibility.NONE, 
Visibility.NONE, Visibility.NONE, Visibility.PUBLIC_ONLY, 
Visibility.PUBLIC_ONLY);
-    
-    @Override public PossiblyStrictPreferringFieldsVisibilityChecker 
with(JsonAutoDetect ann) { throw new UnsupportedOperationException(); }
-    @Override public PossiblyStrictPreferringFieldsVisibilityChecker 
with(Visibility v) { throw new UnsupportedOperationException(); }
-    @Override public PossiblyStrictPreferringFieldsVisibilityChecker 
withVisibility(PropertyAccessor method, Visibility v) { throw new 
UnsupportedOperationException(); }
-    @Override public PossiblyStrictPreferringFieldsVisibilityChecker 
withGetterVisibility(Visibility v) { throw new UnsupportedOperationException(); 
}
-    @Override public PossiblyStrictPreferringFieldsVisibilityChecker 
withIsGetterVisibility(Visibility v) { throw new 
UnsupportedOperationException(); }
-    @Override public PossiblyStrictPreferringFieldsVisibilityChecker 
withSetterVisibility(Visibility v) { throw new UnsupportedOperationException(); 
}
-    @Override public PossiblyStrictPreferringFieldsVisibilityChecker 
withCreatorVisibility(Visibility v) { throw new 
UnsupportedOperationException(); }
-    @Override public PossiblyStrictPreferringFieldsVisibilityChecker 
withFieldVisibility(Visibility v) { throw new UnsupportedOperationException(); }
-    
-    protected VisibilityChecker<?> viz() {
-        return BidiSerialization.isStrictSerialization() ? vizStrict : 
vizDefault;
-    }
-    
-    @Override public boolean isGetterVisible(Method m) { 
-        return viz().isGetterVisible(m);
-    }
-
-    @Override
-    public boolean isGetterVisible(AnnotatedMethod m) {
-        return isGetterVisible(m.getAnnotated());
-    }
-
-    @Override
-    public boolean isIsGetterVisible(Method m) {
-        return viz().isIsGetterVisible(m);
-    }
-
-    @Override
-    public boolean isIsGetterVisible(AnnotatedMethod m) {
-        return isIsGetterVisible(m.getAnnotated());
-    }
-
-    @Override
-    public boolean isSetterVisible(Method m) {
-        return viz().isSetterVisible(m);
-    }
-
-    @Override
-    public boolean isSetterVisible(AnnotatedMethod m) {
-        return isSetterVisible(m.getAnnotated());
-    }
-
-    @Override
-    public boolean isCreatorVisible(Member m) {
-        return viz().isCreatorVisible(m);
-    }
-
-    @Override
-    public boolean isCreatorVisible(AnnotatedMember m) {
-        return isCreatorVisible(m.getMember());
-    }
-
-    @Override
-    public boolean isFieldVisible(Field f) {
-        return viz().isFieldVisible(f);
-    }
-
-    @Override
-    public boolean isFieldVisible(AnnotatedField f) {
-        return isFieldVisible(f.getAnnotated());
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-server/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/rest/rest-server/src/main/webapp/WEB-INF/web.xml 
b/rest/rest-server/src/main/webapp/WEB-INF/web.xml
index ae98ff6..7ae55a0 100644
--- a/rest/rest-server/src/main/webapp/WEB-INF/web.xml
+++ b/rest/rest-server/src/main/webapp/WEB-INF/web.xml
@@ -1,6 +1,3 @@
-<!DOCTYPE web-app PUBLIC
-        "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
-        "http://java.sun.com/dtd/web-app_2_3.dtd"; >
 <!--
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
@@ -19,7 +16,8 @@
     specific language governing permissions and limitations
     under the License.
 -->
-<web-app>
+<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee";
+         version="3.1">
     <display-name>Brooklyn REST API v1</display-name>
 
     <filter>
@@ -58,15 +56,6 @@
         <url-pattern>/*</url-pattern>
     </filter-mapping>
 
-    <filter>
-        <filter-name>Brooklyn Swagger Bootstrap</filter-name>
-        
<filter-class>org.apache.brooklyn.rest.filter.SwaggerFilter</filter-class>
-    </filter>
-    <filter-mapping>
-        <filter-name>Brooklyn Swagger Bootstrap</filter-name>
-        <url-pattern>/*</url-pattern>
-    </filter-mapping>
-
     <!-- Brooklyn REST is usually run as a filter so static content can be 
placed in a webapp
          to which this is added; to run as a servlet directly, replace the 
filter tags 
          below (after the comment) with the servlet tags (commented out 
immediately below),
@@ -75,63 +64,44 @@
             <servlet-name>Brooklyn REST API v1 Servlet</servlet-name>
             
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
      -->
-    <filter>
-        <filter-name>Brooklyn REST API v1 Filter</filter-name>
-        
<filter-class>com.sun.jersey.spi.container.servlet.ServletContainer</filter-class>
+    <servlet>
+        <servlet-name>Brooklyn REST API v1 Filter</servlet-name>
+        
<servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
 
-        <!-- load our REST API jersey resources explicitly 
-            (the package scanner will only pick up classes with @Path 
annotations - doesn't look at implemented interfaces) 
-        -->
         <init-param>
-            
<param-name>com.sun.jersey.config.property.resourceConfigClass</param-name>
-            
<param-value>com.sun.jersey.api.core.ClassNamesResourceConfig</param-value>
-        </init-param>
-        <init-param>
-            <param-name>com.sun.jersey.config.property.classnames</param-name>
+            <param-name>jaxrs.serviceClasses</param-name>
             <param-value>
-                io.swagger.jaxrs.listing.SwaggerSerializers;
-                org.apache.brooklyn.rest.util.FormMapProvider;
-                com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
-                org.apache.brooklyn.rest.resources.ActivityResource;
-                org.apache.brooklyn.rest.resources.ApidocResource;
-                org.apache.brooklyn.rest.resources.ApplicationResource;
-                org.apache.brooklyn.rest.resources.CatalogResource;
-                org.apache.brooklyn.rest.resources.EffectorResource;
-                org.apache.brooklyn.rest.resources.EntityConfigResource;
-                org.apache.brooklyn.rest.resources.EntityResource;
-                org.apache.brooklyn.rest.resources.LocationResource;
-                org.apache.brooklyn.rest.resources.PolicyConfigResource;
-                org.apache.brooklyn.rest.resources.PolicyResource;
-                org.apache.brooklyn.rest.resources.ScriptResource;
-                org.apache.brooklyn.rest.resources.SensorResource;
-                org.apache.brooklyn.rest.resources.UsageResource;
-                org.apache.brooklyn.rest.resources.VersionResource;
+                org.apache.brooklyn.rest.resources.AccessResource,
+                org.apache.brooklyn.rest.resources.ActivityResource,
+                org.apache.brooklyn.rest.resources.ApidocResource,
+                org.apache.brooklyn.rest.resources.ApplicationResource,
+                org.apache.brooklyn.rest.resources.CatalogResource,
+                org.apache.brooklyn.rest.resources.EffectorResource,
+                org.apache.brooklyn.rest.resources.EntityConfigResource,
+                org.apache.brooklyn.rest.resources.EntityResource,
+                org.apache.brooklyn.rest.resources.LocationResource,
+                org.apache.brooklyn.rest.resources.PolicyConfigResource,
+                org.apache.brooklyn.rest.resources.PolicyResource,
+                org.apache.brooklyn.rest.resources.ScriptResource,
+                org.apache.brooklyn.rest.resources.SensorResource,
+                org.apache.brooklyn.rest.resources.ServerResource,
+                org.apache.brooklyn.rest.resources.UsageResource,
+                org.apache.brooklyn.rest.resources.VersionResource
             </param-value>
         </init-param>
 
         <init-param>
-            <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
-            <param-value>true</param-value>
-        </init-param>
-
-        <!-- no need for WADL. of course you can turn it back on it you want. 
-->
-        <init-param>
-            <param-name>com.sun.jersey.config.feature.DisableWADL</param-name>
-            <param-value>true</param-value>
+            <param-name>jaxrs.providers</param-name>
+            <param-value>
+                io.swagger.jaxrs.listing.SwaggerSerializers,
+                org.apache.brooklyn.rest.util.FormMapProvider,
+                com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider
+            </param-value>
         </init-param>
 
-    </filter>
-    <filter-mapping>
-        <filter-name>Brooklyn REST API v1 Filter</filter-name>
-        <url-pattern>/*</url-pattern>
-    </filter-mapping>
-    <!-- Brooklyn REST as a filter above; replace above 5 lines with those 
commented out below,
-         to run it as a servlet (see note above) 
-            <load-on-startup>1</load-on-startup>
-        </servlet>
-        <servlet-mapping>
-            <servlet-name>Brooklyn REST API v1 Servlet</servlet-name>
-            <url-pattern>/*</url-pattern>
-        </servlet-mapping>
-    -->
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>Brooklyn REST API v1 Filter</servlet-name>
+        <url-pattern>/v1/*</url-pattern>
+    </servlet-mapping>
 </web-app>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/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 e855841..6fe610b 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
@@ -109,7 +109,7 @@ public class BrooklynPropertiesSecurityFilterTest extends 
BrooklynRestApiLaunche
                     .build();
             List<? extends NameValuePair> nvps = Lists.newArrayList(
                     new BasicNameValuePair("arg", "bar"));
-            String effector = 
String.format("/v1/applications/%s/entities/%s/effectors/identityEffector", 
appId, entityId);
+            String effector = 
String.format("/applications/%s/entities/%s/effectors/identityEffector", appId, 
entityId);
             HttpToolResponse response = HttpTool.httpPost(client, 
URI.create(getBaseUri() + effector),
                     ImmutableMap.of(HttpHeaders.CONTENT_TYPE, 
ContentType.APPLICATION_FORM_URLENCODED.getMimeType()),
                     URLEncodedUtils.format(nvps, Charsets.UTF_8).getBytes());
@@ -129,7 +129,7 @@ public class BrooklynPropertiesSecurityFilterTest extends 
BrooklynRestApiLaunche
         HttpClient client = HttpTool.httpClientBuilder()
                 .uri(getBaseUri(server))
                 .build();
-        HttpToolResponse response = HttpTool.httpPost(client, 
URI.create(getBaseUri() + "/v1/applications"),
+        HttpToolResponse response = HttpTool.httpPost(client, 
URI.create(getBaseUri() + "/applications"),
                 ImmutableMap.of(HttpHeaders.CONTENT_TYPE, 
"application/x-yaml"),
                 blueprint.getBytes());
         assertTrue(HttpTool.isStatusCodeHealthy(response.getResponseCode()), 
"error creating app. response code=" + response.getResponseCode());
@@ -144,7 +144,7 @@ public class BrooklynPropertiesSecurityFilterTest extends 
BrooklynRestApiLaunche
                 .uri(getBaseUri(server))
                 .build();
         List entities = new ObjectMapper().readValue(
-                HttpTool.httpGet(client, URI.create(getBaseUri() + 
"/v1/applications/" + appId + "/entities"), MutableMap.<String, 
String>of()).getContent(), List.class);
+                HttpTool.httpGet(client, URI.create(getBaseUri() + 
"/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/6f624c78/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncher.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncher.java
 
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncher.java
index becb882..0fe421e 100644
--- 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncher.java
+++ 
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncher.java
@@ -24,10 +24,8 @@ import java.io.File;
 import java.io.FilenameFilter;
 import java.io.IOException;
 import java.net.InetSocketAddress;
-import java.util.EnumSet;
 import java.util.List;
 
-import javax.servlet.DispatcherType;
 import javax.servlet.Filter;
 
 import org.apache.brooklyn.api.mgmt.ManagementContext;
@@ -38,12 +36,11 @@ import 
org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
 import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
 import org.apache.brooklyn.core.server.BrooklynServerConfig;
 import org.apache.brooklyn.core.server.BrooklynServiceAttributes;
+import org.apache.brooklyn.rest.apidoc.RestApiResourceScanner;
 import org.apache.brooklyn.rest.filter.BrooklynPropertiesSecurityFilter;
 import org.apache.brooklyn.rest.filter.HaMasterCheckFilter;
 import org.apache.brooklyn.rest.filter.LoggingFilter;
-import org.apache.brooklyn.rest.filter.NoCacheFilter;
 import org.apache.brooklyn.rest.filter.RequestTaggingFilter;
-import org.apache.brooklyn.rest.filter.SwaggerFilter;
 import org.apache.brooklyn.rest.security.provider.AnyoneSecurityProvider;
 import org.apache.brooklyn.rest.security.provider.SecurityProvider;
 import org.apache.brooklyn.rest.util.ManagementContextProvider;
@@ -59,9 +56,7 @@ import org.apache.brooklyn.util.text.WildcardGlobs;
 import org.eclipse.jetty.server.NetworkConnector;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.handler.ContextHandler;
-import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
 import org.eclipse.jetty.webapp.WebAppContext;
 import org.reflections.util.ClasspathHelper;
 import org.slf4j.Logger;
@@ -72,9 +67,8 @@ import com.google.common.base.Charsets;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 import com.google.common.io.Files;
-import com.sun.jersey.api.core.DefaultResourceConfig;
-import com.sun.jersey.api.core.ResourceConfig;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
+
+import io.swagger.config.ScannerFactory;
 
 /** Convenience and demo for launching programmatically. Also used for 
automated tests.
  * <p>
@@ -96,20 +90,19 @@ public class BrooklynRestApiLauncher {
     public static final String SCANNING_CATALOG_BOM_URL = 
"classpath://brooklyn/scanning.catalog.bom";
 
     enum StartMode {
-        FILTER, SERVLET, /** web-xml is not fully supported */ @Beta WEB_XML
+        SERVLET, /** web-xml is not fully supported */ @Beta WEB_XML
     }
 
     public static final List<Class<? extends Filter>> DEFAULT_FILTERS = 
ImmutableList.of(
             RequestTaggingFilter.class,
             BrooklynPropertiesSecurityFilter.class,
             LoggingFilter.class,
-            HaMasterCheckFilter.class,
-            SwaggerFilter.class);
+            HaMasterCheckFilter.class);
 
     private boolean forceUseOfDefaultCatalogWithJavaClassPath = false;
     private Class<? extends SecurityProvider> securityProvider;
     private List<Class<? extends Filter>> filters = DEFAULT_FILTERS;
-    private StartMode mode = StartMode.FILTER;
+    private StartMode mode = StartMode.SERVLET;
     private ManagementContext mgmt;
     private ContextHandler customContext;
     private boolean deployJsgui = true;
@@ -182,18 +175,14 @@ public class BrooklynRestApiLauncher {
         String summary;
         if (customContext == null) {
             switch (mode) {
-            case SERVLET:
-                context = servletContextHandler(mgmt);
-                summary = "programmatic Jersey ServletContainer servlet";
-                break;
             case WEB_XML:
                 context = webXmlContextHandler(mgmt);
                 summary = "from WAR at " + ((WebAppContext) context).getWar();
                 break;
-            case FILTER:
+            case SERVLET:
             default:
-                context = filterContextHandler(mgmt);
-                summary = "programmatic Jersey ServletContainer filter on 
webapp at " + ((WebAppContext) context).getWar();
+                context = servletContextHandler(mgmt);
+                summary = "programmatic Jersey ServletContainer servlet";
                 break;
             }
         } else {
@@ -225,10 +214,22 @@ public class BrooklynRestApiLauncher {
         return server;
     }
 
-    private ContextHandler filterContextHandler(ManagementContext mgmt) {
+    private ContextHandler servletContextHandler(ManagementContext 
managementContext) {
         WebAppContext context = new WebAppContext();
-        
context.setAttribute(BrooklynServiceAttributes.BROOKLYN_MANAGEMENT_CONTEXT, 
mgmt);
+
+        
context.setAttribute(BrooklynServiceAttributes.BROOKLYN_MANAGEMENT_CONTEXT, 
managementContext);
+
+        installWar(context);
+        RestApiSetup.installRestServlet(context,
+                new ManagementContextProvider(managementContext),
+                new ShutdownHandlerProvider(shutdownListener));
+        RestApiSetup.installServletFilters(context, this.filters);
+
         context.setContextPath("/");
+        return context;
+    }
+
+    private void installWar(WebAppContext context) {
         // here we run with the JS GUI, for convenience, if we can find it, 
else set up an empty dir
         // TODO pretty sure there is an option to monitor this dir and load 
changes to static content
         // NOTE: When running Brooklyn from an IDE (i.e. by launching 
BrooklynJavascriptGuiLauncher.main())
@@ -243,8 +244,6 @@ public class BrooklynRestApiLauncher {
                 : 
ResourceUtils.create(this).doesUrlExist("classpath://brooklyn.war") 
                     ? 
Os.writeToTempFile(ResourceUtils.create(this).getResourceFromUrl("classpath://brooklyn.war"),
 "brooklyn", "war").getAbsolutePath()
                 : createTempWebDirWithIndexHtml("Brooklyn REST API <p> (gui 
not available)"));
-        installAsServletFilter(context, this.filters);
-        return context;
     }
 
     private ContextHandler servletContextHandler(ManagementContext 
managementContext) {
@@ -265,6 +264,7 @@ public class BrooklynRestApiLauncher {
 
     /** NB: not fully supported; use one of the other {@link StartMode}s */
     private ContextHandler webXmlContextHandler(ManagementContext mgmt) {
+        RestApiSetup.initSwagger();
         // TODO add security to web.xml
         WebAppContext context;
         if (findMatchingFile("src/main/webapp")!=null) {
@@ -328,16 +328,10 @@ public class BrooklynRestApiLauncher {
     }
 
     public static void main(String[] args) throws Exception {
-        startRestResourcesViaFilter();
+        startRestResourcesViaServlet();
         log.info("Press Ctrl-C to quit.");
     }
 
-    public static Server startRestResourcesViaFilter() {
-        return new BrooklynRestApiLauncher()
-                .mode(StartMode.FILTER)
-                .start();
-    }
-
     public static Server startRestResourcesViaServlet() throws Exception {
         return new BrooklynRestApiLauncher()
                 .mode(StartMode.SERVLET)

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/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 1bf756d..e73fab4 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
@@ -18,7 +18,6 @@
  */
 package org.apache.brooklyn.rest;
 
-import static 
org.apache.brooklyn.rest.BrooklynRestApiLauncher.StartMode.FILTER;
 import static 
org.apache.brooklyn.rest.BrooklynRestApiLauncher.StartMode.SERVLET;
 import static 
org.apache.brooklyn.rest.BrooklynRestApiLauncher.StartMode.WEB_XML;
 
@@ -37,11 +36,6 @@ import org.testng.annotations.Test;
 public class BrooklynRestApiLauncherTest extends 
BrooklynRestApiLauncherTestFixture {
 
     @Test
-    public void testFilterStart() throws Exception {
-        
checkRestCatalogEntities(useServerForTest(baseLauncher().mode(FILTER).start()));
-    }
-
-    @Test
     public void testServletStart() throws Exception {
         
checkRestCatalogEntities(useServerForTest(baseLauncher().mode(SERVLET).start()));
     }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/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 b2c5031..4ca48df 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
@@ -18,20 +18,21 @@
  */
 package org.apache.brooklyn.rest;
 
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.handler.ContextHandler;
-import org.reflections.util.ClasspathHelper;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
 import org.apache.brooklyn.api.mgmt.ManagementContext;
 import org.apache.brooklyn.core.entity.Entities;
 import org.apache.brooklyn.core.internal.BrooklynProperties;
 import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
 import org.apache.brooklyn.core.server.BrooklynServerConfig;
+import org.apache.brooklyn.core.server.BrooklynServiceAttributes;
 import org.apache.brooklyn.rest.security.provider.AnyoneSecurityProvider;
-import org.apache.brooklyn.rest.util.OsgiCompat;
+import org.apache.brooklyn.util.core.osgi.Compat;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.eclipse.jetty.server.NetworkConnector;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.ContextHandler;
+import org.reflections.util.ClasspathHelper;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
 
 public abstract class BrooklynRestApiLauncherTestFixture {
 
@@ -104,7 +105,14 @@ public abstract class BrooklynRestApiLauncherTestFixture {
     }
 
     public static ManagementContext 
getManagementContextFromJettyServerAttributes(Server server) {
-        return OsgiCompat.getManagementContext((ContextHandler) 
server.getHandler());
+        return getManagementContext((ContextHandler) server.getHandler());
     }
     
+    public static ManagementContext getManagementContext(ContextHandler 
jettyServerHandler) {
+        ManagementContext managementContext = 
Compat.getInstance().getManagementContext();
+        if (managementContext == null && jettyServerHandler != null) {
+            managementContext = (ManagementContext) 
jettyServerHandler.getAttribute(BrooklynServiceAttributes.BROOKLYN_MANAGEMENT_CONTEXT);
+        }
+        return managementContext;
+    }
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-server/src/test/java/org/apache/brooklyn/rest/HaHotCheckTest.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/HaHotCheckTest.java 
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/HaHotCheckTest.java
deleted file mode 100644
index 3fd5d38..0000000
--- 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/HaHotCheckTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.rest;
-
-import static org.testng.Assert.assertEquals;
-
-import javax.ws.rs.core.MediaType;
-
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityManager;
-import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode;
-import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.rest.filter.HaHotCheckResourceFilter;
-import org.apache.brooklyn.rest.filter.HaMasterCheckFilter;
-import org.apache.brooklyn.rest.testing.BrooklynRestResourceTest;
-import org.apache.brooklyn.rest.util.HaHotStateCheckClassResource;
-import org.apache.brooklyn.rest.util.HaHotStateCheckResource;
-
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.WebResource.Builder;
-import com.sun.jersey.api.core.ResourceConfig;
-
-public class HaHotCheckTest extends BrooklynRestResourceTest {
-
-    // setup and teardown before/after each method
-    
-    @BeforeMethod(alwaysRun = true)
-    public void setUp() throws Exception { super.setUp(); }
-
-    @AfterMethod(alwaysRun = true)
-    public void tearDown() throws Exception { super.tearDown(); }
-    
-    @Override
-    protected void addBrooklynResources() {
-        
config.getProperties().put(ResourceConfig.PROPERTY_RESOURCE_FILTER_FACTORIES, 
-            new HaHotCheckResourceFilter(getManagementContext()));
-        addResource(new HaHotStateCheckResource());
-        addResource(new HaHotStateCheckClassResource());
-        
-        ((LocalManagementContext)getManagementContext()).noteStartupComplete();
-    }
-
-    @Test
-    public void testHaCheck() {
-        HighAvailabilityManager ha = 
getManagementContext().getHighAvailabilityManager();
-        assertEquals(ha.getNodeState(), ManagementNodeState.MASTER);
-        testResourceFetch("/ha/method/ok", 200);
-        testResourceFetch("/ha/method/fail", 200);
-        testResourceFetch("/ha/class/fail", 200);
-
-        
getManagementContext().getHighAvailabilityManager().changeMode(HighAvailabilityMode.STANDBY);
-        assertEquals(ha.getNodeState(), ManagementNodeState.STANDBY);
-
-        testResourceFetch("/ha/method/ok", 200);
-        testResourceFetch("/ha/method/fail", 403);
-        testResourceFetch("/ha/class/fail", 403);
-
-        ((ManagementContextInternal)getManagementContext()).terminate();
-        assertEquals(ha.getNodeState(), ManagementNodeState.TERMINATED);
-
-        testResourceFetch("/ha/method/ok", 200);
-        testResourceFetch("/ha/method/fail", 403);
-        testResourceFetch("/ha/class/fail", 403);
-    }
-
-    @Test
-    public void testHaCheckForce() {
-        HighAvailabilityManager ha = 
getManagementContext().getHighAvailabilityManager();
-        assertEquals(ha.getNodeState(), ManagementNodeState.MASTER);
-        testResourceForcedFetch("/ha/method/ok", 200);
-        testResourceForcedFetch("/ha/method/fail", 200);
-        testResourceForcedFetch("/ha/class/fail", 200);
-
-        
getManagementContext().getHighAvailabilityManager().changeMode(HighAvailabilityMode.STANDBY);
-        assertEquals(ha.getNodeState(), ManagementNodeState.STANDBY);
-
-        testResourceForcedFetch("/ha/method/ok", 200);
-        testResourceForcedFetch("/ha/method/fail", 200);
-        testResourceForcedFetch("/ha/class/fail", 200);
-
-        ((ManagementContextInternal)getManagementContext()).terminate();
-        assertEquals(ha.getNodeState(), ManagementNodeState.TERMINATED);
-
-        testResourceForcedFetch("/ha/method/ok", 200);
-        testResourceForcedFetch("/ha/method/fail", 200);
-        testResourceForcedFetch("/ha/class/fail", 200);
-    }
-
-
-    private void testResourceFetch(String resourcePath, int code) {
-        testResourceFetch(resourcePath, false, code);
-    }
-
-    private void testResourceForcedFetch(String resourcePath, int code) {
-        testResourceFetch(resourcePath, true, code);
-    }
-
-    private void testResourceFetch(String resourcePath, boolean force, int 
code) {
-        Builder resource = client().resource(resourcePath)
-                .accept(MediaType.APPLICATION_JSON_TYPE);
-        if (force) {
-            resource.header(HaMasterCheckFilter.SKIP_CHECK_HEADER, "true");
-        }
-        ClientResponse response = resource
-                .get(ClientResponse.class);
-        assertEquals(response.getStatus(), code);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/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 424c0c1..90e7957 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
@@ -114,7 +114,7 @@ System.err.println("TEAR DOWN");
 
     private int getAppResponseCode() {
         HttpToolResponse response = HttpTool.httpGet(
-                client, URI.create(getBaseUri(server) + "/v1/applications/" + 
appId),
+                client, URI.create(getBaseUri(server) + "/applications/" + 
appId),
                 ImmutableMap.<String,String>of());
         return response.getResponseCode();
     }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-server/src/test/java/org/apache/brooklyn/rest/domain/ApplicationTest.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/domain/ApplicationTest.java
 
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/domain/ApplicationTest.java
deleted file mode 100644
index 8708fb1..0000000
--- 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/domain/ApplicationTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.rest.domain;
-
-import static org.apache.brooklyn.rest.util.RestApiTestUtils.asJson;
-import static org.apache.brooklyn.rest.util.RestApiTestUtils.fromJson;
-import static org.apache.brooklyn.rest.util.RestApiTestUtils.jsonFixture;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.core.test.entity.TestApplication;
-import org.apache.brooklyn.test.Asserts;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-public class ApplicationTest {
-
-    final EntitySpec entitySpec = new EntitySpec("Vanilla Java App", 
"org.apache.brooklyn.entity.java.VanillaJavaApp",
-            ImmutableMap.of(
-                    "initialSize", "1",
-                    "creationScriptUrl", 
"http://my.brooklyn.io/storage/foo.sql";));
-
-    final ApplicationSpec applicationSpec = 
ApplicationSpec.builder().name("myapp")
-            .entities(ImmutableSet.of(entitySpec))
-            .locations(ImmutableSet.of("/v1/locations/1"))
-            .build();
-
-    final Map<String, URI> links = ImmutableMap.of(
-            "self", URI.create("/v1/applications/" + 
applicationSpec.getName()),
-            "entities", URI.create("fixtures/entity-summary-list.json"));
-    final ApplicationSummary application = new ApplicationSummary("myapp_id", 
applicationSpec, Status.STARTING, links);
-
-    @SuppressWarnings("serial")
-    @Test
-    public void testSerializeToJSON() throws IOException {
-        assertEquals(asJson(application), 
jsonFixture("fixtures/application.json"));
-    }
-
-    @Test
-    public void testDeserializeFromJSON() throws IOException {
-        assertEquals(fromJson(jsonFixture("fixtures/application.json"),
-                ApplicationSummary.class), application);
-    }
-
-    @Test
-    public void testTransitionToRunning() {
-        ApplicationSummary running = application.transitionTo(Status.RUNNING);
-        assertEquals(running.getStatus(), Status.RUNNING);
-    }
-
-    @Test
-    public void testAppInAppTest() throws IOException {
-        ManagementContext mgmt = LocalManagementContextForTests.newInstance();
-        try {
-            TestApplication app = 
mgmt.getEntityManager().createEntity(org.apache.brooklyn.api.entity.EntitySpec.create(TestApplication.class));
-            
app.addChild(org.apache.brooklyn.api.entity.EntitySpec.create(TestApplication.class));
-            Asserts.assertEqualsIgnoringOrder(mgmt.getApplications(), 
ImmutableList.of(app));
-        } finally {
-            Entities.destroyAll(mgmt);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-server/src/test/java/org/apache/brooklyn/rest/domain/SensorSummaryTest.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/domain/SensorSummaryTest.java
 
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/domain/SensorSummaryTest.java
deleted file mode 100644
index a3c6df2..0000000
--- 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/domain/SensorSummaryTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.rest.domain;
-
-import static org.apache.brooklyn.rest.util.RestApiTestUtils.asJson;
-import static org.apache.brooklyn.rest.util.RestApiTestUtils.fromJson;
-import static org.apache.brooklyn.rest.util.RestApiTestUtils.jsonFixture;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.core.config.render.RendererHints;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.core.test.entity.TestApplication;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.rest.transform.SensorTransformer;
-
-import com.google.common.collect.ImmutableMap;
-
-public class SensorSummaryTest {
-
-    private SensorSummary sensorSummary = new SensorSummary("redis.uptime", 
"Integer",
-            "Description", ImmutableMap.of(
-            "self", 
URI.create("/v1/applications/redis-app/entities/redis-ent/sensors/redis.uptime")));
-
-    private TestApplication app;
-    private TestEntity entity;
-    private ManagementContext mgmt;
-
-    @BeforeMethod(alwaysRun = true)
-    public void setUp() throws Exception {
-        app = TestApplication.Factory.newManagedInstanceForTests();
-        mgmt = app.getManagementContext();
-        entity = app.createAndManageChild(EntitySpec.create(TestEntity.class));
-    }
-
-    @AfterMethod(alwaysRun = true)
-    public void tearDown() throws Exception {
-        if (mgmt != null) Entities.destroyAll(mgmt);
-    }
-
-    @Test
-    public void testSerializeToJSON() throws IOException {
-        assertEquals(asJson(sensorSummary), 
jsonFixture("fixtures/sensor-summary.json"));
-    }
-
-    @Test
-    public void testDeserializeFromJSON() throws IOException {
-        assertEquals(fromJson(jsonFixture("fixtures/sensor-summary.json"), 
SensorSummary.class), sensorSummary);
-    }
-
-    @Test
-    public void testEscapesUriForSensorName() throws IOException {
-        Sensor<String> sensor = Sensors.newStringSensor("name with space");
-        SensorSummary summary = SensorTransformer.sensorSummary(entity, 
sensor);
-        URI selfUri = summary.getLinks().get("self");
-
-        String expectedUri = "/v1/applications/" + entity.getApplicationId() + 
"/entities/" + entity.getId() + "/sensors/" + "name%20with%20space";
-
-        assertEquals(selfUri, URI.create(expectedUri));
-    }
-
-    // Previously failed because immutable-map builder threw exception if put 
same key multiple times,
-    // and the NamedActionWithUrl did not have equals/hashCode
-    @Test
-    public void testSensorWithMultipleOpenUrlActionsRegistered() throws 
IOException {
-        AttributeSensor<String> sensor = Sensors.newStringSensor("sensor1");
-        entity.sensors().set(sensor, "http://myval";);
-        RendererHints.register(sensor, RendererHints.namedActionWithUrl());
-        RendererHints.register(sensor, RendererHints.namedActionWithUrl());
-
-        SensorSummary summary = SensorTransformer.sensorSummary(entity, 
sensor);
-
-        assertEquals(summary.getLinks().get("action:open"), 
URI.create("http://myval";));
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/AccessResourceTest.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/AccessResourceTest.java
 
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/AccessResourceTest.java
deleted file mode 100644
index 0839ea5..0000000
--- 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/AccessResourceTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.rest.resources;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import javax.ws.rs.core.Response;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.Test;
-
-import org.apache.brooklyn.rest.domain.AccessSummary;
-import org.apache.brooklyn.rest.testing.BrooklynRestResourceTest;
-
-import com.sun.jersey.api.client.ClientResponse;
-
-@Test(singleThreaded = true)
-public class AccessResourceTest extends BrooklynRestResourceTest {
-
-    @SuppressWarnings("unused")
-    private static final Logger log = 
LoggerFactory.getLogger(AccessResourceTest.class);
-
-    @Test
-    public void testGetAndSetAccessControl() throws Exception {
-        // Default is everything allowed
-        AccessSummary summary = 
client().resource("/v1/access").get(AccessSummary.class);
-        assertTrue(summary.isLocationProvisioningAllowed());
-
-        // Forbid location provisioning
-        ClientResponse response = client().resource(
-                "/v1/access/locationProvisioningAllowed")
-                .queryParam("allowed", "false")
-                .post(ClientResponse.class);
-        assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
-
-        AccessSummary summary2 = 
client().resource("/v1/access").get(AccessSummary.class);
-        assertFalse(summary2.isLocationProvisioningAllowed());
-        
-        // Allow location provisioning
-        ClientResponse response2 = client().resource(
-                "/v1/access/locationProvisioningAllowed")
-                .queryParam("allowed", "true")
-                .post(ClientResponse.class);
-        assertEquals(response2.getStatus(), 
Response.Status.OK.getStatusCode());
-
-        AccessSummary summary3 = 
client().resource("/v1/access").get(AccessSummary.class);
-        assertTrue(summary3.isLocationProvisioningAllowed());
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/ApidocResourceTest.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/ApidocResourceTest.java
 
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/ApidocResourceTest.java
deleted file mode 100644
index 739d63f..0000000
--- 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/ApidocResourceTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.rest.resources;
-
-
-import com.google.common.base.Function;
-import com.google.common.base.Joiner;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-import com.sun.jersey.api.core.ClassNamesResourceConfig;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import org.apache.brooklyn.rest.BrooklynRestApi;
-import org.apache.brooklyn.rest.testing.BrooklynRestResourceTest;
-
-import com.sun.jersey.test.framework.AppDescriptor;
-import com.sun.jersey.test.framework.JerseyTest;
-import com.sun.jersey.test.framework.WebAppDescriptor;
-import com.sun.jersey.test.framework.spi.container.TestContainerException;
-import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
-import 
com.sun.jersey.test.framework.spi.container.grizzly2.web.GrizzlyWebTestContainerFactory;
-import io.swagger.annotations.Api;
-import io.swagger.models.Info;
-import io.swagger.models.Operation;
-import io.swagger.models.Path;
-import io.swagger.models.Swagger;
-import java.util.Collection;
-import org.apache.brooklyn.rest.api.CatalogApi;
-import org.apache.brooklyn.rest.api.EffectorApi;
-import org.apache.brooklyn.rest.api.EntityApi;
-import org.apache.brooklyn.rest.filter.SwaggerFilter;
-import org.apache.brooklyn.rest.util.ShutdownHandlerProvider;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-
-/**
- * @author Adam Lowe
- */
-@Test(singleThreaded = true)
-public class ApidocResourceTest extends BrooklynRestResourceTest {
-
-    private static final Logger log = 
LoggerFactory.getLogger(ApidocResourceTest.class);
-
-    @Override
-    protected JerseyTest createJerseyTest() {
-        return new JerseyTest() {
-            @Override
-            protected AppDescriptor configure() {
-                return new WebAppDescriptor.Builder(
-                        ImmutableMap.of(
-                                ServletContainer.RESOURCE_CONFIG_CLASS, 
ClassNamesResourceConfig.class.getName(),
-                                ClassNamesResourceConfig.PROPERTY_CLASSNAMES, 
getResourceClassnames()))
-                        .addFilter(SwaggerFilter.class, 
"SwaggerFilter").build();
-            }
-
-            @Override
-            protected TestContainerFactory getTestContainerFactory() throws 
TestContainerException {
-                return new GrizzlyWebTestContainerFactory();
-            }
-
-            private String getResourceClassnames() {
-                Iterable<String> classnames = 
Collections2.transform(config.getClasses(), new Function<Class, String>() {
-                    @Override
-                    public String apply(Class clazz) {
-                        return clazz.getName();
-                    }
-                });
-                classnames = Iterables.concat(classnames, 
Collections2.transform(config.getSingletons(), new Function<Object, String>() {
-                    @Override
-                    public String apply(Object singleton) {
-                        return singleton.getClass().getName();
-                    }
-                }));
-                return Joiner.on(';').join(classnames);
-            }
-        };
-    }
-
-    @Override
-    protected void addBrooklynResources() {
-        for (Object o : BrooklynRestApi.getApidocResources()) {
-            addResource(o);
-        }
-        super.addBrooklynResources();
-    }
-    
-    @Test(enabled = false)
-    public void testRootSerializesSensibly() throws Exception {
-        String data = resource("/v1/apidoc/swagger.json").get(String.class);
-        log.info("apidoc gives: "+data);
-        // make sure no scala gets in
-        assertFalse(data.contains("$"));
-        assertFalse(data.contains("scala"));
-        // make sure it's an appropriate swagger 2.0 json
-        Swagger swagger = 
resource("/v1/apidoc/swagger.json").get(Swagger.class);
-        assertEquals(swagger.getSwagger(), "2.0");
-    }
-    
-    @Test(enabled = false)
-    public void testCountRestResources() throws Exception {
-        Swagger swagger = 
resource("/v1/apidoc/swagger.json").get(Swagger.class);
-        assertEquals(swagger.getTags().size(), 1 + 
Iterables.size(BrooklynRestApi.getBrooklynRestResources()));
-    }
-
-    @Test(enabled = false)
-    public void testApiDocDetails() throws Exception {
-        Swagger swagger = 
resource("/v1/apidoc/swagger.json").get(Swagger.class);
-        Collection<Operation> operations = getTaggedOperations(swagger, 
ApidocResource.class.getAnnotation(Api.class).value());
-        assertEquals(operations.size(), 2, "ops="+operations);
-    }
-
-    @Test(enabled = false)
-    public void testEffectorDetails() throws Exception {
-        Swagger swagger = 
resource("/v1/apidoc/swagger.json").get(Swagger.class);
-        Collection<Operation> operations = getTaggedOperations(swagger, 
EffectorApi.class.getAnnotation(Api.class).value());
-        assertEquals(operations.size(), 2, "ops="+operations);
-    }
-
-    @Test(enabled = false)
-    public void testEntityDetails() throws Exception {
-        Swagger swagger = 
resource("/v1/apidoc/swagger.json").get(Swagger.class);
-        Collection<Operation> operations = getTaggedOperations(swagger, 
EntityApi.class.getAnnotation(Api.class).value());
-        assertEquals(operations.size(), 14, "ops="+operations);
-    }
-
-    @Test(enabled = false)
-    public void testCatalogDetails() throws Exception {
-        Swagger swagger = 
resource("/v1/apidoc/swagger.json").get(Swagger.class);
-        Collection<Operation> operations = getTaggedOperations(swagger, 
CatalogApi.class.getAnnotation(Api.class).value());
-        assertEquals(operations.size(), 22, "ops="+operations);
-    }
-
-    /**
-     * Retrieves all operations tagged the given tag from the given swagger 
spec.
-     */
-    private Collection<Operation> getTaggedOperations(Swagger swagger, final 
String requiredTag) {
-        Iterable<Operation> allOperations = 
Iterables.concat(Collections2.transform(swagger.getPaths().values(),
-                new Function<Path, Collection<Operation>>() {
-                    @Override
-                    public Collection<Operation> apply(Path path) {
-                        return path.getOperations();
-                    }
-                }));
-
-        return Collections2.filter(ImmutableList.copyOf(allOperations), new 
Predicate<Operation>() {
-            @Override
-            public boolean apply(Operation operation) {
-                return operation.getTags().contains(requiredTag);
-            }
-        });
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java
 
b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java
deleted file mode 100644
index 865b6f7..0000000
--- 
a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.rest.resources;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-import java.util.Set;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-import org.apache.brooklyn.rest.domain.ApplicationSpec;
-import org.apache.brooklyn.rest.domain.ApplicationSummary;
-import org.apache.brooklyn.rest.domain.EntitySpec;
-import org.apache.brooklyn.rest.domain.EntitySummary;
-import org.apache.brooklyn.rest.domain.SensorSummary;
-import org.apache.brooklyn.rest.testing.BrooklynRestResourceTest;
-import org.apache.brooklyn.test.Asserts;
-import org.apache.brooklyn.util.collections.MutableMap;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.GenericType;
-
-@Test(singleThreaded = true)
-public class ApplicationResourceIntegrationTest extends 
BrooklynRestResourceTest {
-
-    @SuppressWarnings("unused")
-    private static final Logger log = 
LoggerFactory.getLogger(ApplicationResourceIntegrationTest.class);
-
-    private final ApplicationSpec redisSpec = 
ApplicationSpec.builder().name("redis-app")
-            .entities(ImmutableSet.of(new EntitySpec("redis-ent", 
"org.apache.brooklyn.entity.nosql.redis.RedisStore")))
-            .locations(ImmutableSet.of("localhost"))
-            .build();
-
-    @Test(groups="Integration")
-    public void testDeployRedisApplication() throws Exception {
-        ClientResponse response = clientDeploy(redisSpec);
-
-        assertEquals(response.getStatus(), 201);
-        assertEquals(getManagementContext().getApplications().size(), 1);
-        
assertTrue(response.getLocation().getPath().startsWith("/v1/applications/"), 
"path="+response.getLocation().getPath()); // path uses id, rather than app name
-
-        waitForApplicationToBeRunning(response.getLocation());
-    }
-
-    @Test(groups="Integration", dependsOnMethods = 
"testDeployRedisApplication")
-    public void testListEntities() {
-        Set<EntitySummary> entities = 
client().resource("/v1/applications/redis-app/entities")
-                .get(new GenericType<Set<EntitySummary>>() {});
-
-        for (EntitySummary entity : entities) {
-            
client().resource(entity.getLinks().get("self")).get(ClientResponse.class);
-            // TODO assertions on the above call?
-
-            Set<EntitySummary> children = 
client().resource(entity.getLinks().get("children"))
-                    .get(new GenericType<Set<EntitySummary>>() {});
-            assertEquals(children.size(), 0);
-        }
-    }
-
-    @Test(groups="Integration", dependsOnMethods = 
"testDeployRedisApplication")
-    public void testListSensorsRedis() {
-        Set<SensorSummary> sensors = 
client().resource("/v1/applications/redis-app/entities/redis-ent/sensors")
-                .get(new GenericType<Set<SensorSummary>>() {});
-        assertTrue(sensors.size() > 0);
-        SensorSummary uptime = Iterables.find(sensors, new 
Predicate<SensorSummary>() {
-            @Override
-            public boolean apply(SensorSummary sensorSummary) {
-                return sensorSummary.getName().equals("redis.uptime");
-            }
-        });
-        assertEquals(uptime.getType(), "java.lang.Integer");
-    }
-
-    @Test(groups="Integration", dependsOnMethods = { "testListSensorsRedis", 
"testListEntities" })
-    public void testTriggerRedisStopEffector() throws Exception {
-        ClientResponse response = 
client().resource("/v1/applications/redis-app/entities/redis-ent/effectors/stop")
-                .type(MediaType.APPLICATION_JSON_TYPE)
-                .post(ClientResponse.class, ImmutableMap.of());
-        assertEquals(response.getStatus(), 
Response.Status.ACCEPTED.getStatusCode());
-
-        final URI stateSensor = 
URI.create("/v1/applications/redis-app/entities/redis-ent/sensors/service.state");
-        final String expectedStatus = Lifecycle.STOPPED.toString();
-        Asserts.succeedsEventually(MutableMap.of("timeout", 60 * 1000), new 
Runnable() {
-            public void run() {
-                // Accept with and without quotes; if don't specify "Accepts" 
header, then
-                // might get back json or plain text (depending on compiler / 
java runtime 
-                // used for SensorApi!)
-                String val = client().resource(stateSensor).get(String.class);
-                assertTrue(expectedStatus.equalsIgnoreCase(val) || 
("\""+expectedStatus+"\"").equalsIgnoreCase(val), "state="+val);
-            }
-        });
-    }
-
-    @Test(groups="Integration", dependsOnMethods = 
"testTriggerRedisStopEffector" )
-    public void testDeleteRedisApplication() throws Exception {
-        int size = getManagementContext().getApplications().size();
-        ClientResponse response = 
client().resource("/v1/applications/redis-app")
-                .delete(ClientResponse.class);
-
-        waitForPageNotFoundResponse("/v1/applications/redis-app", 
ApplicationSummary.class);
-
-        assertEquals(response.getStatus(), 
Response.Status.ACCEPTED.getStatusCode());
-        assertEquals(getManagementContext().getApplications().size(), size-1);
-    }
-
-}

Reply via email to