This closes #38
diff --git a/deb-packaging/pom.xml b/deb-packaging/pom.xml
index fea43b6..c96a8fd 100644
--- a/deb-packaging/pom.xml
+++ b/deb-packaging/pom.xml
@@ -20,6 +20,7 @@
<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>deb-packaging</artifactId>
+ <packaging>pom</packaging>
<name>Brooklyn DEB Package</name>
<description>
Brooklyn DEB Package for Debian and Ubuntu operating systems
@@ -38,10 +39,47 @@
<artifactId>brooklyn-dist</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.brooklyn</groupId>
+ <artifactId>shared-packaging</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.brooklyn</groupId>
+ <artifactId>brooklyn-dist</artifactId>
+ <version>${project.version}</version>
+ <classifier>dist</classifier>
+ <type>tar.gz</type>
+ <outputDirectory>${project.build.directory}/deps</outputDirectory>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.brooklyn</groupId>
+ <artifactId>shared-packaging</artifactId>
+ <version>${project.version}</version>
+ <type>jar</type>
+ <outputDirectory>${project.build.directory}/deps/shared-packaging</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<artifactId>jdeb</artifactId>
<groupId>org.vafer</groupId>
<version>1.5</version>
@@ -52,36 +90,38 @@
<goal>jdeb</goal>
</goals>
<configuration>
- <verbose>true</verbose>
+ <verbose>false</verbose>
+ <skipPOMs>false</skipPOMs>
<deb>${project.build.directory}/apache-brooklyn_${project.version}_all.deb</deb>
<controlDir>${basedir}/deb/control</controlDir>
<dataSet>
<data>
- <src>../dist/target/brooklyn-dist</src>
+ <src>${project.build.directory}/deps/brooklyn-dist-${project.version}</src>
<type>directory</type>
<mapper>
<type>perm</type>
- <prefix>/opt</prefix>
+ <prefix>/opt/brooklyn</prefix>
<user>brooklyn</user>
<group>brooklyn</group>
</mapper>
</data>
<data>
- <src>../src/service/upstart/deb/brooklyn.conf</src>
+ <src>${project.build.directory}/deps/shared-packaging/service/upstart/deb/brooklyn.conf</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/etc/init</prefix>
- <filemode>755</filemode>
+ <filemode>644</filemode>
</mapper>
</data>
<data>
- <src>../src/service/systemd/brooklyn.service</src>
+ <!-- TODO Probably should live in /usr/lib/systemd/system with a symlink in the following folder -->
+ <src>${project.build.directory}/deps/shared-packaging/service/systemd/brooklyn.service</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/etc/systemd/system/multi-user.target.wants</prefix>
- <filemode>755</filemode>
+ <filemode>644</filemode>
</mapper>
</data>
<data>
@@ -89,7 +129,6 @@
<paths>
<path>etc/brooklyn</path>
<path>var/lib/brooklyn</path>
- <path>var/log/brooklyn</path>
</paths>
<mapper>
<type>perm</type>
@@ -98,7 +137,19 @@
</mapper>
</data>
<data>
- <src>../src/conf/brooklyn.conf</src>
+ <type>template</type>
+ <paths>
+ <path>var/log/brooklyn</path>
+ </paths>
+ <mapper>
+ <type>perm</type>
+ <user>brooklyn</user>
+ <group>brooklyn</group>
+ <filemode>700</filemode>
+ </mapper>
+ </data>
+ <data>
+ <src>${project.build.directory}/deps/shared-packaging/conf/brooklyn.conf</src>
<type>file</type>
<conffile>true</conffile>
<mapper>
@@ -110,7 +161,7 @@
</mapper>
</data>
<data>
- <src>../src/conf/logback.xml</src>
+ <src>${project.build.directory}/deps/shared-packaging/conf/logback.xml</src>
<type>file</type>
<conffile>true</conffile>
<mapper>
diff --git a/downstream-parent/pom.xml b/downstream-parent/pom.xml
index 855d35c..560a208 100644
--- a/downstream-parent/pom.xml
+++ b/downstream-parent/pom.xml
@@ -416,8 +416,32 @@
</file>
</activation>
<build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <version>1.3</version>
+ <configuration>
+ <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
@@ -462,6 +486,8 @@
server's features list.
-->
<Brooklyn-Feature-Name>${project.name}</Brooklyn-Feature-Name>
+ <Implementation-SHA-1>${buildNumber}</Implementation-SHA-1>
+ <Implementation-Branch>${scmBranch}</Implementation-Branch>
</instructions>
</configuration>
</plugin>
diff --git a/pom.xml b/pom.xml
index bd8bc94..74b5564 100644
--- a/pom.xml
+++ b/pom.xml
@@ -121,6 +121,7 @@
<module>dist</module>
<module>vagrant</module>
<module>archetypes/quickstart</module>
+ <module>shared-packaging</module>
</modules>
<build>
diff --git a/rpm-packaging/pom.xml b/rpm-packaging/pom.xml
index 02d2cf6..eba5163 100644
--- a/rpm-packaging/pom.xml
+++ b/rpm-packaging/pom.xml
@@ -39,10 +39,47 @@
<artifactId>brooklyn-dist</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.brooklyn</groupId>
+ <artifactId>shared-packaging</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.brooklyn</groupId>
+ <artifactId>brooklyn-dist</artifactId>
+ <version>${project.version}</version>
+ <classifier>dist</classifier>
+ <type>tar.gz</type>
+ <outputDirectory>${project.build.directory}/deps</outputDirectory>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.brooklyn</groupId>
+ <artifactId>shared-packaging</artifactId>
+ <version>${project.version}</version>
+ <type>jar</type>
+ <outputDirectory>${project.build.directory}/deps/shared-packaging</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1.5</version>
@@ -67,15 +104,14 @@
<defineStatements>
<defineStatement>_binaries_in_noarch_packages_terminate_build 0</defineStatement>
</defineStatements>
+ <defaultDirmode>755</defaultDirmode>
+ <defaultFilemode>644</defaultFilemode>
+ <defaultGroupname>brooklyn</defaultGroupname>
+ <defaultUsername>brooklyn</defaultUsername>
<mappings>
<mapping>
<directory>/etc/brooklyn</directory>
<configuration>true</configuration>
- <sources>
- <source>
- <location>../src/conf</location>
- </source>
- </sources>
</mapping>
<mapping>
<directory>/etc/brooklyn</directory>
@@ -85,39 +121,30 @@
<groupname>brooklyn</groupname>
<sources>
<source>
- <location>../src/conf/brooklyn.conf</location>
+ <location>${project.build.directory}/deps/shared-packaging/conf/brooklyn.conf</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/etc/brooklyn</directory>
<configuration>true</configuration>
- <filemode>644</filemode>
- <username>brooklyn</username>
- <groupname>brooklyn</groupname>
<sources>
<source>
- <location>../src/conf/logback.xml</location>
+ <location>${project.build.directory}/deps/shared-packaging/conf/logback.xml</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/opt/brooklyn</directory>
- <filemode>755</filemode>
- <username>brooklyn</username>
- <groupname>brooklyn</groupname>
<sources>
<source>
- <location>../dist/target/brooklyn-dist/brooklyn</location>
+ <location>${project.build.directory}/deps/brooklyn-dist-${project.version}</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/var/lib/brooklyn</directory>
<configuration>true</configuration>
- <filemode>755</filemode>
- <username>brooklyn</username>
- <groupname>brooklyn</groupname>
</mapping>
<mapping>
<directory>/var/log/brooklyn</directory>
@@ -128,23 +155,25 @@
</mapping>
<mapping>
<directory>/etc/systemd/system/multi-user.target.wants</directory>
- <filemode>755</filemode>
+ <directoryIncluded>false</directoryIncluded>
+ <filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<sources>
<source>
- <location>../src/service/systemd</location>
+ <location>${project.build.directory}/deps/shared-packaging/service/systemd</location>
</source>
</sources>
</mapping>
<mapping>
- <directory>/etc/init/</directory>
- <filemode>755</filemode>
+ <directory>/etc/init</directory>
+ <directoryIncluded>false</directoryIncluded>
+ <filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<sources>
<source>
- <location>../src/service/upstart/rpm/</location>
+ <location>${project.build.directory}/deps/shared-packaging/service/upstart/rpm/</location>
</source>
</sources>
</mapping>
diff --git a/shared-packaging/pom.xml b/shared-packaging/pom.xml
new file mode 100644
index 0000000..8e00f6e
--- /dev/null
+++ b/shared-packaging/pom.xml
@@ -0,0 +1,44 @@
+<?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>shared-packaging</artifactId>
+ <packaging>jar</packaging>
+ <name>Brooklyn Shared Package Files</name>
+ <description>
+ Brooklyn shared files for creating RPM and DEB packages
+ </description>
+
+ <parent>
+ <groupId>org.apache.brooklyn</groupId>
+ <artifactId>brooklyn-dist-root</artifactId>
+ <version>0.10.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION -->
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <dependencies>
+ <!-- Not really used, but because of the src/test folder the testing profile is activated and requires the testng as a dependency -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/src/conf/brooklyn.conf b/shared-packaging/src/main/resources/conf/brooklyn.conf
similarity index 100%
rename from src/conf/brooklyn.conf
rename to shared-packaging/src/main/resources/conf/brooklyn.conf
diff --git a/src/conf/logback.xml b/shared-packaging/src/main/resources/conf/logback.xml
similarity index 100%
rename from src/conf/logback.xml
rename to shared-packaging/src/main/resources/conf/logback.xml
diff --git a/src/service/systemd/brooklyn.service b/shared-packaging/src/main/resources/service/systemd/brooklyn.service
similarity index 100%
rename from src/service/systemd/brooklyn.service
rename to shared-packaging/src/main/resources/service/systemd/brooklyn.service
diff --git a/src/service/upstart/deb/brooklyn.conf b/shared-packaging/src/main/resources/service/upstart/deb/brooklyn.conf
similarity index 98%
rename from src/service/upstart/deb/brooklyn.conf
rename to shared-packaging/src/main/resources/service/upstart/deb/brooklyn.conf
index fc7be9e..63c454e 100644
--- a/src/service/upstart/deb/brooklyn.conf
+++ b/shared-packaging/src/main/resources/service/upstart/deb/brooklyn.conf
@@ -26,7 +26,7 @@
setuid brooklyn
setgid brooklyn
-console output
+console log
pre-start script
logger -i -t "$UPSTART_JOB" "[`date -u +%Y-%m-%dT%T.%3NZ`] Starting Apache Brooklyn"
diff --git a/src/service/upstart/rpm/brooklyn.conf b/shared-packaging/src/main/resources/service/upstart/rpm/brooklyn.conf
similarity index 93%
rename from src/service/upstart/rpm/brooklyn.conf
rename to shared-packaging/src/main/resources/service/upstart/rpm/brooklyn.conf
index e9c5e20..77beb54 100644
--- a/src/service/upstart/rpm/brooklyn.conf
+++ b/shared-packaging/src/main/resources/service/upstart/rpm/brooklyn.conf
@@ -18,7 +18,7 @@
description "Apache Brooklyn upstart script"
author "Aleksandr Vasilev aleksandr.vasilev@cloudsoftcorp.com"
-start on started networking
+start on runlevel [23]
stop on runlevel [016]
respawn
respawn limit 5 10
@@ -34,6 +34,7 @@
JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 -Dlogback.configurationFile=/etc/brooklyn/logback.xml -Xms256m -Xmx1g -XX:MaxPermSize=256m"
CLASSPATH="/opt/brooklyn/conf:/opt/brooklyn/lib/patch/*:/opt/brooklyn/lib/brooklyn/*:/opt/brooklyn/lib/dropins/*"
export BROOKLYN_HOME
+ # Upstart is too old on CentOS 6, at least v1.4 required to use setuid, setgid.
chsh -s /bin/bash brooklyn
exec su -c "java ${JAVA_OPTS} -cp $CLASSPATH org.apache.brooklyn.cli.Main launch --noGlobalBrooklynProperties --localBrooklynProperties /etc/brooklyn/brooklyn.conf --persist auto" brooklyn
end script
diff --git a/shared-packaging/src/test/yaml/package-apps.yaml b/shared-packaging/src/test/yaml/package-apps.yaml
new file mode 100644
index 0000000..5009e56
--- /dev/null
+++ b/shared-packaging/src/test/yaml/package-apps.yaml
@@ -0,0 +1,103 @@
+#
+# 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.
+#
+services:
+- type: test-apt-systemd-brooklyn
+ name: 1. apt-systemd
+ location:
+ byon:
+ hosts: ["172.28.128.3"]
+ # privateKeyFile: ~/.ssh/<private key>
+ user: vagrant
+ brooklyn.config:
+ files.preinstall:
+ ~/.m2/repository/org/apache/brooklyn/deb-packaging/0.10.0-SNAPSHOT/deb-packaging-0.10.0-SNAPSHOT.deb: brooklyn-package.deb # BROOKLYN_VERSION
+
+---
+
+services:
+- type: test-apt-upstart-brooklyn
+ name: 2. apt-upstart
+ location:
+ byon:
+ hosts: ["172.28.128.4"]
+ # privateKeyFile: ~/.ssh/<private key>
+ user: vagrant
+ brooklyn.config:
+ files.preinstall:
+ ~/.m2/repository/org/apache/brooklyn/deb-packaging/0.10.0-SNAPSHOT/deb-packaging-0.10.0-SNAPSHOT.deb: brooklyn-package.deb # BROOKLYN_VERSION
+
+---
+
+services:
+- type: test-yum-systemd-brooklyn
+ name: 3. yum-systemd
+ location:
+ byon:
+ hosts: ["172.28.128.5"]
+ # privateKeyFile: ~/.ssh/<private key>
+ user: vagrant
+ brooklyn.config:
+ files.preinstall:
+ ~/.m2/repository/org/apache/brooklyn/rpm-packaging/0.10.0-SNAPSHOT/rpm-packaging-0.10.0-SNAPSHOT.rpm: brooklyn-package.rpm # BROOKLYN_VERSION
+
+---
+
+services:
+- type: test-yum-upstart-brooklyn
+ name: 4. yum-upstart
+ location:
+ byon:
+ hosts: ["172.28.128.6"]
+ # privateKeyFile: ~/.ssh/<private key>
+ user: vagrant
+ brooklyn.config:
+ files.preinstall:
+ ~/.m2/repository/org/apache/brooklyn/rpm-packaging/0.10.0-SNAPSHOT/rpm-packaging-0.10.0-SNAPSHOT.rpm: brooklyn-package.rpm # BROOKLYN_VERSION
+
+
+---
+
+# Vagrantfile
+Vagrant.configure(2) do |config|
+ config.vm.provider "virtualbox" do |vb|
+ vb.memory = "1024"
+ vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
+ vb.customize ["modifyvm", :id, "--nictype2", "virtio"]
+ end
+ config.vm.provision "shell", privileged: false, inline: <<-SHELL
+ echo "<REPLACE public key fingerprint>" >> ~/.ssh/authorized_keys
+ SHELL
+
+ config.vm.define "apt-systemd" do |config|
+ config.vm.box = "ubuntu/wily64"
+ config.vm.network "private_network", ip: "172.28.128.3"
+ end
+ config.vm.define "apt-upstart" do |config|
+ config.vm.box = "ubuntu/trusty64"
+ config.vm.network "private_network", ip: "172.28.128.4"
+ end
+ config.vm.define "yum-systemd" do |config|
+ config.vm.box = "centos/7"
+ config.vm.network "private_network", ip: "172.28.128.5"
+ end
+ config.vm.define "yum-upstart" do |config|
+ config.vm.box = "nrel/CentOS-6.5-x86_64"
+ config.vm.network "private_network", ip: "172.28.128.6"
+ end
+end
diff --git a/shared-packaging/src/test/yaml/package.bom b/shared-packaging/src/test/yaml/package.bom
new file mode 100644
index 0000000..7c951cf
--- /dev/null
+++ b/shared-packaging/src/test/yaml/package.bom
@@ -0,0 +1,273 @@
+#
+# 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.
+#
+brooklyn.catalog:
+ version: 0.10.0-SNAPSHOT # BROOKLYN_VERSION
+### brooklyn install entities ###
+ apt-config: &apt-config
+ install.command: |
+ sudo apt-get update
+ sudo apt-get install -y default-jre-headless
+ sudo dpkg -i brooklyn-package.deb
+ yum-config: &yum-config
+ install.command: |
+ if sudo iptables -L | grep REJECT; then
+ # Only for CentOS 6
+ sudo iptables -I INPUT -p tcp -m tcp --dport 8081 -j ACCEPT
+ sudo service iptables save
+ fi
+ sudo yum -y install java-1.7.0-openjdk.x86_64
+ sudo yum -y install brooklyn-package.rpm
+ items:
+ - id: systemd-brooklyn
+ item:
+ type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
+ brooklyn.config:
+ launch.command: |
+ sudo systemctl start brooklyn
+ checkRunning.command: |
+ sudo systemctl status brooklyn
+ stop.command: |
+ sudo systemctl stop brooklyn
+ - id: upstart-brooklyn
+ item:
+ type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
+ brooklyn.config:
+ launch.command: |
+ sudo status brooklyn | grep running || sudo start brooklyn
+ checkRunning.command: |
+ sudo status brooklyn | grep running
+ stop.command: |
+ sudo stop brooklyn
+ - id: apt-systemd-brooklyn
+ item:
+ type: systemd-brooklyn
+ id: brooklyn
+ brooklyn.config: *apt-config
+ - id: apt-upstart-brooklyn
+ item:
+ type: upstart-brooklyn
+ id: brooklyn
+ brooklyn.config: *apt-config
+ - id: yum-systemd-brooklyn
+ item:
+ type: systemd-brooklyn
+ id: brooklyn
+ brooklyn.config: *yum-config
+ - id: yum-upstart-brooklyn
+ item:
+ type: upstart-brooklyn
+ id: brooklyn
+ brooklyn.config: *yum-config
+### Tests ###
+ - id: test-is-up
+ item:
+ type: org.apache.brooklyn.test.framework.TestSensor
+ name: Check server is up
+ sensor: service.isUp
+ assert:
+ - equals: true
+ - id: test-is-not-up
+ item:
+ type: org.apache.brooklyn.test.framework.TestSensor
+ name: Check server is up
+ sensor: service.isUp
+ assert:
+ - equals: false
+ - id: test-process-running
+ item:
+ type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
+ name: Check process has started
+ # The brackets prevent grep from matching its own process
+ command: ps ax | grep "[o]rg.apache.brooklyn.cli.Main"
+ assertStatus:
+ equals: 0
+ assertOut:
+ isEmpty: false
+ assertErr:
+ isEmpty: true
+ - id: test-process-not-running
+ item:
+ type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
+ name: Check process is not started
+ # The brackets prevent grep from matching its own process
+ command: ps ax | grep "[o]rg.apache.brooklyn.cli.Main"
+ assertStatus:
+ equals: 1
+ assertOut:
+ isEmpty: true
+ assertErr:
+ isEmpty: true
+ - id: test-process-user
+ item:
+ type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
+ name: Check user the process is running under
+ # The brackets prevent grep from matching its own process
+ command: ps -fu brooklyn | grep "[o]rg.apache.brooklyn.cli.Main"
+ assertStatus:
+ equals: 0
+ assertOut:
+ isEmpty: false
+ assertErr:
+ isEmpty: true
+ - id: test-port-reachable
+ item:
+ type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: Check HTTP Response Status Code
+ url:
+ $brooklyn:formatString:
+ - "http://%s:8081/"
+ - $brooklyn:entity("brooklyn").attributeWhenReady("host.address")
+ applyAssertionTo: status
+ assert:
+ - isEqualTo: 401
+ - id: test-path-permissions
+ item:
+ type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
+ name: Check paths permissions
+ command: |
+ [ "$(stat -c "%A %U %G" /opt/brooklyn)" = "drwxr-xr-x brooklyn brooklyn" ] && \
+ [ "$(stat -c "%A %U %G" /var/lib/brooklyn)" = "drwxr-xr-x brooklyn brooklyn" ] && \
+ [ "$(stat -c "%A %U %G" /var/log/brooklyn)" = "drwx------ brooklyn brooklyn" ] && \
+ [ "$(stat -c "%A %U %G" /etc/systemd/system/multi-user.target.wants)" = "drwxr-xr-x root root" ] && \
+ [ "$(sudo stat -c "%A %U %G" /etc/systemd/system/multi-user.target.wants/brooklyn.service)" = "-rw-r--r-- root root" ] && \
+ [ "$(stat -c "%A %U %G" /etc/init)" = "drwxr-xr-x root root" ] && \
+ [ "$(stat -c "%A %U %G" /etc/init/brooklyn.conf)" = "-rw-r--r-- root root" ] && \
+ [ "$(stat -c "%A %U %G" /etc/brooklyn)" = "drwxr-xr-x brooklyn brooklyn" ] && \
+ [ "$(sudo stat -c "%A %U %G" /etc/brooklyn/brooklyn.conf)" = "-rw------- brooklyn brooklyn" ] && \
+ [ "$(stat -c "%A %U %G" /etc/brooklyn/logback.xml)" = "-rw-r--r-- brooklyn brooklyn" ] && \
+ ! find /opt/brooklyn | xargs stat -c "%A %U %G" | grep -v "drwxr-xr-x brooklyn brooklyn\|-rw-r--r-- brooklyn brooklyn"
+ assertStatus:
+ equals: 0
+ - id: test-log-files-exist
+ item:
+ type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
+ name: Check log files created at expected location
+ command: sudo ls /var/log/brooklyn/brooklyn.{debug,info}.log | wc -l
+ assertOut:
+ equals: "2"
+ - id: test-healthy
+ item:
+ type: org.apache.brooklyn.test.framework.TestCase
+ name: Check entity is healthy
+ brooklyn.children:
+ - type: test-is-up
+ name: 001. Test isUp
+ - type: test-process-running
+ name: 002. Test process is running
+ - type: test-port-reachable
+ name: 003. Test port is reachable
+ - id: test-start
+ item:
+ type: org.apache.brooklyn.test.framework.TestEffector
+ name: Invoke start Effector
+ effector: start
+ - id: test-stop
+ item:
+ type: org.apache.brooklyn.test.framework.TestEffector
+ name: Invoke stop Effector
+ effector: stop
+ params:
+ stopMachineMode: NEVER
+ - id: test-restart
+ item:
+ type: org.apache.brooklyn.test.framework.TestEffector
+ name: Invoke restart Effector
+ effector: restart
+ params:
+ restartMachine: false
+ - id: test-restart-machine
+ item:
+ type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
+ name: Restart the machine
+ command: sudo shutdown -r now
+ assertStatus:
+ # Replacement for anything accepted
+ # Could be 0 or -1, depending on whether the socket closes before restart takes place
+ notNull: true
+ - id: packaging-asserts
+ item:
+ type: org.apache.brooklyn.test.framework.TestCase
+ targetId: brooklyn
+ brooklyn.config:
+ timeout: 1m
+ brooklyn.children:
+ - type: test-is-up
+ name: 01. Block until started
+ brooklyn.config:
+ timeout: 10m
+ - type: test-healthy
+ name: 02. Check healthy
+ - type: test-process-user
+ name: 03. Test process user
+ - type: test-path-permissions
+ name: 04. Test paths permissions
+ - type: test-log-files-exist
+ name: 05. Check log files created
+ - type: test-stop
+ name: 06. Test stop effector
+ - type: test-is-not-up
+ name: 07. Check not running
+ - type: test-process-not-running
+ name: 08. Check process not running
+ - type: test-start
+ name: 09. Test start effector
+ - type: test-healthy
+ name: 10. Check healthy
+ - type: test-restart
+ name: 11. Test restart effector
+ - type: test-healthy
+ name: 12. Check healthy
+ - type: test-restart-machine
+ name: 13. Restart machine
+ - type: test-is-not-up
+ name: 14. Check not running while restarting
+ - type: test-healthy
+ name: 15. Check healthy
+### Combined tests with target entity - system specific ###
+ - id: test-yum-upstart-brooklyn
+ item:
+ type: org.apache.brooklyn.entity.stock.BasicApplication
+ brooklyn.children:
+ - type: yum-upstart-brooklyn
+ - type: packaging-asserts
+ - id: test-yum-systemd-brooklyn
+ item:
+ type: org.apache.brooklyn.entity.stock.BasicApplication
+ brooklyn.children:
+ - type: yum-systemd-brooklyn
+ - type: packaging-asserts
+ - id: test-apt-upstart-brooklyn
+ item:
+ type: org.apache.brooklyn.entity.stock.BasicApplication
+ brooklyn.children:
+ - type: apt-upstart-brooklyn
+ - type: packaging-asserts
+ - id: test-apt-systemd-brooklyn
+ item:
+ type: org.apache.brooklyn.entity.stock.BasicApplication
+ brooklyn.children:
+ - type: apt-systemd-brooklyn
+ - type: packaging-asserts
+### How to use in a blueprint:
+### location: xxx
+### services:
+### - type: test-apt-systemd-brooklyn
+### brooklyn.config:
+### files.preinstall:
+### <path to package>: brooklyn-package.{deb, rpm}