Search in sources :

Example 31 with Problem

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

the class MobileDeviceRulesLegacyAPITest method mobileDeviceRulesLegacyAPITest.

@Test
public void mobileDeviceRulesLegacyAPITest() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(getTestFile());
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(8, problems.size());
    Problem problem = problems.get(0);
    assertEquals(36, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1554, problem.startOffset);
        assertEquals(1625, problem.endOffset);
    } else {
        assertEquals(1519, problem.startOffset);
        assertEquals(1590, problem.endOffset);
    }
    problem = problems.get(1);
    assertEquals(64, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(2804, problem.startOffset);
        assertEquals(2900, problem.endOffset);
    } else {
        assertEquals(2741, problem.startOffset);
        assertEquals(2836, problem.endOffset);
    }
    problem = problems.get(2);
    assertEquals(37, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1635, problem.startOffset);
        assertEquals(1701, problem.endOffset);
    } else {
        assertEquals(1599, problem.startOffset);
        assertEquals(1665, problem.endOffset);
    }
    problem = problems.get(3);
    assertEquals(68, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(2960, problem.startOffset);
        assertEquals(3183, problem.endOffset);
    } else {
        assertEquals(2893, problem.startOffset);
        assertEquals(3112, problem.endOffset);
    }
    problem = problems.get(4);
    assertEquals(38, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1711, problem.startOffset);
        assertEquals(1793, problem.endOffset);
    } else {
        assertEquals(1674, problem.startOffset);
        assertEquals(1756, problem.endOffset);
    }
    problem = problems.get(5);
    assertEquals(50, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(2248, problem.startOffset);
        assertEquals(2360, problem.endOffset);
    } else {
        assertEquals(2199, problem.startOffset);
        assertEquals(2310, problem.endOffset);
    }
    problem = problems.get(6);
    assertEquals(39, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1803, problem.startOffset);
        assertEquals(1880, problem.endOffset);
    } else {
        assertEquals(1765, problem.startOffset);
        assertEquals(1842, problem.endOffset);
    }
    problem = problems.get(7);
    assertEquals(57, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(2513, problem.startOffset);
        assertEquals(2756, problem.endOffset);
    } else {
        assertEquals(2457, problem.startOffset);
        assertEquals(2696, problem.endOffset);
    }
}
Also used : FileMigrator(com.liferay.blade.api.FileMigrator) Problem(com.liferay.blade.api.Problem) Test(org.junit.Test)

Example 32 with Problem

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

the class PortletConfigGetFormatMethodsTest method unicodeLanguageImplFile.

@Test
public void unicodeLanguageImplFile() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(unicodeLanguageImplFile);
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(23, problems.size());
}
Also used : FileMigrator(com.liferay.blade.api.FileMigrator) Problem(com.liferay.blade.api.Problem) Test(org.junit.Test)

Example 33 with Problem

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

the class PortletConfigGetFormatMethodsTest method languageUtilJspFile.

@Test
public void languageUtilJspFile() {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(languageUtilJspFile);
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(5, problems.size());
}
Also used : FileMigrator(com.liferay.blade.api.FileMigrator) Problem(com.liferay.blade.api.Problem) Test(org.junit.Test)

Example 34 with Problem

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

the class ShoppingCartLegacyAPITest method shoppingCartLegacyAPITest.

@Test
public void shoppingCartLegacyAPITest() 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(32, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1475, problem.startOffset);
        assertEquals(1540, problem.endOffset);
    } else {
        assertEquals(1444, problem.startOffset);
        assertEquals(1509, problem.endOffset);
    }
    problem = problems.get(1);
    assertEquals(143, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(4691, problem.startOffset);
        assertEquals(4858, problem.endOffset);
    } else {
        assertEquals(4549, problem.startOffset);
        assertEquals(4714, problem.endOffset);
    }
    problem = problems.get(2);
    assertEquals(33, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1550, problem.startOffset);
        assertEquals(1615, problem.endOffset);
    } else {
        assertEquals(1518, problem.startOffset);
        assertEquals(1583, problem.endOffset);
    }
    problem = problems.get(3);
    assertEquals(118, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(3987, problem.startOffset);
        assertEquals(4031, problem.endOffset);
    } else {
        assertEquals(3870, problem.startOffset);
        assertEquals(3914, problem.endOffset);
    }
}
Also used : FileMigrator(com.liferay.blade.api.FileMigrator) Problem(com.liferay.blade.api.Problem) Test(org.junit.Test)

Example 35 with Problem

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

the class SocialNetworkingLegacyAPITest method testFull.

@Test
public void testFull() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(getTestFile());
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(2, problems.size());
    Problem problem = problems.get(0);
    assertEquals(20, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(781, problem.startOffset);
        assertEquals(843, problem.endOffset);
    } else {
        assertEquals(762, problem.startOffset);
        assertEquals(824, problem.endOffset);
    }
    problem = problems.get(1);
    assertEquals(31, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1086, problem.startOffset);
        assertEquals(1149, problem.endOffset);
    } else {
        assertEquals(1056, problem.startOffset);
        assertEquals(1119, 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