brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [01/11] incubator-brooklyn git commit: remove simple-open-loop-policy, it is a bad example, and has an unavailable dependency; and notes on disabling maven incremental build
Date Tue, 11 Nov 2014 14:17:05 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master dc53cec5d -> 9352bbe90


remove simple-open-loop-policy, it is a bad example, and has an unavailable dependency; and
notes on disabling maven incremental build


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

Branch: refs/heads/master
Commit: df5fb25f4ed9a609a0e17b6b62d876cc87deb3b0
Parents: dc53cec
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Fri Nov 7 09:05:02 2014 +0000
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Tue Nov 11 10:46:48 2014 +0000

----------------------------------------------------------------------
 pom.xml                                         |   7 +
 .../examples/simple-open-loop-policy/README.md  |  63 --------
 .../examples/simple-open-loop-policy/pom.xml    | 150 -----------------
 .../resources/jmeter-test-plan.jmx              | 143 -----------------
 .../src/main/java/brooklyn/demo/Sms.java        |  63 --------
 .../demo/WebClusterDatabaseOpenLoopExample.java | 160 -------------------
 .../main/resources/visitors-creation-script.sql |  35 ----
 .../src/test/java/brooklyn/demo/SmsTest.java    |  50 ------
 8 files changed, 7 insertions(+), 664 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/df5fb25f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f40ed09..045f3a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -971,6 +971,13 @@
                                     <ignore />
                                   </action>
                                 </pluginExecution>
+                                <pluginExecution>
+                                  <action>
+                                    <execute>
+                                      <runOnIncremental>false</runOnIncremental>
+                                    </execute>
+                                  </action>
+                                </pluginExecution>
                             </pluginExecutions>
                         </lifecycleMappingMetadata>
                     </configuration>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/df5fb25f/sandbox/examples/simple-open-loop-policy/README.md
