Search in sources :

Example 26 with Problem

use of com.liferay.blade.api.Problem in project liferay-ide by liferay.

the class AppViewSearchEntryTagsTest 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/app-view-search-entry/"), new NullProgressMonitor());
    assertEquals(3, problems.size());
}
Also used : NullProgressMonitor(com.liferay.blade.util.NullProgressMonitor) Migration(com.liferay.blade.api.Migration) Problem(com.liferay.blade.api.Problem) File(java.io.File) Test(org.junit.Test)

Example 27 with Problem

use of com.liferay.blade.api.Problem in project liferay-ide by liferay.

the class CalendarLegacyAPITest method calendarLegacyAPITest.

@Test
public void calendarLegacyAPITest() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(getTestFile());
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(7, problems.size());
    Problem problem = problems.get(0);
    assertEquals(38, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1886, problem.startOffset);
        assertEquals(1946, problem.endOffset);
    } else {
        assertEquals(1849, problem.startOffset);
        assertEquals(1909, problem.endOffset);
    }
    problem = problems.get(1);
    assertEquals(39, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1956, problem.startOffset);
        assertEquals(2011, problem.endOffset);
    } else {
        assertEquals(1918, problem.startOffset);
        assertEquals(1973, problem.endOffset);
    }
    problem = problems.get(2);
    assertEquals(40, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(2021, problem.startOffset);
        assertEquals(2074, problem.endOffset);
    } else {
        assertEquals(1982, problem.startOffset);
        assertEquals(2035, problem.endOffset);
    }
    problem = problems.get(3);
    assertEquals(159, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(7006, problem.startOffset);
        assertEquals(7143, problem.endOffset);
    } else {
        assertEquals(6848, problem.startOffset);
        assertEquals(6983, problem.endOffset);
    }
    problem = problems.get(4);
    assertEquals(43, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(2228, problem.startOffset);
        assertEquals(2276, problem.endOffset);
    } else {
        assertEquals(2186, problem.startOffset);
        assertEquals(2234, problem.endOffset);
    }
    problem = problems.get(5);
    assertEquals(41, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(2084, problem.startOffset);
        assertEquals(2152, problem.endOffset);
    } else {
        assertEquals(2044, problem.startOffset);
        assertEquals(2112, problem.endOffset);
    }
    problem = problems.get(6);
    assertEquals(42, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(2162, problem.startOffset);
        assertEquals(2218, problem.endOffset);
    } else {
        assertEquals(2121, problem.startOffset);
        assertEquals(2177, problem.endOffset);
    }
}
Also used : FileMigrator(com.liferay.blade.api.FileMigrator) Problem(com.liferay.blade.api.Problem) Test(org.junit.Test)

Example 28 with Problem

use of com.liferay.blade.api.Problem in project liferay-ide by liferay.

the class DDLRecordLegacyAPITest method dDLRecordLegacyAPITest.

@Test
public void dDLRecordLegacyAPITest() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(getTestFile());
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(3, problems.size());
    Problem problem = problems.get(0);
    assertEquals(30, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1361, problem.startOffset);
        assertEquals(1426, problem.endOffset);
    } else {
        assertEquals(1332, problem.startOffset);
        assertEquals(1397, problem.endOffset);
    }
    problem = problems.get(1);
    assertEquals(132, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(4220, problem.startOffset);
        assertEquals(4263, problem.endOffset);
    } else {
        assertEquals(4089, problem.startOffset);
        assertEquals(4132, problem.endOffset);
    }
    problem = problems.get(2);
    assertEquals(145, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(4619, problem.startOffset);
        assertEquals(4699, problem.endOffset);
    } else {
        assertEquals(4475, problem.startOffset);
        assertEquals(4554, problem.endOffset);
    }
}
Also used : FileMigrator(com.liferay.blade.api.FileMigrator) Problem(com.liferay.blade.api.Problem) Test(org.junit.Test)

Example 29 with Problem

use of com.liferay.blade.api.Problem in project liferay-ide by liferay.

the class MarketplaceLegacyAPITest method marketplaceLegacyAPITest.

