Program: 92004
Project: 92004
Buggy source:
/** 
 * Run the TraceControlComponent.
 * @throws Exception Would fail the test
 */
@Test public void testTraceSessionTree() throws Exception {
  fProxy.setTestFile(fTestFile);
  fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST);
  ITraceControlComponent root=fFacility.getControlView().getTraceControlRoot();
  ISystemRegistry registry=RSECorePlugin.getTheSystemRegistry();
  ISystemProfile profile=registry.createSystemProfile("String_Node_Str",true);
  IHost host=registry.createLocalHost(profile,"String_Node_Str","String_Node_Str");
  TargetNodeComponent node=new TargetNodeComponent("String_Node_Str",root,host,fProxy);
  root.addChild(node);
  fFacility.waitForJobs();
  fFacility.executeCommand(node,"String_Node_Str");
  int i=0;
  while ((i < 10) && (node.getTargetNodeState() != TargetNodeState.CONNECTED)) {
    i++;
    fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
  }
  assertEquals(TargetNodeState.CONNECTED,node.getTargetNodeState());
  ITraceControlComponent[] groups=node.getChildren();
  assertNotNull(groups);
  assertEquals(2,groups.length);
  TraceControlDialogFactory.getInstance().setCreateSessionDialog(new CreateSessionDialogStub());
  TraceControlDialogFactory.getInstance().setGetEventInfoDialog(new GetEventInfoDialogStub());
  TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub());
  fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
  TraceSessionComponent session=fFacility.createSession(groups[1]);
  assertNotNull(session);
  assertEquals("String_Node_Str",session.getName());
  assertEquals("String_Node_Str",session.getSessionPath());
  assertEquals(TraceSessionState.INACTIVE,session.getSessionState());
  fProxy.setScenario(SCEN_SCENARIO3_TEST);
  EnableChannelDialogStub channelStub=new EnableChannelDialogStub();
  channelStub.setIsKernel(true);
  TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelStub);
  fFacility.executeCommand(session,"String_Node_Str");
  ITraceControlComponent[] domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  assertEquals("String_Node_Str",domains[0].getName());
  ITraceControlComponent[] channels=domains[0].getChildren();
  assertNotNull(channels);
  assertEquals(1,channels.length);
  assertTrue(channels[0] instanceof TraceChannelComponent);
  TraceChannelComponent channel=(TraceChannelComponent)channels[0];
  assertEquals("String_Node_Str",channel.getName());
  assertEquals(4,channel.getNumberOfSubBuffers());
  assertEquals("String_Node_Str",channel.getOutputType());
  assertEquals(true,channel.isOverwriteMode());
  assertEquals(200,channel.getReadTimer());
  assertEquals(TraceEnablement.ENABLED,channel.getState());
  assertEquals(16384,channel.getSubBufferSize());
  assertEquals(100,channel.getSwitchTimer());
  ChannelInfo info=(ChannelInfo)channelStub.getChannelInfo();
  info.setName("String_Node_Str");
  info.setOverwriteMode(false);
  info.setSubBufferSize(32768);
  info.setNumberOfSubBuffers(2);
  info.setSwitchTimer(100);
  info.setReadTimer(200);
  channelStub.setChannelInfo(info);
  fFacility.executeCommand(domains[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  assertNotNull(channels);
  assertEquals(2,channels.length);
  assertTrue(channels[1] instanceof TraceChannelComponent);
  channel=(TraceChannelComponent)channels[1];
  assertEquals("String_Node_Str",channel.getName());
  assertEquals(2,channel.getNumberOfSubBuffers());
  assertEquals("String_Node_Str",channel.getOutputType());
  assertEquals(false,channel.isOverwriteMode());
  assertEquals(200,channel.getReadTimer());
  assertEquals(TraceEnablement.ENABLED,channel.getState());
  assertEquals(32768,channel.getSubBufferSize());
  assertEquals(100,channel.getSwitchTimer());
  EnableEventsDialogStub eventsDialogStub=new EnableEventsDialogStub();
  eventsDialogStub.setIsTracePoints(true);
  List<String> events=new ArrayList<String>();
  events.add("String_Node_Str");
  events.add("String_Node_Str");
  eventsDialogStub.setNames(events);
  eventsDialogStub.setIsKernel(true);
  TraceControlDialogFactory.getInstance().setEnableEventsDialog(eventsDialogStub);
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  assertNotNull(channels);
  assertEquals(2,channels.length);
  fFacility.executeCommand(channels,"String_Node_Str");
  assertEquals(TraceEnablement.DISABLED,((TraceChannelComponent)channels[0]).getState());
  assertEquals(TraceEnablement.DISABLED,((TraceChannelComponent)channels[1]).getState());
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  assertNotNull(channels);
  assertEquals(2,channels.length);
  fFacility.executeCommand(channels,"String_Node_Str");
  assertEquals(TraceEnablement.ENABLED,((TraceChannelComponent)channels[0]).getState());
  assertEquals(TraceEnablement.ENABLED,((TraceChannelComponent)channels[1]).getState());
  fFacility.executeCommand(session,"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  assertNotNull(channels);
  assertEquals(3,channels.length);
  assertTrue(channels[2] instanceof TraceChannelComponent);
  channel=(TraceChannelComponent)channels[2];
  assertEquals("String_Node_Str",channel.getName());
  ITraceControlComponent[] channel0Events=channel.getChildren();
  assertEquals(2,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceEventComponent);
  assertTrue(channel0Events[1] instanceof TraceEventComponent);
  TraceEventComponent event=(TraceEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  event=(TraceEventComponent)channel0Events[1];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  events.clear();
  events.add("String_Node_Str");
  eventsDialogStub.setNames(events);
  fFacility.executeCommand(domains[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(3,channel0Events.length);
  assertTrue(channel0Events[2] instanceof TraceEventComponent);
  event=(TraceEventComponent)channel0Events[2];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  events.clear();
  eventsDialogStub.setNames(events);
  eventsDialogStub.setIsAllTracePoints(true);
  fFacility.executeCommand(channels[1],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[1];
  channel0Events=channel.getChildren();
  assertEquals(3,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceEventComponent);
  assertTrue(channel0Events[1] instanceof TraceEventComponent);
  assertTrue(channel0Events[2] instanceof TraceEventComponent);
  event=(TraceEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  event=(TraceEventComponent)channel0Events[1];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  event=(TraceEventComponent)channel0Events[2];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  events.clear();
  eventsDialogStub.setIsTracePoints(false);
  eventsDialogStub.setIsAllTracePoints(false);
  eventsDialogStub.setIsSysCalls(true);
  fFacility.executeCommand(channels[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[0];
  channel=(TraceChannelComponent)channels[0];
  channel0Events=channel.getChildren();
  assertEquals(1,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceEventComponent);
  event=(TraceEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,event.getLogLevel());
  assertEquals(TraceEventType.SYSCALL,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  fFacility.executeCommand(domains[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[0];
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(4,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceEventComponent);
  event=(TraceEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,event.getLogLevel());
  assertEquals(TraceEventType.SYSCALL,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  fFacility.executeCommand(session,"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[0];
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(4,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceEventComponent);
  event=(TraceEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,event.getLogLevel());
  assertEquals(TraceEventType.SYSCALL,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  events.clear();
  eventsDialogStub.setIsSysCalls(false);
  eventsDialogStub.setIsDynamicProbe(true);
  eventsDialogStub.setDynamicProbe("String_Node_Str");
  eventsDialogStub.setProbeEventName("String_Node_Str");
  fFacility.executeCommand(domains[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(5,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
  TraceProbeEventComponent probeEvent=(TraceProbeEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",probeEvent.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,probeEvent.getLogLevel());
  assertEquals(TraceEventType.PROBE,probeEvent.getEventType());
  assertEquals(TraceEnablement.ENABLED,probeEvent.getState());
  assertNull(probeEvent.getOffset());
  assertEquals("String_Node_Str",probeEvent.getAddress());
  assertNull(probeEvent.getSymbol());
  eventsDialogStub.setIsDynamicProbe(true);
  eventsDialogStub.setDynamicProbe("String_Node_Str");
  eventsDialogStub.setProbeEventName("String_Node_Str");
  fFacility.executeCommand(channels[2],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(6,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
  probeEvent=(TraceProbeEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",probeEvent.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,probeEvent.getLogLevel());
  assertEquals(TraceEventType.PROBE,probeEvent.getEventType());
  assertEquals(TraceEnablement.ENABLED,probeEvent.getState());
  assertEquals("String_Node_Str",probeEvent.getOffset());
  assertNull(null,probeEvent.getAddress());
  assertEquals("String_Node_Str",probeEvent.getSymbol());
  eventsDialogStub.setIsDynamicProbe(true);
  eventsDialogStub.setDynamicProbe("String_Node_Str");
  eventsDialogStub.setProbeEventName("String_Node_Str");
  fFacility.executeCommand(session,"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(7,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
  probeEvent=(TraceProbeEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",probeEvent.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,probeEvent.getLogLevel());
  assertEquals(TraceEventType.PROBE,probeEvent.getEventType());
  assertEquals(TraceEnablement.ENABLED,probeEvent.getState());
  assertEquals("String_Node_Str",probeEvent.getOffset());
  assertNull(null,probeEvent.getAddress());
  assertEquals("String_Node_Str",probeEvent.getSymbol());
  eventsDialogStub.setIsDynamicProbe(false);
  eventsDialogStub.setDynamicProbe(null);
  eventsDialogStub.setProbeEventName(null);
  eventsDialogStub.setIsFunctionProbe(true);
  eventsDialogStub.setFunctionEventName("String_Node_Str");
  eventsDialogStub.setFunctionProbe("String_Node_Str");
  fFacility.executeCommand(session,"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(8,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
  probeEvent=(TraceProbeEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",probeEvent.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,probeEvent.getLogLevel());
  assertEquals(TraceEventType.PROBE,probeEvent.getEventType());
  assertEquals(TraceEnablement.ENABLED,probeEvent.getState());
  assertEquals("String_Node_Str",probeEvent.getOffset());
  assertNull(null,probeEvent.getAddress());
  assertEquals("String_Node_Str",probeEvent.getSymbol());
  eventsDialogStub.setIsFunctionProbe(true);
  eventsDialogStub.setFunctionEventName("String_Node_Str");
  eventsDialogStub.setFunctionProbe("String_Node_Str");
  fFacility.executeCommand(domains[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(9,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
  probeEvent=(TraceProbeEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",probeEvent.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,probeEvent.getLogLevel());
  assertEquals(TraceEventType.PROBE,probeEvent.getEventType());
  assertEquals(TraceEnablement.ENABLED,probeEvent.getState());
  assertEquals("String_Node_Str",probeEvent.getOffset());
  assertNull(null,probeEvent.getAddress());
  assertEquals("String_Node_Str",probeEvent.getSymbol());
  eventsDialogStub.setIsFunctionProbe(true);
  eventsDialogStub.setFunctionEventName("String_Node_Str");
  eventsDialogStub.setFunctionProbe("String_Node_Str");
  fFacility.executeCommand(channels[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[0];
  channel0Events=channel.getChildren();
  assertEquals(2,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
  probeEvent=(TraceProbeEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",probeEvent.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,probeEvent.getLogLevel());
  assertEquals(TraceEventType.PROBE,probeEvent.getEventType());
  assertEquals(TraceEnablement.ENABLED,probeEvent.getState());
  assertEquals("String_Node_Str",probeEvent.getOffset());
  assertNull(null,probeEvent.getAddress());
  assertEquals("String_Node_Str",probeEvent.getSymbol());
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  AddContextDialogStub addContextStub=new AddContextDialogStub();
  List<String> contexts=new ArrayList<String>();
  contexts.add("String_Node_Str");
  contexts.add("String_Node_Str");
  contexts.add("String_Node_Str");
  addContextStub.setContexts(contexts);
  TraceControlDialogFactory.getInstance().setAddContextDialog(addContextStub);
  fFacility.executeCommand(domains[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[0];
  try {
    addContextStub.setContexts(contexts);
  }
 catch (  IllegalArgumentException e) {
    fail("String_Node_Str");
  }
  fFacility.executeCommand(channel,"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  event=(TraceEventComponent)channel0Events[6];
  fFacility.executeCommand(event,"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  fFacility.executeCommand(domains[0],"String_Node_Str");
  fFacility.executeCommand(node,"String_Node_Str");
  groups=node.getChildren();
  assertNotNull(groups);
  assertEquals(2,groups.length);
  assertEquals(3,groups[0].getChildren().length);
  assertEquals(1,groups[1].getChildren().length);
  assertEquals(1,groups[1].getChildren()[0].getChildren().length);
  assertEquals(3,groups[1].getChildren()[0].getChildren()[0].getChildren().length);
  assertEquals(2,groups[1].getChildren()[0].getChildren()[0].getChildren()[0].getChildren().length);
  fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
  session=(TraceSessionComponent)groups[1].getChildren()[0];
  fFacility.startSession(session);
  assertEquals(TraceSessionState.ACTIVE,session.getSessionState());
  fFacility.stopSession(session);
  assertEquals(TraceSessionState.INACTIVE,session.getSessionState());
  fFacility.destroySession(session);
  assertEquals(0,groups[1].getChildren().length);
  fFacility.executeCommand(node,"String_Node_Str");
  assertEquals(TargetNodeState.DISCONNECTED,node.getTargetNodeState());
  fFacility.executeCommand(node,"String_Node_Str");
  assertEquals(0,fFacility.getControlView().getTraceControlRoot().getChildren().length);
}

Fixed version (ground truth):
/** 
 * Run the TraceControlComponent.
 * @throws Exception Would fail the test
 */
@Test public void testTraceSessionTree() throws Exception {
  fProxy.setTestFile(fTestFile);
  fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST);
  ITraceControlComponent root=fFacility.getControlView().getTraceControlRoot();
  ISystemRegistry registry=RSECorePlugin.getTheSystemRegistry();
  ISystemProfile profile=registry.createSystemProfile("String_Node_Str",true);
  IHost host=registry.createLocalHost(profile,"String_Node_Str","String_Node_Str");
  TargetNodeComponent node=new TargetNodeComponent("String_Node_Str",root,host,fProxy);
  root.addChild(node);
  fFacility.waitForJobs();
  fFacility.executeCommand(node,"String_Node_Str");
  int i=0;
  while ((i < 10) && (node.getTargetNodeState() != TargetNodeState.CONNECTED)) {
    i++;
    fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
  }
  assertEquals(TargetNodeState.CONNECTED,node.getTargetNodeState());
  ITraceControlComponent[] groups=node.getChildren();
  assertNotNull(groups);
  assertEquals(2,groups.length);
  TraceControlDialogFactory.getInstance().setCreateSessionDialog(new CreateSessionDialogStub());
  TraceControlDialogFactory.getInstance().setGetEventInfoDialog(new GetEventInfoDialogStub());
  TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub());
  fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
  TraceSessionComponent session=fFacility.createSession(groups[1]);
  assertNotNull(session);
  assertEquals("String_Node_Str",session.getName());
  assertEquals("String_Node_Str",session.getSessionPath());
  assertEquals(TraceSessionState.INACTIVE,session.getSessionState());
  fProxy.setScenario(SCEN_SCENARIO3_TEST);
  EnableChannelDialogStub channelStub=new EnableChannelDialogStub();
  channelStub.setIsKernel(true);
  TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelStub);
  fFacility.executeCommand(session,"String_Node_Str");
  ITraceControlComponent[] domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  assertEquals("String_Node_Str",domains[0].getName());
  ITraceControlComponent[] channels=domains[0].getChildren();
  assertNotNull(channels);
  assertEquals(1,channels.length);
  assertTrue(channels[0] instanceof TraceChannelComponent);
  TraceChannelComponent channel=(TraceChannelComponent)channels[0];
  assertEquals("String_Node_Str",channel.getName());
  assertEquals(4,channel.getNumberOfSubBuffers());
  assertEquals("String_Node_Str",channel.getOutputType());
  assertEquals(true,channel.isOverwriteMode());
  assertEquals(200,channel.getReadTimer());
  assertEquals(TraceEnablement.ENABLED,channel.getState());
  assertEquals(16384,channel.getSubBufferSize());
  assertEquals(100,channel.getSwitchTimer());
  ChannelInfo info=(ChannelInfo)channelStub.getChannelInfo();
  info.setName("String_Node_Str");
  info.setOverwriteMode(false);
  info.setSubBufferSize(32768);
  info.setNumberOfSubBuffers(2);
  info.setSwitchTimer(100);
  info.setReadTimer(200);
  channelStub.setChannelInfo(info);
  fFacility.executeCommand(domains[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  assertNotNull(channels);
  assertEquals(2,channels.length);
  assertTrue(channels[1] instanceof TraceChannelComponent);
  channel=(TraceChannelComponent)channels[1];
  assertEquals("String_Node_Str",channel.getName());
  assertEquals(2,channel.getNumberOfSubBuffers());
  assertEquals("String_Node_Str",channel.getOutputType());
  assertEquals(false,channel.isOverwriteMode());
  assertEquals(200,channel.getReadTimer());
  assertEquals(TraceEnablement.ENABLED,channel.getState());
  assertEquals(32768,channel.getSubBufferSize());
  assertEquals(100,channel.getSwitchTimer());
  EnableEventsDialogStub eventsDialogStub=new EnableEventsDialogStub();
  eventsDialogStub.setIsTracePoints(true);
  List<String> events=new ArrayList<String>();
  events.add("String_Node_Str");
  events.add("String_Node_Str");
  eventsDialogStub.setNames(events);
  eventsDialogStub.setIsKernel(true);
  TraceControlDialogFactory.getInstance().setEnableEventsDialog(eventsDialogStub);
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  assertNotNull(channels);
  assertEquals(2,channels.length);
  fFacility.executeCommand(channels,"String_Node_Str");
  assertEquals(TraceEnablement.DISABLED,((TraceChannelComponent)channels[0]).getState());
  assertEquals(TraceEnablement.DISABLED,((TraceChannelComponent)channels[1]).getState());
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  assertNotNull(channels);
  assertEquals(2,channels.length);
  fFacility.executeCommand(channels,"String_Node_Str");
  assertEquals(TraceEnablement.ENABLED,((TraceChannelComponent)channels[0]).getState());
  assertEquals(TraceEnablement.ENABLED,((TraceChannelComponent)channels[1]).getState());
  fFacility.executeCommand(session,"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  assertNotNull(channels);
  assertEquals(3,channels.length);
  assertTrue(channels[2] instanceof TraceChannelComponent);
  channel=(TraceChannelComponent)channels[2];
  assertEquals("String_Node_Str",channel.getName());
  ITraceControlComponent[] channel0Events=channel.getChildren();
  assertEquals(2,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceEventComponent);
  assertTrue(channel0Events[1] instanceof TraceEventComponent);
  TraceEventComponent event=(TraceEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  event=(TraceEventComponent)channel0Events[1];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  events.clear();
  events.add("String_Node_Str");
  eventsDialogStub.setNames(events);
  fFacility.executeCommand(domains[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(3,channel0Events.length);
  assertTrue(channel0Events[2] instanceof TraceEventComponent);
  event=(TraceEventComponent)channel0Events[2];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  events.clear();
  eventsDialogStub.setNames(events);
  eventsDialogStub.setIsAllTracePoints(true);
  fFacility.executeCommand(channels[1],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[1];
  channel0Events=channel.getChildren();
  assertEquals(3,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceEventComponent);
  assertTrue(channel0Events[1] instanceof TraceEventComponent);
  assertTrue(channel0Events[2] instanceof TraceEventComponent);
  event=(TraceEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  event=(TraceEventComponent)channel0Events[1];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  event=(TraceEventComponent)channel0Events[2];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  events.clear();
  eventsDialogStub.setIsTracePoints(false);
  eventsDialogStub.setIsAllTracePoints(false);
  eventsDialogStub.setIsSysCalls(true);
  fFacility.executeCommand(channels[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[0];
  channel=(TraceChannelComponent)channels[0];
  channel0Events=channel.getChildren();
  assertEquals(1,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceEventComponent);
  event=(TraceEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,event.getLogLevel());
  assertEquals(TraceEventType.SYSCALL,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  fFacility.executeCommand(domains[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[0];
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(4,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceEventComponent);
  event=(TraceEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,event.getLogLevel());
  assertEquals(TraceEventType.SYSCALL,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  fFacility.executeCommand(session,"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[0];
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(4,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceEventComponent);
  event=(TraceEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,event.getLogLevel());
  assertEquals(TraceEventType.SYSCALL,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  events.clear();
  eventsDialogStub.setIsSysCalls(false);
  eventsDialogStub.setIsDynamicProbe(true);
  eventsDialogStub.setDynamicProbe("String_Node_Str");
  eventsDialogStub.setProbeEventName("String_Node_Str");
  fFacility.executeCommand(domains[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(5,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
  TraceProbeEventComponent probeEvent=(TraceProbeEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",probeEvent.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,probeEvent.getLogLevel());
  assertEquals(TraceEventType.PROBE,probeEvent.getEventType());
  assertEquals(TraceEnablement.ENABLED,probeEvent.getState());
  assertNull(probeEvent.getOffset());
  assertEquals("String_Node_Str",probeEvent.getAddress());
  assertNull(probeEvent.getSymbol());
  eventsDialogStub.setIsDynamicProbe(true);
  eventsDialogStub.setDynamicProbe("String_Node_Str");
  eventsDialogStub.setProbeEventName("String_Node_Str");
  fFacility.executeCommand(channels[2],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(6,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
  probeEvent=(TraceProbeEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",probeEvent.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,probeEvent.getLogLevel());
  assertEquals(TraceEventType.PROBE,probeEvent.getEventType());
  assertEquals(TraceEnablement.ENABLED,probeEvent.getState());
  assertEquals("String_Node_Str",probeEvent.getOffset());
  assertNull(null,probeEvent.getAddress());
  assertEquals("String_Node_Str",probeEvent.getSymbol());
  eventsDialogStub.setIsDynamicProbe(true);
  eventsDialogStub.setDynamicProbe("String_Node_Str");
  eventsDialogStub.setProbeEventName("String_Node_Str");
  fFacility.executeCommand(session,"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(7,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
  probeEvent=(TraceProbeEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",probeEvent.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,probeEvent.getLogLevel());
  assertEquals(TraceEventType.PROBE,probeEvent.getEventType());
  assertEquals(TraceEnablement.ENABLED,probeEvent.getState());
  assertEquals("String_Node_Str",probeEvent.getOffset());
  assertNull(null,probeEvent.getAddress());
  assertEquals("String_Node_Str",probeEvent.getSymbol());
  eventsDialogStub.setIsDynamicProbe(false);
  eventsDialogStub.setDynamicProbe(null);
  eventsDialogStub.setProbeEventName(null);
  eventsDialogStub.setIsFunctionProbe(true);
  eventsDialogStub.setFunctionEventName("String_Node_Str");
  eventsDialogStub.setFunctionProbe("String_Node_Str");
  fFacility.executeCommand(session,"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(8,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
  probeEvent=(TraceProbeEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",probeEvent.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,probeEvent.getLogLevel());
  assertEquals(TraceEventType.FUNCTION,probeEvent.getEventType());
  assertEquals(TraceEnablement.ENABLED,probeEvent.getState());
  assertEquals("String_Node_Str",probeEvent.getOffset());
  assertNull(null,probeEvent.getAddress());
  assertEquals("String_Node_Str",probeEvent.getSymbol());
  eventsDialogStub.setIsFunctionProbe(true);
  eventsDialogStub.setFunctionEventName("String_Node_Str");
  eventsDialogStub.setFunctionProbe("String_Node_Str");
  fFacility.executeCommand(domains[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  assertEquals(9,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
  probeEvent=(TraceProbeEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",probeEvent.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,probeEvent.getLogLevel());
  assertEquals(TraceEventType.PROBE,probeEvent.getEventType());
  assertEquals(TraceEnablement.ENABLED,probeEvent.getState());
  assertEquals("String_Node_Str",probeEvent.getOffset());
  assertNull(null,probeEvent.getAddress());
  assertEquals("String_Node_Str",probeEvent.getSymbol());
  eventsDialogStub.setIsFunctionProbe(true);
  eventsDialogStub.setFunctionEventName("String_Node_Str");
  eventsDialogStub.setFunctionProbe("String_Node_Str");
  fFacility.executeCommand(channels[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[0];
  channel0Events=channel.getChildren();
  assertEquals(2,channel0Events.length);
  assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
  probeEvent=(TraceProbeEventComponent)channel0Events[0];
  assertEquals("String_Node_Str",probeEvent.getName());
  assertEquals(TraceLogLevel.LEVEL_UNKNOWN,probeEvent.getLogLevel());
  assertEquals(TraceEventType.PROBE,probeEvent.getEventType());
  assertEquals(TraceEnablement.ENABLED,probeEvent.getState());
  assertEquals("String_Node_Str",probeEvent.getOffset());
  assertNull(null,probeEvent.getAddress());
  assertEquals("String_Node_Str",probeEvent.getSymbol());
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  AddContextDialogStub addContextStub=new AddContextDialogStub();
  List<String> contexts=new ArrayList<String>();
  contexts.add("String_Node_Str");
  contexts.add("String_Node_Str");
  contexts.add("String_Node_Str");
  addContextStub.setContexts(contexts);
  TraceControlDialogFactory.getInstance().setAddContextDialog(addContextStub);
  fFacility.executeCommand(domains[0],"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[0];
  try {
    addContextStub.setContexts(contexts);
  }
 catch (  IllegalArgumentException e) {
    fail("String_Node_Str");
  }
  fFacility.executeCommand(channel,"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  channels=domains[0].getChildren();
  channel=(TraceChannelComponent)channels[2];
  channel0Events=channel.getChildren();
  event=(TraceEventComponent)channel0Events[6];
  fFacility.executeCommand(event,"String_Node_Str");
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  fFacility.executeCommand(domains[0],"String_Node_Str");
  fFacility.executeCommand(node,"String_Node_Str");
  groups=node.getChildren();
  assertNotNull(groups);
  assertEquals(2,groups.length);
  assertEquals(3,groups[0].getChildren().length);
  assertEquals(1,groups[1].getChildren().length);
  assertEquals(1,groups[1].getChildren()[0].getChildren().length);
  assertEquals(3,groups[1].getChildren()[0].getChildren()[0].getChildren().length);
  assertEquals(2,groups[1].getChildren()[0].getChildren()[0].getChildren()[0].getChildren().length);
  fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
  session=(TraceSessionComponent)groups[1].getChildren()[0];
  fFacility.startSession(session);
  assertEquals(TraceSessionState.ACTIVE,session.getSessionState());
  fFacility.stopSession(session);
  assertEquals(TraceSessionState.INACTIVE,session.getSessionState());
  fFacility.destroySession(session);
  assertEquals(0,groups[1].getChildren().length);
  fFacility.executeCommand(node,"String_Node_Str");
  assertEquals(TargetNodeState.DISCONNECTED,node.getTargetNodeState());
  fFacility.executeCommand(node,"String_Node_Str");
  assertEquals(0,fFacility.getControlView().getTraceControlRoot().getChildren().length);
}