You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ol...@apache.org on 2017/05/16 09:50:03 UTC
[1/2] ambari git commit: AMBARI-21024. Support rpm/deb build for
ambari-infra-manager (oleewere)
Repository: ambari
Updated Branches:
refs/heads/trunk 38cc334e0 -> b97d268a1
AMBARI-21024. Support rpm/deb build for ambari-infra-manager (oleewere)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b97d268a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b97d268a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b97d268a
Branch: refs/heads/trunk
Commit: b97d268a1920c833fd8c7e94921a9148f7d2c398
Parents: e54252c
Author: oleewere <ol...@gmail.com>
Authored: Mon May 15 16:43:10 2017 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Tue May 16 11:46:18 2017 +0200
----------------------------------------------------------------------
ambari-infra/ambari-infra-assembly/pom.xml | 89 ++++++++++++++++++++
.../src/main/package/deb/manager/control | 22 +++++
.../src/main/package/deb/manager/postinst | 15 ++++
.../src/main/package/deb/manager/postrm | 15 ++++
.../src/main/package/deb/manager/preinst | 15 ++++
.../src/main/package/deb/manager/prerm | 15 ++++
ambari-infra/ambari-infra-manager/build.xml | 53 ++++++++++++
ambari-infra/ambari-infra-manager/pom.xml | 43 +++++++++-
.../org/apache/ambari/infra/InfraManager.java | 1 -
.../conf/batch/InfraManagerBatchConfig.java | 2 +-
.../src/main/resources/infraManager.sh | 20 +++++
11 files changed, 287 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-assembly/pom.xml b/ambari-infra/ambari-infra-assembly/pom.xml
index 51e5804..550d97c 100644
--- a/ambari-infra/ambari-infra-assembly/pom.xml
+++ b/ambari-infra/ambari-infra-assembly/pom.xml
@@ -38,6 +38,10 @@
<solr.client.mapping.path>${mapping.base.path}/${solr.client.package.name}</solr.client.mapping.path>
<solr.client.dir>${project.basedir}/../ambari-infra-solr-client</solr.client.dir>
<infra.solr.plugin.dir>${project.basedir}/../ambari-infra-solr-plugin</infra.solr.plugin.dir>
+ <infra-manager.package.name>ambari-infra-manager</infra-manager.package.name>
+ <infra-manager.dir>${project.basedir}/../ambari-infra-manager</infra-manager.dir>
+ <infra-manager.mapping.path>${mapping.base.path}/${infra-manager.package.name}</infra-manager.mapping.path>
+ <infra-manager.conf.mapping.path>/etc/${infra-manager.package.name}/conf</infra-manager.conf.mapping.path>
</properties>
<profiles>
@@ -118,6 +122,43 @@
</mappings>
</configuration>
</execution>
+ <execution>
+ <id>infra-manager</id>
+ <phase>package</phase>
+ <goals>
+ <goal>rpm</goal>
+ </goals>
+ <configuration>
+ <group>Development</group>
+ <name>${infra-manager.package.name}</name>
+ <mappings>
+ <mapping>
+ <directory>${infra-manager.mapping.path}</directory>
+ <sources>
+ <source>
+ <location>${infra-manager.dir}/target/package</location>
+ <excludes>
+ <exclude>log4j.xml</exclude>
+ <exclude>infra-manager.properties</exclude>
+ </excludes>
+ </source>
+ </sources>
+ </mapping>
+ <mapping>
+ <directory>${infra-manager.conf.mapping.path}</directory>
+ <sources>
+ <source>
+ <location>${infra-manager.dir}/target/package</location>
+ <includes>
+ <include>log4j.xml</include>
+ <include>infra-manager.properties</include>
+ </includes>
+ </source>
+ </sources>
+ </mapping>
+ </mappings>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin>
@@ -277,6 +318,49 @@
</dataSet>
</configuration>
</execution>
+
+ <execution>
+ <phase>package</phase>
+ <id>jdeb-infra-manager</id>
+ <goals>
+ <goal>jdeb</goal>
+ </goals>
+ <configuration>
+ <controlDir>${basedir}/src/main/package/deb/manager</controlDir>
+ <deb>${basedir}/target/${infra-manager.package.name}_${package-version}-${package-release}.deb</deb>
+ <skip>false</skip>
+ <skipPOMs>false</skipPOMs>
+ <dataSet>
+ <data>
+ <src>${infra-manager.dir}/target/ambari-infra-manager.tar.gz</src>
+ <type>archive</type>
+ <mapper>
+ <type>perm</type>
+ <user>root</user>
+ <group>root</group>
+ <prefix>${infra-manager.mapping.path}</prefix>
+ </mapper>
+ <excludes>
+ log4j.xml,infra-manager.properties
+ </excludes>
+ </data>
+ <data>
+ <src>${infra-manager.dir}/target/package</src>
+ <type>directory</type>
+ <mapper>
+ <prefix>${infra-manager.conf.mapping.path}</prefix>
+ <type>perm</type>
+ <user>root</user>
+ <group>root</group>
+ <filemode>644</filemode>
+ </mapper>
+ <includes>
+ log4j.xml,infra-manager.properties
+ </includes>
+ </data>
+ </dataSet>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin>
@@ -330,6 +414,11 @@
<artifactId>ambari-infra-solr-plugin</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.ambari</groupId>
+ <artifactId>ambari-infra-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/control
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/control b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/control
new file mode 100644
index 0000000..03663a0
--- /dev/null
+++ b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/control
@@ -0,0 +1,22 @@
+# 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: [[infra-manager.package.name]]
+Version: [[package-version]]-[[package-release]]
+Section: [[deb.section]]
+Priority: [[deb.priority]]
+Depends: [[deb.dependency.list]]
+Architecture: [[deb.architecture]]
+Description: [[description]]
+Maintainer: [[deb.publisher]]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postinst
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postinst b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postinst
new file mode 100644
index 0000000..21a01fa
--- /dev/null
+++ b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postinst
@@ -0,0 +1,15 @@
+#!/bin/bash
+# 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/ambari/blob/b97d268a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postrm
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postrm b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postrm
new file mode 100644
index 0000000..21a01fa
--- /dev/null
+++ b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postrm
@@ -0,0 +1,15 @@
+#!/bin/bash
+# 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/ambari/blob/b97d268a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/preinst
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/preinst b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/preinst
new file mode 100644
index 0000000..21a01fa
--- /dev/null
+++ b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/preinst
@@ -0,0 +1,15 @@
+#!/bin/bash
+# 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/ambari/blob/b97d268a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/prerm
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/prerm b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/prerm
new file mode 100644
index 0000000..21a01fa
--- /dev/null
+++ b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/prerm
@@ -0,0 +1,15 @@
+#!/bin/bash
+# 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/ambari/blob/b97d268a/ambari-infra/ambari-infra-manager/build.xml
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/build.xml b/ambari-infra/ambari-infra-manager/build.xml
new file mode 100644
index 0000000..c7954d9
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/build.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ 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 basedir="." default="build" name="infra-manager">
+ <property environment="env"/>
+ <property name="debuglevel" value="source,lines,vars"/>
+ <dirname property="builddir" file="build.xml"/>
+ <property name="target" value="1.7"/>
+ <property name="source" value="1.7"/>
+ <target name="init">
+ </target>
+ <target name="build"/>
+
+ <target name="package">
+ <delete dir="target/package"/>
+ <copy todir="target/package/libs" includeEmptyDirs="no">
+ <fileset dir="target/libs"/>
+ </copy>
+ <copy todir="target/package/libs" includeEmptyDirs="no">
+ <fileset file="target/*.jar"/>
+ </copy>
+ <copy todir="target/package" includeEmptyDirs="no">
+ <fileset file="src/main/resources/infraManager.sh"/>
+ <fileset file="target/classes/infra-manager.properties"/>
+ <fileset file="target/classes/log4j.xml"/>
+ </copy>
+ <chmod file="target/package/*.sh" perm="755"/>
+ <tar compression="gzip" destfile="target/ambari-infra-manager.tar.gz">
+ <tarfileset mode="755" dir="target/package">
+ <include name="*.sh"/>
+ </tarfileset>
+ <tarfileset mode="664" dir="target/package">
+ <exclude name="*.sh"/>
+ </tarfileset>
+ </tar>
+
+ </target>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-manager/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/pom.xml b/ambari-infra/ambari-infra-manager/pom.xml
index bd5bf03..b7708c2 100644
--- a/ambari-infra/ambari-infra-manager/pom.xml
+++ b/ambari-infra/ambari-infra-manager/pom.xml
@@ -43,7 +43,7 @@
</properties>
<build>
- <finalName>ambari-infra-manager</finalName>
+ <finalName>ambari-infra-manager_${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -69,6 +69,47 @@
<mainClass>org.apache.ambari.infra.InfraManager</mainClass>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.8</version>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
+ <outputDirectory>${basedir}/target/libs</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>false</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <ant antfile="build.xml">
+ <target name="package"/>
+ </ant>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java
index 227bab4..656127e 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java
@@ -142,7 +142,6 @@ public class InfraManager {
ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/api/v1/*");
jerseyServlet.setInitOrder(1);
jerseyServlet.setInitParameter("jersey.config.server.provider.packages","org.apache.ambari.infra.rest,io.swagger.jaxrs.listing");
-
context.getSessionHandler().getSessionManager().setMaxInactiveInterval(SESSION_TIMEOUT);
context.getSessionHandler().getSessionManager().getSessionCookieConfig().setName(INFRA_MANAGER_SESSION_ID);
http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/batch/InfraManagerBatchConfig.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/batch/InfraManagerBatchConfig.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/batch/InfraManagerBatchConfig.java
index a587ec2..7310626 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/batch/InfraManagerBatchConfig.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/batch/InfraManagerBatchConfig.java
@@ -104,7 +104,7 @@ public class InfraManagerBatchConfig {
dataSource.setDriverClassName("org.sqlite.JDBC");
dataSource.setUrl("jdbc:sqlite:" + sqliteDbFileLocation);
dataSource.setUsername(databaseUsername);
- dataSource.setUsername(databasePassword);
+ dataSource.setPassword(databasePassword);
return dataSource;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-manager/src/main/resources/infraManager.sh
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/resources/infraManager.sh b/ambari-infra/ambari-infra-manager/src/main/resources/infraManager.sh
new file mode 100644
index 0000000..9f40d5c
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/resources/infraManager.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+# 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.
+
+JVM="java"
+sdir="`dirname \"$0\"`"
+
+PATH=$JAVA_HOME/bin:$PATH $JVM -classpath "/etc/ambari-infra-manager/conf:$sdir:$sdir/libs/*" org.apache.ambari.infra.InfraManager ${1+"$@"}
\ No newline at end of file
[2/2] ambari git commit: AMBARI-21020. Support external story
locations in Log Search IT framework (oleewere)
Posted by ol...@apache.org.
AMBARI-21020. Support external story locations in Log Search IT framework (oleewere)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e54252c8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e54252c8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e54252c8
Branch: refs/heads/trunk
Commit: e54252c829f674919d51d38c33689cce7a17e075
Parents: 38cc334
Author: oleewere <ol...@gmail.com>
Authored: Mon May 15 12:12:36 2017 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Tue May 16 11:46:18 2017 +0200
----------------------------------------------------------------------
ambari-logsearch/README.md | 1 +
ambari-logsearch/ambari-logsearch-it/pom.xml | 6 ++
.../story/LogSearchBackendStories.java | 19 +---
.../logsearch/story/LogSearchStoryLocator.java | 97 ++++++++++++++++++++
.../logsearch/story/LogSearchUIStories.java | 10 +-
5 files changed, 114 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e54252c8/ambari-logsearch/README.md
----------------------------------------------------------------------
diff --git a/ambari-logsearch/README.md b/ambari-logsearch/README.md
index 92b98f9..d05f45a 100644
--- a/ambari-logsearch/README.md
+++ b/ambari-logsearch/README.md
@@ -45,5 +45,6 @@ mvn clean integration-test -Dbackend-tests failsafe:verify
xquartz
# then in an another window you can start ui tests
mvn clean integration-test -Dselenium-tests failsafe:verify
+# you can specify story file folde location with -Dbackend.stories.location and -Dui.stories.location (absolute file path) in the commands
```
Also you can run from the IDE, but make sure all of the ambari logsearch modules are built.
http://git-wip-us.apache.org/repos/asf/ambari/blob/e54252c8/ambari-logsearch/ambari-logsearch-it/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/pom.xml b/ambari-logsearch/ambari-logsearch-it/pom.xml
index 0058c80..81af9e8 100644
--- a/ambari-logsearch/ambari-logsearch-it/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-it/pom.xml
@@ -39,6 +39,8 @@
<failsafe-plugin.version>2.20</failsafe-plugin.version>
<forkCount>1</forkCount>
<docker.host>localhost</docker.host>
+ <backend.stories.location>NONE</backend.stories.location>
+ <ui.stories.location>NONE</ui.stories.location>
</properties>
<dependencies>
@@ -162,6 +164,7 @@
<systemPropertyVariables>
<log4j.configuration>file:${project.build.testOutputDirectory}/log4j.properties</log4j.configuration>
<docker.host>${docker.host}</docker.host>
+ <ui.stories.location>${ui.stories.location}</ui.stories.location>
</systemPropertyVariables>
</configuration>
</execution>
@@ -204,6 +207,7 @@
<systemPropertyVariables>
<log4j.configuration>file:${project.build.testOutputDirectory}/log4j.properties</log4j.configuration>
<docker.host>${docker.host}</docker.host>
+ <backend.stories.location>${backend.stories.location}</backend.stories.location>
</systemPropertyVariables>
</configuration>
</execution>
@@ -246,6 +250,8 @@
<systemPropertyVariables>
<log4j.configuration>file:${project.build.testOutputDirectory}/log4j.properties</log4j.configuration>
<docker.host>${docker.host}</docker.host>
+ <backend.stories.location>${backend.stories.location}</backend.stories.location>
+ <ui.stories.location>${ui.stories.location}</ui.stories.location>
</systemPropertyVariables>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/ambari/blob/e54252c8/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchBackendStories.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchBackendStories.java b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchBackendStories.java
index 46f2928..fa7a527 100644
--- a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchBackendStories.java
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchBackendStories.java
@@ -18,7 +18,6 @@
*/
package org.apache.ambari.logsearch.story;
-import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
@@ -27,31 +26,24 @@ import org.apache.ambari.logsearch.steps.SolrSteps;
import org.apache.ambari.logsearch.steps.LogSearchDockerSteps;
import org.jbehave.core.configuration.Configuration;
import org.jbehave.core.configuration.MostUsefulConfiguration;
-import org.jbehave.core.embedder.executors.SameThreadExecutors;
-import org.jbehave.core.io.LoadFromClasspath;
-import org.jbehave.core.io.StoryFinder;
-import org.jbehave.core.io.StoryPathResolver;
-import org.jbehave.core.io.UnderscoredCamelCaseResolver;
import org.jbehave.core.junit.JUnitStories;
-import org.jbehave.core.junit.JUnitStory;
import org.jbehave.core.reporters.Format;
import org.jbehave.core.reporters.StoryReporterBuilder;
import org.jbehave.core.steps.InjectableStepsFactory;
import org.jbehave.core.steps.InstanceStepsFactory;
import org.junit.Test;
-import javax.annotation.Nullable;
-import java.util.Arrays;
import java.util.List;
-import static org.jbehave.core.io.CodeLocations.codeLocationFromClass;
-
public class LogSearchBackendStories extends JUnitStories {
+ private static final String BACKEND_STORIES_LOCATION_PROPERTY = "backend.stories.location";
+ private static final String STORY_SUFFIX = ".story";
+
@Override
public Configuration configuration() {
return new MostUsefulConfiguration()
- .useStoryLoader(new LoadFromClasspath(this.getClass()))
+ .useStoryLoader(LogSearchStoryLocator.getStoryLoader(BACKEND_STORIES_LOCATION_PROPERTY, this.getClass()))
.useStoryReporterBuilder(
new StoryReporterBuilder().withFailureTrace(true).withDefaultFormats().withFormats(Format.CONSOLE, Format.TXT));
}
@@ -71,8 +63,7 @@ public class LogSearchBackendStories extends JUnitStories {
@Override
protected List<String> storyPaths() {
- List<String> backendStories = new StoryFinder()
- .findPaths(codeLocationFromClass(this.getClass()).getFile(), Arrays.asList("**/*.story"), null);
+ List<String> backendStories = LogSearchStoryLocator.findStories(BACKEND_STORIES_LOCATION_PROPERTY, STORY_SUFFIX, this.getClass());
return Lists.newArrayList(Collections2.filter(backendStories, new Predicate<String>() {
@Override
public boolean apply(String storyFileName) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/e54252c8/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchStoryLocator.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchStoryLocator.java b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchStoryLocator.java
new file mode 100644
index 0000000..bed7999
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchStoryLocator.java
@@ -0,0 +1,97 @@
+/*
+ * 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.ambari.logsearch.story;
+
+import com.google.common.collect.Lists;
+import org.apache.commons.lang.StringUtils;
+import org.jbehave.core.io.LoadFromClasspath;
+import org.jbehave.core.io.LoadFromRelativeFile;
+import org.jbehave.core.io.StoryFinder;
+import org.jbehave.core.io.StoryLoader;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.jbehave.core.io.CodeLocations.codeLocationFromClass;
+
+/**
+ * Helper class for loading story files from the classpath or externally - based on system properties
+ */
+public class LogSearchStoryLocator {
+
+ private LogSearchStoryLocator() {
+ }
+
+ /**
+ * Get the proper story loader based on story location property (if empty or NONE - use story loading from classpath)
+ * @param property Story location property (absolute path - folder)
+ * @param clazz Class of the *Stories object
+ */
+ public static StoryLoader getStoryLoader(String property, Class clazz) {
+ boolean useExternalStoryLocation = useExternalStoryLocation(property);
+ if (useExternalStoryLocation) {
+ try {
+ return new LoadFromRelativeFile(new URL("file://" + System.getProperty(property)));
+ } catch (Exception e) {
+ throw new RuntimeException("Cannot load story files from url: file://" + System.getProperty(property));
+ }
+ } else {
+ return new LoadFromClasspath(clazz);
+ }
+ }
+
+
+ /**
+ * Find stories based on story location property, if the property is not set or NONE, then the story files will be loaded from the classpath
+ * @param property Story location property (absolute path - folder)
+ * @param suffix Story suffix for specific stories - i.e. : .ui.story
+ * @param clazz Class of the *Stories object
+ */
+ public static List<String> findStories(String property, String suffix, Class clazz) {
+ List<String> stories = null;
+ if (useExternalStoryLocation(property)) {
+ stories = findStoriesInFolder(System.getProperty(property), suffix);
+ } else {
+ stories = new StoryFinder()
+ .findPaths(codeLocationFromClass(clazz).getFile(), Arrays.asList(String.format("**/*%s", suffix)), null);
+ }
+ return stories;
+ }
+
+ private static List<String> findStoriesInFolder(String folderAbsolutePath, String suffix) {
+ List<String> results = Lists.newArrayList();
+ File folder = new File(folderAbsolutePath);
+ File[] listOfFiles = folder.listFiles();
+ if (listOfFiles != null) {
+ for (File file : listOfFiles) {
+ if (file.getName().endsWith(suffix)) {
+ results.add(file.getName());
+ }
+ }
+ }
+ return results;
+ }
+
+ private static boolean useExternalStoryLocation(String property) {
+ String storyLocationProp = System.getProperty(property);
+ return StringUtils.isNotEmpty(storyLocationProp) && !"NONE".equals(storyLocationProp);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e54252c8/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchUIStories.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchUIStories.java b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchUIStories.java
index 217c50f..5417ab1 100644
--- a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchUIStories.java
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchUIStories.java
@@ -24,8 +24,6 @@ import org.apache.ambari.logsearch.steps.LogSearchUISteps;
import org.jbehave.core.configuration.Configuration;
import org.jbehave.core.Embeddable;
import org.jbehave.core.embedder.executors.SameThreadExecutors;
-import org.jbehave.core.io.LoadFromClasspath;
-import org.jbehave.core.io.StoryFinder;
import org.jbehave.core.junit.JUnitStories;
import org.jbehave.core.reporters.StoryReporterBuilder;
import org.jbehave.core.steps.InjectableStepsFactory;
@@ -52,6 +50,9 @@ public class LogSearchUIStories extends JUnitStories {
private WebDriverProvider driverProvider;
private SeleniumContext context;
+ private static final String UI_STORIES_LOCATION_PROPERTY = "ui.stories.location";
+ private static final String STORY_SUFFIX = ".ui.story";
+
public LogSearchUIStories() {
String dockerHost = System.getProperty("docker.host") != null ? System.getProperty("docker.host") : "localhost";
System.setProperty("REMOTE_WEBDRIVER_URL", String.format("http://%s:4444/wd/hub", dockerHost));
@@ -70,7 +71,7 @@ public class LogSearchUIStories extends JUnitStories {
return new SeleniumConfiguration()
.useSeleniumContext(context)
.useWebDriverProvider(driverProvider)
- .useStoryLoader(new LoadFromClasspath(embeddableClass))
+ .useStoryLoader(LogSearchStoryLocator.getStoryLoader(UI_STORIES_LOCATION_PROPERTY, this.getClass()))
.useStoryReporterBuilder(new StoryReporterBuilder()
.withCodeLocation(codeLocationFromClass(embeddableClass))
.withDefaultFormats()
@@ -86,7 +87,6 @@ public class LogSearchUIStories extends JUnitStories {
@Override
protected List<String> storyPaths() {
- return new StoryFinder()
- .findPaths(codeLocationFromClass(this.getClass()).getFile(), Arrays.asList("**/*.ui.story"), null);
+ return LogSearchStoryLocator.findStories(UI_STORIES_LOCATION_PROPERTY, STORY_SUFFIX, this.getClass());
}
}