Search in sources :

Example 6 with FileMigrator

use of com.liferay.blade.api.FileMigrator 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)

Example 7 with FileMigrator

use of com.liferay.blade.api.FileMigrator 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 8 with FileMigrator

use of com.liferay.blade.api.FileMigrator 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 9 with FileMigrator

use of com.liferay.blade.api.FileMigrator 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 10 with FileMigrator

use of com.liferay.blade.api.FileMigrator 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)

Aggregations

FileMigrator (com.liferay.blade.api.FileMigrator)32 Problem (com.liferay.blade.api.Problem)31 Test (org.junit.Test)30 File (java.io.File)7 ServiceReference (org.osgi.framework.ServiceReference)5 AutoMigrator (com.liferay.blade.api.AutoMigrator)4 ServiceTracker (org.osgi.util.tracker.ServiceTracker)2 Migration (com.liferay.blade.api.Migration)1 MigrationListener (com.liferay.blade.api.MigrationListener)1 ProgressMonitor (com.liferay.blade.api.ProgressMonitor)1 Reporter (com.liferay.blade.api.Reporter)1 ListUtil (com.liferay.ide.core.util.ListUtil)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 FileVisitResult (java.nio.file.FileVisitResult)1 FileVisitor (java.nio.file.FileVisitor)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 SimpleFileVisitor (java.nio.file.SimpleFileVisitor)1 BasicFileAttributes (java.nio.file.attribute.BasicFileAttributes)1