Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-02-14 07:58:16 -0500
committerUwe Stieber2013-02-14 07:58:16 -0500
commit0ef7371b53eaf6695a1459e2054dd5a98bb9c6ca (patch)
treec3c005272a1bf039aa4cebf316504b24e93b6226
parent5187a4c562ce28d00a5d257dc3a6882b6d7b02d4 (diff)
downloadorg.eclipse.tcf-0ef7371b53eaf6695a1459e2054dd5a98bb9c6ca.tar.gz
org.eclipse.tcf-0ef7371b53eaf6695a1459e2054dd5a98bb9c6ca.tar.xz
org.eclipse.tcf-0ef7371b53eaf6695a1459e2054dd5a98bb9c6ca.zip
Target Explorer: Added basic TCF channel step contributions and tests
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/StepContextAdapter.java56
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.properties5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/steps/IStepProperties.java27
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerModelStepContextAdapter.java85
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.properties2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/AbstractPeerModelContextStep.java32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/CloseChannelStep.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/OpenChannelStep.java91
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml405
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/StepperTests.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/steps/ParameterizedTestStep.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/ParameterizedTestStep.java)64
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/steps/TestStep.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/TestStep.java)82
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/steps/ValidateChannelStep.java49
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllTests.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/tests/TcfStepperTests.java80
19 files changed, 738 insertions, 319 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/StepContextAdapter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/StepContextAdapter.java
index 3c613e9da..7e18fb467 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/StepContextAdapter.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/StepContextAdapter.java
@@ -9,15 +9,12 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.launch.core.internal.adapters;
-import java.util.concurrent.atomic.AtomicReference;
-
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
@@ -68,25 +65,7 @@ public class StepContextAdapter extends PlatformObject implements IStepContext {
*/
@Override
public String getName() {
- final AtomicReference<String> name = new AtomicReference<String>();
-
- if (launch != null) {
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- name.set(getId());
- }
- };
-
- if (Protocol.isDispatchThread()) {
- runnable.run();
- }
- else {
- Protocol.invokeAndWait(runnable);
- }
- }
-
- return name.get();
+ return getId();
}
/* (non-Javadoc)
@@ -115,37 +94,6 @@ public class StepContextAdapter extends PlatformObject implements IStepContext {
*/
@Override
public Object getAdapter(final Class adapter) {
- // NOTE: The getAdapter(...) method can be invoked from many place and
- // many threads where we cannot control the calls. Therefore, this
- // method is allowed be called from any thread.
- final AtomicReference<Object> object = new AtomicReference<Object>();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- object.set(doGetAdapter(adapter));
- }
- };
-
- if (Protocol.isDispatchThread()) {
- runnable.run();
- }
- else {
- Protocol.invokeAndWait(runnable);
- }
-
- return object.get() != null ? object.get() : super.getAdapter(adapter);
- }
-
- /**
- * Returns an object which is an instance of the given class associated with this object.
- * Returns <code>null</code> if no such object can be found.
- * <p>
- * This method must be called within the TCF dispatch thread!
- *
- * @param adapter The adapter class to look up.
- * @return The adapter or <code>null</code>.
- */
- protected Object doGetAdapter(Class<?> adapter) {
if (ILaunch.class.equals(adapter)) {
return launch;
}
@@ -162,6 +110,6 @@ public class StepContextAdapter extends PlatformObject implements IStepContext {
}
}
- return null;
+ return super.getAdapter(adapter);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF
index 45b1a5985..0a5e0dce2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF
@@ -13,6 +13,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
org.eclipse.tcf.te.runtime.model;bundle-version="1.1.0",
org.eclipse.tcf.te.runtime.persistence;bundle-version="1.1.0",
org.eclipse.tcf.te.runtime.services;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.stepper;bundle-version="1.1.0",
org.eclipse.tcf.te.tcf.core;bundle-version="1.1.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
@@ -23,6 +24,7 @@ Export-Package: org.eclipse.tcf.te.tcf.locator,
org.eclipse.tcf.te.tcf.locator.interfaces.nodes,
org.eclipse.tcf.te.tcf.locator.interfaces.preferences,
org.eclipse.tcf.te.tcf.locator.interfaces.services,
+ org.eclipse.tcf.te.tcf.locator.interfaces.steps,
org.eclipse.tcf.te.tcf.locator.internal;x-internal:=true,
org.eclipse.tcf.te.tcf.locator.internal.adapters;x-internal:=true,
org.eclipse.tcf.te.tcf.locator.internal.nls;x-internal:=true,
@@ -32,4 +34,5 @@ Export-Package: org.eclipse.tcf.te.tcf.locator,
org.eclipse.tcf.te.tcf.locator.model,
org.eclipse.tcf.te.tcf.locator.nodes,
org.eclipse.tcf.te.tcf.locator.persistence,
- org.eclipse.tcf.te.tcf.locator.services
+ org.eclipse.tcf.te.tcf.locator.services,
+ org.eclipse.tcf.te.tcf.locator.steps
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.properties
index e81e17148..1034f2f94 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.properties
@@ -10,3 +10,8 @@
pluginName = Target Explorer, TCF Locator Extensions
providerName = Eclipse.org - Target Explorer
+
+# ***** Steps *****
+
+OpenChannelStep.name=Open Channel Step
+CloseChannelStep.name=Close Channel Step
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
index 00f5fe277..a6f54f64d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
@@ -16,6 +16,7 @@
adaptableType="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"
class="org.eclipse.tcf.te.tcf.locator.internal.adapters.AdapterFactory">
<adapter type="org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableURIProvider"/>
+ <adapter type="org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext"/>
</factory>
<factory
adaptableType="org.eclipse.tcf.protocol.IPeer"
@@ -117,4 +118,17 @@
</service>
</extension>
+<!-- Step contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.stepper.steps">
+ <step
+ class="org.eclipse.tcf.te.tcf.locator.steps.OpenChannelStep"
+ id="org.eclipse.tcf.te.tcf.stepper.OpenChannelStep"
+ label="%OpenChannelStep.name">
+ </step>
+ <step
+ class="org.eclipse.tcf.te.tcf.locator.steps.CloseChannelStep"
+ id="org.eclipse.tcf.te.tcf.stepper.CloseChannelStep"
+ label="%CloseChannelStep.name">
+ </step>
+ </extension>
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/steps/IStepProperties.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/steps/IStepProperties.java
new file mode 100644
index 000000000..846cd91b8
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/steps/IStepProperties.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.locator.interfaces.steps;
+
+
+/**
+ * Interface defining locator related step property id's.
+ */
+public interface IStepProperties {
+
+ /**
+ * Define the prefix used by all other attribute id's as prefix.
+ */
+ public static final String ATTR_PREFIX = "org.eclipse.tcf.te.tcf.locator"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute: The TCF channel.
+ */
+ public static final String ATTR_CHANNEL = IStepProperties.ATTR_PREFIX + ".channel"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java
index 1f068b73e..09238092d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java
@@ -18,6 +18,7 @@ import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.runtime.model.factory.Factory;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableURIProvider;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
@@ -94,6 +95,11 @@ public class AdapterFactory implements IAdapterFactory {
return node.get();
}
}
+ if (IStepContext.class.equals(adapterType)) {
+ if (adaptableObject instanceof IPeerModel) {
+ return new PeerModelStepContextAdapter((IPeerModel)adaptableObject);
+ }
+ }
}
return null;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerModelStepContextAdapter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerModelStepContextAdapter.java
new file mode 100644
index 000000000..770af3f06
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerModelStepContextAdapter.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.locator.internal.adapters;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+
+/**
+ * Peer model step context adapter implementation.
+ */
+public class PeerModelStepContextAdapter extends PlatformObject implements IStepContext {
+ // Reference to the peer model node
+ private final IPeerModel peerModel;
+
+ /**
+ * Constructor
+ *
+ * @param peerModel The peer model node. Must not be <code>null</code>.
+ */
+ public PeerModelStepContextAdapter(IPeerModel peerModel) {
+ Assert.isNotNull(peerModel);
+ this.peerModel = peerModel;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getId()
+ */
+ @Override
+ public String getId() {
+ return peerModel.getPeerId();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getSecondaryId()
+ */
+ @Override
+ public String getSecondaryId() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getName()
+ */
+ @Override
+ public String getName() {
+ return peerModel.getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getContextObject()
+ */
+ @Override
+ public Object getContextObject() {
+ return peerModel;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getInfo(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public String getInfo(IPropertiesContainer data) {
+ return getName() + "(" + getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (IPeerModel.class.isAssignableFrom(adapter)) {
+ return peerModel;
+ }
+ return super.getAdapter(adapter);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.java
index c52249d53..fcbc25f02 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.java
@@ -68,4 +68,6 @@ public class Messages extends NLS {
// **** Declare externalized string id's down here *****
public static String PeersPersistenceDelegate_error_noRootLocation;
+
+ public static String AbstractPeerModelContextStep_error_invalidPeerModel;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.properties
index 5dc52554b..bc185a5e4 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.properties
@@ -9,3 +9,5 @@
###############################################################################
PeersPersistenceDelegate_error_noRootLocation=Failed to determine persistence storage root location
+
+AbstractPeerModelContextStep_error_invalidPeerModel=Failed to determine the peer model node from the step context.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/AbstractPeerModelContextStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/AbstractPeerModelContextStep.java
new file mode 100644
index 000000000..98a125764
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/AbstractPeerModelContextStep.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.locator.steps;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.te.runtime.stepper.extensions.AbstractStep;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+
+/**
+ * Abstract peer model context step
+ */
+public abstract class AbstractPeerModelContextStep extends AbstractStep {
+
+ /**
+ * Determines the active peer model node from the given step context.
+ *
+ * @param context The step context. Must not be <code>null</code>.
+ * @return The peer model node or <code>null</code>.
+ */
+ public IPeerModel getPeerModel(IStepContext context) {
+ Assert.isNotNull(context);
+ return (IPeerModel)context.getAdapter(IPeerModel.class);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/CloseChannelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/CloseChannelStep.java
new file mode 100644
index 000000000..9a9f80644
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/CloseChannelStep.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.locator.steps;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.locator.interfaces.steps.IStepProperties;
+
+/**
+ * Closes a TCF channel previously opened to the peer mode node determined from
+ * the given step context.
+ */
+public class CloseChannelStep extends AbstractPeerModelContextStep {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
+ IChannel channel = (IChannel)StepperAttributeUtil.getProperty(IStepProperties.ATTR_CHANNEL, fullQualifiedId, data);
+ if (channel != null && channel.getState() != IChannel.STATE_CLOSED) {
+ Tcf.getChannelManager().closeChannel(channel);
+ }
+ callback.done(this, Status.OK_STATUS);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/OpenChannelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/OpenChannelStep.java
new file mode 100644
index 000000000..31e1d6e93
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/OpenChannelStep.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.locator.steps;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.utils.StatusHelper;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
+import org.eclipse.tcf.te.tcf.locator.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.locator.interfaces.steps.IStepProperties;
+import org.eclipse.tcf.te.tcf.locator.internal.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.internal.nodes.InvalidPeerModel;
+
+/**
+ * Opens a TCF channel to the peer mode node determined from the given step context.
+ */
+public class OpenChannelStep extends AbstractPeerModelContextStep {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ Assert.isNotNull(context);
+ Assert.isNotNull(data);
+ Assert.isNotNull(fullQualifiedId);
+ Assert.isNotNull(monitor);
+
+ // If the peer model node cannot be determined from the step context or
+ // the peer model node has an invalid peer associated, the step cannot execute.
+ IPeerModel peerModel = getPeerModel(context);
+ if (peerModel == null || peerModel.getPeer() == null || peerModel instanceof InvalidPeerModel) {
+ IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), Messages.AbstractPeerModelContextStep_error_invalidPeerModel);
+ throw new CoreException(status);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
+ Assert.isNotNull(context);
+ Assert.isNotNull(data);
+ Assert.isNotNull(fullQualifiedId);
+ Assert.isNotNull(monitor);
+
+ // Get the peer model node
+ IPeerModel peerModel = getPeerModel(context);
+ Assert.isNotNull(peerModel);
+
+ // Open the channel
+ Tcf.getChannelManager().openChannel(peerModel.getPeer(), null, new IChannelManager.DoneOpenChannel() {
+ @Override
+ public void doneOpenChannel(final Throwable error, final IChannel channel) {
+ StepperAttributeUtil.setProperty(IStepProperties.ATTR_CHANNEL, fullQualifiedId.getParentId(), data, channel);
+ callback.done(OpenChannelStep.this, StatusHelper.getStatus(error));
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractStep#rollback(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.core.runtime.IStatus, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void rollback(IStepContext context, IPropertiesContainer data, IStatus status, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
+ IChannel channel = (IChannel)StepperAttributeUtil.getProperty(IStepProperties.ATTR_CHANNEL, fullQualifiedId, data);
+ if (channel != null && channel.getState() != IChannel.STATE_CLOSED) {
+ Tcf.getChannelManager().closeChannel(channel);
+ }
+ super.rollback(context, data, status, fullQualifiedId, monitor, callback);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml
index b1a815264..af7f31f62 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml
@@ -1,191 +1,214 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
-<!-- Test status handler contributions -->
- <extension point="org.eclipse.tcf.te.runtime.statushandler.handlers">
- <handler
- id="org.eclipse.tcf.te.tests.handler1"
- class="org.eclipse.tcf.te.tests.statushandler.TestStatusHandler">
- </handler>
-
- <handler
- id="org.eclipse.tcf.te.tests.handler2"
- class="org.eclipse.tcf.te.tests.statushandler.TestStatusHandler">
- </handler>
- </extension>
-
- <extension point="org.eclipse.tcf.te.runtime.statushandler.bindings">
- <binding
- handlerId="org.eclipse.tcf.te.tests.handler1"
- id="org.eclipse.tcf.te.tests.binding1">
- <enablement>
- <or>
- <instanceof value="org.eclipse.tcf.te.tests.CoreTestCase"/>
- <instanceof value="org.eclipse.tcf.te.runtime.interfaces.IConditionTester"/>
- </or>
- </enablement>
- </binding>
-
- <binding
- handlerId="org.eclipse.tcf.te.tests.handler2"
- id="org.eclipse.tcf.te.tests.binding2">
- <enablement>
- <instanceof value="org.eclipse.tcf.te.runtime.interfaces.IConditionTester"/>
- </enablement>
- </binding>
- </extension>
-
-<!-- Test stepper engine contributions -->
- <extension point="org.eclipse.tcf.te.runtime.stepper.steps">
- <step
- class="org.eclipse.tcf.te.tests.stepper.TestStep"
- id="org.eclipse.tcf.te.tests.stepper.step1"
- label="Test Step 1">
- </step>
-
- <step
- id="org.eclipse.tcf.te.tests.stepper.step2"
- label="Test Step 2">
- <class
- class="org.eclipse.tcf.te.tests.stepper.ParameterizedTestStep">
- <parameter
- name="param1"
- value="value1">
- </parameter>
- </class>
- </step>
-
- <step
- class="org.eclipse.tcf.te.tests.stepper.TestStep"
- id="org.eclipse.tcf.te.tests.stepper.step3"
- label="Test Step 3">
- <description>
- Just another test step
- </description>
- </step>
-
- <step
- class="org.eclipse.tcf.te.tests.stepper.TestStep"
- id="org.eclipse.tcf.te.tests.stepper.step4"
- label="Test Step 4">
- <requires
- id="org.eclipse.tcf.te.tests.stepper.step1">
- </requires>
- </step>
-
- <step
- class="org.eclipse.tcf.te.tests.stepper.TestStep"
- id="org.eclipse.tcf.te.tests.stepper.step5"
- label="Test Step 5">
- </step>
- </extension>
-
- <extension point="org.eclipse.tcf.te.runtime.stepper.stepGroups">
- <stepGroup
- id="org.eclipse.tcf.te.tests.stepper.stepGroup1"
- label="Test Step Group 1"
- locked="false">
- </stepGroup>
-
- <stepGroup
- id="org.eclipse.tcf.te.tests.stepper.stepGroup2"
- label="Test Step Group 2"
- locked="true">
- <description>
- Just a step group description
- </description>
- </stepGroup>
-
- <stepGroup
- id="org.eclipse.tcf.te.tests.stepper.stepGroup3"
- label="Test Step Group 3"
- locked="false">
- <references>
- <reference
- disable="false"
- hidden="false"
- id="org.eclipse.tcf.te.tests.stepper.step1"
- removable="true"
- singleton="true">
- </reference>
- <reference
- disable="false"
- hidden="false"
- id="org.eclipse.tcf.te.tests.stepper.step2"
- removable="true"
- singleton="true">
- </reference>
- <reference
- disable="false"
- hidden="false"
- id="org.eclipse.tcf.te.tests.stepper.step3"
- removable="true"
- singleton="true">
- </reference>
- <reference
- disable="false"
- hidden="false"
- id="org.eclipse.tcf.te.tests.stepper.step4"
- removable="true"
- singleton="true">
- </reference>
- <reference
- disable="false"
- hidden="false"
- id="org.eclipse.tcf.te.tests.stepper.step5"
- removable="true"
- singleton="true">
- <enablement>
- <with variable="context">
- <instanceof value="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode"/>
- </with>
- </enablement>
- </reference>
- </references>
- </stepGroup>
-
- <stepGroup
- id="org.eclipse.tcf.te.tests.stepper.stepGroup4"
- label="Test Step Group 4"
- locked="false">
- <references>
- <reference
- disable="false"
- hidden="false"
- id="org.eclipse.tcf.te.tests.stepper.step1"
- removable="true"
- singleton="true">
- </reference>
- <reference
- disable="false"
- hidden="false"
- id="org.eclipse.tcf.te.tests.stepper.step2"
- removable="true"
- singleton="true">
- </reference>
- <reference
- disable="false"
- hidden="false"
- id="org.eclipse.tcf.te.tests.stepper.step3"
- removable="true"
- singleton="true">
- </reference>
- <reference
- disable="false"
- hidden="false"
- id="org.eclipse.tcf.te.tests.stepper.step4"
- removable="true"
- singleton="true">
- </reference>
- <reference
- disable="false"
- hidden="false"
- id="org.eclipse.tcf.te.tests.stepper.step5"
- removable="true"
- singleton="true">
- </reference>
- </references>
- </stepGroup>
- </extension>
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+<!-- Test status handler contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.statushandler.handlers">
+ <handler
+ id="org.eclipse.tcf.te.tests.handler1"
+ class="org.eclipse.tcf.te.tests.statushandler.TestStatusHandler">
+ </handler>
+
+ <handler
+ id="org.eclipse.tcf.te.tests.handler2"
+ class="org.eclipse.tcf.te.tests.statushandler.TestStatusHandler">
+ </handler>
+ </extension>
+
+ <extension point="org.eclipse.tcf.te.runtime.statushandler.bindings">
+ <binding
+ handlerId="org.eclipse.tcf.te.tests.handler1"
+ id="org.eclipse.tcf.te.tests.binding1">
+ <enablement>
+ <or>
+ <instanceof value="org.eclipse.tcf.te.tests.CoreTestCase"/>
+ <instanceof value="org.eclipse.tcf.te.runtime.interfaces.IConditionTester"/>
+ </or>
+ </enablement>
+ </binding>
+
+ <binding
+ handlerId="org.eclipse.tcf.te.tests.handler2"
+ id="org.eclipse.tcf.te.tests.binding2">
+ <enablement>
+ <instanceof value="org.eclipse.tcf.te.runtime.interfaces.IConditionTester"/>
+ </enablement>
+ </binding>
+ </extension>
+
+<!-- Test stepper engine contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.stepper.steps">
+ <step
+ class="org.eclipse.tcf.te.tests.stepper.steps.TestStep"
+ id="org.eclipse.tcf.te.tests.stepper.step1"
+ label="Test Step 1">
+ </step>
+
+ <step
+ id="org.eclipse.tcf.te.tests.stepper.step2"
+ label="Test Step 2">
+ <class
+ class="org.eclipse.tcf.te.tests.stepper.steps.ParameterizedTestStep">
+ <parameter
+ name="param1"
+ value="value1">
+ </parameter>
+ </class>
+ </step>
+
+ <step
+ class="org.eclipse.tcf.te.tests.stepper.steps.TestStep"
+ id="org.eclipse.tcf.te.tests.stepper.step3"
+ label="Test Step 3">
+ <description>
+ Just another test step
+ </description>
+ </step>
+
+ <step
+ class="org.eclipse.tcf.te.tests.stepper.steps.TestStep"
+ id="org.eclipse.tcf.te.tests.stepper.step4"
+ label="Test Step 4">
+ <requires
+ id="org.eclipse.tcf.te.tests.stepper.step1">
+ </requires>
+ </step>
+
+ <step
+ class="org.eclipse.tcf.te.tests.stepper.steps.TestStep"
+ id="org.eclipse.tcf.te.tests.stepper.step5"
+ label="Test Step 5">
+ </step>
+
+ <step
+ class="org.eclipse.tcf.te.tests.stepper.steps.ValidateChannelStep"
+ id="org.eclipse.tcf.te.tests.channelStepTests.validate"
+ label="Validate Channel Step">
+ </step>
+ </extension>
+
+ <extension point="org.eclipse.tcf.te.runtime.stepper.stepGroups">
+ <stepGroup
+ id="org.eclipse.tcf.te.tests.stepper.stepGroup1"
+ label="Test Step Group 1"
+ locked="false">
+ </stepGroup>
+
+ <stepGroup
+ id="org.eclipse.tcf.te.tests.stepper.stepGroup2"
+ label="Test Step Group 2"
+ locked="true">
+ <description>
+ Just a step group description
+ </description>
+ </stepGroup>
+
+ <stepGroup
+ id="org.eclipse.tcf.te.tests.stepper.stepGroup3"
+ label="Test Step Group 3"
+ locked="false">
+ <references>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step1"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step2"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step3"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step4"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step5"
+ removable="true"
+ singleton="true">
+ <enablement>
+ <with variable="context">
+ <instanceof value="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode"/>
+ </with>
+ </enablement>
+ </reference>
+ </references>
+ </stepGroup>
+
+ <stepGroup
+ id="org.eclipse.tcf.te.tests.stepper.stepGroup4"
+ label="Test Step Group 4"
+ locked="false">
+ <references>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step1"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step2"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step3"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step4"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step5"
+ removable="true"
+ singleton="true">
+ </reference>
+ </references>
+ </stepGroup>
+
+ <stepGroup
+ id="org.eclipse.tcf.te.tests.channelStepTests"
+ label="Test TCF Channel Steps"
+ locked="true">
+ <references>
+ <reference
+ id="org.eclipse.tcf.te.tcf.stepper.OpenChannelStep">
+ </reference>
+ <reference
+ id="org.eclipse.tcf.te.tests.channelStepTests.validate">
+ </reference>
+ <reference
+ id="org.eclipse.tcf.te.tcf.stepper.CloseChannelStep">
+ </reference>
+ </references>
+ </stepGroup>
+ </extension>
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/StepperTests.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/StepperTests.java
index a2f2e9c87..f61891454 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/StepperTests.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/StepperTests.java
@@ -26,6 +26,8 @@ import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupable;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper;
import org.eclipse.tcf.te.runtime.stepper.stepper.Stepper;
import org.eclipse.tcf.te.tests.CoreTestCase;
+import org.eclipse.tcf.te.tests.stepper.steps.ParameterizedTestStep;
+import org.eclipse.tcf.te.tests.stepper.steps.TestStep;
/**
* Stepper engine test cases.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/ParameterizedTestStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/steps/ParameterizedTestStep.java
index dd67cea9a..050b78a72 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/ParameterizedTestStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/steps/ParameterizedTestStep.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tests.stepper;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-/**
- * Parameterized test step implementation.
- */
-public class ParameterizedTestStep extends TestStep {
- public Map<?,?> params = null;
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractStep#doSetInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
- */
- @Override
- public void doSetInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- super.doSetInitializationData(config, propertyName, data);
-
- if (data instanceof Map<?,?>) params = (Map<?,?>)data;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tests.stepper.steps;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
+/**
+ * Parameterized test step implementation.
+ */
+public class ParameterizedTestStep extends TestStep {
+ public Map<?,?> params = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractStep#doSetInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void doSetInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ super.doSetInitializationData(config, propertyName, data);
+
+ if (data instanceof Map<?,?>) params = (Map<?,?>)data;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/TestStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/steps/TestStep.java
index 9c70b1bbb..64e98af46 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/TestStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/steps/TestStep.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tests.stepper;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.stepper.extensions.AbstractStep;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
-
-/**
- * Empty test step contribution.
- */
-public class TestStep extends AbstractStep {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
- */
- @Override
- public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
- data.setProperty(getId(), fullQualifiedId.toString());
- callback.done(this, Status.OK_STATUS);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tests.stepper.steps;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.extensions.AbstractStep;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+
+/**
+ * Empty test step contribution.
+ */
+public class TestStep extends AbstractStep {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
+ data.setProperty(getId(), fullQualifiedId.toString());
+ callback.done(this, Status.OK_STATUS);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/steps/ValidateChannelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/steps/ValidateChannelStep.java
new file mode 100644
index 000000000..f5a43fab6
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/steps/ValidateChannelStep.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tests.stepper.steps;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.extensions.AbstractStep;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.locator.interfaces.steps.IStepProperties;
+
+/**
+ * Get the channel and validate that the channel is open
+ */
+public class ValidateChannelStep extends AbstractStep {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
+ IChannel channel = (IChannel)StepperAttributeUtil.getProperty(IStepProperties.ATTR_CHANNEL, fullQualifiedId, data);
+ data.setProperty(IStepProperties.ATTR_CHANNEL, channel);
+ if (channel != null && channel.getState() == IChannel.STATE_OPEN) {
+ data.setProperty("ValidateChannelStep.result", true); //$NON-NLS-1$
+ }
+ callback.done(this, Status.OK_STATUS);
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllTests.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllTests.java
index b3fed2a27..6fb7bf70b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllTests.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllTests.java
@@ -21,6 +21,7 @@ import org.eclipse.tcf.te.tests.tcf.launch.TcfLaunchTests;
import org.eclipse.tcf.te.tests.tcf.processes.launcher.ProcessLauncherTestCase;
import org.eclipse.tcf.te.tests.tcf.processes.model.ProcessModelTestCase;
import org.eclipse.tcf.te.tests.tcf.tests.TcfCoreTests;
+import org.eclipse.tcf.te.tests.tcf.tests.TcfStepperTests;
import org.eclipse.tcf.te.tests.utils.UtilityTestCase;
/**
@@ -65,6 +66,7 @@ public class AllTests {
suite.addTest(StatusHandlerTestCase.getTestSuite());
suite.addTest(StepperTests.getTestSuite());
suite.addTest(TcfCoreTests.getTestSuite());
+ suite.addTest(TcfStepperTests.getTestSuite());
suite.addTest(TcfLaunchTests.getTestSuite());
suite.addTest(ConcurrentTestCase.getTestSuite());
suite.addTest(ModelTestCase.getTestSuite());
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/tests/TcfStepperTests.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/tests/TcfStepperTests.java
new file mode 100644
index 000000000..2f3fbfbf8
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/tests/TcfStepperTests.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tests.tcf.tests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper;
+import org.eclipse.tcf.te.runtime.stepper.stepper.Stepper;
+import org.eclipse.tcf.te.tcf.locator.interfaces.steps.IStepProperties;
+import org.eclipse.tcf.te.tests.tcf.TcfTestCase;
+
+/**
+ * TCF Stepper tests.
+ */
+public class TcfStepperTests extends TcfTestCase {
+
+ /**
+ * Provides a test suite to the caller which combines all single
+ * test bundled within this category.
+ *
+ * @return Test suite containing all test for this test category.
+ */
+ public static Test getTestSuite() {
+ TestSuite testSuite = new TestSuite("TCF Stepper tests"); //$NON-NLS-1$
+
+ // add ourself to the test suite
+ testSuite.addTestSuite(TcfStepperTests.class);
+
+ return testSuite;
+ }
+
+ public void testChannelSteps() {
+ assertNotNull("Precondition Failure: peer model is not available.", peerModel); //$NON-NLS-1$
+
+ final IStepper stepper = new Stepper("testExecuteStepGroup"); //$NON-NLS-1$
+
+ IPropertiesContainer properties = new PropertiesContainer();
+ IStepContext context = (IStepContext)Platform.getAdapterManager().getAdapter(peerModel, IStepContext.class);
+ assertNotNull("Failed to get step context adapter for peer model.", context); //$NON-NLS-1$
+
+ // Initialize the stepper
+ stepper.initialize(context, "org.eclipse.tcf.te.tests.channelStepTests", properties, null); //$NON-NLS-1$
+
+ ExecutorsUtil.execute(new Runnable() {
+ @Override
+ public void run() {
+ // Execute
+ try {
+ stepper.execute();
+ }
+ catch (Exception e) {
+ assertNull("Unexpected exception when executing step group", e); //$NON-NLS-1$
+ }
+ }
+ });
+
+ // Wait for the stepper to be finished
+ assertFalse("Timeout executing step group", ExecutorsUtil.waitAndExecute(0, new IStepper.ExecutionFinishedConditionTester(stepper))); //$NON-NLS-1$
+
+ IChannel channel = (IChannel)properties.getProperty(IStepProperties.ATTR_CHANNEL);
+ assertNotNull("Failed to create channel.", channel); //$NON-NLS-1$
+ assertTrue("Failed to open channel.", properties.getBooleanProperty("ValidateChannelStep.result")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Failed to close channel.", channel.getState() == IChannel.STATE_CLOSED); //$NON-NLS-1$
+ }
+
+}

Back to the top