You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sv...@apache.org on 2016/11/28 14:19:29 UTC

[3/4] brooklyn-server git commit: JS launcher test should ensure no security provider from brooklyn.properties

JS launcher test should ensure no security provider from brooklyn.properties


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

Branch: refs/heads/master
Commit: c15820c6ebc539b6674c99c476dcd60c2302d822
Parents: d1a4977
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Fri Nov 25 10:02:42 2016 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Nov 25 10:02:42 2016 +0000

----------------------------------------------------------------------
 .../rest/jsgui/BrooklynJavascriptGuiLauncher.java   | 15 +++++++++------
 .../brooklyn/rest/BrooklynRestApiLauncher.java      | 16 ++++++++++------
 2 files changed, 19 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c15820c6/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
----------------------------------------------------------------------
diff --git a/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java b/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
index ec908db..0677561 100644
--- a/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
+++ b/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
@@ -20,16 +20,17 @@ package org.apache.brooklyn.rest.jsgui;
 
 import java.net.InetSocketAddress;
 
-import org.apache.brooklyn.rest.NopSecurityHandler;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.brooklyn.rest.BrooklynRestApiLauncher;
+import org.apache.brooklyn.rest.NopSecurityHandler;
+import org.apache.brooklyn.rest.security.provider.AnyoneSecurityProvider;
 import org.apache.brooklyn.util.core.ResourceUtils;
 import org.apache.brooklyn.util.net.Networking;
 import org.apache.brooklyn.util.os.Os;
 import org.eclipse.jetty.server.NetworkConnector;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.webapp.WebAppContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /** launches Javascript GUI programmatically. and used for tests.
  * see {@link BrooklynRestApiLauncher} for more information.
@@ -65,7 +66,9 @@ public class BrooklynJavascriptGuiLauncher {
     
     /** due to the relative path search in {@link BrooklynRestApiLauncher} we can just call that method */ 
     public static Server startJavascriptAndRest() throws Exception {
-        return BrooklynRestApiLauncher.startRestResourcesViaServlet();
+        return BrooklynRestApiLauncher.launcherServlet()
+            .securityProvider(AnyoneSecurityProvider.class)
+            .start();
     }
 
     /** not much fun without a REST server. 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c15820c6/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 602ac56..722e3d9 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
@@ -342,16 +342,20 @@ public class BrooklynRestApiLauncher {
         log.info("Press Ctrl-C to quit.");
     }
 
+    public static BrooklynRestApiLauncher launcherServlet() {
+        return new BrooklynRestApiLauncher().mode(StartMode.SERVLET);
+    }
+    
     public static Server startRestResourcesViaServlet() throws Exception {
-        return new BrooklynRestApiLauncher()
-                .mode(StartMode.SERVLET)
-                .start();
+        return launcherServlet().start();
     }
 
+    public static BrooklynRestApiLauncher launcherWebXml() {
+        return new BrooklynRestApiLauncher().mode(StartMode.WEB_XML);
+    }
+    
     public static Server startRestResourcesViaWebXml() throws Exception {
-        return new BrooklynRestApiLauncher()
-                .mode(StartMode.WEB_XML)
-                .start();
+        return launcherWebXml().start();
     }
 
     /** look for the JS GUI webapp in common source places, returning path to it if found, or null.