@Test
public void marketplaceLegacyAPITest() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(getTestFile());
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(6, problems.size());
    Problem problem = problems.get(0);
    assertEquals(18, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(681, problem.startOffset);
        assertEquals(732, problem.endOffset);
    } else {
        assertEquals(664, problem.startOffset);
        assertEquals(715, problem.endOffset);
    }
    problem = problems.get(1);
    assertEquals(60, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(2068, problem.startOffset);
        assertEquals(2176, problem.endOffset);
    } else {
        assertEquals(2009, problem.startOffset);
        assertEquals(2115, problem.endOffset);
    }
    problem = problems.get(2);
    assertEquals(87, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(2887, problem.startOffset);
        assertEquals(2947, problem.endOffset);
    } else {
        assertEquals(2801, problem.startOffset);
        assertEquals(2861, problem.endOffset);
    }
    problem = problems.get(3);
    assertEquals(19, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(742, problem.startOffset);
        assertEquals(796, problem.endOffset);
    } else {
        assertEquals(724, problem.startOffset);
        assertEquals(778, problem.endOffset);
    }
    problem = problems.get(4);
    assertEquals(73, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(2503, problem.startOffset);
        assertEquals(2613, problem.endOffset);
    } else {
        assertEquals(2431, problem.startOffset);
        assertEquals(2539, problem.endOffset);
    }
    problem = problems.get(5);
    assertEquals(82, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(2764, problem.startOffset);
        assertEquals(2875, problem.endOffset);
    } else {
        assertEquals(2683, problem.startOffset);
        assertEquals(2792, problem.endOffset);
    }
}
Also used : FileMigrator(com.liferay.blade.api.FileMigrator) Problem(com.liferay.blade.api.Problem) Test(org.junit.Test)

Example 30 with Problem

use of com.liferay.blade.api.Problem in project liferay-ide by liferay.

the class MicroblogsLegacyAPITest method microblogsLegacyAPITest.

@Test
public void microblogsLegacyAPITest() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(getTestFile());
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(4, problems.size());
    Problem problem = problems.get(0);
    assertEquals(22, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(972, problem.startOffset);
        assertEquals(1029, problem.endOffset);
    } else {
        assertEquals(951, problem.startOffset);
        assertEquals(1008, problem.endOffset);
    }
    problem = problems.get(1);
    assertEquals(47, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1809, problem.startOffset);
        assertEquals(1876, problem.endOffset);
    } else {
        assertEquals(1763, problem.startOffset);
        assertEquals(1830, problem.endOffset);
    }
    problem = problems.get(2);
    assertEquals(77, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(2879, problem.startOffset);
        assertEquals(2997, problem.endOffset);
    } else {
        assertEquals(2803, problem.startOffset);
        assertEquals(2920, problem.endOffset);
    }
    problem = problems.get(3);
    assertEquals(81, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(3018, problem.startOffset);
        assertEquals(3194, problem.endOffset);
    } else {
        assertEquals(2938, problem.startOffset);
        assertEquals(3112, problem.endOffset);
    }
}
Also used : FileMigrator(com.liferay.blade.api.FileMigrator) Problem(com.liferay.blade.api.Problem) Test(org.junit.Test)

Aggregations

Problem (com.liferay.blade.api.Problem)92 Test (org.junit.Test)58 File (java.io.File)42 FileMigrator (com.liferay.blade.api.FileMigrator)31 Migration (com.liferay.blade.api.Migration)29 NullProgressMonitor (com.liferay.blade.util.NullProgressMonitor)26 ArrayList (java.util.ArrayList)16 FileProblems (com.liferay.ide.project.core.upgrade.FileProblems)9 IOException (java.io.IOException)9 ServiceReference (org.osgi.framework.ServiceReference)9 AutoMigrator (com.liferay.blade.api.AutoMigrator)8 IFile (org.eclipse.core.resources.IFile)8 List (java.util.List)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 AutoMigrateException (com.liferay.blade.api.AutoMigrateException)5 SearchResult (com.liferay.blade.api.SearchResult)5 MigrationProblems (com.liferay.ide.project.core.upgrade.MigrationProblems)5 MigrationProblemsContainer (com.liferay.ide.project.core.upgrade.MigrationProblemsContainer)5 HashSet (java.util.HashSet)5 CoreException (org.eclipse.core.runtime.CoreException)5