Search in sources :

Example 76 with Problem

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

the class LockLegacyAPITest method lockLegacyAPITest.

@Test
public void lockLegacyAPITest() 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(893, problem.startOffset);
        assertEquals(940, problem.endOffset);
    } else {
        assertEquals(872, problem.startOffset);
        assertEquals(919, problem.endOffset);
    }
    problem = problems.get(1);
    assertEquals(46, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1420, problem.startOffset);
        assertEquals(1484, problem.endOffset);
    } else {
        assertEquals(1375, problem.startOffset);
        assertEquals(1438, problem.endOffset);
    }
    problem = problems.get(2);
    assertEquals(62, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1747, problem.startOffset);
        assertEquals(1806, problem.endOffset);
    } else {
        assertEquals(1686, problem.startOffset);
        assertEquals(1745, problem.endOffset);
    }
    problem = problems.get(3);
    assertEquals(73, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(1971, problem.startOffset);
        assertEquals(2044, problem.endOffset);
    } else {
        assertEquals(1899, problem.startOffset);
        assertEquals(1971, problem.endOffset);
    }
}
Also used : FileMigrator(com.liferay.blade.api.FileMigrator) Problem(com.liferay.blade.api.Problem) Test(org.junit.Test)

Example 77 with Problem

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

the class MVCPortletClassInPortletXMLTest method testPortletXmlFileLineNumbers.

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

Example 78 with Problem

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

the class ConfigurationActionRenderMethodTest method editConfigurationActionFile.

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

Example 79 with Problem

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

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

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