Search in sources :

Example 26 with FileMigrator

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

the class DDMLegacyAPITest method dDMLegacyAPITest.

@Test
public void dDMLegacyAPITest() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(getTestFile());
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(5, problems.size());
    Problem problem = problems.get(0);
    assertEquals(36, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1704, problem.startOffset);
        assertEquals(1779, problem.endOffset);
    } else {
        assertEquals(1669, problem.startOffset);
        assertEquals(1744, problem.endOffset);
    }
    problem = problems.get(1);
    assertEquals(134, problem.lineNumber);
    if (Util.isWindows()) {
        assertTrue(problem.startOffset >= 4829 && problem.startOffset <= 4832);
        assertTrue(problem.endOffset >= 4886 && problem.endOffset <= 4889);
    } else {
        assertTrue(problem.startOffset >= 4696 && problem.startOffset <= 4699);
        assertTrue(problem.endOffset >= 4753 && problem.endOffset <= 4756);
    }
    problem = problems.get(2);
    assertEquals(147, problem.lineNumber);
    if (Util.isWindows()) {
        assertTrue(problem.startOffset >= 5177 && problem.startOffset <= 5180);
        assertTrue(problem.endOffset >= 5234 && problem.endOffset <= 5237);
    } else {
        assertTrue(problem.startOffset >= 5031 && problem.startOffset <= 5034);
        assertTrue(problem.endOffset >= 5088 && problem.endOffset <= 5091);
    }
    problem = problems.get(3);
    assertEquals(37, problem.lineNumber);
    if (Util.isWindows()) {
        assertTrue(problem.startOffset >= 1789 && problem.startOffset <= 1792);
        assertTrue(problem.endOffset >= 1859 && problem.endOffset <= 1862);
    } else {
        assertEquals(1753, problem.startOffset);
        assertEquals(1823, problem.endOffset);
    }
    problem = problems.get(4);
    assertEquals(162, problem.lineNumber);
    if (Util.isWindows()) {
        assertTrue(problem.startOffset >= 5573 && problem.startOffset <= 5576);
        assertTrue(problem.endOffset >= 5690 && problem.endOffset <= 5693);
    } else {
        assertTrue(String.valueOf(problem.startOffset), problem.startOffset >= 5412 && problem.startOffset <= 5415);
        assertTrue(String.valueOf(problem.endOffset), problem.endOffset >= 5527 && problem.endOffset <= 5530);
    }
}
Also used : FileMigrator(com.liferay.blade.api.FileMigrator) Problem(com.liferay.blade.api.Problem) Test(org.junit.Test)

Example 27 with FileMigrator

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

the class DDMStructureLocalServiceInvocationTest method ddmTemplateAnalyzeTest.

@Test
public void ddmTemplateAnalyzeTest() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(getTestFile());
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(1, problems.size());
    Problem problem = problems.get(0);
    assertEquals(7, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(144, problem.startOffset);
        assertEquals(270, problem.endOffset);
    } else {
        assertEquals(138, problem.startOffset);
        assertEquals(264, problem.endOffset);
    }
}
Also used : FileMigrator(com.liferay.blade.api.FileMigrator) Problem(com.liferay.blade.api.Problem) Test(org.junit.Test)

Example 28 with FileMigrator

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

the class WebContentLegacyAPITest method webContentLegacyAPITest.

@Test
public void webContentLegacyAPITest() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(getTestFile());
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(5, problems.size());
    Problem problem = problems.get(0);
    assertEquals(20, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(961, problem.startOffset);
        assertEquals(1023, problem.endOffset);
    } else {
        assertEquals(942, problem.startOffset);
        assertEquals(1004, problem.endOffset);
    }
    problem = problems.get(1);
    assertEquals(47, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1917, problem.startOffset);
        assertEquals(1950, problem.endOffset);
    } else {
        assertEquals(1871, problem.startOffset);
        assertEquals(1904, problem.endOffset);
    }
    problem = problems.get(2);
    assertEquals(21, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1033, problem.startOffset);
        assertEquals(1099, problem.endOffset);
    } else {
        assertEquals(1013, problem.startOffset);
        assertEquals(1079, problem.endOffset);
    }
    problem = problems.get(3);
    assertEquals(41, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1637, problem.startOffset);
        assertEquals(1695, problem.endOffset);
    } else {
        assertEquals(1597, problem.startOffset);
        assertEquals(1655, problem.endOffset);
    }
    problem = problems.get(4);
    assertEquals(45, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1830, problem.startOffset);
        assertEquals(1873, problem.endOffset);
    } else {
        assertEquals(1786, problem.startOffset);
        assertEquals(1829, problem.endOffset);
    }
}
Also used : FileMigrator(com.liferay.blade.api.FileMigrator) Problem(com.liferay.blade.api.Problem) Test(org.junit.Test)

Example 29 with FileMigrator

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

the class DeprecatedMethodsTest method deprecatedMethodsNoneVersionTestFile.

@Test
public void deprecatedMethodsNoneVersionTestFile() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(deprecatedMethodsNoneVersionTestFile);
    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 30 with FileMigrator

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

the class DeprecatedMethodsTest method deprecatedMethods61TestFile.

@Test
public void deprecatedMethods61TestFile() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(deprecatedMethods61TestFile);
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(4, problems.size());
}
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