use of com.liferay.ide.gradle.core.parser.GradleDependencyUpdater in project liferay-ide by liferay.
the class GradleProjectTests method testAddGradleDependency.
@Test
public void testAddGradleDependency() throws Exception {
LiferayGradleProject gradleProject = Util.fullImportGradleProject("projects/GradleDependencyTestProject");
String[][] gradleDependencies = new String[][] { { "com.liferay.portal", "com.liferay.portal.kernel", "2.6.0" } };
GradleDependency gd = new GradleDependency(gradleDependencies[0][0], gradleDependencies[0][1], gradleDependencies[0][2]);
assertNotNull(gradleProject);
IProject project = gradleProject.getProject();
IFile gradileFile = project.getFile("build.gradle");
GradleDependencyUpdater updater = new GradleDependencyUpdater(gradileFile.getLocation().toFile());
List<GradleDependency> existDependencies = updater.getAllDependencies();
assertFalse(existDependencies.contains(gd));
IProjectBuilder gradleProjectBuilder = gradleProject.adapt(IProjectBuilder.class);
gradleProjectBuilder.updateProjectDependency(project, Arrays.asList(gradleDependencies));
GradleDependencyUpdater dependencyUpdater = new GradleDependencyUpdater(gradileFile.getLocation().toFile());
List<GradleDependency> updatedDependencies = dependencyUpdater.getAllDependencies();
assertTrue(updatedDependencies.contains(gd));
}
Aggregations