/** Method createEditorAnomalies */ private void createCompareEditorAnomalies() { fCompareEditorAnomaly = fProxy .getAnomalyProxy() .createCompareEditorAnomaly( fItem.getFileContexts().get(fAnomalyFileIndex), 20, 50, TestConstants.COMPARE_EDITOR_ANOMALY_TEST_TITLE, TestConstants.COMPARE_EDITOR_ANOMALY_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_ERRONEOUS, TestConstants.ANOMALY_TEST_RANK_MINOR, TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null); Assert.assertNotNull(fCompareEditorAnomaly); Assert.assertEquals( TestConstants.COMPARE_EDITOR_ANOMALY_TEST_TITLE, fCompareEditorAnomaly.getAnomaly().getTitle()); Assert.assertEquals( TestConstants.COMPARE_EDITOR_ANOMALY_TEST_DESCRIPTION, fCompareEditorAnomaly.getAnomaly().getDescription()); Assert.assertEquals( TestConstants.ANOMALY_TEST_CLASS_ERRONEOUS, ((R4ECommentType) fCompareEditorAnomaly.getAnomaly().getType()).getType()); Assert.assertEquals( TestConstants.ANOMALY_TEST_RANK_MINOR, fCompareEditorAnomaly.getAnomaly().getRank()); Assert.assertEquals( TestConstants.ANOMALY_TEST_DUE_DATE, fCompareEditorAnomaly.getAnomaly().getDueDate()); Assert.assertEquals( TestConstants.PARTICIPANT_ASSIGN_TO, fCompareEditorAnomaly.getAnomaly().getAssignedTo().get(0)); Assert.assertEquals( 20, ((R4ETextPosition) ((R4ETextContent) fCompareEditorAnomaly.getAnomaly().getLocations().get(0)) .getLocation()) .getStartPosition()); Assert.assertEquals( 50, ((R4ETextPosition) ((R4ETextContent) fCompareEditorAnomaly.getAnomaly().getLocations().get(0)) .getLocation()) .getLength()); Assert.assertTrue( fProxy .getCommandProxy() .verifyAnnotation( fCompareEditorAnomaly, true, R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID)); }
/** Method createLinkedAnomalies */ private void createLinkedAnomalies() { R4EUIContent content = fItem .getFileContexts() .get(fAnomalyFileIndex) .getContentsContainerElement() .getContentsList() .get(0); fLinkedAnomaly = fProxy .getAnomalyProxy() .createLinkedAnomaly( content, TestConstants.LINKED_ANOMALY_TEST_TITLE, TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, TestConstants.ANOMALY_TEST_RANK_MAJOR, TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null); Assert.assertNotNull(fLinkedAnomaly); Assert.assertEquals( TestConstants.LINKED_ANOMALY_TEST_TITLE, fLinkedAnomaly.getAnomaly().getTitle()); Assert.assertEquals( TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, fLinkedAnomaly.getAnomaly().getDescription()); Assert.assertEquals( TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, ((R4ECommentType) fLinkedAnomaly.getAnomaly().getType()).getType()); Assert.assertEquals( TestConstants.ANOMALY_TEST_RANK_MAJOR, fLinkedAnomaly.getAnomaly().getRank()); Assert.assertEquals( TestConstants.ANOMALY_TEST_DUE_DATE, fLinkedAnomaly.getAnomaly().getDueDate()); Assert.assertEquals( TestConstants.PARTICIPANT_ASSIGN_TO, fLinkedAnomaly.getAnomaly().getAssignedTo().get(0)); Assert.assertEquals( ((R4EUITextPosition) content.getPosition()).getOffset(), ((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly.getAnomaly().getLocations().get(0)).getLocation()) .getStartPosition()); Assert.assertEquals( ((R4EUITextPosition) content.getPosition()).getLength(), ((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly.getAnomaly().getLocations().get(0)).getLocation()) .getLength()); Assert.assertTrue( fProxy .getCommandProxy() .verifyAnnotation(fLinkedAnomaly, true, R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID)); }
/** Method createReviewItems */ private void createReviewItems() throws CoreException { fItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0); // close and re-open, so the validation takes de-serialized information String itemName = fItem.getName(); fProxy.getCommandProxy().closeElement(fReview); fProxy.getCommandProxy().openElement(fReview); for (IR4EUIModelElement elem : fReview.getChildren()) { if (elem.getName().equals(itemName)) { fItem = (R4EUIReviewItem) elem; } } // Now validate Assert.assertNotNull(fItem); Assert.assertEquals(R4EUIModelController.getReviewer(), fItem.getItem().getAddedById()); Assert.assertEquals("*****@*****.**", fItem.getItem().getAuthorRep()); Assert.assertEquals("second Java Commit", fItem.getItem().getDescription()); Assert.assertEquals(4, fItem.getChildren().length); for (int i = 0; i < fItem.getChildren().length; i++) { if (((R4EUIFileContext) fItem.getChildren()[i]) .getName() .equals(TestUtils.JAVA_FILE1_PROJ_NAME)) { fAnomalyFileIndex = i; // Used later to add anomalies Assert.assertEquals( TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem().getFileContextList().get(i).getBase().getName()); Assert.assertEquals( TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem().getFileContextList().get(i).getTarget().getName()); Assert.assertEquals( 606, ((R4ETextPosition) fItem .getItem() .getFileContextList() .get(i) .getDeltas() .get(0) .getTarget() .getLocation()) .getStartPosition()); Assert.assertEquals( 25, ((R4ETextPosition) fItem .getItem() .getFileContextList() .get(i) .getDeltas() .get(0) .getTarget() .getLocation()) .getLength()); Assert.assertEquals( 665, ((R4ETextPosition) fItem .getItem() .getFileContextList() .get(i) .getDeltas() .get(1) .getTarget() .getLocation()) .getStartPosition()); Assert.assertEquals( 63, ((R4ETextPosition) fItem .getItem() .getFileContextList() .get(i) .getDeltas() .get(1) .getTarget() .getLocation()) .getLength()); Assert.assertEquals( 733, ((R4ETextPosition) fItem .getItem() .getFileContextList() .get(i) .getDeltas() .get(2) .getTarget() .getLocation()) .getStartPosition()); Assert.assertEquals( 61, ((R4ETextPosition) fItem .getItem() .getFileContextList() .get(i) .getDeltas() .get(2) .getTarget() .getLocation()) .getLength()); Assert.assertTrue( fProxy .getCommandProxy() .verifyAnnotations( ((R4EUIFileContext) fItem.getChildren()[i]) .getContentsContainerElement() .getChildren(), true, R4EUIConstants.DELTA_ANNOTATION_ID)); } else if (((R4EUIFileContext) fItem.getChildren()[i]) .getName() .equals(TestUtils.JAVA_FILE4_PROJ_NAME)) { Assert.assertNull(fItem.getItem().getFileContextList().get(i).getBase()); Assert.assertEquals( TestUtils.JAVA_FILE4_PROJ_NAME, fItem.getItem().getFileContextList().get(i).getTarget().getName()); } else if (((R4EUIFileContext) fItem.getChildren()[i]) .getName() .equals(TestUtils.JAVA_FILE3_PROJ_NAME)) { Assert.assertNull(fItem.getItem().getFileContextList().get(i).getBase()); Assert.assertEquals( TestUtils.JAVA_FILE3_PROJ_NAME, fItem.getItem().getFileContextList().get(i).getTarget().getName()); } else if (((R4EUIFileContext) fItem.getChildren()[i]) .getName() .equals(TestUtils.JAVA_FILE2_PROJ_NAME)) { Assert.assertEquals( TestUtils.JAVA_FILE2_PROJ_NAME, fItem.getItem().getFileContextList().get(i).getBase().getName()); Assert.assertNull(fItem.getItem().getFileContextList().get(i).getTarget()); } } fItem2 = fProxy.getItemProxy().createManualTreeItem(TestUtils.FJavaFile3); Assert.assertNotNull(fItem2); Assert.assertEquals(R4EUIModelController.getReviewer(), fItem2.getItem().getAddedById()); Assert.assertEquals( TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem().getFileContextList().get(0).getBase().getName()); Assert.assertEquals( TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem().getFileContextList().get(0).getTarget().getName()); Assert.assertEquals( 0, ((R4ETextPosition) fItem2 .getItem() .getFileContextList() .get(0) .getDeltas() .get(0) .getTarget() .getLocation()) .getStartPosition()); Assert.assertEquals( 755, ((R4ETextPosition) fItem2 .getItem() .getFileContextList() .get(0) .getDeltas() .get(0) .getTarget() .getLocation()) .getLength()); Assert.assertTrue( fProxy .getCommandProxy() .verifyAnnotations( ((R4EUIFileContext) fItem2.getChildren()[0]) .getContentsContainerElement() .getChildren(), false, R4EUIConstants.SELECTION_ANNOTATION_ID)); fItem3 = fProxy.getItemProxy().createManualTextItem(TestUtils.FJavaFile4, 50, 20); Assert.assertNotNull(fItem3); Assert.assertEquals(R4EUIModelController.getReviewer(), fItem3.getItem().getAddedById()); Assert.assertEquals( TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem().getFileContextList().get(0).getBase().getName()); Assert.assertEquals( TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem().getFileContextList().get(0).getTarget().getName()); Assert.assertEquals( 50, ((R4ETextPosition) fItem3 .getItem() .getFileContextList() .get(0) .getDeltas() .get(0) .getTarget() .getLocation()) .getStartPosition()); Assert.assertEquals( 20, ((R4ETextPosition) fItem3 .getItem() .getFileContextList() .get(0) .getDeltas() .get(0) .getTarget() .getLocation()) .getLength()); Assert.assertTrue( fProxy .getCommandProxy() .verifyAnnotations( ((R4EUIFileContext) fItem3.getChildren()[0]) .getContentsContainerElement() .getChildren(), true, R4EUIConstants.SELECTION_ANNOTATION_ID)); }