You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:48:23 UTC
[47/51] [abbrv] [partial] brooklyn-library git commit: move subdir
from incubator up a level as it is promoted to its own repo (first
non-incubator commit!)
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/available.jsp
----------------------------------------------------------------------
diff --git a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/available.jsp b/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/available.jsp
deleted file mode 100644
index 380339e..0000000
--- a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/available.jsp
+++ /dev/null
@@ -1,76 +0,0 @@
-<html>
-<!--
- 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.
--->
-<head>
-<title>Sample "Hello, World" Application</title>
-</head>
-<body bgcolor=white>
-
-<table border="0">
-<tr>
-<td>
-<img src="images/bridge-small.png">
-</td>
-<td>
-<h1>Sample Brooklyn Deployed "Hello, World" Application</h1>
-<p>This is the home page for a sample application used to illustrate
-how web applications can be deployed to multi-cloud environments using Brooklyn.
-</td>
-</tr>
-</table>
-
-<p>
-The following apps are available:
-<p>
-
-<ul>
-<%
-String dburl=System.getProperty("brooklyn.example.db.url");
-//URL should be supplied e.g. "-Dbrooklyn.example.db.url=jdbc:mysql://localhost/visitors?user=brooklyn&password=br00k11n"
-//(note quoting needed due to ampersand)
-if (dburl!=null) {
-%>
-<li><a href="db.jsp">SQL database chatroom</a></li>
-<% } %>
-
-<%
-String hadoop=System.getProperty("brooklyn.example.hadoop.site.xml.url");
-//URL should be supplied e.g. -Dbrooklyn.example.hadoop.site.xml.url=file://tmp/hadoop-site.xml
-if (hadoop!=null) {
-%>
-<li><a href="hadoop-chat.jsp">Hadoop chatroom</a></li>
-<li><a href="hadoop-wordcount.jsp">Hadoop wordcount</a> (inevitably!) run over the chats</li>
-<% } %>
-
-<%
-boolean primes = true;
-if (primes) {
-%>
-<li><a href="primes.jsp">Prime number counting (compute)</a></li>
-<% } %>
-
-<%
-if (hadoop==null && dburl==null && primes==false) {
-%>
-<li><i>None.</i> Try one of the other Brooklyn examples to see SQL or Hadoop.</li>
-<% } %>
-</ul>
-
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/db.jsp
----------------------------------------------------------------------
diff --git a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/db.jsp b/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/db.jsp
deleted file mode 100644
index 7e91b66..0000000
--- a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/db.jsp
+++ /dev/null
@@ -1,123 +0,0 @@
-<%@ page language="java" import="java.sql.*"%>
-
-<html>
-<!--
- 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.
--->
-<head>
-<title>Sample Application Database JSP Page</title>
-</head>
-<body bgcolor=white>
-
-<table border="0">
-<tr>
-<td align=center>
-<img src="images/bridge-small.png">
-</td>
-<td>
-<h1>Sample Brooklyn Deployed WebApp (Database JSP)</h1>
-This is the output of a JSP page that is part of the Hello, World application,
-deployed by brooklyn, to show <b>SQL database interactivity</b>.
-</td>
-</tr>
-</table>
-
-<%
-String url=System.getProperty("brooklyn.example.db.url");
-//URL should be supplied e.g. ""-Dbrooklyn.example.db.url=jdbc:mysql://localhost/visitors?user=brooklyn&password=br00k11n"
-//(note quoting needed due to ampersand)
-if (url==null) {
-%>
- <p>(There is no database included as part of this example.)</p>
-<% } else { /* begin database-enabled block */ %>
-
-<br/>
-<p>Visitors:</p>
-<ul>
-
-<%
-Connection con=null;
-ResultSet rst=null;
-Statement stmt=null;
-int i=0;
-
-try {
-
- String DRIVER = "com.mysql.jdbc.Driver";
- Class.forName(DRIVER).newInstance();
-
- con=DriverManager.getConnection(url);
- stmt=con.createStatement();
-
- if (request.getParameter("name")!=null) {
- //add a message
- stmt.execute("INSERT INTO MESSAGES values (default, '"+
- //better escaping and security desired...
- //this essentially does StringEscapeUtils.escapeSql (either brooklyn.util or apache commons)
- request.getParameter("name").replaceAll("'", "''")+
- "', '"+
- request.getParameter("message").replaceAll("'", "''")+
- "')");
- }
-
- rst=stmt.executeQuery("select * from MESSAGES");
- while (rst.next()) {
-%>
- <li> <b><%= rst.getString(2) %></b>: <%= rst.getString(3) %> </li>
-<%
- i++;
- }
-} catch (Exception e) {
- i=-1;
-%>
- <li> <b>The database does not appear to be connected.</b> </li>
- <li> ERROR: <%= e %> </li>
-<%
-} finally {
- if (rst!=null) rst.close();
- if (stmt!=null) stmt.close();
- if (con!=null) con.close();
-}
-
-if (i==0) {
-%>
- <li> <i>None.</i> </li>
-<%
-}
-%>
-
-</ul>
-
-<br/>
-
-<p>Please enter a message:</p>
-
-<form action="db.jsp" method="GET">
- <table>
- <tr><td>Name: </td><td><input type="text" name="name"></td></tr>
- <tr><td>Message: </td><td><input type="text" name="message"></td></tr>
- </table>
- <input type="submit" value="Submit"/>
-</form>
-
-<% } /* end of database-enabled block */ %>
-
-<br/>
-<p>Click <a href="index.html">here</a> to go back to the main page.</p>
-
-</html>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/hadoop-chat.jsp
----------------------------------------------------------------------
diff --git a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/hadoop-chat.jsp b/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/hadoop-chat.jsp
deleted file mode 100644
index f7e61f4..0000000
--- a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/hadoop-chat.jsp
+++ /dev/null
@@ -1,110 +0,0 @@
-<%@ page language="java" import="java.sql.*"%>
-
-<html>
-<!--
- 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.
--->
-<head>
-<title>Sample Application HDFS JSP Page</title>
-</head>
-<body bgcolor=white>
-
-<table border="0">
-<tr>
-<td align=center>
-<img src="images/bridge-small.png">
-</td>
-<td>
-<h1>Sample Brooklyn Deployed WebApp (Database JSP)</h1>
-This is the output of a JSP page that is part of the Hello, World application,
-deployed by brooklyn, to show <b>hadoop hdfs used as the data store</b>.
-</td>
-</tr>
-</table>
-
-<%
-String hadoop=System.getProperty("brooklyn.example.hadoop.site.xml.url");
-if (hadoop==null) {
-%>
- <p>(There is no hadoop included as part of this example.)</p>
-<% } else { /* begin hadoop-enabled block */
-
-
-try {
- org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration();
- conf.setClassLoader(brooklyn.demo.webapp.hello.HadoopWordCount.class.getClassLoader());
- conf.addResource(new java.net.URL(hadoop));
- org.apache.hadoop.fs.FileSystem fsClient = org.apache.hadoop.fs.FileSystem.get(conf);
- if (fsClient==null) throw new NullPointerException("Can't access fsClient at "+hadoop);
-
- if (request.getParameter("name")!=null) {
- java.io.OutputStream os1 = fsClient.create(new org.apache.hadoop.fs.Path("chats", ""+System.currentTimeMillis()+"-"+((int)(Math.random()*10000))));
- os1.write(request.getParameter("name").getBytes());
- os1.write(" : ".getBytes());
- os1.write(request.getParameter("message").getBytes());
- os1.flush(); os1.close();
- }
-%>
- <br/>
- <p>Visitors:</p>
- <ul>
-<%
- org.apache.hadoop.fs.FileStatus[] files = fsClient.listStatus(new org.apache.hadoop.fs.Path("chats"));
- if (files==null) files = new org.apache.hadoop.fs.FileStatus[0];
- for (org.apache.hadoop.fs.FileStatus f: files) {
-%>
- <li> <%= brooklyn.demo.webapp.hello.DemoUtils.stringFromInputStream(fsClient.open(f.getPath())) %> </li>
-<%
- }
- if (files.length==0) {
- %>
- <li> <i>None.</i> </li>
- <%
- }
- %>
-
- </ul>
- <br/>
-
- <p>Please enter a message:</p>
-
- <form action="hadoop-chat.jsp" method="GET">
- <table>
- <tr><td>Name: </td><td><input type="text" name="name"></td></tr>
- <tr><td>Message: </td><td><input type="text" name="message"></td></tr>
- </table>
- <input type="submit" value="Submit"/>
- </form>
-
-<%
-} catch (Exception e) {
-%>
- <b>Error connecting to Hadoop.</b><br/>
- ERROR: <%= e %><br/><br/>
- <pre> <%= brooklyn.demo.webapp.hello.DemoUtils.getStackTrace(e) %></pre>
-<%
-}
-}
-%>
-
- <br/>
- <p>Click <a href="hadoop-wordcount.jsp">here</a> to run a map-reduce job counting the words in these comments.</p>
- <p>Click <a href="index.html">here</a> to go back to the main page.</p>
-
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/hadoop-wordcount.jsp
----------------------------------------------------------------------
diff --git a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/hadoop-wordcount.jsp b/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/hadoop-wordcount.jsp
deleted file mode 100644
index 570a659..0000000
--- a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/hadoop-wordcount.jsp
+++ /dev/null
@@ -1,114 +0,0 @@
-<%@ page language="java" import="java.sql.*"%>
-
-<html>
-<!--
- 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.
--->
-<head>
-<title>Sample Application Database JSP Page</title>
-</head>
-<body bgcolor=white>
-
-<table border="0">
-<tr>
-<td align=center>
-<img src="images/bridge-small.png">
-</td>
-<td>
-<h1>Sample Brooklyn Deployed WebApp (Database JSP)</h1>
-This is the output of a JSP page that is part of the Hello, World application,
-deployed by brooklyn, to show <b>a hadoop map-reduce task run<b>.
-</td>
-</tr>
-</table>
-
-<%
-String hadoop=System.getProperty("brooklyn.example.hadoop.site.xml.url");
-String hadoopJar=System.getProperty("brooklyn.example.hadoop.custom.jar.url");
-if (hadoop==null) {
-%>
- <p>There is no hadoop included as part of this example. Set brooklyn.example.hadoop.site.xml.url to proceed.</p>
-<% } else if (hadoopJar==null) {
-%>
- <p>brooklyn.example.hadoop.custom.jar.url must be set to point to the Jar.</p>
-<%} else { /* begin hadoop-enabled block */
-
-try {
- org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration();
- conf.setClassLoader(brooklyn.demo.webapp.hello.HadoopWordCount.class.getClassLoader());
- conf.addResource(new java.net.URL(hadoop));
- org.apache.hadoop.fs.FileSystem fsClient = org.apache.hadoop.fs.FileSystem.get(conf);
- if (fsClient==null) throw new NullPointerException("Can't access fsClient at "+hadoop);
-
- org.apache.hadoop.mapreduce.Job job = brooklyn.demo.webapp.hello.HadoopWordCount.makeJob(conf);
- ((org.apache.hadoop.mapred.JobConf)job.getConfiguration()).setJar(hadoopJar);
- org.apache.hadoop.fs.FileStatus[] files = fsClient.listStatus(new org.apache.hadoop.fs.Path("chats"));
- if (files==null) files = new org.apache.hadoop.fs.FileStatus[0];
- for (org.apache.hadoop.fs.FileStatus f: files) {
- org.apache.hadoop.mapreduce.lib.input.FileInputFormat.addInputPath(job, f.getPath());
- }
-
- org.apache.hadoop.fs.Path outp = new org.apache.hadoop.fs.Path("out-"+((int)(Math.random()*10000)));
- org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.setOutputPath(job, outp);
-
- boolean result = job.waitForCompletion(true);
-
- if (!result) {
- %> <p><b></b><i>Map reduce job returned non-zero result code.</i></b></p> <%
- }
-
- %> <p>Output from map reduce is as follows:</p> <%
-
- files = fsClient.listStatus(outp);
- if (files==null) files = new org.apache.hadoop.fs.FileStatus[0];
- for (org.apache.hadoop.fs.FileStatus f: files) {
- try {
- if (!f.isDir() && f.getLen()>0) {
- %>
- <%= f.getPath() %>:<br/>
- <pre><%= brooklyn.demo.webapp.hello.DemoUtils.stringFromInputStream(fsClient.open(f.getPath())) %></pre>
- <%
- }
- } catch (Exception e) {
- %> Error: <%= e %><%
- }
- }
- if (files.length==0) {
- %>
- <i>No output.</i> </li>
- <%
- }
-
- fsClient.delete(outp, true);
-
-} catch (Exception e) {
-%>
- <b>Error connecting to Hadoop.</b><br/>
- ERROR: <%= e %><br/>
- <pre> <%= brooklyn.demo.webapp.hello.DemoUtils.getStackTrace(e) %></pre>
-<%
-}
-}
-%>
-
- <br/>
- <p>Click <a href="hadoop-chat.jsp">here</a> to view the chat room.</p>
- <p>Click <a href="index.html">here</a> to go back to the main page.</p>
-
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/images/BrooklynBridge3Large.png
----------------------------------------------------------------------
diff --git a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/images/BrooklynBridge3Large.png b/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/images/BrooklynBridge3Large.png
deleted file mode 100644
index 2f8253a..0000000
Binary files a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/images/BrooklynBridge3Large.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/images/bridge-large-no-title.png
----------------------------------------------------------------------
diff --git a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/images/bridge-large-no-title.png b/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/images/bridge-large-no-title.png
deleted file mode 100644
index 0a7f878..0000000
Binary files a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/images/bridge-large-no-title.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/images/bridge-small.png
----------------------------------------------------------------------
diff --git a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/images/bridge-small.png b/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/images/bridge-small.png
deleted file mode 100644
index 4149c3c..0000000
Binary files a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/images/bridge-small.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/index.html b/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/index.html
deleted file mode 100644
index 33b9bd9..0000000
--- a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/index.html
+++ /dev/null
@@ -1,42 +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.
--->
-
-<html>
-<head>
-<title>Sample "Hello, World" Application</title>
-<link rel="stylesheet" type="text/css" href="styles/main.css">
-</head>
-<body>
-<div id='main'>
-<div id="header">
- <div class="header_text">
- <h1>Sample Brooklyn Deployed "Hello, World" Application</h1>
- </div>
-</div>
- <div id="container">
- <div class="text_row">
- <div class="app_info"><h3>This is the home page for a sample application used to illustrate
- how web applications can be deployed to multi-cloud environments using Brooklyn.</h3></div>
- <div class="illustrations"><p>See the available illustrations <a href="available.jsp">here</a>.</p></div>
- </div>
- </div>
-</div>
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/primes.jsp
----------------------------------------------------------------------
diff --git a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/primes.jsp b/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/primes.jsp
deleted file mode 100644
index 04f83a1..0000000
--- a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/primes.jsp
+++ /dev/null
@@ -1,77 +0,0 @@
-<%@ page language="java"%>
-
-<html>
-<!--
- 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.
--->
-<head>
-<title>Sample Application Compute JSP Page</title>
-</head>
-<body bgcolor=white>
-
-<table border="0">
-<tr>
-<td align=center>
-<img src="images/bridge-small.png">
-</td>
-<td>
-<h1>Sample Brooklyn Deployed WebApp (Compute Primes JSP)</h1>
-This is the output of a JSP page that is part of the Hello, World application,
-deployed by brooklyn, to show <b>compute load by generating primes</b>.
-</td>
-</tr>
-</table>
-
-<%
-Object nx = request.getParameter("n");
-if (nx==null) {
-%>
- <p>Please supply a value <i>n</i> in the URL, to compute primes up to <i>n</i>.</p>
- <form action="primes.jsp" method="GET">
- <table>
- <tr><td>Count primes up to: </td><td><input type="text" name="n"></td></tr>
- </table>
- <input type="submit" value="Submit"/>
- </form>
-
-<%
-} else {
- long n = Long.parseLong(""+nx);
- long startTime = System.currentTimeMillis();
- int count = 0;
- for (long k=2; k<=n; k++) {
- // check if k prime
- boolean prime = true;
- for (long j=2; j*j<=k; j++) {
- if (k%j==0) {
- prime = false;
- break;
- }
- }
- if (prime) count++;
- }
- long totalTime = System.currentTimeMillis() - startTime;
-%>
- <p>There are <%= count %> primes less than or equal to <%= n %>.</p>
- <p>Computation took <%= totalTime %> ms.</p>
-<%
-}
-%>
-
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/styles/main.css
----------------------------------------------------------------------
diff --git a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/styles/main.css b/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/styles/main.css
deleted file mode 100644
index 27606d3..0000000
--- a/brooklyn-library/examples/webapps/hello-world-webapp/src/main/webapp/styles/main.css
+++ /dev/null
@@ -1,71 +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.
-*/
-*{
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
-}
-body{
- padding: 0;
- margin: 0;
-}
-#main{
- background: url('../images/BrooklynBridge3Large.png')fixed;
- -webkit-background-size: cover;
- -moz-background-size: cover;
- -o-background-size: cover;
- background-size: cover;
- height: 100vh;
- background-color: #6BB445;
-}
-#header{
- text-align: center;
-}
-h1{
- font-family: "open sans","HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
- text-transform: uppercase;
- line-height: 105%;
- letter-spacing: 1px;
- font-weight: bold;
- text-align: center;
- margin: 20px 0 15px;
- margin: 0;
- padding-top: 20vh;
-}
-#container{
- padding-top: 30vh;
- text-align: center;
- line-height: 140%;
- font-family: "Noto Serif","open sans","HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
- font-weight: normal;
- color: white;
- text-shadow: #000 0px 0px 5px, #000 0px 0px 5px, #000 0px 0px 5px,
- #000 0px 0px 5px, #000 0px 0px 5px, #000 0px 0px 5px;
- font-style: italic;
- margin-bottom: 45px;
- width: 80%;
- margin-left: 10%;
-}
-a{
- color: #6BB445;
-}
-.text_row{
- padding: 5%;
-}
-.illustrations{
- padding-bottom: 5%;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/examples/webapps/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-library/examples/webapps/pom.xml b/brooklyn-library/examples/webapps/pom.xml
deleted file mode 100644
index d5c0c05..0000000
--- a/brooklyn-library/examples/webapps/pom.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<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>pom</packaging>
- <artifactId>brooklyn-examples-webapps-parent</artifactId>
- <name>Brooklyn Examples Aggregator Project - Webapps</name>
- <description>
- Brooklyn examples module, building the Brooklyn examples.
- </description>
-
- <parent>
- <groupId>org.apache.brooklyn.example</groupId>
- <artifactId>brooklyn-examples-parent</artifactId>
- <version>0.9.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION -->
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <modules>
- <module>hello-world-webapp</module>
- <module>hello-world-sql</module>
- </modules>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.1.0</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-</project>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-library/pom.xml b/brooklyn-library/pom.xml
deleted file mode 100644
index 2b6ba8d..0000000
--- a/brooklyn-library/pom.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<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>
- <parent>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-parent</artifactId>
- <version>0.9.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION -->
- <relativePath>../brooklyn-server/parent/</relativePath>
- </parent>
-
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-library</artifactId>
- <version>0.9.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION -->
- <packaging>pom</packaging>
-
- <name>Brooklyn Library Root</name>
- <description>
- Brooklyn Library project root, serving as the ancestor POM for all projects --
- declaring versions, profiles, and the modules to build
- </description>
- <url>https://brooklyn.apache.org/</url>
- <inceptionYear>2012</inceptionYear>
-
- <developers>
- <!-- TODO update with PMC members and committers -->
- </developers>
-
- <scm>
- <connection>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-brooklyn.git</connection>
- <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-brooklyn.git</developerConnection>
- <url>https://git-wip-us.apache.org/repos/asf?p=incubator-brooklyn.git</url>
- <tag>HEAD</tag>
- </scm>
-
- <issueManagement>
- <system>JIRA</system>
- <url>https://issues.apache.org/jira/browse/BROOKLYN</url>
- </issueManagement>
- <ciManagement>
- <system>Jenkins</system>
- <url>https://builds.apache.org/job/incubator-brooklyn-master-build/</url>
- </ciManagement>
- <mailingLists>
- <mailingList>
- <name>Brooklyn Developer List</name>
- <subscribe>dev-subscribe@brooklyn.apache.org</subscribe>
- <unsubscribe>dev-unsubscribe@brooklyn.apache.org</unsubscribe>
- <post>dev@brooklyn.apache.org</post>
- <archive>
- http://mail-archives.apache.org/mod_mbox/brooklyn-dev/
- </archive>
- </mailingList>
- </mailingLists>
-
- <properties>
-
- <!-- Versions of Software we Blueprint -->
- <qpid.version>0.20</qpid.version>
- <mongodb.version>3.0.3</mongodb.version>
- <riak.version>1.4.0</riak.version>
- <hazelcast.version>3.5.4</hazelcast.version>
- <org.marre.smsj.version>1.0.0-20051126</org.marre.smsj.version>
- <mysql-connector-java.version>5.1.18</mysql-connector-java.version>
- <hadoop.version>1.0.2</hadoop.version>
- <postgresql.version>9.1-901.jdbc4</postgresql.version>
- <activemq.version>5.10.0</activemq.version>
- <rabbitmq-version>2.8.7</rabbitmq-version>
- <kafka.version>0.8.2.1</kafka.version>
- <storm.version>0.9.0.1</storm.version>
- <redis.version>1.5.2</redis.version>
-
- </properties>
-
- <modules>
-
- <!-- <module>sandbox/cassandra-multicloud-snitch</module> -->
- <!-- <module>sandbox/database</module> -->
- <!-- <module>sandbox/examples/simple-open-loop-policy</module> -->
- <!-- <module>sandbox/extra</module> -->
- <!-- <module>sandbox/mobile-app</module> -->
- <!-- <module>sandbox/monitoring</module> -->
- <!-- <module>sandbox/nosql</module> -->
- <!-- <module>sandbox/web-acceptance</module> -->
-
- <module>software/network</module>
- <module>software/osgi</module>
- <module>software/database</module>
- <module>software/webapp</module>
- <module>software/messaging</module>
- <module>software/nosql</module>
- <module>software/monitoring</module>
-
- <module>qa</module>
-
- <module>examples</module>
-
- </modules>
-
-</project>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/qa/log-exclusions.txt
----------------------------------------------------------------------
diff --git a/brooklyn-library/qa/log-exclusions.txt b/brooklyn-library/qa/log-exclusions.txt
deleted file mode 100644
index 8c9252e..0000000
--- a/brooklyn-library/qa/log-exclusions.txt
+++ /dev/null
@@ -1,19 +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.
-
-GrailsUtil.*is deprecated please use
-echo.*WARNING
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/qa/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-library/qa/pom.xml b/brooklyn-library/qa/pom.xml
deleted file mode 100644
index e38afd1..0000000
--- a/brooklyn-library/qa/pom.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<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>
- <artifactId>brooklyn-qa</artifactId>
- <packaging>jar</packaging>
- <name>Brooklyn QA</name>
- <description>
- This project contains QA-style tests (e.g. longevity and stress tests).
- </description>
-
- <parent>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-library</artifactId>
- <version>0.9.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION -->
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-launcher</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-software-database</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-software-webapp</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.jopt-simple</groupId>
- <artifactId>jopt-simple</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <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-camp</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-core</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-verifier</artifactId>
- <version>1.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <phase>install</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/lib</outputDirectory>
- <excludeArtifactIds>brooklyn-dist</excludeArtifactIds>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes combine.children="append">
- <exclude>src/test/projects/downstream-parent-test/README</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedJBoss7ServerImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedJBoss7ServerImpl.java b/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedJBoss7ServerImpl.java
deleted file mode 100644
index ed00f61..0000000
--- a/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedJBoss7ServerImpl.java
+++ /dev/null
@@ -1,239 +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.qa.load;
-
-import static java.lang.String.format;
-
-import java.util.concurrent.Callable;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.location.access.BrooklynAccessUtils;
-import org.apache.brooklyn.enricher.stock.Enrichers;
-import org.apache.brooklyn.entity.webapp.jboss.JBoss7ServerImpl;
-import org.apache.brooklyn.entity.webapp.jboss.JBoss7SshDriver;
-import org.apache.brooklyn.feed.function.FunctionFeed;
-import org.apache.brooklyn.feed.function.FunctionPollConfig;
-import org.apache.brooklyn.feed.http.HttpFeed;
-import org.apache.brooklyn.feed.http.HttpPollConfig;
-import org.apache.brooklyn.feed.http.HttpValueFunctions;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.guava.Functionals;
-import org.apache.brooklyn.util.os.Os;
-
-import com.google.common.net.HostAndPort;
-
-/**
- * For simulating various aspects of the JBoss 7 app-server entity.
- *
- * The use-case for this is that the desired configuration is not always available for testing.
- * For example, there may be insufficient resources to run 100s of JBoss app-servers, or one
- * may be experimenting with possible configurations such as use of an external monitoring tool
- * that is not yet available.
- *
- * It is then possible to simulate aspects of the behaviour, for performance and load testing purposes.
- *
- * There is configuration for:
- * <ul>
- * <li>{@code simulateEntity}
- * <ul>
- * <li>if true, no underlying entity will be started. Instead a sleep 100000 job will be run and monitored.
- * <li>if false, the underlying entity (i.e. a JBoss app-server) will be started as normal.
- * </ul>
- * <li>{@code simulateExternalMonitoring}
- * <ul>
- * <li>if true, disables the default monitoring mechanism. Instead, a function will periodically execute
- * to set the entity's sensors (as though the values had been obtained from the external monitoring tool).
- * <li>if false, then:
- * <ul>
- * <li>If {@code simulateEntity==true} it will execute comparable commands (e.g. execute a command of the same
- * size over ssh or do a comparable number of http GET requests).
- * <li>If {@code simulateEntity==false} then normal monitoring will be done.
- * </ul>
- * </ul>
- * <li>{@code skipSshOnStart}
- * <ul>
- * <li>If true (and if {@code simulateEntity==true}), then no ssh commands will be executed at deploy-time.
- * This is useful for speeding up load testing, to get to the desired number of entities.
- * Should not be set to {@code true} if {@code simulateEntity==false}.
- * <li>If false, the ssh commands will be executed (based on the value of {@code simulateEntity}.
- * </ul>
- * </ul>
- */
-public class SimulatedJBoss7ServerImpl extends JBoss7ServerImpl {
-
- public static final ConfigKey<Boolean> SIMULATE_ENTITY = SimulatedTheeTierApp.SIMULATE_ENTITY;
- public static final ConfigKey<Boolean> SIMULATE_EXTERNAL_MONITORING = SimulatedTheeTierApp.SIMULATE_EXTERNAL_MONITORING;
- public static final ConfigKey<Boolean> SKIP_SSH_ON_START = SimulatedTheeTierApp.SKIP_SSH_ON_START;
-
- private HttpFeed httpFeed;
- private FunctionFeed functionFeed;
-
- @Override
- public Class<?> getDriverInterface() {
- return SimulatedJBoss7SshDriver.class;
- }
-
- @Override
- protected void connectSensors() {
- boolean simulateEntity = getConfig(SIMULATE_ENTITY);
- boolean simulateExternalMonitoring = getConfig(SIMULATE_EXTERNAL_MONITORING);
-
- if (!simulateEntity && !simulateExternalMonitoring) {
- super.connectSensors();
- return;
- }
-
- HostAndPort hp = BrooklynAccessUtils.getBrooklynAccessibleAddress(this,
- getAttribute(MANAGEMENT_HTTP_PORT) + getConfig(PORT_INCREMENT));
-
- String managementUri = String.format("http://%s:%s/management/subsystem/web/connector/http/read-resource",
- hp.getHostText(), hp.getPort());
- sensors().set(MANAGEMENT_URL, managementUri);
-
- if (simulateExternalMonitoring) {
- // TODO What would set this normally, if not doing connectServiceUpIsRunning?
- sensors().set(SERVICE_PROCESS_IS_RUNNING, true);
- } else {
- // if simulating entity, then simulate work of periodic HTTP request; TODO but not parsing JSON response
- String uriToPoll = (simulateEntity) ? "http://localhost:8081" : managementUri;
-
- httpFeed = HttpFeed.builder()
- .entity(this)
- .period(200)
- .baseUri(uriToPoll)
- .credentials(getConfig(MANAGEMENT_USER), getConfig(MANAGEMENT_PASSWORD))
- .poll(new HttpPollConfig<Integer>(MANAGEMENT_STATUS)
- .onSuccess(HttpValueFunctions.responseCode()))
- .build();
-
- // Polls over ssh for whether process is running
- connectServiceUpIsRunning();
- }
-
- functionFeed = FunctionFeed.builder()
- .entity(this)
- .period(5000)
- .poll(new FunctionPollConfig<Boolean,Boolean>(MANAGEMENT_URL_UP)
- .callable(new Callable<Boolean>() {
- private int counter = 0;
- public Boolean call() {
- sensors().set(REQUEST_COUNT, (counter++ % 100));
- sensors().set(ERROR_COUNT, (counter++ % 100));
- sensors().set(TOTAL_PROCESSING_TIME, (counter++ % 100));
- sensors().set(MAX_PROCESSING_TIME, (counter++ % 100));
- sensors().set(BYTES_RECEIVED, (long) (counter++ % 100));
- sensors().set(BYTES_SENT, (long) (counter++ % 100));
- return true;
- }}))
- .build();
-
- enrichers().add(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS)
- .from(MANAGEMENT_URL_UP)
- .computing(Functionals.ifNotEquals(true).value("Management URL not reachable") )
- .build());
- }
-
- @Override
- protected void disconnectSensors() {
- super.disconnectSensors();
- if (httpFeed != null) httpFeed.stop();
- if (functionFeed != null) functionFeed.stop();
- }
-
- public static class SimulatedJBoss7SshDriver extends JBoss7SshDriver {
- public SimulatedJBoss7SshDriver(SimulatedJBoss7ServerImpl entity, SshMachineLocation machine) {
- super(entity, machine);
- }
-
- @Override
- public boolean isRunning() {
- if (entity.getConfig(SKIP_SSH_ON_START)) {
- return true;
- } else {
- return super.isRunning();
- }
- }
-
- @Override
- public void install() {
- if (entity.getConfig(SKIP_SSH_ON_START)) {
- // no-op
- } else {
- super.install();
- }
- }
-
- @Override
- public void customize() {
- if (entity.getConfig(SKIP_SSH_ON_START)) {
- // no-op
- } else {
- super.customize();
- }
- }
-
- @Override
- public void launch() {
- if (!entity.getConfig(SIMULATE_ENTITY)) {
- super.launch();
- return;
- }
-
- // We wait for evidence of JBoss running because, using SshCliTool,
- // we saw the ssh session return before the JBoss process was fully running
- // so the process failed to start.
- String pidFile = Os.mergePathsUnix(getRunDir(), PID_FILENAME);
-
- if (entity.getConfig(SKIP_SSH_ON_START)) {
- // minimal ssh, so that isRunning will subsequently work
- newScript(MutableMap.of("usePidFile", pidFile), LAUNCHING)
- .body.append(
- format("nohup sleep 100000 > %s/console 2>&1 < /dev/null &", getRunDir()))
- .execute();
- } else {
- newScript(MutableMap.of(USE_PID_FILE, false), LAUNCHING)
- .body.append(
- "export LAUNCH_JBOSS_IN_BACKGROUND=true",
- format("export JBOSS_HOME=%s", getExpandedInstallDir()),
- format("export JBOSS_PIDFILE=%s/%s", getRunDir(), PID_FILENAME),
- format("echo skipping exec of %s/bin/%s.sh ", getExpandedInstallDir(), SERVER_TYPE) +
- format("--server-config %s ", CONFIG_FILE) +
- format("-Djboss.server.base.dir=%s/%s ", getRunDir(), SERVER_TYPE) +
- format("\"-Djboss.server.base.url=file://%s/%s\" ", getRunDir(), SERVER_TYPE) +
- "-Djava.net.preferIPv4Stack=true " +
- "-Djava.net.preferIPv6Addresses=false " +
- format(" >> %s/console 2>&1 </dev/null &", getRunDir()),
- format("nohup sleep 100000 > %s/console 2>&1 < /dev/null &", getRunDir()),
- format("echo $! > "+pidFile),
- format("echo starting > %s/console", getRunDir()),
- "for i in {1..10}\n" +
- "do\n" +
- " grep -i 'starting' "+getRunDir()+"/console && exit\n" +
- " sleep 1\n" +
- "done\n" +
- "echo \"Couldn't determine if process is running (console output does not contain 'starting'); continuing but may subsequently fail\""
-
- )
- .execute();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedMySqlNodeImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedMySqlNodeImpl.java b/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedMySqlNodeImpl.java
deleted file mode 100644
index 4560050..0000000
--- a/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedMySqlNodeImpl.java
+++ /dev/null
@@ -1,183 +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.qa.load;
-
-import static java.lang.String.format;
-
-import java.util.concurrent.Callable;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks;
-import org.apache.brooklyn.entity.database.mysql.MySqlNode;
-import org.apache.brooklyn.entity.database.mysql.MySqlNodeImpl;
-import org.apache.brooklyn.entity.database.mysql.MySqlSshDriver;
-import org.apache.brooklyn.entity.software.base.AbstractSoftwareProcessSshDriver;
-import org.apache.brooklyn.feed.function.FunctionFeed;
-import org.apache.brooklyn.feed.function.FunctionPollConfig;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.task.DynamicTasks;
-import org.apache.brooklyn.util.core.task.system.ProcessTaskWrapper;
-import org.apache.brooklyn.util.time.CountdownTimer;
-import org.apache.brooklyn.util.time.Duration;
-
-/**
- * @see SimulatedJBoss7ServerImpl for description of purpose and configuration options.
- */
-public class SimulatedMySqlNodeImpl extends MySqlNodeImpl {
-
- public static final ConfigKey<Boolean> SIMULATE_ENTITY = SimulatedTheeTierApp.SIMULATE_ENTITY;
- public static final ConfigKey<Boolean> SIMULATE_EXTERNAL_MONITORING = SimulatedTheeTierApp.SIMULATE_EXTERNAL_MONITORING;
- public static final ConfigKey<Boolean> SKIP_SSH_ON_START = SimulatedTheeTierApp.SKIP_SSH_ON_START;
-
- private FunctionFeed feed;
-
- @Override
- public Class<?> getDriverInterface() {
- return SimulatedMySqlSshDriver.class;
- }
-
- @Override
- protected void connectSensors() {
- boolean simulateExternalMonitoring = getConfig(SIMULATE_EXTERNAL_MONITORING);
- if (simulateExternalMonitoring) {
- sensors().set(DATASTORE_URL, String.format("mysql://%s:%s/", getAttribute(HOSTNAME), getAttribute(MYSQL_PORT)));
-
- feed = FunctionFeed.builder()
- .entity(this)
- .period(Duration.FIVE_SECONDS)
- .poll(new FunctionPollConfig<Boolean, Boolean>(SERVICE_UP)
- .callable(new Callable<Boolean>() {
- private int counter = 0;
- public Boolean call() {
- sensors().set(QUERIES_PER_SECOND_FROM_MYSQL, (double)(counter++ % 100));
- return true;
- }})
- .setOnFailureOrException(false))
- .build();
- } else {
- super.connectSensors();
- }
- }
-
- public static class SimulatedMySqlSshDriver extends MySqlSshDriver {
-
- private int counter = 0;
-
- public SimulatedMySqlSshDriver(SimulatedMySqlNodeImpl entity, SshMachineLocation machine) {
- super(entity, machine);
- }
-
- // simulate metrics, for if using ssh polling
- @Override
- public String getStatusCmd() {
- if (entity.getConfig(SIMULATE_ENTITY)) {
- return "echo Uptime: 2427 Threads: 1 Questions: 581 Slow queries: 0 Opens: 53 Flush tables: 1 Open tables: 35 Queries per second avg: "+(counter++ % 100);
- } else {
- return super.getStatusCmd();
- }
- }
-
- @Override
- public void install() {
- if (entity.getConfig(SKIP_SSH_ON_START)) {
- // no-op
- } else {
- super.install();
- }
- }
-
- // Not applying creation-script etc, as that requires launching msyqld (so would not scale for single-machine testing)
- // This is a copy of super.customize, but with the mysqladmin-exec disabled
- @Override
- public void customize() {
- if (!entity.getConfig(SIMULATE_ENTITY)) {
- super.customize();
- return;
- } else if (entity.getConfig(SKIP_SSH_ON_START)) {
- // no-op
- } else {
- copyDatabaseConfigScript();
-
- newScript(CUSTOMIZING)
- .updateTaskAndFailOnNonZeroResultCode()
- .body.append(
- "chmod 600 "+getConfigFile(),
- getBaseDir()+"/scripts/mysql_install_db "+
- "--basedir="+getBaseDir()+" --datadir="+getDataDir()+" "+
- "--defaults-file="+getConfigFile())
- .execute();
-
- // launch, then we will configure it
- launch();
-
- CountdownTimer timer = Duration.seconds(20).countdownTimer();
- boolean hasCreationScript = copyDatabaseCreationScript();
- timer.waitForExpiryUnchecked();
-
- // DELIBERATELY SKIPPED FOR SCALABILITY TESTING ON SINGLE MACHINE
- DynamicTasks.queue(
- SshEffectorTasks.ssh(
- "cd "+getRunDir(),
- "echo skipping exec of "+getBaseDir()+"/bin/mysqladmin --defaults-file="+getConfigFile()+" --password= password "+getPassword()
- ).summary("setting password"));
-
- if (hasCreationScript)
- executeScriptFromInstalledFileAsync("creation-script.sql");
-
- // not sure necessary to stop then subsequently launch, but seems safest
- // (if skipping, use a flag in launch to indicate we've just launched it)
- stop();
- }
- }
-
- @Override
- public void launch() {
- if (!entity.getConfig(SIMULATE_ENTITY)) {
- super.launch();
- return;
- }
-
- entity.sensors().set(MySqlNode.PID_FILE, getRunDir() + "/" + AbstractSoftwareProcessSshDriver.PID_FILENAME);
-
- if (entity.getConfig(SKIP_SSH_ON_START)) {
- // minimal ssh, so that isRunning will subsequently work
- newScript(MutableMap.of("usePidFile", true), LAUNCHING)
- .body.append(
- format("nohup sleep 100000 > %s 2>&1 < /dev/null &", getLogFile()))
- .execute();
- } else {
- newScript(MutableMap.of("usePidFile", true), LAUNCHING)
- .updateTaskAndFailOnNonZeroResultCode()
- .body.append(format("echo skipping normal exec of nohup %s/bin/mysqld --defaults-file=%s --user=`whoami` > %s 2>&1 < /dev/null &", getBaseDir(), getConfigFile(), getLogFile()))
- .body.append(format("nohup sleep 100000 > %s 2>&1 < /dev/null &", getLogFile()))
- .execute();
- }
- }
-
- @Override
- public ProcessTaskWrapper<Integer> executeScriptFromInstalledFileAsync(String filenameAlreadyInstalledAtServer) {
- return DynamicTasks.queue(
- SshEffectorTasks.ssh(
- "cd "+getRunDir(),
- "echo skipping exec of "+getBaseDir()+"/bin/mysql --defaults-file="+getConfigFile()+" < "+filenameAlreadyInstalledAtServer)
- .summary("executing datastore script "+filenameAlreadyInstalledAtServer));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedNginxControllerImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedNginxControllerImpl.java b/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedNginxControllerImpl.java
deleted file mode 100644
index c75c8ab..0000000
--- a/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedNginxControllerImpl.java
+++ /dev/null
@@ -1,196 +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.qa.load;
-
-import static java.lang.String.format;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.concurrent.Callable;
-
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.feed.ConfigToAttributes;
-import org.apache.brooklyn.entity.proxy.nginx.NginxControllerImpl;
-import org.apache.brooklyn.entity.proxy.nginx.NginxSshDriver;
-import org.apache.brooklyn.entity.proxy.nginx.UrlMapping;
-import org.apache.brooklyn.feed.function.FunctionFeed;
-import org.apache.brooklyn.feed.function.FunctionPollConfig;
-import org.apache.brooklyn.feed.http.HttpFeed;
-import org.apache.brooklyn.feed.http.HttpPollConfig;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.net.Networking;
-
-import com.google.common.base.Functions;
-
-/**
- * @see SimulatedJBoss7ServerImpl for description of purpose and configuration options.
- */
-public class SimulatedNginxControllerImpl extends NginxControllerImpl {
-
- public static final ConfigKey<Boolean> SIMULATE_ENTITY = SimulatedTheeTierApp.SIMULATE_ENTITY;
- public static final ConfigKey<Boolean> SIMULATE_EXTERNAL_MONITORING = SimulatedTheeTierApp.SIMULATE_EXTERNAL_MONITORING;
- public static final ConfigKey<Boolean> SKIP_SSH_ON_START = SimulatedTheeTierApp.SKIP_SSH_ON_START;
-
- private HttpFeed httpFeed;
- private FunctionFeed functionFeed;
-
- @Override
- public Class<?> getDriverInterface() {
- return SimulatedNginxSshDriver.class;
- }
-
- @Override
- public void connectSensors() {
- boolean simulateEntity = getConfig(SIMULATE_ENTITY);
- boolean simulateExternalMonitoring = getConfig(SIMULATE_EXTERNAL_MONITORING);
-
- if (!simulateEntity && !simulateExternalMonitoring) {
- super.connectSensors();
- return;
- }
-
- // From AbstractController.connectSensors
- if (getUrl()==null) {
- sensors().set(MAIN_URI, URI.create(inferUrl()));
- sensors().set(ROOT_URL, inferUrl());
- }
- addServerPoolMemberTrackingPolicy();
-
- // From NginxController.connectSensors
- ConfigToAttributes.apply(this);
-
- if (!simulateExternalMonitoring) {
- // if simulating entity, then simulate work of periodic HTTP request; TODO but not parsing JSON response
- String uriToPoll = (simulateEntity) ? "http://localhost:8081" : getAttribute(MAIN_URI).toString();
-
- httpFeed = HttpFeed.builder()
- .entity(this)
- .period(getConfig(HTTP_POLL_PERIOD))
- .baseUri(uriToPoll)
- .poll(new HttpPollConfig<Boolean>(SERVICE_UP)
- .onSuccess(Functions.constant(true))
- .onFailureOrException(Functions.constant(true)))
- .build();
- }
-
- functionFeed = FunctionFeed.builder()
- .entity(this)
- .period(getConfig(HTTP_POLL_PERIOD))
- .poll(new FunctionPollConfig<Boolean,Boolean>(SERVICE_UP)
- .callable(new Callable<Boolean>() {
- public Boolean call() {
- return true;
- }}))
- .build();
-
- // Can guarantee that parent/managementContext has been set
- Group urlMappings = getConfig(URL_MAPPINGS);
- if (urlMappings != null) {
- // Listen to the targets of each url-mapping changing
- subscriptions().subscribeToMembers(urlMappings, UrlMapping.TARGET_ADDRESSES, new SensorEventListener<Collection<String>>() {
- @Override public void onEvent(SensorEvent<Collection<String>> event) {
- updateNeeded();
- }
- });
-
- // Listen to url-mappings being added and removed
- urlMappingsMemberTrackerPolicy = policies().add(PolicySpec.create(UrlMappingsMemberTrackerPolicy.class)
- .configure("group", urlMappings));
- }
- }
-
- @Override
- protected void disconnectSensors() {
- super.disconnectSensors();
- if (httpFeed != null) httpFeed.stop();
- if (functionFeed != null) functionFeed.stop();
- }
-
- public static class SimulatedNginxSshDriver extends NginxSshDriver {
- public SimulatedNginxSshDriver(SimulatedNginxControllerImpl entity, SshMachineLocation machine) {
- super(entity, machine);
- }
-
- @Override
- public void install() {
- if (entity.getConfig(SKIP_SSH_ON_START)) {
- // no-op
- } else {
- super.install();
- }
- }
-
- @Override
- public void customize() {
- if (entity.getConfig(SKIP_SSH_ON_START)) {
- // no-op
- } else {
- super.customize();
- }
- }
-
- @Override
- public void launch() {
- if (!entity.getConfig(SIMULATE_ENTITY)) {
- super.launch();
- return;
- }
-
- Networking.checkPortsValid(MutableMap.of("httpPort", getPort()));
-
- if (entity.getConfig(SKIP_SSH_ON_START)) {
- // minimal ssh, so that isRunning will subsequently work
- newScript(MutableMap.of("usePidFile", getPidFile()), LAUNCHING)
- .body.append(
- format("mkdir -p %s/logs", getRunDir()),
- format("nohup sleep 100000 > %s 2>&1 < /dev/null &", getLogFileLocation()))
- .execute();
- } else {
- newScript(MutableMap.of("usePidFile", false), LAUNCHING)
- .body.append(
- format("cd %s", getRunDir()),
- "echo skipping exec of requireExecutable ./sbin/nginx",
- sudoBashCIfPrivilegedPort(getPort(), format(
- "echo skipping exec of nohup ./sbin/nginx -p %s/ -c conf/server.conf > %s 2>&1 &", getRunDir(), getLogFileLocation())),
- format("nohup sleep 100000 > %s 2>&1 < /dev/null &", getLogFileLocation()),
- format("echo $! > "+getPidFile()),
- format("for i in {1..10}\n" +
- "do\n" +
- " test -f %1$s && ps -p `cat %1$s` && exit\n" +
- " sleep 1\n" +
- "done\n" +
- "echo \"No explicit error launching nginx but couldn't find process by pid; continuing but may subsequently fail\"\n" +
- "cat %2$s | tee /dev/stderr",
- getPidFile(), getLogFileLocation()))
- .execute();
- }
- }
-
- // Use pid file, because just simulating the run of nginx
- @Override
- public void stop() {
- newScript(MutableMap.of("usePidFile", getPidFile()), STOPPING).execute();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedTheeTierApp.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedTheeTierApp.java b/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedTheeTierApp.java
deleted file mode 100644
index 0e41beb..0000000
--- a/brooklyn-library/qa/src/main/java/org/apache/brooklyn/qa/load/SimulatedTheeTierApp.java
+++ /dev/null
@@ -1,140 +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.qa.load;
-
-import static org.apache.brooklyn.core.sensor.DependentConfiguration.attributeWhenReady;
-import static org.apache.brooklyn.core.sensor.DependentConfiguration.formatString;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.core.location.PortRanges;
-import org.apache.brooklyn.enricher.stock.Enrichers;
-import org.apache.brooklyn.entity.database.mysql.MySqlNode;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-import org.apache.brooklyn.entity.java.JavaEntityMethods;
-import org.apache.brooklyn.entity.proxy.nginx.NginxController;
-import org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster;
-import org.apache.brooklyn.entity.webapp.DynamicWebAppCluster;
-import org.apache.brooklyn.entity.webapp.JavaWebAppService;
-import org.apache.brooklyn.entity.webapp.WebAppService;
-import org.apache.brooklyn.entity.webapp.WebAppServiceConstants;
-import org.apache.brooklyn.entity.webapp.jboss.JBoss7Server;
-import org.apache.brooklyn.launcher.BrooklynLauncher;
-import org.apache.brooklyn.policy.autoscaling.AutoScalerPolicy;
-import org.apache.brooklyn.policy.enricher.HttpLatencyDetector;
-import org.apache.brooklyn.util.CommandLineUtil;
-import org.apache.brooklyn.util.collections.MutableSet;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-
-/**
- * A 3-tier app where all components are just "simulated" - they don't actually run
- * real app-servers or databases, instead just executing a "sleep" command to simulate
- * the running process.
- *
- * This is useful for load testing, where we want to test the performance of Brooklyn
- * rather than the ability to host many running app-servers.
- *
- * The app is based on WebClusterDatabaseExampleApp
- *
- * @see SimulatedJBoss7ServerImpl for description of purpose and configuration options.
- */
-public class SimulatedTheeTierApp extends AbstractApplication {
-
- public static final ConfigKey<Boolean> SIMULATE_ENTITY = ConfigKeys.newBooleanConfigKey("simulateEntity", "", true);
-
- public static final ConfigKey<Boolean> SIMULATE_EXTERNAL_MONITORING = ConfigKeys.newBooleanConfigKey("simulateExternalMonitoring", "", true);
-
- public static final ConfigKey<Boolean> SKIP_SSH_ON_START = ConfigKeys.newBooleanConfigKey("skipSshOnStart", "", false);
-
- public static final String WAR_PATH = "classpath://hello-world.war";
- public static final String DB_TABLE = "visitors";
- public static final String DB_USERNAME = "brooklyn";
- public static final String DB_PASSWORD = "br00k11n";
- public static final boolean USE_HTTPS = false;
-
- @Override
- public void init() {
- MySqlNode mysql = addChild(
- EntitySpec.create(MySqlNode.class)
- .impl(SimulatedMySqlNodeImpl.class));
-
- ControlledDynamicWebAppCluster web = addChild(
- EntitySpec.create(ControlledDynamicWebAppCluster.class)
- .configure(ControlledDynamicWebAppCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class).impl(SimulatedJBoss7ServerImpl.class))
- .configure(ControlledDynamicWebAppCluster.CONTROLLER_SPEC, EntitySpec.create(NginxController.class).impl(SimulatedNginxControllerImpl.class))
- .configure(WebAppService.HTTP_PORT, PortRanges.fromString("8080+"))
- .configure(JavaWebAppService.ROOT_WAR, WAR_PATH)
- .configure(JavaEntityMethods.javaSysProp("brooklyn.example.db.url"),
- formatString("jdbc:%s%s?user=%s\\&password=%s",
- attributeWhenReady(mysql, MySqlNode.DATASTORE_URL), DB_TABLE, DB_USERNAME, DB_PASSWORD))
- .configure(DynamicCluster.INITIAL_SIZE, 2)
- .configure(WebAppService.ENABLED_PROTOCOLS, ImmutableSet.of(USE_HTTPS ? "https" : "http")) );
-
- web.getCluster().policies().add(AutoScalerPolicy.builder().
- metric(DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW_PER_NODE).
- metricRange(10, 100).
- sizeRange(2, 5).
- build());
-
- enrichers().add(Enrichers.builder()
- .propagating(Attributes.MAIN_URI, WebAppServiceConstants.ROOT_URL,
- DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW,
- HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_IN_WINDOW)
- .from(web)
- .build());
-
- enrichers().add(Enrichers.builder()
- .aggregating(Startable.SERVICE_UP)
- .publishing(Startable.SERVICE_UP)
- .fromHardcodedProducers(ImmutableList.of(web, mysql))
- .computing(new Function<Collection<Boolean>, Boolean>() {
- @Override public Boolean apply(Collection<Boolean> input) {
- return input != null && input.size() == 2 && MutableSet.copyOf(input).equals(ImmutableSet.of(true));
- }})
- .build());
- }
-
- public static void main(String[] argv) {
- List<String> args = Lists.newArrayList(argv);
- String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
- String location = CommandLineUtil.getCommandLineOption(args, "--location", "localhost");
-
- BrooklynLauncher launcher = BrooklynLauncher.newInstance()
- .application(EntitySpec.create(StartableApplication.class, SimulatedTheeTierApp.class)
- .displayName("Brooklyn WebApp Cluster with Database example"))
- .webconsolePort(port)
- .location(location)
- .start();
-
- Entities.dumpInfo(launcher.getApplications());
- }
-}