private void setAndConfirmBreakpoint(NonRootModelElement st) { Selection.getInstance().setSelection(new StructuredSelection(st)); ActivityEditor editor = DebugUITestUtilities.openActivityEditorForSelectedElement(); editor.setFocus(); DebugUITestUtilities.setBreakpointAtLine(editor, 2); IBreakpointManager bpm = DebugPlugin.getDefault().getBreakpointManager(); IBreakpoint[] bps = bpm.getBreakpoints(); assertTrue("Breakpoint not set", bps.length == 1); }
private void checkTransitionActionBreakPoint(final String transName, String expResultFile) { Package_c cp = Package_c.getOneEP_PKGOnR1405( m_sys, new ClassQueryInterface_c() { @Override public boolean evaluate(Object candidate) { return ((Package_c) candidate).getName().equals("Components"); } }); assertNotNull(cp); Component_c component = Component_c.getOneC_COnR8001( PackageableElement_c.getManyPE_PEsOnR8000(cp), new ClassQueryInterface_c() { @Override public boolean evaluate(Object candidate) { return ((Component_c) candidate).getName().equals("TransitionActionTestGlobals"); } }); assertNotNull(component); // launch the component DebugUITestUtilities.setLogActivityAndLaunchForElement( component, m_bp_tree.getControl().getMenu(), m_sys.getName()); // select the transition to be tested Transition_c trans = Transition_c.TransitionInstance( component.getModelRoot(), new ClassQueryInterface_c() { public boolean evaluate(Object candidate) { return ((Transition_c) candidate).Get_name().contains(transName); } }); assertNotNull(trans); Selection.getInstance().clear(); Selection.getInstance().addToSelection(trans); // set a breakpoint at line 2 ActivityEditor editor = DebugUITestUtilities.openActivityEditorForSelectedElement(); DebugUITestUtilities.setBreakpointAtLine(editor, 2); Function_c setup = Function_c.getOneS_SYNCOnR8001( PackageableElement_c.getManyPE_PEsOnR8000( Package_c.getManyEP_PKGsOnR8001( PackageableElement_c.getManyPE_PEsOnR8003(component))), new ClassQueryInterface_c() { public boolean evaluate(Object candidate) { return ((Function_c) candidate).getName().equals("setup"); } }); assertNotNull(setup); openPerspectiveAndView( "com.mentor.nucleus.bp.debug.ui.DebugPerspective", BridgePointPerspective.ID_MGC_BP_EXPLORER); BPDebugUtils.executeElement(setup); DebugUITestUtilities.waitForExecution(); Function_c test = Function_c.getOneS_SYNCOnR8001( PackageableElement_c.getManyPE_PEsOnR8000( Package_c.getManyEP_PKGsOnR8001( PackageableElement_c.getManyPE_PEsOnR8003(component))), new ClassQueryInterface_c() { public boolean evaluate(Object candidate) { return ((Function_c) candidate).getName().equals("test"); } }); assertNotNull(test); BPDebugUtils.executeElement(test); DebugUITestUtilities.waitForExecution(); ComponentInstance_c engine = ComponentInstance_c.getOneI_EXEOnR2955(component); assertNotNull(engine); // wait for the execution to complete DebugUITestUtilities.waitForBPThreads(m_sys); // compare the trace File expectedResults = new File(m_workspace_path + "expected_results/verifier/" + expResultFile); String expected_results = TestUtil.getTextFileContents(expectedResults); // get the text representation of the debug tree String actual_results = DebugUITestUtilities.getConsoleText(expected_results); assertEquals(expected_results, actual_results); }