use of org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple in project m2e-core-tests by tesla.
the class AddDependencyOperationTest method testDuplicatedDependency.
@Test
public void testDuplicatedDependency() 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>" + //
"<dependency><groupId>AAA</groupId><artifactId>BBBB</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));
}
use of org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple in project m2e-core-tests by tesla.
the class AddDependencyOperationTest method testEmptyDependenciesElement.
@Test
public void testEmptyDependenciesElement() throws Exception {
//
document.setText(//
StructuredModelManager.getModelManager(), //
"<project><dependencies>" + "</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(), 1, getDependencyCount(tempModel));
}
use of org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple in project m2e-core-tests by tesla.
the class AddDependencyOperationTest method testNoDependenciesElement.
@Test
public void testNoDependenciesElement() throws Exception {
//
document.setText(//
StructuredModelManager.getModelManager(), "<project></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(), 1, getDependencyCount(tempModel));
}
use of org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple in project m2e-core-tests by tesla.
the class AddExclusionOperationTest method testMissingDependency_withDependencies.
@Test
public void testMissingDependency_withDependencies() 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 AddExclusionOperation(d, e)));
assertEquals("Expected no dependency: " + d.toString() + "\n" + document.getText(), 0, dependencyCount(tempModel, d));
assertEquals("Dependency Count: \n" + document.getText(), 2, getDependencyCount(tempModel));
}
use of org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple in project m2e-core-tests by tesla.
the class AddExclusionOperationTest method testMissingDependency_emptyDependenciesElement.
@Test
public void testMissingDependency_emptyDependenciesElement() throws Exception {
//
document.setText(//
StructuredModelManager.getModelManager(), //
"<project><dependencies>" + "</dependencies></project>");
PomEdits.performOnDOMDocument(new OperationTuple(tempModel, new AddExclusionOperation(d, e)));
assertEquals("Expected no dependency: " + d.toString() + "\n" + document.getText(), 0, dependencyCount(tempModel, d));
}
Aggregations