Search in sources :

Example 1 with FileMigrator

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

the class APITestBase method test.

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

Example 2 with FileMigrator

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

the class ActionCommandImportsTest method sayHelloActionCommandFile2.

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

Example 3 with FileMigrator

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

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

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

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