----------------------------------------------------------------------
diff --git a/sandbox/examples/simple-open-loop-policy/README.md b/sandbox/examples/simple-open-loop-policy/README.md
deleted file mode 100644
index de28c21..0000000
--- a/sandbox/examples/simple-open-loop-policy/README.md
+++ /dev/null
@@ -1,63 +0,0 @@
-Instructions for Running Examples
-=================================
-
-The commands below assume that the `brooklyn` script is on your $PATH, this project has been
built,
-and you are in this directory.  Adjust to taste for other configurations.
-
-  export BROOKLYN_CLASSPATH=$(pwd)/target/classes
-  
-  # Three-tier: auto-scaling app-server cluster fronted by nginx, MySql backend wired up,
on localhost
-  brooklyn launch --app brooklyn.demo.WebClusterDatabaseOpenLoopExample --location localhost
-
-The above requires passwordless `ssh localhost` and requires `gcc` to build `nginx`.
-You could instead target your favourite cloud, where this has been tried and tested:
-
-
-Redistributable embedded example:
-
-  # To build a redistributable tar.gz with a start.sh script
-  # which invokes the `main` method in the example class to start
-  # (the redistributable will be at:  target/brooklyn-?-bin.tar.gz )
-  mvn clean assembly:assembly
-
-For more information, please visit:
-
-  http://brooklyncentral.github.com/use/examples/webcluster/
-
-
-Developer Notes
-===============
-
-This example sends an SMS message when the cluster has reached its max size (and where the
auto-scaler policy
-would continue to increase the size if it were not capped). The message is sent using clickatell.com,
-using http://smsj.sourceforge.net.
-
-Because smsj is not available on maven central, you must obtain this library yourself and
install it into
-your local Maven repository:
-
-  wget -Osmsj-20051126.jar http://sourceforge.net/projects/smsj/files/smsj/smsj-snapshot-20051126/smsj-20051126.jar/download
-
-  mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file \
-      -Dfile=smsj-20051126.jar \
-      -DgroupId=io.brooklyn \ 
-      -DartifactId=org.marre.smsj \
-      -Dversion=1.0.0-20051126 \
-      -Dpackaging=jar
-
-----
-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.

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/df5fb25f/sandbox/examples/simple-open-loop-policy/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/examples/simple-open-loop-policy/pom.xml b/sandbox/examples/simple-open-loop-policy/pom.xml
deleted file mode 100644
index bbeaa2a..0000000
--- a/sandbox/examples/simple-open-loop-policy/pom.xml
+++ /dev/null
@@ -1,150 +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>jar</packaging>
-    <artifactId>brooklyn-sandbox-example-simple-open-loop-policy</artifactId>
-    <groupId>io.brooklyn.sandbox.example</groupId>
-    <name>Brooklyn Simple Web Cluster Example</name>
-
-    <!-- this is only needed for "mvn deploy"; the group and version can be extracted
-         and parent block removed to run this standalone -->
-    <parent>
-        <groupId>org.apache.brooklyn.example</groupId>
-        <artifactId>brooklyn-examples-parent</artifactId>
-        <version>0.7.0-SNAPSHOT</version>   <!-- BROOKLYN_VERSION -->
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>org.marre.smsj</artifactId>
-            <version>${org.marre.smsj.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-all</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-logback-xml</artifactId>
-            <version>${project.version}</version>
-            <optional>true</optional>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-test-support</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <pluginManagement>
-            <plugins>
-                <plugin>
-                    <groupId>org.apache.rat</groupId>
-                    <artifactId>apache-rat-plugin</artifactId>
-                    <configuration>
-                        <excludes combine.children="append">
-                            <exclude>**/localrepo/io/brooklyn/org.marre.smsj/1.0.0-20051126/org.marre.smsj-1.0.0-20051126.pom</exclude>
-                        </excludes>
-                    </configuration>
-                </plugin>
-            </plugins>
-        </pluginManagement>
-
-        <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>
-                                <!-- these can fail in eclipse trying to copy _from_ target/classes.
-                                         see http://jira.codehaus.org/browse/MDEP-259 -->
-                                <artifactItem>
-                                    <groupId>org.apache.brooklyn.example</groupId>
-                                    <artifactId>brooklyn-example-hello-world-webapp</artifactId>
-                                    <version>${project.version}</version>
-                                    <type>war</type>
-                                    <overWrite>true</overWrite>
-                                    <outputDirectory>target/classes</outputDirectory>
-                                    <destFileName>hello-world-webapp.war</destFileName>
-                                </artifactItem>
-                                <artifactItem>
-                                    <groupId>org.apache.brooklyn.example</groupId>
-                                    <artifactId>brooklyn-example-hello-world-sql-webapp</artifactId>
-                                    <version>${project.version}</version>
-                                    <type>war</type>
-                                    <overWrite>true</overWrite>
-                                    <outputDirectory>target/classes</outputDirectory>
-                                    <destFileName>hello-world-sql-webapp.war</destFileName>
-                                </artifactItem>
-                            </artifactItems>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <artifactId>maven-clean-plugin</artifactId>
-                <configuration>
-                    <filesets>
-                        <fileset>
-                            <directory>${project.basedir}</directory>
-							<includes>
-                                <include>${project.artifactId}/</include>
-                                <include>brooklyn*.log</include>
-                                <include>brooklyn*.log.*</include>
-                                <include>stacktrace.log</include>
-                            </includes>
-                        </fileset>
-                    </filesets>
-                </configuration>
-            </plugin>            
-<!-- TODO assembly not supported for this example, currently
-            <plugin>
--->
-                <!-- TODO assembly not supported for this example, currently -->
-                <!-- optional, with this block, `mvn assembly:assembly` will build a redistributable
tgz -->
-<!--
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <descriptors>
-                        <descriptor>src/main/assembly/assembly.xml</descriptor>
-                    </descriptors>
-                </configuration>
-            </plugin>
--->
-        </plugins>
-
-    </build>
-        
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/df5fb25f/sandbox/examples/simple-open-loop-policy/resources/jmeter-test-plan.jmx
----------------------------------------------------------------------
diff --git a/sandbox/examples/simple-open-loop-policy/resources/jmeter-test-plan.jmx b/sandbox/examples/simple-open-loop-policy/resources/jmeter-test-plan.jmx
deleted file mode 100644
index 0eb1741..0000000
--- a/sandbox/examples/simple-open-loop-policy/resources/jmeter-test-plan.jmx
+++ /dev/null
@@ -1,143 +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.
--->
-<jmeterTestPlan version="1.2" properties="2.1">
-  <hashTree>
-    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Brooklyn local webapp
test - load for localhost:8000" enabled="true">
-      <stringProp name="TestPlan.comments"></stringProp>
-      <boolProp name="TestPlan.functional_mode">false</boolProp>
-      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
-      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel"
testclass="Arguments" testname="User Defined Variables" enabled="true">
-        <collectionProp name="Arguments.arguments"/>
-      </elementProp>
-      <stringProp name="TestPlan.user_define_classpath"></stringProp>
-    </TestPlan>
-    <hashTree>
-      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Test Group
- hitting site with 8 threads" enabled="true">
-        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
-        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel"
testclass="LoopController" testname="Loop Controller" enabled="true">
-          <boolProp name="LoopController.continue_forever">false</boolProp>
-          <intProp name="LoopController.loops">-1</intProp>
-        </elementProp>
-        <stringProp name="ThreadGroup.num_threads">8</stringProp>
-        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
-        <longProp name="ThreadGroup.start_time">1326116677000</longProp>
-        <longProp name="ThreadGroup.end_time">1326116677000</longProp>
-        <boolProp name="ThreadGroup.scheduler">false</boolProp>
-        <stringProp name="ThreadGroup.duration"></stringProp>
-        <stringProp name="ThreadGroup.delay"></stringProp>
-      </ThreadGroup>
-      <hashTree>
-        <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Timer
- frequency 50 reqs/sec per thread (20 ms delay)" enabled="true">
-          <stringProp name="ConstantTimer.delay">20</stringProp>
-        </ConstantTimer>
-        <hashTree/>
-        <HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" testname="HTTP
Request - localhost:8000" enabled="true">
-          <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel"
testclass="Arguments" testname="User Defined Variables" enabled="true">
-            <collectionProp name="Arguments.arguments"/>
-          </elementProp>
-          <stringProp name="HTTPSampler.domain">localhost</stringProp>
-          <stringProp name="HTTPSampler.port">8000</stringProp>
-          <stringProp name="HTTPSampler.connect_timeout"></stringProp>
-          <stringProp name="HTTPSampler.response_timeout"></stringProp>
-          <stringProp name="HTTPSampler.protocol"></stringProp>
-          <stringProp name="HTTPSampler.contentEncoding"></stringProp>
-          <stringProp name="HTTPSampler.path"></stringProp>
-          <stringProp name="HTTPSampler.method">GET</stringProp>
-          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
-          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
-          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
-          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
-          <boolProp name="HTTPSampler.monitor">false</boolProp>
-          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
-        </HTTPSampler>
-        <hashTree/>
-        <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP
Cookie Manager" enabled="true">
-          <collectionProp name="CookieManager.cookies"/>
-          <boolProp name="CookieManager.clearEachIteration">false</boolProp>
-        </CookieManager>
-        <hashTree/>
-      </hashTree>
-      <ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary
Report" enabled="true">
-        <boolProp name="ResultCollector.error_logging">false</boolProp>
-        <objProp>
-          <name>saveConfig</name>
-          <value class="SampleSaveConfiguration">
-            <time>true</time>
-            <latency>true</latency>
-            <timestamp>true</timestamp>
-            <success>true</success>
-            <label>true</label>
-            <code>true</code>
-            <message>true</message>
-            <threadName>true</threadName>
-            <dataType>true</dataType>
-            <encoding>false</encoding>
-            <assertions>true</assertions>
-            <subresults>true</subresults>
-            <responseData>false</responseData>
-            <samplerData>false</samplerData>
-            <xml>true</xml>
-            <fieldNames>false</fieldNames>
-            <responseHeaders>false</responseHeaders>
-            <requestHeaders>false</requestHeaders>
-            <responseDataOnError>false</responseDataOnError>
-            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
-            <assertionsResultsToSave>0</assertionsResultsToSave>
-            <bytes>true</bytes>
-          </value>
-        </objProp>
-        <stringProp name="filename"></stringProp>
-      </ResultCollector>
-      <hashTree/>
-      <ResultCollector guiclass="SplineVisualizer" testclass="ResultCollector" testname="Spline
Visualizer" enabled="true">
-        <boolProp name="ResultCollector.error_logging">false</boolProp>
-        <objProp>
-          <name>saveConfig</name>
-          <value class="SampleSaveConfiguration">
-            <time>true</time>
-            <latency>true</latency>
-            <timestamp>true</timestamp>
-            <success>true</success>
-            <label>true</label>
-            <code>true</code>
-            <message>true</message>
-            <threadName>true</threadName>
-            <dataType>true</dataType>
-            <encoding>false</encoding>
-            <assertions>true</assertions>
-            <subresults>true</subresults>
-            <responseData>false</responseData>
-            <samplerData>false</samplerData>
-            <xml>true</xml>
-            <fieldNames>false</fieldNames>
-            <responseHeaders>false</responseHeaders>
-            <requestHeaders>false</requestHeaders>
-            <responseDataOnError>false</responseDataOnError>
-            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
-            <assertionsResultsToSave>0</assertionsResultsToSave>
-            <bytes>true</bytes>
-          </value>
-        </objProp>
-        <stringProp name="filename"></stringProp>
-      </ResultCollector>
-      <hashTree/>
-    </hashTree>
-  </hashTree>
-</jmeterTestPlan>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/df5fb25f/sandbox/examples/simple-open-loop-policy/src/main/java/brooklyn/demo/Sms.java
----------------------------------------------------------------------
diff --git a/sandbox/examples/simple-open-loop-policy/src/main/java/brooklyn/demo/Sms.java
b/sandbox/examples/simple-open-loop-policy/src/main/java/brooklyn/demo/Sms.java
deleted file mode 100644
index 9a3d52e..0000000
--- a/sandbox/examples/simple-open-loop-policy/src/main/java/brooklyn/demo/Sms.java
+++ /dev/null
@@ -1,63 +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 brooklyn.demo;
-
-import java.io.IOException;
-
-import org.marre.SmsSender;
-import org.marre.sms.SmsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Sms {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Sms.class);
-
-    private final String username;
-    private final String password;
-    private final String apiid;
-    private final String sender;
-
-    public Sms(String username, String password, String apiid) {
-        this.username = username;
-        this.password = password;
-        this.apiid = apiid;
-        this.sender = null;
-    }
-    
-    /**
-     * 
-     * @param receiver International number to reciever without leading "+"
-     * @param msg      The message that you want to send
-     * @throws IOException 
-     * @throws SmsException 
-     */
-    public void sendSms(String receiver, String msg) throws SmsException, IOException {
-        // Send SMS with clickatell
-        SmsSender smsSender = SmsSender.getClickatellSender(username, password, apiid);
-
-        smsSender.connect();
-        try {
-            String msgid = smsSender.sendTextSms(msg, receiver, sender);
-            LOG.debug("Sent SMS via {}@clickatell to {}, msg {}; id {}", new Object[] {username,
receiver, msg, msgid});
-        } finally {
-            smsSender.disconnect();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/df5fb25f/sandbox/examples/simple-open-loop-policy/src/main/java/brooklyn/demo/WebClusterDatabaseOpenLoopExample.java
----------------------------------------------------------------------
diff --git a/sandbox/examples/simple-open-loop-policy/src/main/java/brooklyn/demo/WebClusterDatabaseOpenLoopExample.java
b/sandbox/examples/simple-open-loop-policy/src/main/java/brooklyn/demo/WebClusterDatabaseOpenLoopExample.java
deleted file mode 100644
index 3af573f..0000000
--- a/sandbox/examples/simple-open-loop-policy/src/main/java/brooklyn/demo/WebClusterDatabaseOpenLoopExample.java
+++ /dev/null
@@ -1,160 +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 brooklyn.demo;
-
-import static brooklyn.entity.java.JavaEntityMethods.javaSysProp;
-import static brooklyn.event.basic.DependentConfiguration.attributeWhenReady;
-import static brooklyn.event.basic.DependentConfiguration.formatString;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.marre.sms.SmsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import brooklyn.enricher.basic.SensorPropagatingEnricher;
-import brooklyn.enricher.basic.SensorTransformingEnricher;
-import brooklyn.entity.basic.ApplicationBuilder;
-import brooklyn.entity.basic.Entities;
-import brooklyn.entity.basic.StartableApplication;
-import brooklyn.entity.database.mysql.MySqlNode;
-import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.entity.webapp.ControlledDynamicWebAppCluster;
-import brooklyn.entity.webapp.DynamicWebAppCluster;
-import brooklyn.entity.webapp.JavaWebAppService;
-import brooklyn.entity.webapp.WebAppService;
-import brooklyn.entity.webapp.WebAppServiceConstants;
-import brooklyn.event.AttributeSensor;
-import brooklyn.event.SensorEvent;
-import brooklyn.event.SensorEventListener;
-import brooklyn.event.basic.BasicNotificationSensor;
-import brooklyn.event.basic.Sensors;
-import brooklyn.launcher.BrooklynLauncher;
-import brooklyn.launcher.BrooklynServerDetails;
-import brooklyn.location.Location;
-import brooklyn.location.basic.PortRanges;
-import brooklyn.policy.autoscaling.AutoScalerPolicy;
-import brooklyn.policy.autoscaling.MaxPoolSizeReachedEvent;
-import brooklyn.util.CommandLineUtil;
-
-import com.google.common.base.Functions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-/**
- * Launches a 3-tier app with nginx, clustered jboss, and mysql.
- **/
-public class WebClusterDatabaseOpenLoopExample extends ApplicationBuilder {
-    
-    public static final Logger LOG = LoggerFactory.getLogger(WebClusterDatabaseOpenLoopExample.class);
-    
-    public static final String WAR_PATH = "classpath://hello-world-sql-webapp.war";
-    
-    public static final String DB_SETUP_SQL_URL = "classpath://visitors-creation-script.sql";
-    
-    public static final String DB_TABLE = "visitors";
-    public static final String DB_USERNAME = "brooklyn";
-    public static final String DB_PASSWORD = "br00k11n";
-    
-    // TODO Replace these with your details, for a clickatell.com account that has credit
to send SMS messages
-    public static final String CLICKATELL_USERNAME = "brooklyndemo.uk";
-    public static final String CLICKATELL_PASSWORD = "NAYLLHRLZEBYYA";
-    public static final String CLICKATELL_APIID = "3411519";
-    public static final String SMS_RECEIVER = "441234567890";
-
-    public static final AttributeSensor<Integer> APPSERVERS_COUNT = Sensors.newIntegerSensor(

-            "appservers.count", "Number of app servers deployed");
-
-    public static final BasicNotificationSensor<MaxPoolSizeReachedEvent> MAX_SIZE_REACHED
= new BasicNotificationSensor<MaxPoolSizeReachedEvent>(
-            MaxPoolSizeReachedEvent.class, "cluster.maxPoolSizeReached", "");
-
-    protected void doBuild() {
-        MySqlNode mysql = addChild(EntitySpec.create(MySqlNode.class)
-                .configure("creationScriptUrl", DB_SETUP_SQL_URL));
-        
-        ControlledDynamicWebAppCluster web = addChild(EntitySpec.create(ControlledDynamicWebAppCluster.class)
-                .configure(WebAppService.HTTP_PORT, PortRanges.fromString("8080+"))
-                .configure(JavaWebAppService.ROOT_WAR, WAR_PATH)
-                .configure(javaSysProp("brooklyn.example.db.url"), 
-                        formatString("jdbc:%s%s?user=%s\\&password=%s", 
-                                attributeWhenReady(mysql, MySqlNode.MYSQL_URL), 
-                                DB_TABLE, DB_USERNAME, DB_PASSWORD)));
-
-        // Subscribe not notifications about the auto-scaler policy reaching its max cluster
size 
-        getManagementContext().getSubscriptionManager().subscribe(
-                web.getCluster(), 
-                MAX_SIZE_REACHED, 
-                new SensorEventListener<MaxPoolSizeReachedEvent>() {
-                    @Override public void onEvent(SensorEvent<MaxPoolSizeReachedEvent>
event) {
-                        onMaxPoolSizeReached(event.getValue());
-                    }
-                });
-        
-        // simple scaling policy
-        web.getCluster().addPolicy(AutoScalerPolicy.builder().
-                metric(DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW_PER_NODE).
-                metricRange(10, 100).
-                sizeRange(1, 5).
-                maxSizeReachedSensor(MAX_SIZE_REACHED).
-//                maxReachedNotificationDelay(1000).
-                build());
-
-        // expose some KPI's
-        getApp().addEnricher(SensorPropagatingEnricher.newInstanceListeningTo(web,  
-                WebAppServiceConstants.ROOT_URL,
-                DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW));
-        getApp().addEnricher(new SensorTransformingEnricher<Integer,Integer>(web, 
-                DynamicWebAppCluster.GROUP_SIZE, APPSERVERS_COUNT, Functions.<Integer>identity()));
-    }
-
-    private void onMaxPoolSizeReached(MaxPoolSizeReachedEvent event) {
-        String msg = "Max-pool-size-reached: "+event;
-        System.out.println("*** "+msg);
-        
-        try {
-            new Sms(CLICKATELL_USERNAME, CLICKATELL_PASSWORD, CLICKATELL_APIID).sendSms(SMS_RECEIVER,
msg);
-        } catch (SmsException e) {
-            LOG.warn("Error sending SMS message: "+e.getMessage(), e);
-        } catch (IOException e) {
-            LOG.warn("Error sending SMS message", e);
-        }
-    }
-    
-    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()
-                .webconsolePort(port)
-                .start();
-        BrooklynServerDetails server = launcher.getServerDetails();
-        
-        Location loc = server.getManagementContext().getLocationRegistry().resolve(location);
-
-        StartableApplication app = new WebClusterDatabaseOpenLoopExample()
-                .appDisplayName("Brooklyn WebApp Cluster with Database example")
-                .manage(server.getManagementContext());
-        
-        app.start(ImmutableList.of(loc));
-        
-        Entities.dumpInfo(app);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/df5fb25f/sandbox/examples/simple-open-loop-policy/src/main/resources/visitors-creation-script.sql
----------------------------------------------------------------------
diff --git a/sandbox/examples/simple-open-loop-policy/src/main/resources/visitors-creation-script.sql
b/sandbox/examples/simple-open-loop-policy/src/main/resources/visitors-creation-script.sql
deleted file mode 100644
index 0a805c4..0000000
--- a/sandbox/examples/simple-open-loop-policy/src/main/resources/visitors-creation-script.sql
+++ /dev/null
@@ -1,35 +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.
---
-create database visitors;
-use visitors;
-create user 'brooklyn' identified by 'br00k11n';
-grant usage on *.* to 'brooklyn'@'%' identified by 'br00k11n';
-# ''@localhost is sometimes set up, overriding brooklyn@'%', so do a second explicit grant
-grant usage on *.* to 'brooklyn'@'localhost' identified by 'br00k11n';
-grant all privileges on visitors.* to 'brooklyn'@'%';
-flush privileges;
-
-CREATE TABLE MESSAGES (
-        id INT NOT NULL AUTO_INCREMENT,
-        NAME VARCHAR(30) NOT NULL,
-        MESSAGE VARCHAR(400) NOT NULL,
-        PRIMARY KEY (ID)
-    );
-
-INSERT INTO MESSAGES values (default, 'Isaac Asimov', 'I grew up in Brooklyn' );

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/df5fb25f/sandbox/examples/simple-open-loop-policy/src/test/java/brooklyn/demo/SmsTest.java
----------------------------------------------------------------------
diff --git a/sandbox/examples/simple-open-loop-policy/src/test/java/brooklyn/demo/SmsTest.java
b/sandbox/examples/simple-open-loop-policy/src/test/java/brooklyn/demo/SmsTest.java
deleted file mode 100644
index 8ea9119..0000000
--- a/sandbox/examples/simple-open-loop-policy/src/test/java/brooklyn/demo/SmsTest.java
+++ /dev/null
@@ -1,50 +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 brooklyn.demo;
-
-import org.marre.sms.SmsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.Test;
-
-public class SmsTest {
-
-    private static final Logger LOG = LoggerFactory.getLogger(SmsTest.class);
-
-    @Test(groups="Integration")
-    public void testSendSms() throws Exception {
-        // http://api.clickatell.com/http/sendmsg?user=brooklyndemo.uk&password=PASSWORD&api_id=3411519&to=447709428472&text=Message
-        // Note this account has *no* credit card details; sending a message will result
in a standard message from Clickatell.com,
-        // rather than receiving the actual message body.
-        //
-        // TODO It's started failing with "Error 301, No Credit Left"
-        // How to commit something that passes but without exposing credit card details?!
-        Sms sender = new Sms("brooklyndemo.uk", "NAYLLHRLZEBYYA", "3411519");
-        try {
-            sender.sendSms("447709428472", "test sms sent in brooklyn");
-        } catch (SmsException e) {
-            if (e.toString().contains("Error 301, No Credit Left")) {
-                // fair enough; let's not fail the test for this reason
-                LOG.warn("Cannot test SMS because no credit left on account: "+e.toString());
-            } else {
-                throw e;
-            }
-        }
-    }
-}


Mime
View raw message