You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ge...@apache.org on 2017/01/20 15:27:22 UTC
[2/5] brooklyn-server git commit: RecordingWinRm+SshTool give better
error messages when there were no execs
RecordingWinRm+SshTool give better error messages when there were no execs
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/45123535
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/45123535
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/45123535
Branch: refs/heads/master
Commit: 45123535a5b600f26be59be70a1772ddeaf23bee
Parents: 4d2f7cc
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Mon Jan 16 12:36:19 2017 +0000
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Fri Jan 20 10:25:13 2017 +0000
----------------------------------------------------------------------
.../brooklyn/util/core/internal/ssh/RecordingSshTool.java | 7 +++++--
.../brooklyn/util/core/internal/winrm/RecordingWinRmTool.java | 3 +++
2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/45123535/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/RecordingSshTool.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/RecordingSshTool.java b/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/RecordingSshTool.java
index 02109be..82524d3 100644
--- a/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/RecordingSshTool.java
+++ b/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/RecordingSshTool.java
@@ -187,9 +187,12 @@ public class RecordingSshTool implements SshTool {
public static List<ExecCmd> getExecCmds() {
return ImmutableList.copyOf(execScriptCmds);
}
-
+
public static ExecCmd getLastExecCmd() {
- return execScriptCmds.get(execScriptCmds.size()-1);
+ if (execScriptCmds.isEmpty()) {
+ throw new IllegalStateException("No executions recorded");
+ }
+ return execScriptCmds.get(execScriptCmds.size() - 1);
}
public static Map<?,?> getLastConstructorProps() {
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/45123535/software/winrm/src/test/java/org/apache/brooklyn/util/core/internal/winrm/RecordingWinRmTool.java
----------------------------------------------------------------------
diff --git a/software/winrm/src/test/java/org/apache/brooklyn/util/core/internal/winrm/RecordingWinRmTool.java b/software/winrm/src/test/java/org/apache/brooklyn/util/core/internal/winrm/RecordingWinRmTool.java
index 6d39fab..a314795 100644
--- a/software/winrm/src/test/java/org/apache/brooklyn/util/core/internal/winrm/RecordingWinRmTool.java
+++ b/software/winrm/src/test/java/org/apache/brooklyn/util/core/internal/winrm/RecordingWinRmTool.java
@@ -119,6 +119,9 @@ public class RecordingWinRmTool implements WinRmTool {
}
public static ExecParams getLastExec() {
+ if (execs.isEmpty()) {
+ throw new IllegalStateException("No executions recorded");
+ }
return execs.get(execs.size()-1);
}