| 1 | /********************************************************************** |
| 2 | * Copyright (c) 2012 Ericsson |
| 3 | * |
| 4 | * All rights reserved. This program and the accompanying materials are |
| 5 | * made available under the terms of the Eclipse Public License v1.0 which |
| 6 | * accompanies this distribution, and is available at |
| 7 | * http://www.eclipse.org/legal/epl-v10.html |
| 8 | * |
| 9 | * Contributors: |
| 10 | * Bernd Hufmann - Initial API and implementation |
| 11 | **********************************************************************/ |
| 12 | package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component; |
| 13 | |
| 14 | import java.io.File; |
| 15 | import java.net.URL; |
| 16 | |
| 17 | import junit.framework.Test; |
| 18 | import junit.framework.TestCase; |
| 19 | import junit.framework.TestSuite; |
| 20 | |
| 21 | import org.eclipse.core.commands.ExecutionException; |
| 22 | import org.eclipse.core.commands.NotEnabledException; |
| 23 | import org.eclipse.core.commands.NotHandledException; |
| 24 | import org.eclipse.core.commands.common.NotDefinedException; |
| 25 | import org.eclipse.core.runtime.FileLocator; |
| 26 | import org.eclipse.core.runtime.Path; |
| 27 | import org.eclipse.linuxtools.internal.lttng2.stubs.service.TestRemoteSystemProxy; |
| 28 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IConfirmDialog; |
| 29 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateChannelDialog; |
| 30 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateSessionDialog; |
| 31 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IGetEventInfoDialog; |
| 32 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.TraceControlDialogFactory; |
| 33 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo; |
| 34 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent; |
| 35 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TargetNodeState; |
| 36 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceEnablement; |
| 37 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceEventType; |
| 38 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceLogLevel; |
| 39 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceSessionState; |
| 40 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.BaseEventComponent; |
| 41 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.ChannelInfo; |
| 42 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.KernelProviderComponent; |
| 43 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TargetNodeComponent; |
| 44 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceChannelComponent; |
| 45 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent; |
| 46 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceEventComponent; |
| 47 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent; |
| 48 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionGroup; |
| 49 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.UstProviderComponent; |
| 50 | import org.eclipse.linuxtools.lttng2.ui.tests.Activator; |
| 51 | import org.eclipse.rse.core.model.Host; |
| 52 | import org.eclipse.rse.core.model.IHost; |
| 53 | import org.eclipse.rse.internal.core.model.SystemProfile; |
| 54 | import org.eclipse.swt.widgets.Shell; |
| 55 | import org.junit.After; |
| 56 | import org.junit.Before; |
| 57 | |
| 58 | /** |
| 59 | * The class <code>TraceControlTreeModelTest</code> contains tests for the tree component classes. |
| 60 | */ |
| 61 | @SuppressWarnings("nls") |
| 62 | public class TraceControlProviderTests extends TestCase { |
| 63 | |
| 64 | private static final String DIRECTORY = "testfiles"; |
| 65 | private static final String TEST_STREAM = "CreateTreeTest.cfg"; |
| 66 | private static final String SCEN_INIT_TEST = "Initialize"; |
| 67 | private static final String SCEN_SCENARIO1_TEST = "Scenario1"; |
| 68 | private static final String SCEN_SCENARIO2_TEST = "Scenario2"; |
| 69 | |
| 70 | // ------------------------------------------------------------------------ |
| 71 | // Test data |
| 72 | // ------------------------------------------------------------------------ |
| 73 | private TraceControlTestFacility fFacility; |
| 74 | private TestRemoteSystemProxy fProxy; |
| 75 | private String fTestFile; |
| 76 | |
| 77 | // ------------------------------------------------------------------------ |
| 78 | // Static methods |
| 79 | // ------------------------------------------------------------------------ |
| 80 | |
| 81 | /** |
| 82 | * Returns test setup used when executing test case stand-alone. |
| 83 | * @return Test setup class |
| 84 | */ |
| 85 | public static Test suite() { |
| 86 | return new ModelImplTestSetup(new TestSuite(TraceControlProviderTests.class)); |
| 87 | } |
| 88 | |
| 89 | // ------------------------------------------------------------------------ |
| 90 | // Housekeeping |
| 91 | // ------------------------------------------------------------------------ |
| 92 | |
| 93 | /** |
| 94 | * Perform pre-test initialization. |
| 95 | * |
| 96 | * @throws Exception |
| 97 | * if the initialization fails for some reason |
| 98 | * |
| 99 | */ |
| 100 | @Override |
| 101 | @Before |
| 102 | public void setUp() throws Exception { |
| 103 | fFacility = TraceControlTestFacility.getInstance(); |
| 104 | fProxy = new TestRemoteSystemProxy(); |
| 105 | URL location = FileLocator.find(Activator.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); |
| 106 | File testfile = new File(FileLocator.toFileURL(location).toURI()); |
| 107 | fTestFile = testfile.getAbsolutePath(); |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * Perform post-test clean-up. |
| 112 | * |
| 113 | * @throws Exception |
| 114 | * if the clean-up fails for some reason |
| 115 | * |
| 116 | */ |
| 117 | @Override |
| 118 | @After |
| 119 | public void tearDown() throws Exception { |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * Run the TraceControlComponent. |
| 124 | */ |
| 125 | public void testTraceControlComponents() |
| 126 | throws Exception { |
| 127 | |
| 128 | fProxy.setTestFile(fTestFile); |
| 129 | fProxy.setScenario(SCEN_INIT_TEST); |
| 130 | |
| 131 | ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot(); |
| 132 | |
| 133 | @SuppressWarnings("restriction") |
| 134 | IHost host = new Host(new SystemProfile("myProfile", true)); |
| 135 | host.setHostName("127.0.0.1"); |
| 136 | |
| 137 | TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy); |
| 138 | |
| 139 | root.addChild(node); |
| 140 | node.connect(); |
| 141 | |
| 142 | fFacility.waitForJobs(); |
| 143 | |
| 144 | // Verify that node is connected |
| 145 | assertEquals(TargetNodeState.CONNECTED, node.getTargetNodeState()); |
| 146 | |
| 147 | // Get provider groups |
| 148 | ITraceControlComponent[] groups = node.getChildren(); |
| 149 | assertNotNull(groups); |
| 150 | assertEquals(2, groups.length); |
| 151 | |
| 152 | // Get kernel provider |
| 153 | ITraceControlComponent[] providers = groups[0].getChildren(); |
| 154 | KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0]; |
| 155 | |
| 156 | // Get kernel provider events and select 2 events |
| 157 | ITraceControlComponent[] events = kernelProvider.getChildren(); |
| 158 | assertNotNull(events); |
| 159 | assertEquals(3, events.length); |
| 160 | |
| 161 | BaseEventComponent baseEventInfo0 = (BaseEventComponent) events[0]; |
| 162 | BaseEventComponent baseEventInfo1 = (BaseEventComponent) events[1]; |
| 163 | |
| 164 | // Initialize dialog implementations for command execution |
| 165 | TraceControlDialogFactory.getInstance().setCreateSessionDialog(new CreateSessionDialogStub()); |
| 166 | TraceControlDialogFactory.getInstance().setGetEventInfoDialog(new GetEventInfoDialogStub()); |
| 167 | TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub()); |
| 168 | |
| 169 | // Initialize scenario |
| 170 | fProxy.setScenario(SCEN_SCENARIO1_TEST); |
| 171 | |
| 172 | // ------------------------------------------------------------------------ |
| 173 | // Create session |
| 174 | // ------------------------------------------------------------------------ |
| 175 | TraceSessionComponent session = createSession(groups[1]); |
| 176 | |
| 177 | // Verify that session was created |
| 178 | assertNotNull(session); |
| 179 | assertEquals("mysession", session.getName()); |
| 180 | assertEquals("/home/user/lttng-traces/mysession-20120314-132824", session.getSessionPath()); |
| 181 | assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); |
| 182 | |
| 183 | // ------------------------------------------------------------------------ |
| 184 | // Enable event on default channel on created session above |
| 185 | // ------------------------------------------------------------------------ |
| 186 | ITraceControlComponent[] components = { baseEventInfo0, baseEventInfo1 }; |
| 187 | |
| 188 | fFacility.getControlView().setSelection(components); |
| 189 | // Give GUI time to actually execute refresh |
| 190 | fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY); |
| 191 | |
| 192 | fFacility.executeCommand("assign.event"); |
| 193 | fFacility.waitForJobs(); |
| 194 | |
| 195 | // Verify that kernel domain was created |
| 196 | ITraceControlComponent[] domains = session.getChildren(); |
| 197 | assertNotNull(domains); |
| 198 | assertEquals(1, domains.length); |
| 199 | |
| 200 | assertEquals("Kernel", domains[0].getName()); |
| 201 | |
| 202 | // Verify that channel0 was created with default values |
| 203 | ITraceControlComponent[] channels = domains[0].getChildren(); |
| 204 | assertNotNull(channels); |
| 205 | assertEquals(1, channels.length); |
| 206 | |
| 207 | assertTrue(channels[0] instanceof TraceChannelComponent); |
| 208 | TraceChannelComponent channel = (TraceChannelComponent) channels[0]; |
| 209 | assertEquals("channel0", channel.getName()); |
| 210 | assertEquals(4, channel.getNumberOfSubBuffers()); |
| 211 | assertEquals("splice()", channel.getOutputType()); |
| 212 | assertEquals(false, channel.isOverwriteMode()); |
| 213 | assertEquals(200, channel.getReadTimer()); |
| 214 | assertEquals(TraceEnablement.ENABLED, channel.getState()); |
| 215 | assertEquals(262144, channel.getSubBufferSize()); |
| 216 | assertEquals(0, channel.getSwitchTimer()); |
| 217 | |
| 218 | // Verify that event components were created |
| 219 | ITraceControlComponent[] channel0Events = channel.getChildren(); |
| 220 | assertNotNull(channel0Events); |
| 221 | assertEquals(2, channel0Events.length); |
| 222 | assertTrue(channel0Events[0] instanceof TraceEventComponent); |
| 223 | assertTrue(channel0Events[1] instanceof TraceEventComponent); |
| 224 | |
| 225 | TraceEventComponent event = (TraceEventComponent) channel0Events[0]; |
| 226 | assertEquals("sched_kthread_stop_ret", event.getName()); |
| 227 | assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel()); |
| 228 | assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); |
| 229 | assertEquals(TraceEnablement.ENABLED, event.getState()); |
| 230 | |
| 231 | TraceEventComponent event1 = (TraceEventComponent) channel0Events[1]; |
| 232 | assertEquals("sched_kthread_stop", event1.getName()); |
| 233 | assertEquals(TraceLogLevel.TRACE_EMERG, event1.getLogLevel()); |
| 234 | assertEquals(TraceEventType.TRACEPOINT, event1.getEventType()); |
| 235 | assertEquals(TraceEnablement.ENABLED, event1.getState()); |
| 236 | |
| 237 | // ------------------------------------------------------------------------ |
| 238 | // Disable event components |
| 239 | // ------------------------------------------------------------------------ |
| 240 | ITraceControlComponent[] selection = { event, event1 }; |
| 241 | fFacility.getControlView().setSelection(selection); |
| 242 | // Give GUI time to actually execute the selection |
| 243 | fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY); |
| 244 | fFacility.executeCommand("disable.event"); |
| 245 | fFacility.waitForJobs(); |
| 246 | |
| 247 | assertEquals(TraceEnablement.DISABLED, event.getState()); |
| 248 | assertEquals(TraceEnablement.DISABLED, event1.getState()); |
| 249 | |
| 250 | // ------------------------------------------------------------------------ |
| 251 | // Enable event component |
| 252 | // ------------------------------------------------------------------------ |
| 253 | fFacility.getControlView().setSelection(event1); |
| 254 | fFacility.executeCommand("enable.event"); |
| 255 | fFacility.waitForJobs(); |
| 256 | |
| 257 | // Verify event state |
| 258 | assertEquals(TraceEnablement.ENABLED, event1.getState()); |
| 259 | |
| 260 | // ------------------------------------------------------------------------ |
| 261 | // Destroy session |
| 262 | // ------------------------------------------------------------------------ |
| 263 | destroySession(session); |
| 264 | |
| 265 | // Verify that no more session components exist |
| 266 | assertEquals(0, groups[1].getChildren().length); |
| 267 | |
| 268 | |
| 269 | // ------------------------------------------------------------------------ |
| 270 | // Create session |
| 271 | // ------------------------------------------------------------------------ |
| 272 | fProxy.setScenario(SCEN_SCENARIO2_TEST); |
| 273 | |
| 274 | CreateSessionDialogStub sessionDialogStub = new CreateSessionDialogStub(); |
| 275 | sessionDialogStub.setSessionPath("/home/user/temp"); |
| 276 | TraceControlDialogFactory.getInstance().setCreateSessionDialog(sessionDialogStub); |
| 277 | |
| 278 | session = createSession(groups[1]); |
| 279 | |
| 280 | // Verify that session was created |
| 281 | assertNotNull(session); |
| 282 | assertEquals("mysession", session.getName()); |
| 283 | assertEquals("/home/user/temp", session.getSessionPath()); |
| 284 | assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); |
| 285 | |
| 286 | // ------------------------------------------------------------------------ |
| 287 | // Create Channel on UST global domain |
| 288 | // ------------------------------------------------------------------------ |
| 289 | TraceControlDialogFactory.getInstance().setCreateChannelDialog(new CreateChannelDialogStub()); |
| 290 | |
| 291 | fFacility.getControlView().setSelection(session); |
| 292 | // Give GUI time to actually execute refresh |
| 293 | fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY); |
| 294 | |
| 295 | fFacility.executeCommand("createChannelOnSession"); |
| 296 | fFacility.waitForJobs(); |
| 297 | |
| 298 | // Verify that UST domain was created |
| 299 | domains = session.getChildren(); |
| 300 | assertNotNull(domains); |
| 301 | assertEquals(1, domains.length); |
| 302 | |
| 303 | assertEquals("UST global", domains[0].getName()); |
| 304 | |
| 305 | // Verify that channel was created with correct data |
| 306 | channels = domains[0].getChildren(); |
| 307 | assertNotNull(channels); |
| 308 | assertEquals(1, channels.length); |
| 309 | |
| 310 | assertTrue(channels[0] instanceof TraceChannelComponent); |
| 311 | channel = (TraceChannelComponent) channels[0]; |
| 312 | assertEquals("mychannel", channel.getName()); |
| 313 | assertEquals(2, channel.getNumberOfSubBuffers()); |
| 314 | assertEquals("mmap()", channel.getOutputType()); |
| 315 | assertEquals(false, channel.isOverwriteMode()); |
| 316 | assertEquals(100, channel.getReadTimer()); |
| 317 | assertEquals(TraceEnablement.ENABLED, channel.getState()); |
| 318 | assertEquals(16384, channel.getSubBufferSize()); |
| 319 | assertEquals(200, channel.getSwitchTimer()); |
| 320 | |
| 321 | // ------------------------------------------------------------------------ |
| 322 | // Enable event on default channel on created session above |
| 323 | // ------------------------------------------------------------------------ |
| 324 | // Get first UST provider |
| 325 | UstProviderComponent ustProvider = (UstProviderComponent) providers[1]; |
| 326 | assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", ustProvider.getName()); |
| 327 | assertEquals(9379, ustProvider.getPid()); |
| 328 | |
| 329 | // Get events |
| 330 | events = ustProvider.getChildren(); |
| 331 | assertNotNull(events); |
| 332 | assertEquals(2, events.length); |
| 333 | |
| 334 | baseEventInfo0 = (BaseEventComponent) events[0]; |
| 335 | baseEventInfo1 = (BaseEventComponent) events[1]; |
| 336 | |
| 337 | ITraceControlComponent[] ustSelection = { baseEventInfo0, baseEventInfo1 }; |
| 338 | |
| 339 | fFacility.getControlView().setSelection(ustSelection); |
| 340 | // Give GUI time to actually execute refresh |
| 341 | fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY); |
| 342 | fFacility.executeCommand("assign.event"); |
| 343 | fFacility.waitForJobs(); |
| 344 | |
| 345 | // verify that events were created under the channel |
| 346 | // Note that domain and channel has to be re-read because the tree is re-created |
| 347 | |
| 348 | domains = session.getChildren(); |
| 349 | |
| 350 | // Verify that channel was created with correct data |
| 351 | channels = domains[0].getChildren(); |
| 352 | |
| 353 | ITraceControlComponent[] ustEvents = channels[0].getChildren(); |
| 354 | assertEquals(2, ustEvents.length); |
| 355 | |
| 356 | event = (TraceEventComponent) ustEvents[0]; |
| 357 | assertEquals("ust_tests_hello:tptest_sighandler", event.getName()); |
| 358 | assertEquals(TraceLogLevel.TRACE_DEBUG_LINE, event.getLogLevel()); |
| 359 | assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); |
| 360 | assertEquals(TraceEnablement.ENABLED, event.getState()); |
| 361 | |
| 362 | event = (TraceEventComponent) ustEvents[1]; |
| 363 | assertEquals("ust_tests_hello:tptest", ustEvents[1].getName()); |
| 364 | assertEquals(TraceLogLevel.TRACE_DEBUG_LINE, event.getLogLevel()); |
| 365 | assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); |
| 366 | assertEquals(TraceEnablement.ENABLED, event.getState()); |
| 367 | |
| 368 | // ------------------------------------------------------------------------ |
| 369 | // Disable event components |
| 370 | // ------------------------------------------------------------------------ |
| 371 | fFacility.getControlView().setSelection(event); |
| 372 | // Give GUI time to actually execute the selection |
| 373 | fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY); |
| 374 | fFacility.executeCommand("disable.event"); |
| 375 | fFacility.waitForJobs(); |
| 376 | |
| 377 | assertEquals(TraceEnablement.DISABLED, event.getState()); |
| 378 | |
| 379 | // ------------------------------------------------------------------------ |
| 380 | // Enable event component |
| 381 | // ------------------------------------------------------------------------ |
| 382 | fFacility.getControlView().setSelection(event); |
| 383 | fFacility.executeCommand("enable.event"); |
| 384 | fFacility.waitForJobs(); |
| 385 | |
| 386 | // Verify event state |
| 387 | assertEquals(TraceEnablement.ENABLED, event.getState()); |
| 388 | |
| 389 | // ------------------------------------------------------------------------ |
| 390 | // Destroy session |
| 391 | // ------------------------------------------------------------------------ |
| 392 | destroySession(session); |
| 393 | |
| 394 | // Verify that no more session components exist |
| 395 | assertEquals(0, groups[1].getChildren().length); |
| 396 | |
| 397 | |
| 398 | // fFacility.delay(60000); |
| 399 | } |
| 400 | |
| 401 | private TraceSessionComponent createSession(ITraceControlComponent group) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException { |
| 402 | fFacility.getControlView().setSelection(group); |
| 403 | // Give GUI time to actually execute the selection |
| 404 | fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY); |
| 405 | fFacility.executeCommand("createSession"); |
| 406 | fFacility.waitForJobs(); |
| 407 | |
| 408 | ITraceControlComponent[] sessions = group.getChildren(); |
| 409 | if ((sessions == null) || (sessions.length == 0)) { |
| 410 | return null; |
| 411 | } |
| 412 | return (TraceSessionComponent)sessions[0]; |
| 413 | } |
| 414 | |
| 415 | private void destroySession(TraceSessionComponent session) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException { |
| 416 | fFacility.getControlView().setSelection(session); |
| 417 | // Give GUI time to actually execute the selection |
| 418 | fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY); |
| 419 | fFacility.executeCommand("destroySession"); |
| 420 | fFacility.waitForJobs(); |
| 421 | } |
| 422 | |
| 423 | // assertEquals("sched_kthread_stop_ret", baseEventInfo.getName()); |
| 424 | // assertEquals(TraceLogLevel.TRACE_EMERG, baseEventInfo.getLogLevel()); |
| 425 | // assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); |
| 426 | // |
| 427 | // baseEventInfo = (BaseEventComponent) events[2]; |
| 428 | // assertEquals("sched_wakeup_new", baseEventInfo.getName()); |
| 429 | // assertEquals(TraceLogLevel.TRACE_EMERG, baseEventInfo.getLogLevel()); |
| 430 | // assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); |
| 431 | // |
| 432 | // // ------------------------------------------------------------------------ |
| 433 | // // Verify UstProviderComponent |
| 434 | // // ------------------------------------------------------------------------ |
| 435 | // UstProviderComponent ustProvider = (UstProviderComponent) providers[1]; |
| 436 | // assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", ustProvider.getName()); |
| 437 | // assertEquals(9379, ustProvider.getPid()); |
| 438 | // |
| 439 | // // ------------------------------------------------------------------------ |
| 440 | // // Verify event info (UST provider) |
| 441 | // // ------------------------------------------------------------------------ |
| 442 | // events = ustProvider.getChildren(); |
| 443 | // assertNotNull(events); |
| 444 | // assertEquals(2, events.length); |
| 445 | // |
| 446 | // baseEventInfo = (BaseEventComponent) events[0]; |
| 447 | // assertNotNull(baseEventInfo); |
| 448 | // assertEquals("ust_tests_hello:tptest_sighandler", baseEventInfo.getName()); |
| 449 | // assertEquals(TraceLogLevel.TRACE_DEBUG_MODULE, baseEventInfo.getLogLevel()); |
| 450 | // assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); |
| 451 | // |
| 452 | // baseEventInfo = (BaseEventComponent) events[1]; |
| 453 | // assertEquals("ust_tests_hello:tptest", baseEventInfo.getName()); |
| 454 | // assertEquals(TraceLogLevel.TRACE_INFO, baseEventInfo.getLogLevel()); |
| 455 | // assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); |
| 456 | // |
| 457 | // // ------------------------------------------------------------------------ |
| 458 | // // Verify UstProviderComponent |
| 459 | // // ------------------------------------------------------------------------ |
| 460 | // ustProvider = (UstProviderComponent) providers[2]; |
| 461 | // assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", ustProvider.getName()); |
| 462 | // assertEquals(4852, ustProvider.getPid()); |
| 463 | // |
| 464 | // // verify getters and setter |
| 465 | // verifyUstProviderGettersSetters(ustProvider); |
| 466 | // |
| 467 | // // ------------------------------------------------------------------------ |
| 468 | // // Verify event info (UST provider) |
| 469 | // // ------------------------------------------------------------------------ |
| 470 | // events = ustProvider.getChildren(); |
| 471 | // assertNotNull(events); |
| 472 | // assertEquals(2, events.length); |
| 473 | // |
| 474 | // baseEventInfo = (BaseEventComponent) events[0]; |
| 475 | // assertNotNull(baseEventInfo); |
| 476 | // assertEquals("ust_tests_hello:tptest_sighandler", baseEventInfo.getName()); |
| 477 | // assertEquals(TraceLogLevel.TRACE_WARNING, baseEventInfo.getLogLevel()); |
| 478 | // assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); |
| 479 | // |
| 480 | // baseEventInfo = (BaseEventComponent) events[1]; |
| 481 | // assertEquals("ust_tests_hello:tptest", baseEventInfo.getName()); |
| 482 | // assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, baseEventInfo.getLogLevel()); |
| 483 | // assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); |
| 484 | // |
| 485 | // // verify getters and setters |
| 486 | // verifyBaseEventGettersSetters(baseEventInfo); |
| 487 | // |
| 488 | // // ------------------------------------------------------------------------ |
| 489 | // // Verify TraceSessionGroup |
| 490 | // // ------------------------------------------------------------------------ |
| 491 | // ITraceControlComponent[] sessions = groups[1].getChildren(); |
| 492 | // assertNotNull(sessions); |
| 493 | // assertEquals(2, sessions.length); |
| 494 | // for (int i = 0; i < sessions.length; i++) { |
| 495 | // assertTrue(sessions[i] instanceof TraceSessionComponent); |
| 496 | // } |
| 497 | // assertEquals("mysession1", sessions[0].getName()); |
| 498 | // assertEquals("mysession", sessions[1].getName()); |
| 499 | // |
| 500 | // // ------------------------------------------------------------------------ |
| 501 | // // Verify TraceSessionComponent |
| 502 | // // ------------------------------------------------------------------------ |
| 503 | // TraceSessionComponent session = (TraceSessionComponent)sessions[1]; |
| 504 | // assertEquals("mysession", session.getName()); |
| 505 | // assertEquals("/home/user/lttng-traces/mysession-20120129-084256", session.getSessionPath()); |
| 506 | // assertEquals(TraceSessionState.ACTIVE, session.getSessionState()); |
| 507 | // |
| 508 | // // Verify setters and setters |
| 509 | // verifySessionGetterSetters(session); |
| 510 | // |
| 511 | // ITraceControlComponent[] domains = session.getChildren(); |
| 512 | // assertNotNull(domains); |
| 513 | // assertEquals(2, domains.length); |
| 514 | // |
| 515 | // // ------------------------------------------------------------------------ |
| 516 | // // Verify Kernel domain |
| 517 | // // ------------------------------------------------------------------------ |
| 518 | // assertEquals("Kernel", domains[0].getName()); |
| 519 | // ITraceControlComponent[] channels = domains[0].getChildren(); |
| 520 | // assertNotNull(channels); |
| 521 | // assertEquals(2, channels.length); |
| 522 | // |
| 523 | // // ------------------------------------------------------------------------ |
| 524 | // // Verify Kernel's channel0 |
| 525 | // // ------------------------------------------------------------------------ |
| 526 | // assertTrue(channels[0] instanceof TraceChannelComponent); |
| 527 | // TraceChannelComponent channel = (TraceChannelComponent) channels[0]; |
| 528 | // assertEquals("channel0", channel.getName()); |
| 529 | // assertEquals(4, channel.getNumberOfSubBuffers()); |
| 530 | // assertEquals("splice()", channel.getOutputType()); |
| 531 | // assertEquals(false, channel.isOverwriteMode()); |
| 532 | // assertEquals(200, channel.getReadTimer()); |
| 533 | // assertEquals(TraceEnablement.ENABLED, channel.getState()); |
| 534 | // assertEquals(262144, channel.getSubBufferSize()); |
| 535 | // assertEquals(0, channel.getSwitchTimer()); |
| 536 | // |
| 537 | // // ------------------------------------------------------------------------ |
| 538 | // // Verify event info (kernel, channel0) |
| 539 | // // ------------------------------------------------------------------------ |
| 540 | // ITraceControlComponent[] channel0Events = channel.getChildren(); |
| 541 | // assertNotNull(channel0Events); |
| 542 | // assertEquals(5, channel0Events.length); |
| 543 | // assertTrue(channel0Events[0] instanceof TraceEventComponent); |
| 544 | // assertTrue(channel0Events[1] instanceof TraceEventComponent); |
| 545 | // assertTrue(channel0Events[2] instanceof TraceProbeEventComponent); |
| 546 | // assertTrue(channel0Events[3] instanceof TraceProbeEventComponent); |
| 547 | // assertTrue(channel0Events[4] instanceof TraceEventComponent); |
| 548 | // |
| 549 | // TraceEventComponent event = (TraceEventComponent) channel0Events[0]; |
| 550 | // assertEquals("block_rq_remap", event.getName()); |
| 551 | // assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel()); |
| 552 | // assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); |
| 553 | // assertEquals(TraceEnablement.ENABLED, event.getState()); |
| 554 | // |
| 555 | // event = (TraceEventComponent) channel0Events[1]; |
| 556 | // assertEquals("block_bio_remap", event.getName()); |
| 557 | // assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel()); |
| 558 | // assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); |
| 559 | // assertEquals(TraceEnablement.DISABLED, event.getState()); |
| 560 | // |
| 561 | // TraceProbeEventComponent probeEvent = (TraceProbeEventComponent) channel0Events[2]; |
| 562 | // assertEquals("myevent2", probeEvent.getName()); |
| 563 | // assertEquals(TraceLogLevel.LEVEL_UNKNOWN, probeEvent.getLogLevel()); |
| 564 | // assertEquals(TraceEventType.PROBE, probeEvent.getEventType()); |
| 565 | // assertEquals(TraceEnablement.ENABLED, probeEvent.getState()); |
| 566 | // assertEquals("0xc0101340", probeEvent.getAddress()); |
| 567 | // assertNull(probeEvent.getOffset()); |
| 568 | // assertNull(probeEvent.getSymbol()); |
| 569 | // |
| 570 | // probeEvent = (TraceProbeEventComponent) channel0Events[3]; |
| 571 | // assertEquals("myevent0", probeEvent.getName()); |
| 572 | // assertEquals(TraceLogLevel.LEVEL_UNKNOWN, probeEvent.getLogLevel()); |
| 573 | // assertEquals(TraceEventType.PROBE, probeEvent.getEventType()); |
| 574 | // assertEquals(TraceEnablement.ENABLED, probeEvent.getState()); |
| 575 | // assertNull(probeEvent.getAddress()); |
| 576 | // assertEquals("0x0", probeEvent.getOffset()); |
| 577 | // assertEquals("init_post", probeEvent.getSymbol()); |
| 578 | // |
| 579 | // event = (TraceEventComponent) channel0Events[4]; |
| 580 | // assertEquals("syscalls", event.getName()); |
| 581 | // assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); |
| 582 | // assertEquals(TraceEventType.SYSCALL, event.getEventType()); |
| 583 | // assertEquals(TraceEnablement.ENABLED, event.getState()); |
| 584 | // |
| 585 | // // ------------------------------------------------------------------------ |
| 586 | // // Verify Kernel's channel1 |
| 587 | // // ------------------------------------------------------------------------ |
| 588 | // assertEquals("channel1", channels[1].getName()); |
| 589 | // channel = (TraceChannelComponent) channels[1]; |
| 590 | // assertEquals(4, channel.getNumberOfSubBuffers()); |
| 591 | // assertEquals("splice()", channel.getOutputType()); |
| 592 | // assertEquals(true, channel.isOverwriteMode()); |
| 593 | // assertEquals(400, channel.getReadTimer()); |
| 594 | // assertEquals(TraceEnablement.DISABLED, channel.getState()); |
| 595 | // assertEquals(524288, channel.getSubBufferSize()); |
| 596 | // assertEquals(100, channel.getSwitchTimer()); |
| 597 | // |
| 598 | // // ------------------------------------------------------------------------ |
| 599 | // // Verify event info (kernel, channel1) |
| 600 | // // ------------------------------------------------------------------------ |
| 601 | // ITraceControlComponent[] channel1Events = channels[1].getChildren(); |
| 602 | // assertEquals(0, channel1Events.length); |
| 603 | // |
| 604 | // // ------------------------------------------------------------------------ |
| 605 | // // Verify domain UST global |
| 606 | // // ------------------------------------------------------------------------ |
| 607 | // assertEquals("UST global", domains[1].getName()); |
| 608 | // |
| 609 | // ITraceControlComponent[] ustChannels = domains[1].getChildren(); |
| 610 | // |
| 611 | // for (int i = 0; i < ustChannels.length; i++) { |
| 612 | // assertTrue(ustChannels[i] instanceof TraceChannelComponent); |
| 613 | // } |
| 614 | // |
| 615 | // // ------------------------------------------------------------------------ |
| 616 | // // Verify UST global's mychannel1 |
| 617 | // // ------------------------------------------------------------------------ |
| 618 | // channel = (TraceChannelComponent) ustChannels[0]; |
| 619 | // assertEquals("mychannel1", channel.getName()); |
| 620 | // assertEquals(8, channel.getNumberOfSubBuffers()); |
| 621 | // assertEquals("mmap()", channel.getOutputType()); |
| 622 | // assertEquals(true, channel.isOverwriteMode()); |
| 623 | // assertEquals(100, channel.getReadTimer()); |
| 624 | // assertEquals(TraceEnablement.DISABLED, channel.getState()); |
| 625 | // assertEquals(8192, channel.getSubBufferSize()); |
| 626 | // assertEquals(200, channel.getSwitchTimer()); |
| 627 | // |
| 628 | // // verify getters and setters |
| 629 | // verifyChannelGettersSetters(channel); |
| 630 | // |
| 631 | // // ------------------------------------------------------------------------ |
| 632 | // // Verify event info (UST global, mychannel1) |
| 633 | // // ------------------------------------------------------------------------ |
| 634 | // ITraceControlComponent[] ustEvents = channel.getChildren(); |
| 635 | // assertEquals(0, ustEvents.length); |
| 636 | // |
| 637 | // // ------------------------------------------------------------------------ |
| 638 | // // Verify UST global's channel0 |
| 639 | // // ------------------------------------------------------------------------ |
| 640 | // channel = (TraceChannelComponent) ustChannels[1]; |
| 641 | // assertEquals("channel0", channel.getName()); |
| 642 | // assertEquals(4, channel.getNumberOfSubBuffers()); |
| 643 | // assertEquals("mmap()", channel.getOutputType()); |
| 644 | // assertEquals(false, channel.isOverwriteMode()); |
| 645 | // assertEquals(200, channel.getReadTimer()); |
| 646 | // assertEquals(TraceEnablement.ENABLED, channel.getState()); |
| 647 | // assertEquals(4096, channel.getSubBufferSize()); |
| 648 | // assertEquals(0, channel.getSwitchTimer()); |
| 649 | // |
| 650 | // // ------------------------------------------------------------------------ |
| 651 | // // Verify event info (UST global, channel0) |
| 652 | // // ------------------------------------------------------------------------ |
| 653 | // ustEvents = channel.getChildren(); |
| 654 | // assertEquals(2, ustEvents.length); |
| 655 | // |
| 656 | // event = (TraceEventComponent) ustEvents[0]; |
| 657 | // assertEquals("ust_tests_hello:tptest_sighandler", event.getName()); |
| 658 | // assertEquals(TraceLogLevel.TRACE_DEBUG_LINE, event.getLogLevel()); |
| 659 | // assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); |
| 660 | // assertEquals(TraceEnablement.DISABLED, event.getState()); |
| 661 | // |
| 662 | // event = (TraceEventComponent) ustEvents[1]; |
| 663 | // assertEquals("*", ustEvents[1].getName()); |
| 664 | // assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); |
| 665 | // assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); |
| 666 | // assertEquals(TraceEnablement.ENABLED, event.getState()); |
| 667 | // |
| 668 | // // verify getters and setters |
| 669 | // verifyEventGettersSetters(event); |
| 670 | // |
| 671 | // // disconnect |
| 672 | // node.disconnect(); |
| 673 | // assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState()); |
| 674 | // assertNotNull(node.getImage()); |
| 675 | // assertNotSame(connectedImage, node.getImage()); |
| 676 | // } |
| 677 | // |
| 678 | // private void verifySessionGetterSetters(TraceSessionComponent session) { |
| 679 | // // save original values |
| 680 | // String name = session.getName(); |
| 681 | // String origPath = session.getSessionPath(); |
| 682 | // TraceSessionState origState = session.getSessionState(); |
| 683 | // |
| 684 | // // test cases |
| 685 | // session.setName("newName"); |
| 686 | // assertEquals("newName", session.getName()); |
| 687 | // |
| 688 | // session.setSessionPath("/home/user/tmp"); |
| 689 | // assertEquals("/home/user/tmp", session.getSessionPath()); |
| 690 | // |
| 691 | // session.setSessionState(TraceSessionState.INACTIVE); |
| 692 | // assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); |
| 693 | // Image inactiveImage = session.getImage(); |
| 694 | // assertNotNull(inactiveImage); |
| 695 | // |
| 696 | // session.setSessionState("active"); |
| 697 | // assertEquals(TraceSessionState.ACTIVE, session.getSessionState()); |
| 698 | // |
| 699 | // Image activeImage = session.getImage(); |
| 700 | // assertNotNull(activeImage); |
| 701 | // assertNotSame(activeImage, inactiveImage); |
| 702 | // |
| 703 | // |
| 704 | // // restore original values |
| 705 | // session.setName(name); |
| 706 | // session.setSessionPath(origPath); |
| 707 | // session.setSessionState(origState); |
| 708 | // } |
| 709 | // |
| 710 | // private void verifyBaseEventGettersSetters(BaseEventComponent event) { |
| 711 | // // save original values |
| 712 | // String name = event.getName(); |
| 713 | // TraceLogLevel level = event.getLogLevel(); |
| 714 | // TraceEventType type = event.getEventType(); |
| 715 | // |
| 716 | // // test cases |
| 717 | // event.setName("newName"); |
| 718 | // assertEquals("newName", event.getName()); |
| 719 | // |
| 720 | // event.setLogLevel(TraceLogLevel.TRACE_INFO); |
| 721 | // assertEquals(TraceLogLevel.TRACE_INFO, event.getLogLevel()); |
| 722 | // event.setLogLevel("TRACE_ALERT"); |
| 723 | // assertEquals(TraceLogLevel.TRACE_ALERT, event.getLogLevel()); |
| 724 | // |
| 725 | // event.setEventType(TraceEventType.UNKNOWN); |
| 726 | // assertEquals(TraceEventType.UNKNOWN, event.getEventType()); |
| 727 | // event.setEventType("tracepoint"); |
| 728 | // assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); |
| 729 | // |
| 730 | // // restore original values |
| 731 | // event.setName(name); |
| 732 | // event.setLogLevel(level); |
| 733 | // event.setEventType(type); |
| 734 | // } |
| 735 | // |
| 736 | // private void verifyEventGettersSetters(TraceEventComponent event) { |
| 737 | // // save original values |
| 738 | // String name = event.getName(); |
| 739 | // TraceLogLevel level = event.getLogLevel(); |
| 740 | // TraceEventType type = event.getEventType(); |
| 741 | // TraceEnablement state = event.getState(); |
| 742 | // |
| 743 | // // test cases |
| 744 | // event.setName("newName"); |
| 745 | // assertEquals("newName", event.getName()); |
| 746 | // |
| 747 | // event.setLogLevel(TraceLogLevel.TRACE_INFO); |
| 748 | // assertEquals(TraceLogLevel.TRACE_INFO, event.getLogLevel()); |
| 749 | // event.setLogLevel("TRACE_ALERT"); |
| 750 | // assertEquals(TraceLogLevel.TRACE_ALERT, event.getLogLevel()); |
| 751 | // |
| 752 | // event.setEventType(TraceEventType.UNKNOWN); |
| 753 | // assertEquals(TraceEventType.UNKNOWN, event.getEventType()); |
| 754 | // event.setEventType("tracepoint"); |
| 755 | // assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); |
| 756 | // |
| 757 | // event.setState("disabled"); |
| 758 | // assertEquals(TraceEnablement.DISABLED, event.getState()); |
| 759 | // |
| 760 | // Image disabledImage = event.getImage(); |
| 761 | // assertNotNull(disabledImage); |
| 762 | // |
| 763 | // event.setState(TraceEnablement.ENABLED); |
| 764 | // assertEquals(TraceEnablement.ENABLED, event.getState()); |
| 765 | // |
| 766 | // Image enabledImage = event.getImage(); |
| 767 | // assertNotNull(enabledImage); |
| 768 | // assertNotSame(enabledImage, disabledImage); |
| 769 | // |
| 770 | // // restore original values |
| 771 | // event.setName(name); |
| 772 | // event.setLogLevel(level); |
| 773 | // event.setEventType(type); |
| 774 | // event.setState(state); |
| 775 | // } |
| 776 | // |
| 777 | // private void verifyChannelGettersSetters(TraceChannelComponent channel) { |
| 778 | // // save original values |
| 779 | // String name = channel.getName(); |
| 780 | // int nbSubBuffers = channel.getNumberOfSubBuffers(); |
| 781 | // String type = channel.getOutputType(); |
| 782 | // boolean mode = channel.isOverwriteMode(); |
| 783 | // long readTimer = channel.getReadTimer(); |
| 784 | // TraceEnablement state = channel.getState(); |
| 785 | // long subBufferSize = channel.getSubBufferSize(); |
| 786 | // long switchTimer = channel.getSwitchTimer(); |
| 787 | // |
| 788 | // // test cases |
| 789 | // channel.setName("newName"); |
| 790 | // assertEquals("newName", channel.getName()); |
| 791 | // |
| 792 | // channel.setNumberOfSubBuffers(2); |
| 793 | // assertEquals(2, channel.getNumberOfSubBuffers()); |
| 794 | // |
| 795 | // channel.setOutputType("splice()"); |
| 796 | // assertEquals("splice()", channel.getOutputType()); |
| 797 | // |
| 798 | // channel.setOverwriteMode(false); |
| 799 | // assertEquals(false, channel.isOverwriteMode()); |
| 800 | // |
| 801 | // channel.setReadTimer(250); |
| 802 | // assertEquals(250, channel.getReadTimer()); |
| 803 | // |
| 804 | // channel.setState("enabled"); |
| 805 | // assertEquals(TraceEnablement.ENABLED, channel.getState()); |
| 806 | // |
| 807 | // Image enabledImage = channel.getImage(); |
| 808 | // assertNotNull(enabledImage); |
| 809 | // channel.setState(TraceEnablement.DISABLED); |
| 810 | // assertEquals(TraceEnablement.DISABLED, channel.getState()); |
| 811 | // |
| 812 | // Image disabledImage = channel.getImage(); |
| 813 | // assertNotNull(disabledImage); |
| 814 | // assertNotSame(enabledImage, disabledImage); |
| 815 | // |
| 816 | // channel.setSubBufferSize(1024); |
| 817 | // assertEquals(1024, channel.getSubBufferSize()); |
| 818 | // |
| 819 | // channel.setSwitchTimer(1000); |
| 820 | // assertEquals(1000, channel.getSwitchTimer()); |
| 821 | // |
| 822 | // // restore original values |
| 823 | // channel.setName(name); |
| 824 | // channel.setNumberOfSubBuffers(nbSubBuffers); |
| 825 | // channel.setOutputType(type); |
| 826 | // channel.setOverwriteMode(mode); |
| 827 | // channel.setReadTimer(readTimer); |
| 828 | // channel.setState(state); |
| 829 | // channel.setSubBufferSize(subBufferSize); |
| 830 | // channel.setSwitchTimer(switchTimer); |
| 831 | // } |
| 832 | // |
| 833 | // private void verifyUstProviderGettersSetters(UstProviderComponent ustProvider) { |
| 834 | // // save original values |
| 835 | // String name = ustProvider.getName(); |
| 836 | // int pid = ustProvider.getPid(); |
| 837 | // |
| 838 | // // test cases |
| 839 | // ustProvider.setName("newName"); |
| 840 | // assertEquals("newName", ustProvider.getName()); |
| 841 | // |
| 842 | // ustProvider.setPid(9876); |
| 843 | // assertEquals(9876, ustProvider.getPid()); |
| 844 | // |
| 845 | // // restore original values |
| 846 | // ustProvider.setName(name); |
| 847 | // ustProvider.setPid(pid); |
| 848 | // } |
| 849 | |
| 850 | public class CreateSessionDialogStub implements ICreateSessionDialog { |
| 851 | public String fPath = null; |
| 852 | |
| 853 | @Override |
| 854 | public String getSessionName() { |
| 855 | return "mysession"; |
| 856 | } |
| 857 | |
| 858 | @Override |
| 859 | public String getSessionPath() { |
| 860 | return fPath; |
| 861 | } |
| 862 | |
| 863 | @Override |
| 864 | public boolean isDefaultSessionPath() { |
| 865 | return fPath == null; |
| 866 | } |
| 867 | |
| 868 | @Override |
| 869 | public void setTraceSessionGroup(TraceSessionGroup group) { |
| 870 | |
| 871 | } |
| 872 | |
| 873 | @Override |
| 874 | public int open() { |
| 875 | return 0; |
| 876 | } |
| 877 | |
| 878 | public void setSessionPath(String path) { |
| 879 | fPath = path; |
| 880 | } |
| 881 | } |
| 882 | |
| 883 | public class GetEventInfoDialogStub implements IGetEventInfoDialog { |
| 884 | |
| 885 | private TraceSessionComponent[] fSessions; |
| 886 | |
| 887 | @Override |
| 888 | public TraceSessionComponent getSession() { |
| 889 | return fSessions[0]; |
| 890 | } |
| 891 | |
| 892 | @Override |
| 893 | public TraceChannelComponent getChannel() { |
| 894 | return null; |
| 895 | } |
| 896 | |
| 897 | @Override |
| 898 | public void setIsKernel(boolean isKernel) { |
| 899 | } |
| 900 | |
| 901 | @Override |
| 902 | public void setSessions(TraceSessionComponent[] sessions) { |
| 903 | fSessions = sessions; |
| 904 | } |
| 905 | |
| 906 | @Override |
| 907 | public int open() { |
| 908 | return 0; |
| 909 | } |
| 910 | } |
| 911 | |
| 912 | public class DestroyConfirmDialogStub implements IConfirmDialog { |
| 913 | |
| 914 | @Override |
| 915 | public boolean openConfirm(Shell parent, String title, String message) { |
| 916 | return true; |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | public class CreateChannelDialogStub implements ICreateChannelDialog { |
| 921 | |
| 922 | @Override |
| 923 | public IChannelInfo getChannelInfo() { |
| 924 | ChannelInfo info = new ChannelInfo("mychannel"); |
| 925 | info.setNumberOfSubBuffers(2); |
| 926 | info.setOverwriteMode(false); |
| 927 | info.setReadTimer(100); |
| 928 | info.setSwitchTimer(200); |
| 929 | info.setSubBufferSize(16384); |
| 930 | return info; |
| 931 | } |
| 932 | |
| 933 | @Override |
| 934 | public void setDomainComponent(TraceDomainComponent domain) { |
| 935 | } |
| 936 | |
| 937 | @Override |
| 938 | public int open() { |
| 939 | return 0; |
| 940 | } |
| 941 | |
| 942 | @Override |
| 943 | public boolean isKernel() { |
| 944 | return false; |
| 945 | } |
| 946 | |
| 947 | } |
| 948 | } |