Github user geomacy commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/1030#discussion_r44902393
--- Diff:
usage/test-framework/src/main/java/org/apache/brooklyn/test/framework/SimpleCommand.java
---
@@ -0,0 +1,50 @@
+/*
+ * 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.test.framework;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.ImplementedBy;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.entity.trait.Startable;
+import org.apache.brooklyn.core.sensor.AttributeSensorAndConfigKey;
+import org.apache.brooklyn.entity.software.base.SoftwareProcess;
+import org.apache.brooklyn.util.core.flags.SetFromFlag;
+import org.apache.brooklyn.util.os.Os;
+
+import static org.apache.brooklyn.core.config.ConfigKeys.newConfigKey;
+
+/**
+ * Entity to invoke on a node a simple command that will immediately
succeed or fail.
+ *
+ * Invokes the command in the start operation, and declares itself RUNNING.
+ */
+@ImplementedBy(SimpleCommandImpl.class)
+public interface SimpleCommand extends Entity, Startable {
+
+ @SetFromFlag(nullable = false)
+ ConfigKey<String> DEFAULT_COMMAND =
ConfigKeys.newConfigKey(String.class, "defaultCommand",
+ "Command to invoke if no script is provided via a
downloadUrl");
+
+ @SetFromFlag("downloadUrl")
+ AttributeSensorAndConfigKey<String, String> DOWNLOAD_URL =
SoftwareProcess.DOWNLOAD_URL;
+
+ @SetFromFlag("scriptDir")
+ ConfigKey<String> SCRIPT_DIR = newConfigKey("scriptDir", "directory
where downloaded scripts should be put", Os.tmp());
--- End diff --
Thanks for the detailed reviews. Regarding the 'step back' comment on the
amount of code, I couldn't agree more! I followed the VanillaSoftwareProcess
model, and while that was probably a valuable learning exercise, it leaves what
does seem like an awful lot of code to do something simple. If it's ok to do
the work as tasks directly in the ```start()``` of the entity then I'll rework
it that way. (I wasn't sure if there might be some non-obvious dependencies
elsewhere in the code that meant you had to have a driver or lifecycle
classes?)
---
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.
---