You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by aledsage <gi...@git.apache.org> on 2016/08/10 21:54:28 UTC
[GitHub] brooklyn-server pull request #296: Various minor things
GitHub user aledsage opened a pull request:
https://github.com/apache/brooklyn-server/pull/296
Various minor things
Mostly improvements to tests (including failing tests for BROOKLYN-328 and BROOKLYN-329). See individual commits for explanation and details.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/aledsage/brooklyn-server various-fixes-20160810
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/brooklyn-server/pull/296.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #296
----
commit e096444a335134749a8010d04a9cf02c32354fd1
Author: Aled Sage <al...@gmail.com>
Date: 2016-08-10T20:14:58Z
Extract execCmdAsserts
commit c3a0821bdbe5908334af90b63f4324f3f31aef14
Author: Aled Sage <al...@gmail.com>
Date: 2016-08-10T20:13:31Z
Add more tests to ConfigParametersYamlTests
Including for BROOKLYN-328 and BROOKLYN-329
commit 5f4eef3ec9a80845f1c88821b350f3d6f8ff5773
Author: Aled Sage <al...@gmail.com>
Date: 2016-08-10T20:13:57Z
brooklyn.parameter: accept more basic types
commit 7e92096791bf90da1b6928e031ffb202fbcb6243
Author: Aled Sage <al...@gmail.com>
Date: 2016-08-10T20:15:14Z
Tidy FixedListMachineProvisioningLocationTset
commit 4f8c9fad6ea72ec73484083e4c58c64a282ff2a0
Author: Aled Sage <al...@gmail.com>
Date: 2016-08-10T20:17:40Z
Adds SshCommandSensorYamlTest
----
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server pull request #296: Various minor things
Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/296#discussion_r74429096
--- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/SshCommandSensorYamlTest.java ---
@@ -0,0 +1,75 @@
+/*
+ * 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.brooklyn.camp.brooklyn;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.core.entity.EntityAsserts;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess;
+import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+
+public class SshCommandSensorYamlTest extends AbstractYamlTest {
+ private static final Logger log = LoggerFactory.getLogger(SshCommandSensorYamlTest.class);
+
+ @BeforeMethod(alwaysRun=true)
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ RecordingSshTool.clear();
+ }
+
+ @Test
+ public void testSshCommandSensorWithEffectorInEnv() throws Exception {
+ // TODO Should we automatically trim the stdout?
--- End diff --
Already end trimming at https://github.com/apache/brooklyn-server/blob/master/core/src/main/java/org/apache/brooklyn/core/sensor/ssh/SshCommandSensor.java#L130. I think that's good enough.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server issue #296: Various minor things
Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the issue:
https://github.com/apache/brooklyn-server/pull/296
Thanks @neykov - incorporated comments and squashed. Merging now.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server pull request #296: Various minor things
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/brooklyn-server/pull/296
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server issue #296: Various minor things
Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the issue:
https://github.com/apache/brooklyn-server/pull/296
Can be merged after fixing the `assertExecContains` -> `assertExecNotContains` name.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server pull request #296: Various minor things
Posted by neykov <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---