Search in sources :

Example 81 with Problem

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

the class UpgradeAssistantSettingsUtilTests method readExistingMigrationProblemsContainer.

@Test
public void readExistingMigrationProblemsContainer() throws Exception {
    MigrationProblemsContainer migrationProblemsContainer = UpgradeAssistantSettingsUtil.getObjectFromStore(MigrationProblemsContainer.class);
    assertNotNull(migrationProblemsContainer);
    MigrationProblems[] migrationProblems = migrationProblemsContainer.getProblemsArray();
    assertEquals(2, migrationProblems.length);
    FileProblems[] fileProblems = migrationProblems[0].getProblems();
    assertNotNull(fileProblems);
    assertEquals(18, fileProblems.length);
    List<Problem> problems = fileProblems[0].getProblems();
    assertNotNull(problems);
    assertEquals(9, problems.size());
}
Also used : FileProblems(com.liferay.ide.project.core.upgrade.FileProblems) Problem(com.liferay.blade.api.Problem) MigrationProblems(com.liferay.ide.project.core.upgrade.MigrationProblems) MigrationProblemsContainer(com.liferay.ide.project.core.upgrade.MigrationProblemsContainer) Test(org.junit.Test)

Example 82 with Problem

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

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

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

Example 85 with Problem

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

the class SocialNetworkingLegacyAPITest method testFull2.

@Test
public void testFull2() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(testFile2);
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(6, problems.size());
    Problem problem = problems.get(0);
    assertEquals(24, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1005, problem.startOffset);
        assertEquals(1070, problem.endOffset);
    } else {
        assertEquals(982, problem.startOffset);
        assertEquals(1047, problem.endOffset);
    }
    problem = problems.get(1);
    assertEquals(57, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1892, problem.startOffset);
        assertEquals(1955, problem.endOffset);
    } else {
        assertEquals(1836, problem.startOffset);
        assertEquals(1899, problem.endOffset);
    }
    problem = problems.get(2);
    assertEquals(128, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(4271, problem.startOffset);
        assertEquals(4570, problem.endOffset);
    } else {
        assertEquals(4144, problem.startOffset);
        assertEquals(4439, problem.endOffset);
    }
    problem = problems.get(3);
    assertEquals(135, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(4591, problem.startOffset);
        assertEquals(4914, problem.endOffset);
    } else {
        assertEquals(4457, problem.startOffset);
        assertEquals(4775, problem.endOffset);
    }
    problem = problems.get(4);
    assertEquals(25, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1080, problem.startOffset);
        assertEquals(1152, problem.endOffset);
    } else {
        assertEquals(1056, problem.startOffset);
        assertEquals(1128, problem.endOffset);
    }
    problem = problems.get(5);
    assertEquals(156, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(5378, problem.startOffset);
        assertEquals(5504, problem.endOffset);
    } else {
        assertEquals(5223, problem.startOffset);
        assertEquals(5348, 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