Update DeleteHandler (LTTng 2.0 tracer control) and JUnit tests
authorBernd Hufmann <bhufmann@gmail.com>
Wed, 25 Apr 2012 19:46:10 +0000 (15:46 -0400)
committerBernd Hufmann <bhufmann@gmail.com>
Wed, 25 Apr 2012 19:46:10 +0000 (15:46 -0400)
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelProviderTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelSessionTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstProviderTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstSessionTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/impl/ProbeEventInfoTest.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/DeleteHandler.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java

index 2f0bf7465e2e16ba6664ff195930967746b6354d..2157fbdc462d8fd6ff18916058908052f047c25a 100644 (file)
@@ -37,9 +37,10 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.Target
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceChannelComponent;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceEventComponent;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
-import org.eclipse.rse.core.model.Host;
+import org.eclipse.rse.core.RSECorePlugin;
 import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.core.model.SystemProfile;
+import org.eclipse.rse.core.model.ISystemProfile;
+import org.eclipse.rse.core.model.ISystemRegistry;
 import org.junit.After;
 import org.junit.Before;
 import org.osgi.framework.FrameworkUtil;
@@ -121,9 +122,9 @@ public class TraceControlKernelProviderTests extends TestCase {
         
         ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
 
-        @SuppressWarnings("restriction")
-        IHost host = new Host(new SystemProfile("myProfile", true));
-        host.setHostName("127.0.0.1");
+        ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+        ISystemProfile profile =  registry.createSystemProfile("myProfile", true);
+        IHost host = registry.createLocalHost(profile, "myProfile", "user");
         
         TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
 
index 4843b4f9f984fe94964a254fba5096172293f889..f8d710ae86c35405a70ea60be532f187ebccfced 100644 (file)
@@ -23,9 +23,9 @@ import junit.framework.TestSuite;
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.AddContextDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableChannelDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateSessionDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.DestroyConfirmDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableChannelDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableEventsDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.GetEventInfoDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.service.TestRemoteSystemProxy;
@@ -42,9 +42,10 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceC
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceEventComponent;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceProbeEventComponent;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
-import org.eclipse.rse.core.model.Host;
+import org.eclipse.rse.core.RSECorePlugin;
 import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.core.model.SystemProfile;
+import org.eclipse.rse.core.model.ISystemProfile;
+import org.eclipse.rse.core.model.ISystemRegistry;
 import org.junit.After;
 import org.junit.Before;
 import org.osgi.framework.FrameworkUtil;
@@ -126,9 +127,9 @@ public class TraceControlKernelSessionTests extends TestCase {
         
         ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
 
-        @SuppressWarnings("restriction")
-        IHost host = new Host(new SystemProfile("myProfile", true));
-        host.setHostName("127.0.0.1");
+        ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+        ISystemProfile profile =  registry.createSystemProfile("myProfile", true);
+        IHost host = registry.createLocalHost(profile, "myProfile", "user");
 
         TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
 
index bf0687e984e9aef9c12da22084778f839d4feb01..42f741d456de79dd516c2e39f2d8e2dfec87e041 100644 (file)
@@ -46,9 +46,10 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.TraceEve
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.TraceProbeEventPropertySource;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.TraceSessionPropertySource;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.UstProviderPropertySource;
-import org.eclipse.rse.core.model.Host;
+import org.eclipse.rse.core.RSECorePlugin;
 import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.core.model.SystemProfile;
+import org.eclipse.rse.core.model.ISystemProfile;
+import org.eclipse.rse.core.model.ISystemRegistry;
 import org.eclipse.ui.views.properties.IPropertySource;
 import org.junit.After;
 import org.junit.Before;
@@ -129,9 +130,9 @@ public class TraceControlPropertiesTest extends TestCase {
             
         ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
 
-        @SuppressWarnings("restriction")
-        IHost host = new Host(new SystemProfile("myProfile", true));
-        host.setHostName("127.0.0.1");
+        ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+        ISystemProfile profile =  registry.createSystemProfile("myProfile", true);
+        IHost host = registry.createLocalHost(profile, "myProfile", "user");
 
         TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, proxy);
 
@@ -154,7 +155,7 @@ public class TraceControlPropertiesTest extends TestCase {
         assertNotNull(source.getPropertyDescriptors());
 
         assertEquals("myNode", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_NAME_PROPERTY_ID));
-        assertEquals("127.0.0.1",  source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_ADDRESS_PROPERTY_ID));
+        assertEquals("LOCALHOST",  source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_ADDRESS_PROPERTY_ID));
         assertEquals(TargetNodeState.CONNECTED.name(), source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_STATE_PROPERTY_ID));
         assertNull(source.getPropertyValue("test"));
 
index 2b51940800edf377b03f5e853be779d1d824bf76..673210041c2892dff528b8662a1ef83ab0918d25 100644 (file)
@@ -40,9 +40,10 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceS
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.UstProviderComponent;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.LTTngControlService;
-import org.eclipse.rse.core.model.Host;
+import org.eclipse.rse.core.RSECorePlugin;
 import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.core.model.SystemProfile;
+import org.eclipse.rse.core.model.ISystemProfile;
+import org.eclipse.rse.core.model.ISystemRegistry;
 import org.eclipse.swt.graphics.Image;
 import org.junit.After;
 import org.junit.Before;
