Search in sources :

Example 21 with FileMigrator

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

the class BackgroundTaskLegacyAPITest method testFull.

@Test
public void testFull() throws Exception {
    FileMigrator fmigrator = context.getService(fileMigrators[0]);
    List<Problem> problems = fmigrator.analyze(getTestFile());
    context.ungetService(fileMigrators[0]);
    assertNotNull(problems);
    assertEquals(2, problems.size());
    Problem problem = problems.get(0);
    assertEquals(18, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(688, problem.startOffset);
        assertEquals(736, problem.endOffset);
    } else {
        assertEquals(671, problem.startOffset);
        assertEquals(719, problem.endOffset);
    }
    problem = problems.get(1);
    assertEquals(19, problem.lineNumber);
    if (Util.isWindows()) {
        assertEquals(746, problem.startOffset);
        assertEquals(801, problem.endOffset);
    } else {
        assertEquals(728, problem.startOffset);
        assertEquals(783, problem.endOffset);
    }
}
Also used : FileMigrator(com.liferay.blade.api.FileMigrator) Problem(com.liferay.blade.api.Problem) Test(org.junit.Test)

Example 22 with FileMigrator

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

the class IndexerGetFacetQueryTest method indexerWrapperFile.

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

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

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

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

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