Program: 92529
Project: 92529
Buggy source:
/** 
 * Run the TraceControlComponent.
 */
public void testTraceControlComponents() throws Exception {
  fProxy.setTestFile(fTestFile);
  fProxy.setScenario(SCEN_INIT_TEST);
  ITraceControlComponent root=TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
  @SuppressWarnings("String_Node_Str") IHost host=new Host(new SystemProfile("String_Node_Str",true));
  host.setHostName("String_Node_Str");
  TargetNodeComponent node=new TargetNodeComponent("String_Node_Str",root,host,fProxy);
  root.addChild(node);
  node.connect();
  fFacility.waitForJobs();
  assertEquals(TargetNodeState.CONNECTED,node.getTargetNodeState());
  ITraceControlComponent[] groups=node.getChildren();
  assertNotNull(groups);
  assertEquals(2,groups.length);
  ITraceControlComponent[] providers=groups[0].getChildren();
  KernelProviderComponent kernelProvider=(KernelProviderComponent)providers[0];
  ITraceControlComponent[] events=kernelProvider.getChildren();
  assertNotNull(events);
  assertEquals(3,events.length);
  BaseEventComponent baseEventInfo0=(BaseEventComponent)events[0];
  BaseEventComponent baseEventInfo1=(BaseEventComponent)events[1];
  TraceControlDialogFactory.getInstance().setCreateSessionDialog(new CreateSessionDialogStub());
  TraceControlDialogFactory.getInstance().setGetEventInfoDialog(new GetEventInfoDialogStub());
  TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub());
  fProxy.setScenario(SCEN_SCENARIO1_TEST);
  TraceSessionComponent session=createSession(groups[1]);
  assertNotNull(session);
  assertEquals("String_Node_Str",session.getName());
  assertEquals("String_Node_Str",session.getSessionPath());
  assertEquals(TraceSessionState.INACTIVE,session.getSessionState());
  ITraceControlComponent[] components={baseEventInfo0,baseEventInfo1};
  fFacility.getControlView().setSelection(components);
  fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  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(false,channel.isOverwriteMode());
  assertEquals(200,channel.getReadTimer());
  assertEquals(TraceEnablement.ENABLED,channel.getState());
  assertEquals(262144,channel.getSubBufferSize());
  assertEquals(0,channel.getSwitchTimer());
  ITraceControlComponent[] channel0Events=channel.getChildren();
  assertNotNull(channel0Events);
  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());
  TraceEventComponent event1=(TraceEventComponent)channel0Events[1];
  assertEquals("String_Node_Str",event1.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event1.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event1.getEventType());
  assertEquals(TraceEnablement.ENABLED,event1.getState());
  ITraceControlComponent[] selection={event,event1};
  fFacility.getControlView().setSelection(selection);
  fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  assertEquals(TraceEnablement.DISABLED,event.getState());
  assertEquals(TraceEnablement.DISABLED,event1.getState());
  fFacility.getControlView().setSelection(event1);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  assertEquals(TraceEnablement.ENABLED,event1.getState());
  destroySession(session);
  assertEquals(0,groups[1].getChildren().length);
  fProxy.setScenario(SCEN_SCENARIO2_TEST);
  CreateSessionDialogStub sessionDialogStub=new CreateSessionDialogStub();
  sessionDialogStub.setSessionPath("String_Node_Str");
  TraceControlDialogFactory.getInstance().setCreateSessionDialog(sessionDialogStub);
  session=createSession(groups[1]);
  assertNotNull(session);
  assertEquals("String_Node_Str",session.getName());
  assertEquals("String_Node_Str",session.getSessionPath());
  assertEquals(TraceSessionState.INACTIVE,session.getSessionState());
  TraceControlDialogFactory.getInstance().setCreateChannelOnSessionDialog(new CreateChannelOnSessionDialogStub());
  fFacility.getControlView().setSelection(session);
  fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  assertEquals("String_Node_Str",domains[0].getName());
  channels=domains[0].getChildren();
  assertNotNull(channels);
  assertEquals(1,channels.length);
  assertTrue(channels[0] instanceof TraceChannelComponent);
  channel=(TraceChannelComponent)channels[0];
  assertEquals("String_Node_Str",channel.getName());
  assertEquals(2,channel.getNumberOfSubBuffers());
  assertEquals("String_Node_Str",channel.getOutputType());
  assertEquals(false,channel.isOverwriteMode());
  assertEquals(100,channel.getReadTimer());
  assertEquals(TraceEnablement.ENABLED,channel.getState());
  assertEquals(16384,channel.getSubBufferSize());
  assertEquals(200,channel.getSwitchTimer());
  UstProviderComponent ustProvider=(UstProviderComponent)providers[1];
  assertEquals("String_Node_Str",ustProvider.getName());
  assertEquals(9379,ustProvider.getPid());
  events=ustProvider.getChildren();
  assertNotNull(events);
  assertEquals(2,events.length);
  baseEventInfo0=(BaseEventComponent)events[0];
  baseEventInfo1=(BaseEventComponent)events[1];
  ITraceControlComponent[] ustSelection={baseEventInfo0,baseEventInfo1};
  fFacility.getControlView().setSelection(ustSelection);
  fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  domains=session.getChildren();
  channels=domains[0].getChildren();
  ITraceControlComponent[] ustEvents=channels[0].getChildren();
  assertEquals(2,ustEvents.length);
  event=(TraceEventComponent)ustEvents[0];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_DEBUG_LINE,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  event=(TraceEventComponent)ustEvents[1];
  assertEquals("String_Node_Str",ustEvents[1].getName());
  assertEquals(TraceLogLevel.TRACE_DEBUG_LINE,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  fFacility.getControlView().setSelection(event);
  fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  assertEquals(TraceEnablement.DISABLED,event.getState());
  fFacility.getControlView().setSelection(event);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  assertEquals(TraceEnablement.ENABLED,event.getState());
  destroySession(session);
  assertEquals(0,groups[1].getChildren().length);
}

