/** Method createReviewGroups */ private void createReviewGroups() { fGroup = null; // Create Review Group for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) { if (group.getReviewGroup().getName().equals(TestConstants.REVIEW_GROUP_TEST_NAME)) { fGroup = group; fGroupName = group.getName(); break; } } if (null == fGroup) { fGroup = fProxy .getReviewGroupProxy() .createReviewGroup( TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]); Assert.assertNotNull(fGroup); Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName()); Assert.assertEquals( new Path(TestUtils.FSharedFolder).toPortableString() + "/" + TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getFolder()); Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup().getDescription()); Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, fGroup.getReviewGroup().getDefaultEntryCriteria()); for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS.length; i++) { Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], fGroup.getReviewGroup().getAvailableProjects().get(i)); } for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS.length; i++) { Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], fGroup.getReviewGroup().getAvailableComponents().get(i)); } fGroupName = fGroup.getName(); } }
/** * Method createReviewGroupSetup * * @throws ExecutionException * @throws NotDefinedException * @throws NotEnabledException * @throws NotHandledException * @throws ResourceHandlingException * @throws OutOfSyncException */ public void createReviewGroupSetup() { // Create Review Group R4EUIReviewGroup newGroup = fProxy .getReviewGroupProxy() .createReviewGroup( TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]); Assert.assertNotNull(newGroup); Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, newGroup.getReviewGroup().getName()); Assert.assertEquals( new Path(TestUtils.FSharedFolder).toPortableString() + "/" + TestConstants.REVIEW_GROUP_TEST_NAME, newGroup.getReviewGroup().getFolder()); Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, newGroup.getReviewGroup().getDescription()); Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, newGroup.getReviewGroup().getDefaultEntryCriteria()); for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS.length; i++) { Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], newGroup.getReviewGroup().getAvailableProjects().get(i)); } for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS.length; i++) { Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], newGroup.getReviewGroup().getAvailableComponents().get(i)); } String newGroupName = newGroup.getName(); // Create a second Review Group R4EUIReviewGroup newGroup2 = fProxy .getReviewGroupProxy() .createReviewGroup( TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME2, TestConstants.REVIEW_GROUP_TEST_NAME2, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]); Assert.assertNotNull(newGroup2); Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_NAME2, newGroup2.getReviewGroup().getName()); Assert.assertEquals( new Path(TestUtils.FSharedFolder).toPortableString() + "/" + TestConstants.REVIEW_GROUP_TEST_NAME2, newGroup2.getReviewGroup().getFolder()); Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, newGroup2.getReviewGroup().getDescription()); Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, newGroup2.getReviewGroup().getDefaultEntryCriteria()); for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS.length; i++) { Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], newGroup2.getReviewGroup().getAvailableProjects().get(i)); } for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS.length; i++) { Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], newGroup2.getReviewGroup().getAvailableComponents().get(i)); } // Close a Review Group fProxy.getCommandProxy().closeElement(newGroup); Assert.assertFalse(newGroup.isOpen()); // Open the closed Review Group fProxy.getCommandProxy().openElement(newGroup); Assert.assertTrue(newGroup.isOpen()); // Remove Review Group from preferences String prefsGroup = newGroup2.getReviewGroup().eResource().getURI().toFileString(); fProxy.getPreferencesProxy().removeGroupFromPreferences(prefsGroup); for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) { if (group.getReviewGroup().getName().equals(newGroup2.getReviewGroup().getName())) { fail( "Group " + prefsGroup + " should not be present since it was removed from preferences"); } } // Add back Review Group to preferences boolean groupFound = false; fProxy.getPreferencesProxy().addGroupToPreferences(prefsGroup); for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) { if (group.getReviewGroup().getName().equals(newGroup2.getReviewGroup().getName())) { groupFound = true; break; } } Assert.assertTrue(groupFound); // Get back handle to Review Group since view is refreshed for (IR4EUIModelElement elem : R4EUIModelController.getRootElement().getChildren()) { if (newGroupName.equals(elem.getName())) { newGroup = (R4EUIReviewGroup) elem; } } fProxy.getCommandProxy().openElement(newGroup); Assert.assertTrue(newGroup.isOpen()); // Update Review Group properties fProxy .getReviewGroupProxy() .changeReviewGroupDescription(newGroup, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION2); Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_DESCRIPTION2, newGroup.getReviewGroup().getDescription()); fProxy .getReviewGroupProxy() .changeReviewGroupDefaultEntryCriteria( newGroup, TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA2); Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA2, newGroup.getReviewGroup().getDefaultEntryCriteria()); fProxy .getReviewGroupProxy() .removeReviewGroupAvailableProject( newGroup, TestConstants.REVIEW_GROUP_TEST_REM_AVAILABLE_PROJECT); fProxy .getReviewGroupProxy() .addReviewGroupAvailableProject( newGroup, TestConstants.REVIEW_GROUP_TEST_ADD_AVAILABLE_PROJECT); for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS2.length; i++) { Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS2[i], newGroup.getReviewGroup().getAvailableProjects().get(i)); } fProxy .getReviewGroupProxy() .removeReviewGroupAvailableComponent( newGroup, TestConstants.REVIEW_GROUP_TEST_REM_AVAILABLE_COMPONENT); fProxy .getReviewGroupProxy() .addReviewGroupAvailableComponent( newGroup, TestConstants.REVIEW_GROUP_TEST_ADD_AVAILABLE_COMPONENT); for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS2.length; i++) { Assert.assertEquals( TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS2[i], newGroup.getReviewGroup().getAvailableComponents().get(i)); } for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) { if (ruleSet.getName().equals(TestConstants.RULE_SET_TEST_NAME2)) { fProxy .getReviewGroupProxy() .addReviewGroupRuleSet(newGroup, ruleSet.getRuleSet().getName()); Assert.assertEquals( ruleSet.getRuleSet().getName(), newGroup.getReviewGroup().getDesignRuleLocations().get(0)); break; } } for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) { if (ruleSet.getName().equals(TestConstants.RULE_SET_TEST_NAME)) { fProxy .getReviewGroupProxy() .addReviewGroupRuleSet(newGroup, ruleSet.getRuleSet().getName()); } else if (ruleSet.getName().equals(TestConstants.RULE_SET_TEST_NAME2)) { fProxy .getReviewGroupProxy() .removeReviewGroupRuleSet(newGroup, ruleSet.getRuleSet().getName()); } } for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) { if (ruleSet.getName().equals(TestConstants.RULE_SET_TEST_NAME)) { Assert.assertEquals( ruleSet.getRuleSet().getName(), newGroup.getReviewGroup().getDesignRuleLocations().get(0)); break; } } }