brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [43/71] [abbrv] incubator-brooklyn git commit: [SERVER] [UI] moved BrooklynJavascriptGuiLauncher from ui to server repo, relative paths updated, tested in both IntelliJ and Eclipse
Date Wed, 23 Dec 2015 11:07:06 GMT
[SERVER] [UI] moved BrooklynJavascriptGuiLauncher from ui to server repo, relative paths updated,
tested in both IntelliJ and Eclipse


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

Branch: refs/heads/master
Commit: 912343571778bb72dc377ba503166e73fa409f23
Parents: b4d6c4b
Author: John McCabe <john@johnmccabe.net>
Authored: Thu Dec 17 18:06:47 2015 +0000
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Mon Dec 21 16:43:36 2015 +0000

----------------------------------------------------------------------
 brooklyn-server/karaf/apache-brooklyn/pom.xml   |   1 +
 brooklyn-server/launcher/pom.xml                |  57 +++++++
 .../jsgui/BrooklynJavascriptGuiLauncher.java    |  81 ++++++++++
 .../BrooklynJavascriptGuiLauncherTest.java      |  81 ++++++++++
 .../brooklyn/rest/BrooklynRestApiLauncher.java  |  12 +-
 brooklyn-ui/pom.xml                             | 148 +++----------------
 .../jsgui/BrooklynJavascriptGuiLauncher.java    |  80 ----------
 .../BrooklynJavascriptGuiLauncherTest.java      |  81 ----------
 8 files changed, 243 insertions(+), 298 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/91234357/brooklyn-server/karaf/apache-brooklyn/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-server/karaf/apache-brooklyn/pom.xml b/brooklyn-server/karaf/apache-brooklyn/pom.xml
index 145f83b..00fbe78 100755
--- a/brooklyn-server/karaf/apache-brooklyn/pom.xml
+++ b/brooklyn-server/karaf/apache-brooklyn/pom.xml
@@ -116,6 +116,7 @@
             <bootFeature>wrap</bootFeature>
             <!-- brooklyn features -->
             <bootFeature>brooklyn-rest-server</bootFeature>
+            <bootFeature>brooklyn-jsgui</bootFeature>
           </bootFeatures>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/91234357/brooklyn-server/launcher/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-server/launcher/pom.xml b/brooklyn-server/launcher/pom.xml
index c8c0c57..1d7f726 100644
--- a/brooklyn-server/launcher/pom.xml
+++ b/brooklyn-server/launcher/pom.xml
@@ -77,6 +77,14 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+             <groupId>org.apache.brooklyn</groupId>     
+             <artifactId>brooklyn-jsgui</artifactId>      
+             <type>war</type>       
+             <!-- Needed during build time only -->     
+             <scope>provided</scope>        
+             <version>${project.version}</version>      
+        </dependency>
+        <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.framework</artifactId>
         </dependency>
@@ -204,6 +212,35 @@
 
     <build>
         <plugins>
+
+             <plugin>
+                 <artifactId>maven-dependency-plugin</artifactId>
+                 <!-- copy the WAR so it is available on the classpath for programmatic
deployment -->
+                 <executions>
+                     <execution>
+                         <id>copy</id>
+                         <phase>process-classes</phase>
+                         <goals>
+                             <goal>copy</goal>
+                         </goals>
+                         <configuration>
+                             <artifactItems>
+                                 <artifactItem>
+                                     <!-- this can fail in eclipse trying to copy _from_
target/classes.
+                                          see http://jira.codehaus.org/browse/MDEP-259 -->
+                                     <groupId>${project.groupId}</groupId>
+                                     <artifactId>brooklyn-jsgui</artifactId>
+                                     <version>${project.version}</version>
+                                     <type>war</type>
+                                     <overWrite>true</overWrite>
+                                     <outputDirectory>target/classes</outputDirectory>
+                                     <destFileName>brooklyn.war</destFileName>
+                                 </artifactItem>
+                             </artifactItems>
+                         </configuration>
+                     </execution>
+                 </executions>
+             </plugin>
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
@@ -221,6 +258,26 @@
                     <generateReports>false</generateReports>
                 </configuration>
             </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>exclude-jsgui</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <classifier>no-jsgui</classifier>