@@ -125,9 +126,9 @@ public class TraceControlTreeModelTest extends TestCase {
         
         ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
 
-        @SuppressWarnings("restriction")
-        IHost host = new Host(new SystemProfile("myProfile", true));
-        host.setHostName("127.0.0.1");
+        ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+        ISystemProfile profile =  registry.createSystemProfile("myProfile", true);
+        IHost host = registry.createLocalHost(profile, "myProfile", "user");
 
         TargetNodeComponent node = new TargetNodeComponent(TARGET_NODE_NAME, root, host, fProxy);
 
@@ -139,8 +140,8 @@ public class TraceControlTreeModelTest extends TestCase {
         // ------------------------------------------------------------------------
         // Verify Parameters of TargetNodeComponent
         // ------------------------------------------------------------------------
-        assertEquals("127.0.0.1", node.getHostName());
-        assertEquals("127.0.0.1", node.getToolTip());
+        assertEquals("LOCALHOST", node.getHostName()); // assigned in createLocalHost() above
+        assertEquals("LOCALHOST", node.getToolTip()); // assigned in createLocalHost() above
         Image connectedImage = node.getImage();
         assertNotNull(connectedImage);
         assertEquals(TargetNodeState.CONNECTED, node.getTargetNodeState());
index 3aeba2ab3913e86bc164046b552758ada0268d54..1cd0feb76ad1a247ae29d1a32dd15eb7ade9e4a3 100644 (file)
@@ -20,9 +20,9 @@ import junit.framework.TestSuite;
 
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableChannelDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateSessionDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.DestroyConfirmDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableChannelDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.GetEventInfoDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.service.TestRemoteSystemProxy;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.TraceControlDialogFactory;
@@ -39,9 +39,10 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceC
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceEventComponent;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.UstProviderComponent;
-import org.eclipse.rse.core.model.Host;
+import org.eclipse.rse.core.RSECorePlugin;
 import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.core.model.SystemProfile;
+import org.eclipse.rse.core.model.ISystemProfile;
+import org.eclipse.rse.core.model.ISystemRegistry;
 import org.junit.After;
 import org.junit.Before;
 import org.osgi.framework.FrameworkUtil;
@@ -122,9 +123,9 @@ public class TraceControlUstProviderTests extends TestCase {
         
         ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
 
-        @SuppressWarnings("restriction")
-        IHost host = new Host(new SystemProfile("myProfile", true));
-        host.setHostName("127.0.0.1");
+        ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+        ISystemProfile profile =  registry.createSystemProfile("myProfile", true);
+        IHost host = registry.createLocalHost(profile, "myProfile", "user");
 
         TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
         root.addChild(node);
index d5189bddd35169ac5dca932d8ad5eed7f729d18d..a056d2fc92bf7649e3124186b4f36d581e050700 100644 (file)
@@ -22,9 +22,9 @@ import junit.framework.TestSuite;
 
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableChannelDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateSessionDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.DestroyConfirmDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableChannelDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableEventsDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.GetEventInfoDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.service.TestRemoteSystemProxy;
@@ -41,9 +41,10 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.Target
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceChannelComponent;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceEventComponent;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
-import org.eclipse.rse.core.model.Host;
+import org.eclipse.rse.core.RSECorePlugin;
 import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.core.model.SystemProfile;
+import org.eclipse.rse.core.model.ISystemProfile;
+import org.eclipse.rse.core.model.ISystemRegistry;
 import org.junit.After;
 import org.junit.Before;
 import org.osgi.framework.FrameworkUtil;
@@ -124,9 +125,9 @@ public class TraceControlUstSessionTests extends TestCase {
         
         ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
 
-        @SuppressWarnings("restriction")
-        IHost host = new Host(new SystemProfile("myProfile", true));
-        host.setHostName("127.0.0.1");
+        ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+        ISystemProfile profile =  registry.createSystemProfile("myProfile", true);
+        IHost host = registry.createLocalHost(profile, "myProfile", "user");
 
         TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
 
index 8d10fe2973c9c6dab5d39b2c50c8c215ef4d71f3..022087f6e5a61fe7aa0923d8e47655103bf4ff48 100644 (file)
@@ -17,7 +17,6 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IProbeEvent
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceEnablement;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceEventType;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.BaseEventInfo;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.EventInfo;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.ProbeEventInfo;
 
 /**
index 34cbe187919ba473d2c91043c39d203ed1a8fff6..b694d83719a0d2641f7c6e84d6508f6f0cdf7a37 100644 (file)
@@ -37,6 +37,7 @@ public class DeleteHandler extends BaseNodeHandler {
         try {
             ITraceControlComponent root = fTargetNode.getParent();
             fTargetNode.removeAllChildren();
+            fTargetNode.deregister();
             root.removeChild(fTargetNode);
         } finally {
             fLock.unlock();
index 7e546901a6a08796c452c723999950cb12e3d780..3f1639f6c953c042c20cba108d5994efbe533466 100644 (file)
@@ -28,8 +28,10 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.RemoteSyst
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ICommandShell;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.LTTngControlServiceFactory;
+import org.eclipse.rse.core.RSECorePlugin;
 import org.eclipse.rse.core.model.IHost;
 import org.eclipse.rse.core.model.IRSECallback;
+import org.eclipse.rse.core.model.ISystemRegistry;
 import org.eclipse.rse.core.subsystems.CommunicationsEvent;
 import org.eclipse.rse.core.subsystems.ICommunicationsListener;
 import org.eclipse.swt.graphics.Image;
@@ -314,10 +316,21 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
         job.schedule();
     }
 
+    /**
+     * Refresh the node configuration
+     */
     public void refresh() {
         removeAllChildren();
         getConfigurationFromNode();
     }
+    
+    /**
+     * Deregisters host from registry.
+     */
+    public void deregister() {
+        ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+        registry.deleteHost(fHost);
+    }
 
     // ------------------------------------------------------------------------
     // Helper function
This page took 0.033376 seconds and 5 git commands to generate.