Fixed version (ground truth):
/** 
 * Run the TraceControlComponent.
 */
public void testTraceControlComponents() throws Exception {
  fProxy.setTestFile(fTestFile);
  fProxy.setScenario(SCEN_INIT_TEST);
  ITraceControlComponent root=TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
  @SuppressWarnings("String_Node_Str") IHost host=new Host(new SystemProfile("String_Node_Str",true));
  host.setHostName("String_Node_Str");
  TargetNodeComponent node=new TargetNodeComponent("String_Node_Str",root,host,fProxy);
  root.addChild(node);
  node.connect();
  fFacility.waitForJobs();
  assertEquals(TargetNodeState.CONNECTED,node.getTargetNodeState());
  ITraceControlComponent[] groups=node.getChildren();
  assertNotNull(groups);
  assertEquals(2,groups.length);
  ITraceControlComponent[] providers=groups[0].getChildren();
  KernelProviderComponent kernelProvider=(KernelProviderComponent)providers[0];
  ITraceControlComponent[] events=kernelProvider.getChildren();
  assertNotNull(events);
  assertEquals(3,events.length);
  BaseEventComponent baseEventInfo0=(BaseEventComponent)events[0];
  BaseEventComponent baseEventInfo1=(BaseEventComponent)events[1];
  TraceControlDialogFactory.getInstance().setCreateSessionDialog(new CreateSessionDialogStub());
  TraceControlDialogFactory.getInstance().setGetEventInfoDialog(new GetEventInfoDialogStub());
  TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub());
  fProxy.setScenario(SCEN_SCENARIO1_TEST);
  TraceSessionComponent session=createSession(groups[1]);
  assertNotNull(session);
  assertEquals("String_Node_Str",session.getName());
  assertEquals("String_Node_Str",session.getSessionPath());
  assertEquals(TraceSessionState.INACTIVE,session.getSessionState());
  ITraceControlComponent[] components={baseEventInfo0,baseEventInfo1};
  fFacility.getControlView().setSelection(components);
  fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  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(false,channel.isOverwriteMode());
  assertEquals(200,channel.getReadTimer());
  assertEquals(TraceEnablement.ENABLED,channel.getState());
  assertEquals(262144,channel.getSubBufferSize());
  assertEquals(0,channel.getSwitchTimer());
  ITraceControlComponent[] channel0Events=channel.getChildren();
  assertNotNull(channel0Events);
  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());
  TraceEventComponent event1=(TraceEventComponent)channel0Events[1];
  assertEquals("String_Node_Str",event1.getName());
  assertEquals(TraceLogLevel.TRACE_EMERG,event1.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event1.getEventType());
  assertEquals(TraceEnablement.ENABLED,event1.getState());
  ITraceControlComponent[] selection={event,event1};
  fFacility.getControlView().setSelection(selection);
  fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  assertEquals(TraceEnablement.DISABLED,event.getState());
  assertEquals(TraceEnablement.DISABLED,event1.getState());
  fFacility.getControlView().setSelection(event1);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  assertEquals(TraceEnablement.ENABLED,event1.getState());
  destroySession(session);
  assertEquals(0,groups[1].getChildren().length);
  fProxy.setScenario(SCEN_SCENARIO2_TEST);
  CreateSessionDialogStub sessionDialogStub=new CreateSessionDialogStub();
  sessionDialogStub.setSessionPath("String_Node_Str");
  TraceControlDialogFactory.getInstance().setCreateSessionDialog(sessionDialogStub);
  session=createSession(groups[1]);
  assertNotNull(session);
  assertEquals("String_Node_Str",session.getName());
  assertEquals("String_Node_Str",session.getSessionPath());
  assertEquals(TraceSessionState.INACTIVE,session.getSessionState());
  TraceControlDialogFactory.getInstance().setCreateChannelDialog(new CreateChannelDialogStub());
  fFacility.getControlView().setSelection(session);
  fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  domains=session.getChildren();
  assertNotNull(domains);
  assertEquals(1,domains.length);
  assertEquals("String_Node_Str",domains[0].getName());
  channels=domains[0].getChildren();
  assertNotNull(channels);
  assertEquals(1,channels.length);
  assertTrue(channels[0] instanceof TraceChannelComponent);
  channel=(TraceChannelComponent)channels[0];
  assertEquals("String_Node_Str",channel.getName());
  assertEquals(2,channel.getNumberOfSubBuffers());
  assertEquals("String_Node_Str",channel.getOutputType());
  assertEquals(false,channel.isOverwriteMode());
  assertEquals(100,channel.getReadTimer());
  assertEquals(TraceEnablement.ENABLED,channel.getState());
  assertEquals(16384,channel.getSubBufferSize());
  assertEquals(200,channel.getSwitchTimer());
  UstProviderComponent ustProvider=(UstProviderComponent)providers[1];
  assertEquals("String_Node_Str",ustProvider.getName());
  assertEquals(9379,ustProvider.getPid());
  events=ustProvider.getChildren();
  assertNotNull(events);
  assertEquals(2,events.length);
  baseEventInfo0=(BaseEventComponent)events[0];
  baseEventInfo1=(BaseEventComponent)events[1];
  ITraceControlComponent[] ustSelection={baseEventInfo0,baseEventInfo1};
  fFacility.getControlView().setSelection(ustSelection);
  fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  domains=session.getChildren();
  channels=domains[0].getChildren();
  ITraceControlComponent[] ustEvents=channels[0].getChildren();
  assertEquals(2,ustEvents.length);
  event=(TraceEventComponent)ustEvents[0];
  assertEquals("String_Node_Str",event.getName());
  assertEquals(TraceLogLevel.TRACE_DEBUG_LINE,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  event=(TraceEventComponent)ustEvents[1];
  assertEquals("String_Node_Str",ustEvents[1].getName());
  assertEquals(TraceLogLevel.TRACE_DEBUG_LINE,event.getLogLevel());
  assertEquals(TraceEventType.TRACEPOINT,event.getEventType());
  assertEquals(TraceEnablement.ENABLED,event.getState());
  fFacility.getControlView().setSelection(event);
  fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  assertEquals(TraceEnablement.DISABLED,event.getState());
  fFacility.getControlView().setSelection(event);
  fFacility.executeCommand("String_Node_Str");
  fFacility.waitForJobs();
  assertEquals(TraceEnablement.ENABLED,event.getState());
  destroySession(session);
  assertEquals(0,groups[1].getChildren().length);
}