use of com.liferay.blade.api.Problem 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());
}
use of com.liferay.blade.api.Problem in project liferay-ide by liferay.
the class APITestBase method test2.
@Test
public void test2() throws Exception {
FileMigrator fmigrator = context.getService(fileMigrators[0]);
List<Problem> problems = fmigrator.analyze(getTestFile());
problems = fmigrator.analyze(getTestFile());
context.ungetService(fileMigrators[0]);
assertNotNull(problems);
assertEquals(getExpectedNumber(), problems.size());
}
use of com.liferay.blade.api.Problem in project liferay-ide by liferay.
the class AssetCategoriesNavigationTagsTest 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/asset-categories-navigation/"), new NullProgressMonitor());
assertEquals(1, problems.size());
boolean found = false;
for (Problem problem : problems) {
if (problem.file.getName().endsWith("AssetCategoriesNavigationTagsTest.jsp")) {
if (problem.lineNumber == 48 && problem.startOffset >= 1530 && problem.endOffset >= 1616) {
found = true;
}
}
}
if (!found) {
fail();
}
}
use of com.liferay.blade.api.Problem in project liferay-ide by liferay.
the class AssetPreviewTagsTest 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/asset-preview/"), new NullProgressMonitor());
assertEquals(1, problems.size());
boolean found = false;
for (Problem problem : problems) {
if (problem.file.getName().endsWith("AssetPreviewTest.jsp") && problem.lineNumber == 7 && problem.startOffset >= 230 && problem.endOffset >= 310) {
found = true;
}
}
if (!found) {
fail();
}
}
use of com.liferay.blade.api.Problem in project liferay-ide by liferay.
the class ContactNameExceptionImportAutoCorrectTest method autoCorrectProblems.
@Test
public void autoCorrectProblems() throws Exception {
File tempFolder = Files.createTempDirectory("autocorrect").toFile();
File testFile = new File(tempFolder, "ContactNameExceptionImport.java");
tempFolder.deleteOnExit();
File originalTestfile = new File("javatests/ContactNameExceptionImport.java");
Files.copy(originalTestfile.toPath(), testFile.toPath());
List<Problem> problems = null;
FileMigrator migrator = null;
Collection<ServiceReference<FileMigrator>> mrefs = context.getServiceReferences(FileMigrator.class, null);
for (ServiceReference<FileMigrator> mref : mrefs) {
migrator = context.getService(mref);
if (migrator.getClass().getName().contains("ContactNameExceptionImport")) {
problems = migrator.analyze(testFile);
break;
}
}
assertEquals(3, problems.size());
int problemsFixed = ((AutoMigrator) migrator).correctProblems(testFile, problems);
assertEquals(3, problemsFixed);
File dest = new File(tempFolder, "Updated.java");
assertTrue(testFile.renameTo(dest));
problems = migrator.analyze(dest);
assertEquals(0, problems.size());
}
Aggregations