Author: adietish
Date: 2010-11-19 09:56:56 -0500 (Fri, 19 Nov 2010)
New Revision: 26769
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstancePropertyTester.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/ChangeLog
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/context/MockIntegrationTestContext.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/InstanceMockIntegrationTest.java
Log:
[JBIDE-7688] renamed State to InstanceState, added property isRunning, testing for
ShowInRemoteSystemExplorerHandler
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-11-19 14:40:46
UTC (rev 26768)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-11-19 14:56:56
UTC (rev 26769)
@@ -1,5 +1,11 @@
2010-11-19 André Dietisheim <adietish(a)redhat.com>
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java:
+ (isRunning):
+ [JBIDE-7688] renamed State to InstanceState, added property isRunning, testing for
ShowInRemoteSystemExplorerHandler
+ * src/org/jboss/tools/deltacloud/core/client/Instance.java (InstanceState):
+ (isRunning):
+ [JBIDE-7688] renamed State to InstanceState, added property isRunning, testing for
ShowInRemoteSystemExplorerHandler
* src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (loadCloud):
[JBIDE-7663] removed loading of images and instances on startup
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2010-11-19
14:40:46 UTC (rev 26768)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2010-11-19
14:56:56 UTC (rev 26769)
@@ -14,17 +14,17 @@
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
import org.jboss.tools.deltacloud.core.client.Instance;
-import org.jboss.tools.deltacloud.core.client.Instance.State;
+import org.jboss.tools.deltacloud.core.client.Instance.InstanceState;
import org.jboss.tools.deltacloud.core.client.InstanceAction;
import org.jboss.tools.deltacloud.core.client.InternalDeltaCloudClient;
public class DeltaCloudInstance {
- public final static String PENDING = Instance.State.PENDING.toString();
- public final static String RUNNING = Instance.State.RUNNING.toString();
- public final static String STOPPED = Instance.State.STOPPED.toString();
- public final static String TERMINATED = Instance.State.TERMINATED.toString();
- public final static String BOGUS = Instance.State.BOGUS.toString();
+ public final static String PENDING = Instance.InstanceState.PENDING.toString();
+ public final static String RUNNING = Instance.InstanceState.RUNNING.toString();
+ public final static String STOPPED = Instance.InstanceState.STOPPED.toString();
+ public final static String TERMINATED = Instance.InstanceState.TERMINATED.toString();
+ public final static String BOGUS = Instance.InstanceState.BOGUS.toString();
public final static String START = InstanceAction.START;
public final static String STOP = InstanceAction.STOP;
@@ -89,7 +89,7 @@
}
public boolean isStopped() {
- return instance.getState() == State.STOPPED;
+ return instance.getState() == InstanceState.STOPPED;
}
public boolean canStart() {
@@ -109,6 +109,10 @@
}
+ public boolean isRunning() {
+ return instance.isRunning();
+ }
+
public String getHostName() {
List<String> hostNames = getHostNames();
if (hostNames != null && hostNames.size() > 0)
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java 2010-11-19
14:40:46 UTC (rev 26768)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java 2010-11-19
14:56:56 UTC (rev 26769)
@@ -19,7 +19,7 @@
private static final long serialVersionUID = 1L;
- public static enum State {
+ public static enum InstanceState {
RUNNING, STOPPED, PENDING, TERMINATED, BOGUS
};
@@ -44,7 +44,7 @@
private String keyname;
@XmlElement
- private State state;
+ private InstanceState state;
private List<InstanceAction> actions;
@@ -97,9 +97,9 @@
protected void setState(String state) {
try {
- this.state = State.valueOf(state);
+ this.state = InstanceState.valueOf(state);
} catch (Exception e) {
- this.state = State.BOGUS;
+ this.state = InstanceState.BOGUS;
}
}
@@ -153,7 +153,7 @@
return realmId;
}
- public State getState() {
+ public InstanceState getState() {
return state;
}
@@ -198,6 +198,10 @@
return getAction(InstanceAction.DESTROY) != null;
}
+ public boolean isRunning() {
+ return getState() == InstanceState.RUNNING;
+ }
+
public List<String> getPublicAddresses() {
return publicAddresses.getAddress();
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-11-19 14:40:46
UTC (rev 26768)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-11-19 14:56:56
UTC (rev 26769)
@@ -1,3 +1,9 @@
+2010-11-19 André Dietisheim <adietish(a)redhat.com>
+
+ * plugin.xml:
+ * src/org/jboss/tools/deltacloud/ui/commands/InstancePropertyTester.java (test):
+ [JBIDE-7688] added property isRunning, testing for ShowInRemoteSystemExplorerHandler
handler
+
2010-11-18 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard2.java
(performFinish):
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-11-19 14:40:46
UTC (rev 26768)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-11-19 14:56:56
UTC (rev 26769)
@@ -393,11 +393,15 @@
commandId="org.jboss.tools.deltacloud.ui.showremotesysexplorer">
<activeWhen>
<with
- variable="selection">
- <iterate>
- <instanceof
-
value="org.jboss.tools.deltacloud.core.DeltaCloudInstance">
- </instanceof>
+ variable="selection">
+ <iterate operator="and">
+ <and>
+ <adapt
+
type="org.jboss.tools.deltacloud.core.DeltaCloudInstance">
+ <test property="org.jboss.tools.deltacloud.ui.commands.isRunning"
+ value="true"/>
+ </adapt>
+ </and>
</iterate>
</with>
</activeWhen>
@@ -833,7 +837,7 @@
class="org.jboss.tools.deltacloud.ui.commands.InstancePropertyTester"
id="org.jboss.tools.deltacloud.ui.commands.instancepropertytester"
namespace="org.jboss.tools.deltacloud.ui.commands"
- properties="canStart,canStop,canReboot,canDestroy"
+ properties="canStart,canStop,canReboot,canDestroy,isRunning"
type="org.jboss.tools.deltacloud.core.DeltaCloudInstance">
</propertyTester>
</extension>
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstancePropertyTester.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstancePropertyTester.java 2010-11-19
14:40:46 UTC (rev 26768)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstancePropertyTester.java 2010-11-19
14:56:56 UTC (rev 26769)
@@ -27,6 +27,7 @@
private static final String PROPERTY_ACTION_CANSTOP = "canStop";
private static final String PROPERTY_ACTION_CANREBOOT = "canReboot";
private static final String PROPERTY_ACTION_CANDESTROY = "canDestroy";
+ private static final String PROPERTY_ACTION_ISRUNNING = "isRunning";
@Override
public boolean test(Object receiver, String property, Object[] args, Object
expectedValue) {
@@ -38,15 +39,18 @@
if (PROPERTY_ACTION_CANSTART.equals(property)) {
return equalsExpectedValue(instance.canStart(), expectedValue);
}
- if (PROPERTY_ACTION_CANSTOP.equals(property)) {
+ else if (PROPERTY_ACTION_CANSTOP.equals(property)) {
return equalsExpectedValue(instance.canStop(), expectedValue);
}
- if (PROPERTY_ACTION_CANREBOOT.equals(property)) {
+ else if (PROPERTY_ACTION_CANREBOOT.equals(property)) {
return equalsExpectedValue(instance.canReboot(), expectedValue);
}
- if (PROPERTY_ACTION_CANDESTROY.equals(property)) {
+ else if (PROPERTY_ACTION_CANDESTROY.equals(property)) {
return equalsExpectedValue(instance.canDestroy(), expectedValue);
}
+ else if (PROPERTY_ACTION_ISRUNNING.equals(property)) {
+ return equalsExpectedValue(instance.isRunning(), expectedValue);
+ }
return false;
}
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/ChangeLog
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/ChangeLog 2010-11-19 14:40:46
UTC (rev 26768)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/ChangeLog 2010-11-19 14:56:56
UTC (rev 26769)
@@ -1,3 +1,9 @@
+2010-11-19 André Dietisheim <adietish(a)redhat.com>
+
+ *
src/org/jboss/tools/internal/deltacloud/test/core/client/InstanceMockIntegrationTest.java:
+ * src/org/jboss/tools/internal/deltacloud/test/context/MockIntegrationTestContext.java:
+ [JBIDE-7688] renamed State to InstanceState, added property isRunning, testing for
ShowInRemoteSystemExplorerHandler
+
2010-10-21 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/internal/deltacloud/test/DeltaCloudMockClientIntegrationTest.java
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/context/MockIntegrationTestContext.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/context/MockIntegrationTestContext.java 2010-11-19
14:40:46 UTC (rev 26768)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/context/MockIntegrationTestContext.java 2010-11-19
14:56:56 UTC (rev 26769)
@@ -29,7 +29,7 @@
import org.jboss.tools.deltacloud.core.client.DeltaCloudClient;
import org.jboss.tools.deltacloud.core.client.Image;
import org.jboss.tools.deltacloud.core.client.Instance;
-import org.jboss.tools.deltacloud.core.client.Instance.State;
+import org.jboss.tools.deltacloud.core.client.Instance.InstanceState;
/**
* A class that holds the integration test context
@@ -103,7 +103,7 @@
public void quietlyDestroyInstance(Instance instance) {
if (instance != null) {
try {
- if (instance.getState() == Instance.State.RUNNING) {
+ if (instance.getState() == Instance.InstanceState.RUNNING) {
instance.stop(client);
}
instance.destroy(client);
@@ -127,7 +127,7 @@
* @throws ExecutionException
* @throws InterruptedException
*/
- public boolean waitForInstanceState(final String instanceId, final State state, final
long timeout)
+ public boolean waitForInstanceState(final String instanceId, final InstanceState state,
final long timeout)
throws InterruptedException, ExecutionException {
final long startTime = System.currentTimeMillis();
Callable<Boolean> waitingCallable = new Callable<Boolean>() {
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/InstanceMockIntegrationTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/InstanceMockIntegrationTest.java 2010-11-19
14:40:46 UTC (rev 26768)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/InstanceMockIntegrationTest.java 2010-11-19
14:56:56 UTC (rev 26769)
@@ -31,7 +31,7 @@
import org.jboss.tools.deltacloud.core.client.DeltaCloudNotFoundClientException;
import org.jboss.tools.deltacloud.core.client.Image;
import org.jboss.tools.deltacloud.core.client.Instance;
-import org.jboss.tools.deltacloud.core.client.Instance.State;
+import org.jboss.tools.deltacloud.core.client.Instance.InstanceState;
import org.jboss.tools.deltacloud.core.client.InstanceAction;
import org.jboss.tools.deltacloud.core.client.InternalDeltaCloudClient;
import org.jboss.tools.deltacloud.core.client.request.DeltaCloudRequest.HttpMethod;
@@ -137,7 +137,7 @@
instance = testSetup.getClient().createInstance(image.getId());
assertTrue(instance != null);
assertEquals(image.getId(), instance.getImageId());
- assertEquals(State.RUNNING, instance.getState());
+ assertEquals(InstanceState.RUNNING, instance.getState());
} finally {
testSetup.quietlyDestroyInstance(instance);
}
@@ -215,31 +215,31 @@
DeltaCloudClient client = testSetup.getClient();
testInstance.stop(client);
testInstance = client.listInstances(testInstance.getId()); // reload!
- assertEquals(State.STOPPED, testInstance.getState());
+ assertEquals(InstanceState.STOPPED, testInstance.getState());
}
@Test
public void canStartInstance() throws DeltaCloudClientException {
Instance testInstance = testSetup.getTestInstance();
DeltaCloudClient client = testSetup.getClient();
- if (testInstance.getState() == State.RUNNING) {
+ if (testInstance.getState() == InstanceState.RUNNING) {
testInstance.stop(client);
}
testInstance.start(client);
testInstance = client.listInstances(testInstance.getId()); // reload!
- assertEquals(State.RUNNING, testInstance.getState());
+ assertEquals(InstanceState.RUNNING, testInstance.getState());
}
@Test
public void canStartInstanceByAction() throws DeltaCloudClientException {
Instance testInstance = testSetup.getTestInstance();
DeltaCloudClient client = testSetup.getClient();
- if (testInstance.getState() == State.RUNNING) {
+ if (testInstance.getState() == InstanceState.RUNNING) {
testInstance.stop(client);
}
assertTrue(testInstance.start(client));
testInstance = client.listInstances(testInstance.getId()); // reload!
- assertEquals(State.RUNNING, testInstance.getState());
+ assertEquals(InstanceState.RUNNING, testInstance.getState());
}
@Test
@@ -267,7 +267,7 @@
Instance testInstance = testSetup.getTestInstance();
DeltaCloudClient client = testSetup.getClient();
testInstance = client.listInstances(testInstance.getId()); // reload
- assertTrue(testInstance.getState() == State.RUNNING);
+ assertTrue(testInstance.getState() == InstanceState.RUNNING);
assertFalse(testInstance.destroy(client));
}
@@ -279,7 +279,7 @@
try {
testInstance.stop(client);
testInstance = client.listInstances(testInstance.getId()); // reload
- assertTrue(testInstance.getState() == State.STOPPED);
+ assertTrue(testInstance.getState() == InstanceState.STOPPED);
assertFalse(testInstance.reboot(client));
} finally {
testInstance.start(client);