[rhq] Changes to 'mtho11/d3-charts-master'
by mike thompson
New branch 'mtho11/d3-charts-master' available with the following commits:
commit 8e405b094f954f50f6b44801ec85cb072a1a2532
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Wed Feb 27 16:15:47 2013 -0800
Charting - Update d3.js version to 3.0.6.
commit e370b3e4d5a44747f9a453e23afd3f7e60296766
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Wed Feb 27 13:29:03 2013 -0800
Charting - Add Availability Hovers to new availability graph section.
commit 9186a0490b47c9ea158f7a69a86e4d33c1e9fd06
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Wed Feb 27 08:57:43 2013 -0800
Charting - Change the terms Time --> Start and Bar --> Duration in the bundles.
commit e539c49ea05a20e43c4d5a8e9f738dc6cc6a536d
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Feb 26 12:40:56 2013 -0800
Charting - Incorporate changes from charting meeting.
commit 6c4d0873c8b5ce9cdff1bb92a4a00f50846ea3df
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Feb 26 08:18:15 2013 -0800
Charting - Incorporate changes from charting meeting.
commit e2085fa80a7a9c1eeabe2e85edf0e648debbca42
Merge: 014aa67 503f985
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Mon Feb 25 13:59:40 2013 -0800
Merge branch 'master' into mtho11/d3-charts-master
commit 014aa67831f645ca92fea1a32e81dd9cdde029b9
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Sun Feb 17 15:59:42 2013 -0800
Charting - Add new availability graph seperate from metric graphs.
commit 8606abb01073bedc1aa105fa19a2524c74995d98
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Fri Feb 15 14:38:58 2013 -0800
Charting - Change the chart titles so min, avg, peak data is shown to the side of the chart and not at the top.
commit 8b917ea286b03791bbe6e2e5a8d62b5d32723fc2
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Fri Feb 15 12:46:18 2013 -0800
Charting - Remove Availability from current charts. Unknown and Down bars become same as no data bars except with different hovers to convey availability status.
commit 2a6f8c37f36c2ced605ad64be629b6761cd6aba0
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Fri Feb 15 12:23:02 2013 -0800
Charting - Remove Availability from current charts. Unknown and Down bars become same as no data bars except with different hovers to convey availability status.
commit ccd21cfb0b56342100aa1fd2df358ae6075d62b8
Merge: 8246cba d124641
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Thu Feb 14 14:39:05 2013 -0800
Merge branch 'master' into mtho11/d3-charts3
commit 8246cba62f2ba9c1bf8d07c9cb4aade5aa762c26
Merge: 546ca74 727dfae
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Thu Feb 14 09:45:50 2013 -0800
Merge branch 'searchbar3' into mtho11/d3-charts3
11 years, 2 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java | 12 ++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
New commits:
commit 3bed8cb705a9c4662b69891c1ec1c833ba8dbc64
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 27 17:59:39 2013 -0500
[Bug 888070 - Agent prompt-command doesn't properly parse command-line arguments]
A sort of annoying parsing issue affecting topmost command line parsing in
AgentMain.
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
index 0c95199..d959552 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
@@ -3314,9 +3314,9 @@ public class AgentMain {
}
if (nextToken == java.io.StreamTokenizer.TT_WORD) {
- args.add(strtok.sval);
+ args.add(safeArg(strtok.sval));
} else if (nextToken == '\"') {
- args.add(strtok.sval);
+ args.add(safeArg(strtok.sval));
} else if ((nextToken == java.io.StreamTokenizer.TT_EOF) || (nextToken == java.io.StreamTokenizer.TT_EOL)) {
keep_going = false;
}
@@ -3325,6 +3325,14 @@ public class AgentMain {
return args.toArray(new String[args.size()]);
}
+ // perform any other massaging
+ private String safeArg(String arg) {
+ // remove trailing '=' from long option args. For example --plugin= should just be --plugin for
+ // downstream processing.
+ String result = (arg.startsWith("--") && arg.endsWith("=")) ? arg.substring(0, arg.length() - 1) : arg;
+ return result;
+ }
+
/**
* Returns the preferences for this agent. The node returned is where all preferences are to be stored.
*
11 years, 2 months
[rhq] Branch 'feature/cassandra-backend' - modules/helpers
by John Sanda
modules/helpers/metrics-simulator/pom.xml | 37 +++++
modules/helpers/metrics-simulator/src/main/assembly/bin/rhq-ms | 46 ++++++
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java | 6
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/SimulatorCLI.java | 70 ++++++++++
modules/helpers/metrics-simulator/src/main/resources/conf/log4j.properties | 39 +++++
modules/helpers/metrics-simulator/src/main/resources/log4j.properties | 39 -----
modules/helpers/metrics-simulator/src/main/scripts/assembly.xml | 50 +++++++
7 files changed, 248 insertions(+), 39 deletions(-)
New commits:
commit 0e0f40338a226f3022ff3177a0a6ab1f7d7d8a00
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Feb 27 17:38:04 2013 -0500
inital commit for packaging simulator as stand-alone, cli app
The simulator can/will be executed with the rhq-ms shell script. Further
changes are needed to wire everything up.
diff --git a/modules/helpers/metrics-simulator/pom.xml b/modules/helpers/metrics-simulator/pom.xml
index 2f30869..115faca 100644
--- a/modules/helpers/metrics-simulator/pom.xml
+++ b/modules/helpers/metrics-simulator/pom.xml
@@ -58,6 +58,24 @@
<artifactId>commons-math3</artifactId>
<version>3.1.1</version>
</dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${commons-logging.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>1.2</version>
+ </dependency>
</dependencies>
<build>
@@ -68,6 +86,25 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/scripts/assembly.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</project>
diff --git a/modules/helpers/metrics-simulator/src/main/assembly/bin/rhq-ms b/modules/helpers/metrics-simulator/src/main/assembly/bin/rhq-ms
new file mode 100755
index 0000000..e4388a7
--- /dev/null
+++ b/modules/helpers/metrics-simulator/src/main/assembly/bin/rhq-ms
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+_DOLLARZERO=`readlink "$0" 2>/dev/null || echo "$0"`
+RHQ_MS_BIN_DIR_PATH=`dirname "$_DOLLARZERO"`
+
+if [ -z "$RHQ_MS_HOME" ]; then
+ cd $RHQ_MS_BIN_DIR_PATH/..
+fi
+
+RHQ_MS_HOME=`pwd`
+
+prepare_java()
+{
+ if [ -z "$JAVA_HOME" ]; then
+ echo "$JAVA_HOME must be set"
+ exit 1
+ fi
+ RHQ_MS_JAVA_EXE=$JAVA_HOME/bin/java
+}
+
+prepare_classpath()
+{
+ RHQ_MS_CLASSPATH="$RHQ_MS_HOME/conf"
+ lib_dir=`cd "$RHQ_MS_HOME/lib";ls -1 *.jar`
+ for jar in $lib_dir ; do
+ RHQ_MS_CLASSPATH="$RHQ_MS_CLASSPATH:$RHQ_MS_HOME/lib/$jar"
+ done
+}
+
+prepare_java_opts()
+{
+ if [ -z "$RHQ_MS_JAVA_OPTS" ]; then
+ RHQ_MS_JAVA_OPTS="-Xms64M -Xmx64M -Djava.net.preferIPv4Stack=true"
+ fi
+}
+
+launch_simulator()
+{
+ class="org.rhq.metrics.simulator.Simulator"
+ $RHQ_MS_JAVA_EXE $JAVA_OPTS -cp "$RHQ_MS_CLASSPATH" org.rhq.metrics.simulator.SimulatorCLI "$@"
+}
+
+prepare_java
+prepare_classpath
+prepare_java_opts
+launch_simulator
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
index b2680f4..53d2a5e 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
@@ -179,4 +179,10 @@ public class Simulator {
return schedules;
}
+ public static void main(String[] args) {
+ System.out.println("Running simulator...");
+ Simulator simulator = new Simulator();
+ simulator.log.info("Testing logging...");
+ }
+
}
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/SimulatorCLI.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/SimulatorCLI.java
new file mode 100644
index 0000000..93bb582
--- /dev/null
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/SimulatorCLI.java
@@ -0,0 +1,70 @@
+/*
+ *
+ * * RHQ Management Platform
+ * * Copyright (C) 2005-2012 Red Hat, Inc.
+ * * All rights reserved.
+ * *
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License, version 2, as
+ * * published by the Free Software Foundation, and/or the GNU Lesser
+ * * General Public License, version 2.1, also as published by the Free
+ * * Software Foundation.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License and the GNU Lesser General Public License
+ * * for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * and the GNU Lesser General Public License along with this program;
+ * * if not, write to the Free Software Foundation, Inc.,
+ * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+package org.rhq.metrics.simulator;
+
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+
+/**
+ * @author John Sanda
+ */
+public class SimulatorCLI {
+
+ private Options options;
+
+ public SimulatorCLI() {
+ options = new Options();
+
+ Option help = new Option("h", "help", false, "Display this message.");
+ options.addOption(help);
+
+ Option simulation = new Option("s", "simulation", true, "The simulation to run. Expected to be a JSON file.");
+ options.addOption(simulation);
+ }
+
+ public void exec(String[] args) {
+ if (args.length == 0) {
+ printUsage();
+ System.exit(1);
+ }
+ }
+
+ public void printUsage() {
+ HelpFormatter helpFormatter = new HelpFormatter();
+ String syntax = "rhq-ms [options]";
+ String header = "";
+
+ helpFormatter.setOptPrefix("");
+ helpFormatter.printHelp(syntax, header, options, null);
+ }
+
+ public static void main(String[] args) {
+ SimulatorCLI cli = new SimulatorCLI();
+ cli.exec(args);
+ }
+
+}
diff --git a/modules/helpers/metrics-simulator/src/main/resources/conf/log4j.properties b/modules/helpers/metrics-simulator/src/main/resources/conf/log4j.properties
new file mode 100644
index 0000000..50c2e2a
--- /dev/null
+++ b/modules/helpers/metrics-simulator/src/main/resources/conf/log4j.properties
@@ -0,0 +1,39 @@
+#
+# /*
+# * RHQ Management Platform
+# * Copyright (C) 2005-2012 Red Hat, Inc.
+# * All rights reserved.
+# *
+# * This program is free software; you can redistribute it and/or modify
+# * it under the terms of the GNU General Public License, version 2, as
+# * published by the Free Software Foundation, and/or the GNU Lesser
+# * General Public License, version 2.1, also as published by the Free
+# * Software Foundation.
+# *
+# * This program is distributed in the hope that it will be useful,
+# * but WITHOUT ANY WARRANTY; without even the implied warranty of
+# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# * GNU General Public License and the GNU Lesser General Public License
+# * for more details.
+# *
+# * You should have received a copy of the GNU General Public License
+# * and the GNU Lesser General Public License along with this program;
+# * if not, write to the Free Software Foundation, Inc.,
+# * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# */
+#
+
+log4j.rootCategory=INFO, FILE, CONSOLE
+
+log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.FILE.DatePattern='.'yyyy-MM-dd
+log4j.appender.FILE.File=log/rhq-ms.log
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.ConversionPattern=%d{ISO8601} %-5p [%t] (%c{5}) - %m%n
+#log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
+log4j.appender.FILE.Append=false
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%5p %d{HH:mm:ss,SSS} %m%n
+log4j.logger.org.rhq=DEBUG
\ No newline at end of file
diff --git a/modules/helpers/metrics-simulator/src/main/resources/log4j.properties b/modules/helpers/metrics-simulator/src/main/resources/log4j.properties
deleted file mode 100644
index 9a3f64d..0000000
--- a/modules/helpers/metrics-simulator/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# /*
-# * RHQ Management Platform
-# * Copyright (C) 2005-2012 Red Hat, Inc.
-# * All rights reserved.
-# *
-# * This program is free software; you can redistribute it and/or modify
-# * it under the terms of the GNU General Public License, version 2, as
-# * published by the Free Software Foundation, and/or the GNU Lesser
-# * General Public License, version 2.1, also as published by the Free
-# * Software Foundation.
-# *
-# * This program is distributed in the hope that it will be useful,
-# * but WITHOUT ANY WARRANTY; without even the implied warranty of
-# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# * GNU General Public License and the GNU Lesser General Public License
-# * for more details.
-# *
-# * You should have received a copy of the GNU General Public License
-# * and the GNU Lesser General Public License along with this program;
-# * if not, write to the Free Software Foundation, Inc.,
-# * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# */
-#
-
-log4j.rootCategory=INFO, FILE, CONSOLE
-
-log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.FILE.DatePattern='.'yyyy-MM-dd
-log4j.appender.FILE.File=./target/test.log
-log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
-log4j.appender.FILE.layout.ConversionPattern=%d{ISO8601} %-5p [%t] (%c{5}) - %m%n
-#log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
-log4j.appender.FILE.Append=false
-
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%5p %d{HH:mm:ss,SSS} %m%n
-log4j.logger.org.rhq=DEBUG
\ No newline at end of file
diff --git a/modules/helpers/metrics-simulator/src/main/scripts/assembly.xml b/modules/helpers/metrics-simulator/src/main/scripts/assembly.xml
new file mode 100644
index 0000000..6bee585
--- /dev/null
+++ b/modules/helpers/metrics-simulator/src/main/scripts/assembly.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+
+ <id>rhq-metrics-simulator</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <baseDirectory>rhq-bundle-deployer-${project.version}</baseDirectory> <!-- matches the zip when it is renamed in rhq-container.build.xml -->
+
+ <fileSets>
+
+ <fileSet>
+ <directory>src/main/assembly</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>bin/rhq-ms</exclude>
+ </excludes>
+ </fileSet>
+
+ <fileSet>
+ <directory>src/main/assembly</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>bin/rhq-ms</include>
+ </includes>
+ <fileMode>0755</fileMode>
+ </fileSet>
+
+ <fileSet>
+ <directory>src/main/resources/conf</directory>
+ <outputDirectory>conf</outputDirectory>
+ </fileSet>
+
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ </dependencySet>
+ </dependencySets>
+
+</assembly>
+
11 years, 2 months
[rhq] Branch 'feature/cassandra-backend' - modules/enterprise
by John Sanda
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MetricsManagerBean.java | 6 ++++++
1 file changed, 6 insertions(+)
New commits:
commit c53f06c1340da9da33a8f2aa60b14fd7deb81049
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Feb 27 15:02:56 2013 -0500
initialize DateTimeService with metrics configuration
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MetricsManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MetricsManagerBean.java
index df2fe58..7535875 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MetricsManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MetricsManagerBean.java
@@ -36,6 +36,7 @@ import javax.ejb.TransactionAttributeType;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
import org.rhq.enterprise.server.cassandra.SessionManagerBean;
+import org.rhq.server.metrics.DateTimeService;
import org.rhq.server.metrics.MetricsServer;
import org.rhq.server.metrics.domain.AggregateNumericMetric;
import org.rhq.server.metrics.domain.RawNumericMetric;
@@ -110,6 +111,11 @@ public class MetricsManagerBean implements MetricsManagerLocal {
MetricsServer metricsServer = new MetricsServer();
metricsServer.setSession(sessionManager.getSession());
metricsServer.setConfiguration(sessionManager.getMetricsConfiguration());
+
+ DateTimeService dateTimeService = new DateTimeService();
+ dateTimeService.setConfiguration(sessionManager.getMetricsConfiguration());
+ metricsServer.setDateTimeService(dateTimeService);
+
return metricsServer;
}
}
11 years, 2 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java | 1 -
1 file changed, 1 deletion(-)
New commits:
commit b0b1589b891e6377b06fdb8ef0c947a8ee8e8551
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 27 14:00:38 2013 -0500
[Bug 911681 - Globally Uncaught exception while viewing resource configuration]
If there actually is no resource configuration available, for whatever reason,
there was a bug in the handling of this rare use case. We try to disable
the save button, which at this point does not actually exist.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index f0947ac..10d8760 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -130,7 +130,6 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
Message message = new Message(MSG.view_configurationDetails_noConfigurationFetched(),
Message.Severity.Info);
CoreGUI.getMessageCenter().notify(message);
- saveButton.disable();
refreshing = false;
return;
}
11 years, 2 months
[rhq] Branch 'feature/cassandra-backend' - modules/enterprise
by John Sanda
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cassandra/SessionManagerBean.java | 7 +++++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MetricsManagerBean.java | 1 +
2 files changed, 8 insertions(+)
New commits:
commit 76afc646065a30db60f7dfa8c57f264860ced958
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Feb 27 13:20:46 2013 -0500
need to initialize the metrics configuration in MetricsServer
For the work I have been doing with metrics simulator I introduced the class
MetricsConfiguration which specifies retention and time slice intervals to use.
That configuration is injected into MetricsServer. This commit updates SLSB
code to set a default configuration.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cassandra/SessionManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cassandra/SessionManagerBean.java
index 667744c..f35f7fd 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cassandra/SessionManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cassandra/SessionManagerBean.java
@@ -37,6 +37,7 @@ import com.datastax.driver.core.exceptions.NoHostAvailableException;
import org.rhq.cassandra.CassandraNode;
import org.rhq.server.metrics.CQLException;
+import org.rhq.server.metrics.MetricsConfiguration;
/**
* @author John Sanda
@@ -46,6 +47,8 @@ public class SessionManagerBean {
private Session session;
+ private MetricsConfiguration metricsConfiguration = new MetricsConfiguration();
+
@PostConstruct
private void createSession() {
try {
@@ -85,4 +88,8 @@ public class SessionManagerBean {
return session;
}
+ public MetricsConfiguration getMetricsConfiguration() {
+ return metricsConfiguration;
+ }
+
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MetricsManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MetricsManagerBean.java
index f37368d..df2fe58 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MetricsManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MetricsManagerBean.java
@@ -109,6 +109,7 @@ public class MetricsManagerBean implements MetricsManagerLocal {
private MetricsServer getMetricsServer() {
MetricsServer metricsServer = new MetricsServer();
metricsServer.setSession(sessionManager.getSession());
+ metricsServer.setConfiguration(sessionManager.getMetricsConfiguration());
return metricsServer;
}
}
11 years, 2 months
[rhq] modules/core
by Jay Shaughnessy
modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java | 26 ++++++----
modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java | 2
2 files changed, 19 insertions(+), 9 deletions(-)
New commits:
commit 0f973b4b8ef0f9f261a6bcc7563d823907fa5f44
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 27 12:10:54 2013 -0500
[Bug 808231 - [plugin-container] NullPointerExceptions (NPE's) occur during PC shutdown, because the PC does not wait for ExecutorServices that have been shut down to terminate]
A follow-on to commit 5ef9c47ee8edab0fd0558a208911cc31dfb5d1dc. It seems this
existing BZ had the same intention and actually had support built-in to
deal with this problem, but had not applied it to production. So:
- Enable WAIT_FOR_SHUTDOWN_SERVICE_TERMINATION_DEFAULT such that we wait
5 minutes for executors to finish their work. This is good for
operation execution, avail checking, and discovery.
- Keep isRunning(), added in the previous commit, but make it a lightweight
check by taking away the lock request. Continue to use it to safeguard
against ERROR generation even if discovery takes longer than 5 minutes to
complete.
- Complement the outer guards in intialize() and shutdown() with guards
that are inside the lock aquisition, to prevent sequentially executing
the init or shutdown logic.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
index 7c0a21b..3705505 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
@@ -260,17 +260,15 @@ public class PluginContainer {
/**
* If the plugin container has been initialized, the plugins have started work, and the container is
- * not actively shutting down, this returns <code>true</code>.
+ * not actively shutting down, this returns <code>true</code>.
+ *
+ * <p>Note! that there is no locking on this method. Therefore it returns quickly and is likely correct, but if
+ * called outside of locking the return value is not guaranteed. As such, use this only as a lightweight check.</p>
*
* @return <code>true</code> if the plugin container was initialized, started and is not shutting down; <code>false</code> otherwise
*/
public boolean isRunning() {
- Lock lock = obtainReadLock();
- try {
- return started && !shuttingDown;
- } finally {
- releaseLock(lock);
- }
+ return !shuttingDown && started;
}
/**
@@ -283,12 +281,18 @@ public class PluginContainer {
* <p>If the plugin container has already been initialized, this method does nothing and returns.</p>
*/
public void initialize() {
+ // this quick guard is OK but doesn't prevent several calls to initialize() from stacking up while waiting for the lock
if (started) {
log.info("Plugin container is already initialized.");
}
Lock lock = obtainWriteLock();
try {
+ // this guard prevents us from executing initialize logic multiple times in a row
+ if (started) {
+ return;
+ }
+
version = PluginContainer.class.getPackage().getImplementationVersion();
log.info("Initializing Plugin Container" + ((version != null) ? (" v" + version) : "") + "...");
@@ -354,7 +358,8 @@ public class PluginContainer {
* this method does nothing and returns.
*/
public boolean shutdown() {
- if (!started) {
+ // this quick guard is OK but doesn't prevent several calls to shutdown() from stacking up while waiting for the lock
+ if (!isRunning()) {
log.info("Plugin container is already shut down.");
}
@@ -362,6 +367,11 @@ public class PluginContainer {
// end up deadlocked.
Lock lock = (configuration.isWaitForShutdownServiceTermination()) ? obtainReadLock() : obtainWriteLock();
try {
+ // this guard prevents us from executing shutdown logic multiple times in a row
+ if (!isRunning()) {
+ return true;
+ }
+
shuttingDown = true;
shutdownGracefully = true;
shutdownStartTime = System.currentTimeMillis();
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java
index 41dbda7..22f8150 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java
@@ -52,7 +52,7 @@ public class PluginContainerConfiguration {
private static final String CREATE_RESOURCE_CLASSLOADERS = PROP_PREFIX + "create-resource-classloaders";
private static final String START_MANAGEMENT_BEAN_PROP = PROP_PREFIX + "start-management-bean";
private static final String WAIT_FOR_SHUTDOWN_SERVICE_TERMINATION = PROP_PREFIX + "wait-for-shutdown-service-termination";
- public static final boolean WAIT_FOR_SHUTDOWN_SERVICE_TERMINATION_DEFAULT = false;
+ public static final boolean WAIT_FOR_SHUTDOWN_SERVICE_TERMINATION_DEFAULT = true;
private static final String SHUTDOWN_SERVICE_TERMINATION_TIMEOUT = PROP_PREFIX + "shutdown-service-termination-timeout";
public static final long SHUTDOWN_SERVICE_TERMINATION_TIMEOUT_DEFAULT = 5 * 60L; // in seconds
11 years, 2 months
[rhq] 3 commits - etc/dev-utils etc/scripts .mailmap modules/integration-tests
by Heiko W. Rupp
.mailmap | 5
etc/dev-utils/setup-rest/setup.sh | 17 -
etc/scripts/createRelasenotes.pl | 5
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java | 89 +++++++
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java | 38 +--
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java | 20 -
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java | 14 -
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/MetricsTest.java | 9
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java | 21 -
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ReportsTest.java | 7
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java | 122 ++++++----
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/UserTest.java | 34 +-
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Resource.java | 30 ++
13 files changed, 284 insertions(+), 127 deletions(-)
New commits:
commit ac0be216834e9fc362f4ba5fa006fdd2001609b1
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Feb 27 11:19:13 2013 +0100
Add some more mappings and improve generator.
diff --git a/.mailmap b/.mailmap
index 67f51f8..384ec04 100644
--- a/.mailmap
+++ b/.mailmap
@@ -30,6 +30,8 @@ Jason Dobies <jason.dobies(a)redhat.com> <jdobies(a)redhat.com>
Jay Shaughnessy <jshaughn(a)redhat.com>
Jay Shaughnessy <jshaughn(a)redhat.com> <jshaughnessy@jshaughnessy-PC>
Jay Shaughnessy <jshaughn(a)redhat.com> <jshaughnessy@.(none)>
+Jay Shaughnessy <jshaughn(a)redhat.com> <jshaughn(a)jshaughn.csb>
+Jay Shaughnessy <jshaughn(a)redhat.com> Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Jeff Ortel <jortel(a)redhat.com>
Jessica Sant <jsant(a)redhat.com>
Jijun Liu <lxjijun(a)gmail.com>
@@ -64,6 +66,7 @@ Shannon Hughes <shughes(a)redhat.com> <shughes(a)fred.hughes.lan>
Simeon Pinder <spinder(a)redhat.com> <simeonpinder(a)gmail.com>
Simeon Pinder <spinder(a)redhat.com> <spinder(a)cacaphonix.conchfritter.com>
Simeon Pinder <spinder(a)redhat.com> <spinder(a)fulliautomatix.conchfritter.com>
+Simeon Pinder <spinder(a)redhat.com> <spinder(a)spinder.csb>
Simeon Pinder <spinder(a)redhat.com>
Stefan Negrea <snegrea(a)redhat.com>
Steve Millidge <smillidge(a)c2b2.co.uk>
@@ -71,4 +74,6 @@ Ted Won 원종석 <tedd824(a)gmail.com>
Test JON User <test_jon(a)jon01.qa.atl2.redhat.com>
Todd B Sanders <tsanders(a)dhcp231-67.rdu.redhat.com>
Torben Jäger <torben(a)jit-central.com>
+Thomas Segismont <tsegismo(a)redhat.com> Thomas SEGISMONT <tsegismo(a)redhat.com>
+Thomas Segismont <tsegismo(a)redhat.com>
hudson auto <wnstb(a)yahoo.com>
diff --git a/etc/scripts/createRelasenotes.pl b/etc/scripts/createRelasenotes.pl
index 7984d8f..fe42631 100644
--- a/etc/scripts/createRelasenotes.pl
+++ b/etc/scripts/createRelasenotes.pl
@@ -27,7 +27,10 @@ while(<GIT>) {
# print "IN: ", $_;
next if /^$/;
- s/^[\s\[]*BZ\s([0-9]{5,7})(\]? .*)$/ [BZ $1|https:\/\/bugzilla.redhat.com\/show_bug.cgi\?id\=$1] $2/;
+ s/\${/\$\\{/g;
+ s/^[\s\[]*BZ\s([0-9]{5,7})\s?(\]? .*)$/ [BZ $1|https:\/\/bugzilla.redhat.com\/show_bug.cgi\?id\=$1] $2/;
+ s/^[\s\[]*BZ-([0-9]{5,7})\s?(\]? .*)$/ [BZ $1|https:\/\/bugzilla.redhat.com\/show_bug.cgi\?id\=$1] $2/;
+ s/^[\s\[]*BZ([0-9]{5,7})\s?(\]? .*)$/ [BZ $1|https:\/\/bugzilla.redhat.com\/show_bug.cgi\?id\=$1] $2/;
s/^[\s\[]*Bug\s([0-9]{5,7})(\]? .*)$/ [BZ $1|https:\/\/bugzilla.redhat.com\/show_bug.cgi\?id\=$1] $2/;
if (/ .*/) {
s/^ (.*)/** $1/;
commit 8f1cc42d33c5221e1e37df61fcb663ee27554d2d
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Feb 26 17:27:40 2013 +0100
No longer needed
diff --git a/etc/dev-utils/setup-rest/setup.sh b/etc/dev-utils/setup-rest/setup.sh
deleted file mode 100644
index 0634cd9..0000000
--- a/etc/dev-utils/setup-rest/setup.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-# Set the DEV_CONTAINER to your dev container location
-DEV_CONTAINER=/im/dev-container
-
-
-cd $DEV_CONTAINER/jbossas/server/default/lib
-cp ~/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/2.2.1.GA/resteasy-jaxrs-2.2.1.GA.jar .
-cp ~/.m2/repository/org/jboss/resteasy/resteasy-links/2.2.0.GA/resteasy-links-2.2.0.GA.jar .
-cp ~/.m2/repository/org/jboss/resteasy/resteasy-jettison-provider/2.2.0.GA/resteasy-jettison-provider-2.2.0.GA.jar .
-cp ~/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/2.2.1.GA/resteasy-jaxb-provider-2.2.1.GA.jar .
-cp ~/.m2/repository/org/scannotation/scannotation/1.0.3/scannotation-1.0.3.jar .
-cp ~/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar .
-cp ~/.m2/repository/org/codehaus/jettison/1.2/jessison-1.2.jar .
-cp ~/.m2/repository/org/codehaus/jettison/jettison/1.2/jettison-1.2.jar .
-cp ~/.m2/repository/org/jboss/el/jboss-el/2.0.1.GA/jboss-el-2.0.1.GA.jar .
-cp ~/.m2/repository/org/freemarker/freemarker/2.3.18/freemarker-2.3.18.jar .
commit 3eb0ac487e92e5f26174deb2b19eaffc1729937a
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Feb 25 16:37:15 2013 +0100
Make tests independent of a specific id for the platform
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
index 3d06335..1794062 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
@@ -18,12 +18,22 @@
*/
package org.rhq.modules.integrationTests.restApi;
+import java.util.List;
+import java.util.Map;
+
import com.jayway.restassured.RestAssured;
+import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.response.Header;
+import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Before;
+import org.junit.BeforeClass;
+
+import org.rhq.modules.integrationTests.restApi.d.Resource;
import static com.jayway.restassured.RestAssured.basic;
+import static com.jayway.restassured.RestAssured.given;
/**
* Common setup for the tests
@@ -35,11 +45,15 @@ public abstract class AbstractBase {
private static final String APPLICATION_XML = "application/xml";
private static final String TEXT_CSV = "text/csv";
private static final String TEXT_HTML = "text/html";
+ static final String REST_TEST_DUMMY = "-rest-test-dummy-";
static Header acceptJson = new Header("Accept", APPLICATION_JSON);
static Header acceptXml = new Header("Accept", APPLICATION_XML);
static Header acceptHtml = new Header("Accept", TEXT_HTML);
static Header acceptCsv = new Header("Accept", TEXT_CSV);
+ int _platformId ;
+ int _platformTypeId;
+
@Before
public void setUp() throws Exception {
@@ -48,5 +62,80 @@ public abstract class AbstractBase {
RestAssured.basePath = "/rest/";
RestAssured.authentication = basic("rhqadmin","rhqadmin");
+ Resource resource = new Resource();
+ resource.setResourceName(REST_TEST_DUMMY);
+ resource.setTypeName("Linux");
+
+ Resource platform =
+ given()
+ .header(acceptJson)
+ .contentType(ContentType.JSON)
+ .body(resource)
+ .expect()
+ .statusCode(201)
+ .log().ifError()
+ .when()
+ .post("/resource/platforms")
+ .as(Resource.class);
+
+ _platformId = platform.getResourceId();
+ _platformTypeId = platform.getTypeId();
+
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+
+
+ List res =
+ given()
+ .header(acceptJson)
+ .queryParam("q",REST_TEST_DUMMY)
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .when()
+ .get("/resource")
+ .as(List.class);
+
+ if (res!=null && res.get(0)!=null) {
+
+ String tmp = ((Map <String,String>)res.get(0)).get("resourceId");
+ int pid =Integer.valueOf(tmp);
+
+ given()
+ .pathParam("id", pid)
+ .expect()
+ .statusCode(204)
+ .log().ifError()
+ .when()
+ .delete("/resource/{id}");
+
+ }
+ }
+
+ protected int findIdOfARealPlatform() {
+ List res =
+ given()
+ .header(acceptJson)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/platforms")
+ .as(List.class);
+
+ assert res != null;
+ for (Object entry : res) {
+ if (entry instanceof Map) {
+ Map<String,String> map = (Map<String, String>) entry;
+ if (!map.get("resourceName").equals(REST_TEST_DUMMY)) {
+ return Integer.valueOf(map.get("resourceId"));
+ }
+ }
+ }
+
+ assert true : "No real platform found in inventory. Please add one";
+
+ return 0;
}
}
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
index aa56a46..c3accf3 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
@@ -259,7 +259,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(201)
.body("dampeningCategory",is("NONE"))
@@ -289,7 +289,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(406)
.log().everything()
@@ -316,7 +316,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(201)
.body("dampeningCategory",is("PARTIAL_COUNT"))
@@ -351,7 +351,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceId", 10001)
+ .queryParam("resourceId", _platformId)
.expect()
.statusCode(201)
.body("dampeningCategory",is("DURATION_COUNT"))
@@ -800,7 +800,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(201)
.log().ifError()
@@ -933,7 +933,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.body(alertDefinition)
.log().everything()
- .queryParam("resourceId", 10001)
+ .queryParam("resourceId", _platformId)
.expect()
.statusCode(201)
.log().ifError()
@@ -999,7 +999,7 @@ public class AlertTest extends AbstractBase {
.contentType(ContentType.JSON)
.header(acceptJson)
.body(alertDefinition)
- .queryParam("resourceId", 10001)
+ .queryParam("resourceId", _platformId)
.expect()
.statusCode(201)
.body("priority", is("HIGH"))
@@ -1146,10 +1146,12 @@ public class AlertTest extends AbstractBase {
@Test
public void testCreateDefinitionForGroup() throws Exception {
+ assert _platformTypeId!=0 : "Set up did not run or failed";
+
// Create a group
Group group = new Group("test-group-" + System.currentTimeMillis()/1000);
group.setCategory("COMPATIBLE");
- group.setResourceTypeId(10001);
+ group.setResourceTypeId(_platformTypeId);
String groupUri =
given()
@@ -1204,7 +1206,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceTypeId",10001)
+ .queryParam("resourceTypeId",_platformTypeId)
.expect()
.statusCode(201)
.log().ifError()
@@ -1242,10 +1244,10 @@ public class AlertTest extends AbstractBase {
// Send a avail down/up sequence -> alert definition should fire
long now = System.currentTimeMillis();
- Availability a = new Availability(10001,now-2000,"DOWN");
+ Availability a = new Availability(_platformId,now-2000,"DOWN");
given()
.contentType(ContentType.JSON)
- .pathParam("id", 10001)
+ .pathParam("id", _platformId)
.body(a)
.expect()
.statusCode(204)
@@ -1253,10 +1255,10 @@ public class AlertTest extends AbstractBase {
.when()
.put("/resource/{id}/availability");
- a = new Availability(10001,now-1000,"UP");
+ a = new Availability(_platformId,now-1000,"UP");
given()
.contentType(ContentType.JSON)
- .pathParam("id", 10001)
+ .pathParam("id", _platformId)
.body(a)
.expect()
.statusCode(204)
@@ -1370,10 +1372,10 @@ public class AlertTest extends AbstractBase {
// Send a avail down/up sequence -> alert definition should fire
long now = System.currentTimeMillis();
- Availability a = new Availability(10001,now-2000,"DOWN");
+ Availability a = new Availability(_platformId,now-2000,"DOWN");
given()
.contentType(ContentType.JSON)
- .pathParam("id", 10001)
+ .pathParam("id", _platformId)
.body(a)
.expect()
.statusCode(204)
@@ -1381,10 +1383,10 @@ public class AlertTest extends AbstractBase {
.when()
.put("/resource/{id}/availability");
- a = new Availability(10001,now-1000,"UP");
+ a = new Availability(_platformId,now-1000,"UP");
given()
.contentType(ContentType.JSON)
- .pathParam("id", 10001)
+ .pathParam("id", _platformId)
.body(a)
.expect()
.statusCode(204)
@@ -1479,7 +1481,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(201)
.log().ifError()
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java
index 20caca4..2e74181 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java
@@ -43,7 +43,7 @@ public class EventTest extends AbstractBase {
given()
.header(acceptJson)
- .pathParam("id",10001)
+ .pathParam("id",_platformId)
.expect()
.statusCode(200)
.log().ifError()
@@ -57,7 +57,7 @@ public class EventTest extends AbstractBase {
given()
.header(acceptJson)
- .pathParam("id",10001)
+ .pathParam("id",_platformId)
.expect()
.statusCode(200)
.log().ifError()
@@ -89,14 +89,14 @@ public class EventTest extends AbstractBase {
public void testAddEventSourceForUnknownDefinition() throws Exception {
EventSource es = new EventSource();
- es.setResourceId(10001);
+ es.setResourceId(_platformId);
es.setName("Frobnitz"); // Name of the event definition
es.setLocation("-x-test-location");
given()
.header(acceptJson)
.contentType(ContentType.JSON)
- .pathParam("id", 10001)
+ .pathParam("id", _platformId)
.body(es)
.expect()
.statusCode(404)
@@ -108,7 +108,7 @@ public class EventTest extends AbstractBase {
public void testAddGetDeleteEventSource() throws Exception {
EventSource es = new EventSource();
- es.setResourceId(10001);
+ es.setResourceId(_platformId);
es.setName("Event Log"); // Name of the event definition
es.setLocation("-x-test-location");
@@ -116,7 +116,7 @@ public class EventTest extends AbstractBase {
given()
.header(acceptJson)
.contentType(ContentType.JSON)
- .pathParam("id",10001)
+ .pathParam("id",_platformId)
.body(es)
.expect()
.statusCode(200)
@@ -148,7 +148,7 @@ public class EventTest extends AbstractBase {
response =
given()
.header(acceptJson)
- .pathParam("id",10001)
+ .pathParam("id",_platformId)
.expect()
.statusCode(200)
.when()
@@ -178,7 +178,7 @@ public class EventTest extends AbstractBase {
public void testAddGetEventOnSource() throws Exception {
EventSource es = new EventSource();
- es.setResourceId(10001);
+ es.setResourceId(_platformId);
es.setName("Event Log"); // Name of the event definition
es.setLocation("-x-test-location");
@@ -186,7 +186,7 @@ public class EventTest extends AbstractBase {
given()
.header(acceptJson)
.contentType(ContentType.JSON)
- .pathParam("id",10001)
+ .pathParam("id",_platformId)
.body(es)
.expect()
.statusCode(200)
@@ -235,7 +235,7 @@ public class EventTest extends AbstractBase {
response =
given()
.header(acceptJson)
- .pathParam("id", 10001)
+ .pathParam("id", _platformId)
.queryParam("startTime",now - 10)
.queryParam("endTime",now + 10)
.expect()
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java
index f6ffbe7..646f81c 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java
@@ -46,7 +46,6 @@ public class GroupTest extends AbstractBase {
private static final String X_TEST_GROUP = "-x-test-group";
- @Override
@Before
public void setUp() throws Exception {
super.setUp();
@@ -214,6 +213,9 @@ public class GroupTest extends AbstractBase {
@Test
public void testAddResourceToGroup() throws Exception {
+
+ assert _platformId !=0 : "Set up did not run or was not successful";
+
Group group = new Group(X_TEST_GROUP);
// Generate the group
@@ -237,7 +239,7 @@ public class GroupTest extends AbstractBase {
.contentType(ContentType.JSON)
.body(group)
.pathParam("id", id)
- .pathParam("resourceId",10001)
+ .pathParam("resourceId",_platformId)
.expect()
.statusCode(HttpStatus.SC_OK)
.log().ifError()
@@ -281,7 +283,7 @@ public class GroupTest extends AbstractBase {
.contentType(ContentType.JSON)
.body(group)
.pathParam("gid", groupId)
- .pathParam("resourceId",10001)
+ .pathParam("resourceId",_platformId)
.expect()
.statusCode(HttpStatus.SC_OK)
.log().ifError()
@@ -390,7 +392,7 @@ public class GroupTest extends AbstractBase {
.contentType(ContentType.JSON)
.body(group)
.pathParam("id",id)
- .pathParam("resourceId",10001)
+ .pathParam("resourceId",_platformId)
.expect()
.statusCode(HttpStatus.SC_OK)
.log().ifError()
@@ -401,7 +403,7 @@ public class GroupTest extends AbstractBase {
given()
.header(acceptJson)
.pathParam("id",id)
- .pathParam("resourceId",10001)
+ .pathParam("resourceId",_platformId)
.expect()
.statusCode(HttpStatus.SC_OK)
.log().ifError()
@@ -425,7 +427,7 @@ public class GroupTest extends AbstractBase {
public void testGetMetricDefinitionsForGroup() throws Exception {
Group group = new Group(X_TEST_GROUP);
group.setCategory("COMPATIBLE");
- group.setResourceTypeId(10001);
+ group.setResourceTypeId(_platformTypeId);
// Generate the group
Response response =
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/MetricsTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/MetricsTest.java
index 28fa806..0e7506d 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/MetricsTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/MetricsTest.java
@@ -46,21 +46,21 @@ public class MetricsTest extends AbstractBase {
private int numericScheduleId;
private long defaultInterval;
- @Override
@Before
public void setUp() throws Exception {
- super.setUp();// is not called by junit before this one
+ super.setUp();
// Determine a schedule id for the common cases
Response r =
given()
.header(acceptJson)
.queryParam("type", "metric")
+ .pathParam("rid",_platformId)
.expect()
.statusCode(200)
.log().ifError()
.when()
- .get("/resource/10001/schedules");
+ .get("/resource/{rid}/schedules");
JsonPath jp = r.jsonPath();
numericScheduleId = jp.getInt("[0].scheduleId");
@@ -216,11 +216,12 @@ public class MetricsTest extends AbstractBase {
given()
.header(acceptJson)
.queryParam("type", "trait")
+ .pathParam("rid",_platformId)
.expect()
.statusCode(200)
.log().ifError()
.when()
- .get("/resource/10001/schedules");
+ .get("/resource/{rid}/schedules");
JsonPath jp = r.jsonPath();
int tsId = jp.getInt("[0].scheduleId");
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java
index 18b0297..b4dc580 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2012 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -43,14 +43,14 @@ public class OperationsTest extends AbstractBase {
private int definitionId;
- @Override
@Before
public void setUp() throws Exception {
- super.setUp(); // Junit does not call that for us
+ super.setUp();
+
Response r =
given()
.header(acceptJson)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(200)
.log().ifError()
@@ -90,7 +90,7 @@ public class OperationsTest extends AbstractBase {
given()
.header(acceptJson)
.pathParam("definitionId",definitionId)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(200)
.log().ifError()
@@ -118,7 +118,7 @@ public class OperationsTest extends AbstractBase {
given()
.header(acceptJson)
.pathParam("definitionId",definitionId)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(200)
.log().ifError()
@@ -156,11 +156,13 @@ public class OperationsTest extends AbstractBase {
@Test
public void testCreateDraftOperationAndScheduleExecution() throws Exception {
+ int platformId = findIdOfARealPlatform();
+
Operation draft =
given()
.header(acceptJson)
.pathParam("definitionId",definitionId)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",platformId)
.expect()
.statusCode(200)
.log().ifError()
@@ -174,7 +176,7 @@ public class OperationsTest extends AbstractBase {
int draftId = draft.getId();
draft.setReadyToSubmit(true);
- draft.getParams().put("detailed", true);
+ draft.getParams().put("detailedDiscovery", false);
// update to schedule
Operation scheduled =
@@ -213,7 +215,7 @@ public class OperationsTest extends AbstractBase {
// See if we also find it when we are looking for histories on the resource
Response response =
given()
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",platformId)
.header(acceptJson)
.expect()
.statusCode(200)
@@ -269,7 +271,6 @@ public class OperationsTest extends AbstractBase {
.delete("/operation/history/{hid}");
}
-
}
}
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ReportsTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ReportsTest.java
index a76a640..2c16ba2 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ReportsTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ReportsTest.java
@@ -38,13 +38,6 @@ public class ReportsTest extends AbstractBase {
private static final int NUMBER_REPORTS = 9;
- @Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
-
- }
-
@Test
public void testReportListJson() throws Exception {
given()
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java
index 27bf5a2..a889ffc 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2012 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -33,6 +33,7 @@ import org.apache.http.HttpStatus;
import org.hamcrest.CoreMatchers;
import org.junit.Test;
+import org.rhq.modules.integrationTests.restApi.d.Availability;
import org.rhq.modules.integrationTests.restApi.d.Resource;
import static com.jayway.restassured.RestAssured.expect;
@@ -61,12 +62,14 @@ public class ResourcesTest extends AbstractBase {
given()
.header("Accept","application/json")
+ .pathParam("id",_platformId)
.expect()
.statusCode(200)
.contentType(ContentType.JSON)
+ .log().ifError()
.body("links.rel", CoreMatchers.hasItem("self"))
.when()
- .get("/resource/10001");
+ .get("/resource/{id}");
}
@@ -132,33 +135,40 @@ public class ResourcesTest extends AbstractBase {
@Test
public void testGetPlatformXml() {
+
+ assert _platformId!=0 : "Setup did not run or was no success";
+
given()
.header("Accept", "application/xml")
+ .pathParam("id",_platformId)
.expect()
.statusCode(200)
.contentType(ContentType.XML)
.when()
- .get("/resource/10001");
+ .get("/resource/{id}");
}
@Test
public void testGetPlatformSchedules() {
given()
.header("Accept", "application/json")
+ .pathParam("id", _platformId)
.expect()
.statusCode(200)
+ .log().ifError()
.when()
- .get("/resource/10001/schedules");
+ .get("/resource/{id}/schedules");
}
@Test
public void testGetPlatformChildren() {
given()
- .header("Accept","application/json")
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
.expect()
.statusCode(200)
.when()
- .get("/resource/10001/children");
+ .get("/resource/{id}/children");
}
@Test
@@ -421,60 +431,81 @@ public class ResourcesTest extends AbstractBase {
@Test
public void testAlertsForResource() throws Exception {
given()
- .header("Accept","application/json")
- .expect().statusCode(200)
- .when().get("/resource/10001/alerts");
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/alerts");
}
@Test
public void testSchedulesForResource() throws Exception {
given()
- .header("Accept","application/json")
- .expect().statusCode(200)
- .when().get("/resource/10001/schedules");
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/schedules");
}
@Test
public void testAvailabilityForResource() throws Exception {
given()
- .header("Accept", "application/json")
- .expect().statusCode(200)
- .when().get("/resource/10001/availability");
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/availability");
}
@Test
public void testAvailabilityHistoryForResource() throws Exception {
given()
- .header("Accept", "application/json")
- .expect().statusCode(200)
- .when().get("/resource/10001/availability/history");
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/availability/history");
}
@Test
public void testUpdateAvailability() throws Exception {
- Response response = given()
+ Response response =
+ given()
.header("Accept", "application/json")
- .expect().statusCode(200)
- .when().get("/resource/10001/availability");
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/availability");
String oldType = response.jsonPath().get("type");
try {
long now = System.currentTimeMillis()-100;
- given().body("{\"since\":" + now + ",\"type\":\"DOWN\",\"resourceId\":10001}")
- .header("Content-Type","application/json")
- .header("Accept","application/json")
- .pathParam("id",10001)
+ given()
+ .body("{\"since\":" + now + ",\"type\":\"DOWN\",\"resourceId\":" + _platformId + "}")
+ .header("Content-Type", "application/json")
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
.expect()
- .statusCode(HttpStatus.SC_NO_CONTENT)
- .log().ifError()
- .when().put("/resource/{id}/availability");
+ .statusCode(HttpStatus.SC_NO_CONTENT)
+ .log().ifError()
+ .when()
+ .put("/resource/{id}/availability");
response = given()
.header("Accept", "application/json")
- .expect().statusCode(200)
- .when().get("/resource/10001/availability");
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/availability");
String currentType = response.jsonPath().get("type");
assert currentType.equals("DOWN"); // TODO small window where an agent may have sent an update
@@ -482,13 +513,14 @@ public class ResourcesTest extends AbstractBase {
// Set back to original value
long now = System.currentTimeMillis()-100;
- given().body("{\"since\":" + now + ",\"type\":\""+oldType+"\",\"resourceId\":10001}")
- .header("Content-Type","application/json")
- .header("Accept","application/json")
- .pathParam("id",10001)
+ given()
+ .body("{\"since\":" + now + ",\"type\":\"" + oldType + "\",\"resourceId\":" + _platformId + "}")
+ .header("Content-Type", "application/json")
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
.expect()
- .statusCode(HttpStatus.SC_NO_CONTENT)
- .log().ifError()
+ .statusCode(HttpStatus.SC_NO_CONTENT)
+ .log().ifError()
.when().put("/resource/{id}/availability");
}
@@ -500,14 +532,18 @@ public class ResourcesTest extends AbstractBase {
// Platforms should not be set to DISABLED according ot JSHAUGHN
long now = System.currentTimeMillis()-100;
- given().body("{\"since\":" + now + ",\"type\":\"DISABLED\",\"resourceId\":10001}")
- .header("Content-Type","application/json")
- .header("Accept","application/json")
- .pathParam("id",10001)
+ Availability avail = new Availability(_platformId,now,"DISABLED");
+
+ given()
+ .body(avail)
+ .header("Content-Type", "application/json")
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
.expect()
- .statusCode(HttpStatus.SC_NOT_ACCEPTABLE)
- .log().ifError()
- .when().put("/resource/{id}/availability");
+ .statusCode(HttpStatus.SC_NOT_ACCEPTABLE)
+ .log().ifError()
+ .when()
+ .put("/resource/{id}/availability");
}
}
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/UserTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/UserTest.java
index 07e2f29..e199dc5 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/UserTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/UserTest.java
@@ -40,38 +40,50 @@ public class UserTest extends AbstractBase {
@Test
public void testGetFavoritesResources() throws Exception {
- expect().statusCode(200)
- .log().ifError()
- .when().get("/user/favorites/resource");
+ expect()
+ .statusCode(200)
+ .log().ifError()
+ .when()
+ .get("/user/favorites/resource");
}
@Test
public void testGetFavoriteGroups() throws Exception {
- expect().statusCode(200)
- .log().ifError()
- .when().get("/user/favorites/group");
+ expect()
+ .statusCode(200)
+ .log().ifError()
+ .when()
+ .get("/user/favorites/group");
}
@Test
public void testAddRemoveFavoriteResources() throws Exception {
- expect().statusCode(204)
- .when().put("/user/favorites/resource/10001");
+ given()
+ .pathParam("rid",_platformId)
+ .expect()
+ .statusCode(204)
+ .when()
+ .put("/user/favorites/resource/{rid}");
try {
Response r =
expect()
.statusCode(200)
+ .log().everything()
.when()
.get("/user/favorites/resource");
JsonPath jp = r.jsonPath();
- assert jp.getList("resourceId").contains("10001");
+ assert jp.getList("resourceId").contains(String.valueOf(_platformId));
}
finally {
- expect()
+ given()
+ .pathParam("rid",_platformId)
+ .expect()
.statusCode(204)
- .when().delete("/user/favorites/resource/10001");
+ .when()
+ .delete("/user/favorites/resource/{rid}");
}
}
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Resource.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Resource.java
index 9c3c1a3..6cbcea0 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Resource.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Resource.java
@@ -19,6 +19,9 @@
package org.rhq.modules.integrationTests.restApi.d;
+import java.util.List;
+import java.util.Map;
+
/**
* A resource for testing purposes
* @author Heiko W. Rupp
@@ -30,6 +33,9 @@ public class Resource {
String typeName;
String pluginName;
Integer parentId;
+ int typeId;
+ List<Map> links;
+ String ancestry;
public Resource() {
}
@@ -73,4 +79,28 @@ public class Resource {
public void setTypeName(String typeName) {
this.typeName = typeName;
}
+
+ public int getTypeId() {
+ return typeId;
+ }
+
+ public void setTypeId(int typeId) {
+ this.typeId = typeId;
+ }
+
+ public List<Map> getLinks() {
+ return links;
+ }
+
+ public void setLinks(List<Map> links) {
+ this.links = links;
+ }
+
+ public String getAncestry() {
+ return ancestry;
+ }
+
+ public void setAncestry(String ancestry) {
+ this.ancestry = ancestry;
+ }
}
11 years, 2 months