Search in sources :

Example 6 with AddDependencyOperation

use of org.eclipse.m2e.core.ui.internal.editing.AddDependencyOperation in project m2e-core-tests by tesla.

the class AddDependencyOperationTest method testWithDependencies.

@Test
public void testWithDependencies() throws Exception {
    // 
    document.setText(// 
    StructuredModelManager.getModelManager(), // 
    "<project><dependencies>" + // 
    "<dependency><groupId>AAA</groupId><artifactId>BBB</artifactId><version>1.0</version></dependency>" + // 
    "<dependency><groupId>AAAB</groupId><artifactId>BBB</artifactId><version>1.0</version></dependency>" + "</dependencies></project>");
    PomEdits.performOnDOMDocument(new OperationTuple(tempModel, new AddDependencyOperation(d)));
    assertEquals("Expected dependency: " + d.toString() + "\n" + document.getText(), 1, dependencyCount(tempModel, d));
    assertEquals("Dependency Count: \n" + document.getText(), 3, getDependencyCount(tempModel));
}
Also used : OperationTuple(org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple) AddDependencyOperation(org.eclipse.m2e.core.ui.internal.editing.AddDependencyOperation) Test(org.junit.Test)

Aggregations

AddDependencyOperation (org.eclipse.m2e.core.ui.internal.editing.AddDependencyOperation)6 OperationTuple (org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Dependency (org.apache.maven.model.Dependency)1 Exclusion (org.apache.maven.model.Exclusion)1 IFile (org.eclipse.core.resources.IFile)1 IStatus (org.eclipse.core.runtime.IStatus)1 MultiStatus (org.eclipse.core.runtime.MultiStatus)1 Status (org.eclipse.core.runtime.Status)1 SubMonitor (org.eclipse.core.runtime.SubMonitor)1 RefactoringStatus (org.eclipse.ltk.core.refactoring.RefactoringStatus)1 ArtifactKey (org.eclipse.m2e.core.embedder.ArtifactKey)1 AddExclusionOperation (org.eclipse.m2e.core.ui.internal.editing.AddExclusionOperation)1 CompoundOperation (org.eclipse.m2e.core.ui.internal.editing.PomEdits.CompoundOperation)1 Operation (org.eclipse.m2e.core.ui.internal.editing.PomEdits.Operation)1 RemoveDependencyOperation (org.eclipse.m2e.core.ui.internal.editing.RemoveDependencyOperation)1 ParentHierarchyEntry (org.eclipse.m2e.core.ui.internal.util.ParentHierarchyEntry)1