use of com.liferay.blade.api.Migration in project liferay-ide by liferay.
the class JSPTagImportsTest method allProblems.
@Test
public void allProblems() throws Exception {
ServiceReference<Migration> sr = context.getServiceReference(Migration.class);
Migration migration = context.getService(sr);
File tempFolder = Files.createTempDirectory("autocorrect").toFile();
File testFile = new File(tempFolder, "jsptaglist.jsp");
tempFolder.deleteOnExit();
File originalTestfile = new File("jsptests/imports/view.jsp");
Files.copy(originalTestfile.toPath(), testFile.toPath());
List<Problem> problems = migration.findProblems(testFile, new NullProgressMonitor());
assertEquals(6, problems.size());
Collection<ServiceReference<AutoMigrator>> refs = context.getServiceReferences(AutoMigrator.class, "(auto.correct=import)");
for (ServiceReference<AutoMigrator> ref : refs) {
AutoMigrator autoMigrator = context.getService(ref);
autoMigrator.correctProblems(testFile, problems);
}
File dest = new File(tempFolder, "Updated.jsp");
assertTrue(testFile.renameTo(dest));
List<Problem> problems2 = migration.findProblems(dest, new NullProgressMonitor());
assertEquals(0, problems2.size());
}
use of com.liferay.blade.api.Migration in project liferay-ide by liferay.
the class LiferayUIFlagsTagsTest method findProblems.
@Test
public void findProblems() throws Exception {
ServiceReference<Migration> sr = context.getServiceReference(Migration.class);
Migration m = context.getService(sr);
List<Problem> problems = m.findProblems(new File("jsptests/liferayui-flags/"), new NullProgressMonitor());
assertEquals(1, problems.size());
boolean found = false;
for (Problem problem : problems) {
if (problem.file.getName().endsWith("LiferayUIFlagsTagsTest.jsp")) {
if (problem.lineNumber == 3 && problem.startOffset >= 65 && problem.endOffset >= 273) {
found = true;
}
}
}
if (!found) {
fail();
}
}
use of com.liferay.blade.api.Migration in project liferay-ide by liferay.
the class NavigationTagsTest method findProblems.
@Test
public void findProblems() throws Exception {
ServiceReference<Migration> sr = context.getServiceReference(Migration.class);
Migration m = context.getService(sr);
List<Problem> problems = m.findProblems(new File("jsptests/navigation-tags/"), new NullProgressMonitor());
assertEquals(1, problems.size());
boolean found = false;
for (Problem problem : problems) {
if (problem.file.getName().endsWith("NavigationTagsTest.jsp")) {
if (problem.lineNumber == 3 && problem.startOffset >= 57 && problem.endOffset >= 374) {
found = true;
}
}
}
if (!found) {
fail();
}
}
use of com.liferay.blade.api.Migration in project liferay-ide by liferay.
the class RepositoryServiceUtilTest method repositoryServiceUtilTest.
@Test
public void repositoryServiceUtilTest() throws Exception {
ServiceReference<Migration> sr = context.getServiceReference(Migration.class);
Migration m = context.getService(sr);
List<Problem> problems = m.findProblems(new File("jsptests/repository-service-util"), new NullProgressMonitor());
assertEquals(1, problems.size());
boolean found = false;
for (Problem problem : problems) {
if (problem.file.getName().endsWith("RepositoryServiceUtilTest.jsp")) {
if (problem.lineNumber == 9 && problem.startOffset >= 104 && problem.endOffset >= 171) {
found = true;
}
}
}
if (!found) {
fail();
}
}
use of com.liferay.blade.api.Migration in project liferay-ide by liferay.
the class TrashEmptyTagsTest method findProblems.
@Test
public void findProblems() throws Exception {
ServiceReference<Migration> sr = context.getServiceReference(Migration.class);
Migration m = context.getService(sr);
List<Problem> problems = m.findProblems(new File("jsptests/liferay-ui-trash-empty/"), new NullProgressMonitor());
assertEquals(3, problems.size());
}
Aggregations