/** * ask for the existence of a project with the same name. * * @param projectName the name of the project * @return true, if an other project with the same name as the parameter projectName exists, else * false */ private boolean existProjectName(String projectName) { for (TestProject project : projects) { if (project.getName().equalsIgnoreCase(projectName)) { return true; } } return false; }
/** * Tests the lookup of a TestStructure based on a relative path name. Path Name like: * /DemoWebRapTests/DialogWidgetsSuite/ConfirmMessageTest * * @throws SystemException for test */ @Test public void testLookUpOfTestStructure() throws SystemException { TestProject project = new TestProject(); project.setName("DemoWebRapTests"); TestSuite suite = new TestSuite(); project.addChild(suite); suite.setName("DialogWidgetsSuite"); TestCase testCase = new TestCase(); testCase.setName("ConfirmMessageTest"); suite.addChild(testCase); TeamChange change = new TeamChange( TeamChangeType.DELETE, "DemoWebRapTests.DialogWidgetsSuite.ConfirmMessageTest", project); TestStructure testStructure = change.getReleatedTestStructure(); assertNotNull("TestStructure expected.", testStructure); assertEquals( "Expecting MyTestCase as teststructure", "ConfirmMessageTest", testStructure.getName()); }
/** * Test delete of elements with fullqualified name and removing child elements on removing their * parent. */ @Test public void testDeleteEventHandlerOnFullNameAndParentName() { TestProtocolService protocolService = new TestProtocolService(); TestProject tp = new TestProject(); tp.setName("TP"); TestCase tc = new TestCase(); tp.addChild(tc); protocolService.set(tc, new TestResult()); assertNotNull(protocolService.get(tc)); Map<String, String> properties = new HashMap<String, String>(); properties.put("org.eclipse.e4.data", tc.getFullName()); Event event = new Event(TestEditorCoreEventConstants.TESTSTRUCTURE_MODEL_CHANGED_DELETED, properties); protocolService.getDeletedTestStructureEventHandler().handleEvent(event); assertNull(protocolService.get(tc)); protocolService.set(tc, new TestResult()); assertNotNull(protocolService.get(tc)); properties.put("org.eclipse.e4.data", tp.getFullName()); event = new Event(TestEditorCoreEventConstants.TESTSTRUCTURE_MODEL_CHANGED_DELETED, properties); protocolService.getDeletedTestStructureEventHandler().handleEvent(event); assertNull("Deleting project also deletes child testcase.", protocolService.get(tc)); }