+                            <excludes>
+                                <exclude>brooklyn.war</exclude>
+                            </excludes>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/91234357/brooklyn-server/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
b/brooklyn-server/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
new file mode 100644
index 0000000..6f04fd7
--- /dev/null
+++ b/brooklyn-server/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
@@ -0,0 +1,81 @@
+/*
+ * 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.jsgui;
+
+import java.net.InetSocketAddress;
+
+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.util.net.Networking;
+import org.eclipse.jetty.server.NetworkConnector;
+
+/** launches Javascript GUI programmatically. and used for tests.
+ * see {@link BrooklynRestApiLauncher} for more information.
+ *
+ * WINDOWS tips:
+ * On Windows Jetty will lock all static files preventing any changes on them.
+ * To work around the problem and tell Jetty not to lock files:
+ * <ul>
+ *   <li>find jetty-webapp-&lt;ver&gt;.jar from your classpath
+ *   <li>extract the file webdefault.xml from folder org/eclipse/jetty/webapp (On Eclipse
+ *      just expanding the jar from the dependencies, right click/copy on the file.)
+ *   <li>in this project create a java package org.eclipse.jetty.webapp and put the
webdefault.html file in it
+ *   <li>edit the file and change the property useFileMappedBuffer to false
+ * </ul> 
+ **/
+public class BrooklynJavascriptGuiLauncher {
+
+    private static final Logger log = LoggerFactory.getLogger(BrooklynJavascriptGuiLauncher.class);
+    
+    public static void main(String[] args) throws Exception {
+        // NOTE: When running Brooklyn from an IDE (i.e. by launching BrooklynJavascriptGuiLauncher.main())
+        // you will need to ensure that the working directory is set to the jsgui folder.
For IntelliJ,
+        // set the 'Working directory' of the Run/Debug Configuration to $MODULE_DIR$/brooklyn-server/launcher.
+        // For Eclipse, use the default option of ${workspace_loc:brooklyn-launcher}.
+        // If the working directory is not set correctly, Brooklyn will be unable to find
the jsgui .war
+        // file and the 'gui not available' message will be shown.
+        startJavascriptAndRest();
+        
+        log.info("Press Ctrl-C to quit.");
+    }
+    
+    final static int FAVOURITE_PORT = 8080;
+    
+    /** due to the ../jsgui trick in {@link BrooklynRestApiLauncher} we can just call that
method */ 
+    public static Server startJavascriptAndRest() throws Exception {
+        return BrooklynRestApiLauncher.startRestResourcesViaFilter();
+    }
+
+    /** not much fun without a REST client. but TODO we should make it so the REST endpoint
can be configured. */
+    /** relative path to webapp assumes brooklyn-server has been checked out at the same
level as brooklyn-ui  */
+    public static Server startJavascriptWithoutRest() throws Exception {
+        WebAppContext context = new WebAppContext("../../brooklyn-ui/src/main/webapp", "/");
+
+        Server server = new Server(new InetSocketAddress(Networking.LOOPBACK, Networking.nextAvailablePort(FAVOURITE_PORT)));
+        server.setHandler(context);
+        server.start();
+        log.info("JS GUI server started (no REST) at  http://localhost:"+((NetworkConnector)server.getConnectors()[0]).getLocalPort()+"/");
+        
+        return server;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/91234357/brooklyn-server/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
b/brooklyn-server/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
new file mode 100644
index 0000000..86eb4fa
--- /dev/null
+++ b/brooklyn-server/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.jsgui;
+
+import org.apache.brooklyn.test.HttpTestUtils;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.ContextHandler;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+import org.apache.brooklyn.api.mgmt.ManagementContext;
+import org.apache.brooklyn.core.entity.Entities;
+import org.apache.brooklyn.rest.BrooklynRestApiLauncherTestFixture;
+import org.apache.brooklyn.rest.util.OsgiCompat;
+import org.eclipse.jetty.server.NetworkConnector;
+
+/** Convenience and demo for launching programmatically. */
+public class BrooklynJavascriptGuiLauncherTest {
+
+    Server server = null;
+    
+    @AfterMethod(alwaysRun=true)
+    public void stopServer() throws Exception {
+        if (server!=null) {
+            ManagementContext mgmt = getManagementContextFromJettyServerAttributes(server);
+            server.stop();
+            if (mgmt!=null) Entities.destroyAll(mgmt);
+            server = null;
+        }
+    }
+    
+    @Test
+    public void testJavascriptWithoutRest() throws Exception {
+        server = BrooklynJavascriptGuiLauncher.startJavascriptWithoutRest();
+        checkUrlContains("/index.html", "Brooklyn");
+    }
+
+    @Test
+    public void testJavascriptWithRest() throws Exception {
+        server = BrooklynJavascriptGuiLauncher.startJavascriptAndRest();
+        BrooklynRestApiLauncherTestFixture.forceUseOfDefaultCatalogWithJavaClassPath(server);
+        BrooklynRestApiLauncherTestFixture.enableAnyoneLogin(server);
+        checkEventuallyHealthy();
+        checkUrlContains("/index.html", "Brooklyn");
+        checkUrlContains("/v1/catalog/entities", "Tomcat");
+    }
+
+    protected void checkUrlContains(final String path, final String text) {
+        //Server may return 403 until it loads completely, wait a bit
+        //until it stabilizes.
+        HttpTestUtils.assertContentEventuallyContainsText(rootUrl()+path, text);
+    }
+
+    protected void checkEventuallyHealthy() {
+        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(rootUrl(), 200);
+    }
+
+    protected String rootUrl() {
+        return "http://localhost:"+((NetworkConnector)server.getConnectors()[0]).getLocalPort();
+    }
+
+    private ManagementContext getManagementContextFromJettyServerAttributes(Server server)
{
+        return OsgiCompat.getManagementContext((ContextHandler) server.getHandler());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/91234357/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncher.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncher.java
b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncher.java
index d003b76..2a1fbfa 100644
--- a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncher.java
+++ b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncher.java
@@ -79,7 +79,7 @@ import org.eclipse.jetty.server.NetworkConnector;
  * BrooklynLauncher has a more full-featured CLI way to start, 
  * but if you want more control you can:
  * <li> take the WAR this project builds (REST API) -- NB probably want the unshaded
one (containing all deps)
- * <li> take the WAR from the jsgui project _and_ this WAR and combine them 
+ * <li> take the WAR from the brooklyn-jsgui project (brooklyn-ui repo) _and_ this
WAR and combine them
  *      (this one should run as a filter on the others, _not_ as a ResourceCollection where
they fight over who's got root)
  * <li> programmatically install things, following the examples herein; 
  *      in particular {@link #installAsServletFilter(ServletContextHandler)} is quite handy!

@@ -225,9 +225,9 @@ public class BrooklynRestApiLauncher {
         // 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())
-        // you will need to ensure that the working directory is set to the jsgui folder.
For IntelliJ,
-        // set the 'Working directory' of the Run/Debug Configuration to $MODULE_DIR/../jsgui.
-        // For Eclipse, use the default option of ${workspace_loc:brooklyn-jsgui}.
+        // you will need to ensure that the working directory is set to the brooklyn-ui repo
folder. For IntelliJ,
+        // set the 'Working directory' of the Run/Debug Configuration to $MODULE_DIR$/brooklyn-server/launcher.
+        // For Eclipse, use the default option of ${workspace_loc:brooklyn-launcher}.
         // If the working directory is not set correctly, Brooklyn will be unable to find
the jsgui .war
         // file and the 'gui not available' message will be shown.
         context.setWar(this.deployJsgui && findJsguiWebapp() != null
@@ -384,8 +384,8 @@ public class BrooklynRestApiLauncher {
     private static String findJsguiWebapp() {
         // could also look in maven repo ?
         return Optional
-                .fromNullable(findMatchingFile("../jsgui/src/main/webapp"))
-                .or(findMatchingFile("../jsgui/target/*.war"))
+                .fromNullable(findMatchingFile("../../brooklyn-ui/src/main/webapp"))
+                .or(findMatchingFile("../../brooklyn-ui/target/*.war"))
                 .orNull();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/91234357/brooklyn-ui/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-ui/pom.xml b/brooklyn-ui/pom.xml
index 037472c..7674362 100644
--- a/brooklyn-ui/pom.xml
+++ b/brooklyn-ui/pom.xml
@@ -19,9 +19,18 @@
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
-    <packaging>war</packaging>
 
+    <parent>
+        <groupId>org.apache</groupId>
+        <artifactId>apache</artifactId>
+        <version>17</version>
+        <relativePath></relativePath>
+    </parent>
+
+    <groupId>org.apache.brooklyn</groupId>
     <artifactId>brooklyn-jsgui</artifactId>
+    <version>0.9.SPLITWIP-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
+    <packaging>war</packaging>
 
     <name>Brooklyn REST JavaScript Web GUI</name>
 
@@ -29,116 +38,19 @@
         JavaScript+HTML GUI for interacting with Brooklyn, using the REST API
     </description>
 
-    <parent>
-        <groupId>org.apache.brooklyn</groupId>
-        <artifactId>brooklyn-parent</artifactId>
-        <version>0.9.SPLITWIP-SNAPSHOT</version><!-- BROOKLYN_VERSION -->
-        <relativePath>../../parent/pom.xml</relativePath>
-    </parent>
-
     <properties>
         <project.build.webapp>
             ${project.build.directory}/${project.build.finalName}
         </project.build.webapp>
         <nodejs.path>${project.basedir}/target/nodejs/node</nodejs.path>
+        <jasmine-maven-plugin.version>1.3.1.5</jasmine-maven-plugin.version>
+        <maven-dependency-plugin.version>2.8</maven-dependency-plugin.version>
+        <nodejs-maven-plugin.version>1.0.3</nodejs-maven-plugin.version>
+        <maven-war-plugin.version>2.4</maven-war-plugin.version>
+        <requirejs-maven-plugin.version>2.0.0</requirejs-maven-plugin.version>
+        <maven-replacer-plugin.version>1.5.2</maven-replacer-plugin.version>
     </properties>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-api</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-core</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-common</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-rest-server</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-rest-server</artifactId>
-            <version>${project.version}</version>
-            <classifier>tests</classifier>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-test-support</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-policy</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-locations-jclouds</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-software-webapp</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-software-database</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-software-nosql</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-software-messaging</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-webapp</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-server</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
     <build>
         <resources>
             <resource>
@@ -197,33 +109,6 @@
                     </additionalContexts>
                 </configuration>
             </plugin>
-
-            <plugin>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <version>${maven-dependency-plugin.version}</version>
-                <executions>
-                    <execution>
-                        <id>prep-server</id>
-                        <phase>process-test-resources</phase>
-                        <goals>
-                            <goal>unpack</goal>
-                        </goals>
-                        <configuration>
-                            <artifactItems>
-                                <artifactItem>
-                                    <groupId>${project.groupId}</groupId>
-                                    <artifactId>brooklyn-rest-api</artifactId>
-                                    <classifier>tests</classifier>
-                                    <version>${brooklyn.version}</version>
-                                    <overWrite>true</overWrite>
-                                    <outputDirectory>${project.build.directory}/jasmine</outputDirectory>
-                                </artifactItem>
-                            </artifactItems>
-                            <includes>fixtures/*</includes>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-war-plugin</artifactId>
@@ -261,6 +146,7 @@
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.5.4</version>
                 <executions>
                     <execution>
                         <id>bundle-manifest</id>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/91234357/brooklyn-ui/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
----------------------------------------------------------------------
diff --git a/brooklyn-ui/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
b/brooklyn-ui/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
deleted file mode 100644
index 6c261fe..0000000
--- a/brooklyn-ui/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
+++ /dev/null
@@ -1,80 +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.jsgui;
-
-import java.net.InetSocketAddress;
-
-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.util.net.Networking;
-import org.eclipse.jetty.server.NetworkConnector;
-
-/** launches Javascript GUI programmatically. and used for tests.
- * see {@link BrooklynRestApiLauncher} for more information.
- *
- * WINDOWS tips:
- * On Windows Jetty will lock all static files preventing any changes on them.
- * To work around the problem and tell Jetty not to lock files:
- * <ul>
- *   <li>find jetty-webapp-&lt;ver&gt;.jar from your classpath
- *   <li>extract the file webdefault.xml from folder org/eclipse/jetty/webapp (On Eclipse
- *      just expanding the jar from the dependencies, right click/copy on the file.)
- *   <li>in this project create a java package org.eclipse.jetty.webapp and put the
webdefault.html file in it
- *   <li>edit the file and change the property useFileMappedBuffer to false
- * </ul> 
- **/
-public class BrooklynJavascriptGuiLauncher {
-
-    private static final Logger log = LoggerFactory.getLogger(BrooklynJavascriptGuiLauncher.class);
-    
-    public static void main(String[] args) throws Exception {
-        // NOTE: When running Brooklyn from an IDE (i.e. by launching BrooklynJavascriptGuiLauncher.main())
-        // you will need to ensure that the working directory is set to the jsgui folder.
For IntelliJ,
-        // set the 'Working directory' of the Run/Debug Configuration to $MODULE_DIR$/../jsgui.
-        // For Eclipse, use the default option of ${workspace_loc:brooklyn-jsgui}.
-        // If the working directory is not set correctly, Brooklyn will be unable to find
the jsgui .war
-        // file and the 'gui not available' message will be shown.
-        startJavascriptAndRest();
-        
-        log.info("Press Ctrl-C to quit.");
-    }
-    
-    final static int FAVOURITE_PORT = 8080;
-    
-    /** due to the ../jsgui trick in {@link BrooklynRestApiLauncher} we can just call that
method */ 
-    public static Server startJavascriptAndRest() throws Exception {
-        return BrooklynRestApiLauncher.startRestResourcesViaFilter();
-    }
-
-    /** not much fun without a REST client. but TODO we should make it so the REST endpoint
can be configured. */
-    public static Server startJavascriptWithoutRest() throws Exception {
-        WebAppContext context = new WebAppContext("./src/main/webapp", "/");
-        
-        Server server = new Server(new InetSocketAddress(Networking.LOOPBACK, Networking.nextAvailablePort(FAVOURITE_PORT)));
-        server.setHandler(context);
-        server.start();
-        log.info("JS GUI server started (no REST) at  http://localhost:"+((NetworkConnector)server.getConnectors()[0]).getLocalPort()+"/");
-        
-        return server;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/91234357/brooklyn-ui/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-ui/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
b/brooklyn-ui/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
deleted file mode 100644
index 86eb4fa..0000000
--- a/brooklyn-ui/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
+++ /dev/null
@@ -1,81 +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.jsgui;
-
-import org.apache.brooklyn.test.HttpTestUtils;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.handler.ContextHandler;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.rest.BrooklynRestApiLauncherTestFixture;
-import org.apache.brooklyn.rest.util.OsgiCompat;
-import org.eclipse.jetty.server.NetworkConnector;
-
-/** Convenience and demo for launching programmatically. */
-public class BrooklynJavascriptGuiLauncherTest {
-
-    Server server = null;
-    
-    @AfterMethod(alwaysRun=true)
-    public void stopServer() throws Exception {
-        if (server!=null) {
-            ManagementContext mgmt = getManagementContextFromJettyServerAttributes(server);
-            server.stop();
-            if (mgmt!=null) Entities.destroyAll(mgmt);
-            server = null;
-        }
-    }
-    
-    @Test
-    public void testJavascriptWithoutRest() throws Exception {
-        server = BrooklynJavascriptGuiLauncher.startJavascriptWithoutRest();
-        checkUrlContains("/index.html", "Brooklyn");
-    }
-
-    @Test
-    public void testJavascriptWithRest() throws Exception {
-        server = BrooklynJavascriptGuiLauncher.startJavascriptAndRest();
-        BrooklynRestApiLauncherTestFixture.forceUseOfDefaultCatalogWithJavaClassPath(server);
-        BrooklynRestApiLauncherTestFixture.enableAnyoneLogin(server);
-        checkEventuallyHealthy();
-        checkUrlContains("/index.html", "Brooklyn");
-        checkUrlContains("/v1/catalog/entities", "Tomcat");
-    }
-
-    protected void checkUrlContains(final String path, final String text) {
-        //Server may return 403 until it loads completely, wait a bit
-        //until it stabilizes.
-        HttpTestUtils.assertContentEventuallyContainsText(rootUrl()+path, text);
-    }
-
-    protected void checkEventuallyHealthy() {
-        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(rootUrl(), 200);
-    }
-
-    protected String rootUrl() {
-        return "http://localhost:"+((NetworkConnector)server.getConnectors()[0]).getLocalPort();
-    }
-
-    private ManagementContext getManagementContextFromJettyServerAttributes(Server server)
{
-        return OsgiCompat.getManagementContext((ContextHandler) server.getHandler());
-    }
-
-}


Mime
View raw message