Github user neykov commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/296#discussion_r74428306
--- Diff:
core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/ExecCmdAsserts.java
---
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2016 The Apache Software Foundation.
+ *
+ * Licensed 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.brooklyn.util.core.internal.ssh;
+
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.util.List;
+
+import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool.ExecCmd;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Predicate;
+
+@Beta
+public class ExecCmdAsserts {
+
+ public static void assertExecsContain(List<ExecCmd> actuals,
List<String> expectedCmds) {
+ String errMsg = "actuals="+actuals+"; expected="+expectedCmds;
+ assertTrue(actuals.size() >= expectedCmds.size(),
"actualSize="+actuals.size()+"; expectedSize="+expectedCmds.size()+"; "+errMsg);
+ for (int i = 0; i < expectedCmds.size(); i++) {
+ assertExecContains(actuals.get(i), expectedCmds.get(i),
errMsg);
+ }
+ }
+
+ public static void assertExecContains(ExecCmd actual, String
expectedCmdRegex) {
+ assertExecContains(actual, expectedCmdRegex, null);
+ }
+
+ public static void assertExecContains(ExecCmd actual, String
expectedCmdRegex, String errMsg) {
+ for (String cmd : actual.commands) {
+ if (cmd.matches(expectedCmdRegex)) {
+ return;
+ }
+ }
+ fail(expectedCmdRegex + " not matched by any commands in " +
actual+(errMsg != null ? "; "+errMsg : ""));
+ }
+
+ public static void assertExecsNotContains(List<? extends ExecCmd>
actuals, List<String> expectedNotCmdRegexs) {
+ for (ExecCmd actual : actuals) {
+ assertExecContains(actual, expectedNotCmdRegexs);
+ }
+ }
+
+ public static void assertExecContains(ExecCmd actual, List<String>
expectedNotCmdRegexs) {
--- End diff --
Missing `Not`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---