Search in sources :

Example 71 with Problem

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

the class AUIColumnTagsTest method findProblems.

@Test
public void findProblems() throws Exception {
    ServiceReference<Migration> sr = context.getServiceReference(Migration.class);
    Migration m = context.getService(sr);
    List<Problem> problems = m.findProblems(new File("jsptests/aui-column/"), new NullProgressMonitor());
    assertEquals(2, problems.size());
    boolean found = false;
    for (Problem problem : problems) {
        if (problem.file.getName().endsWith("AUIColumnTagTest.jsp")) {
            if (problem.lineNumber == 2 && problem.startOffset >= 58 && problem.endOffset >= 461) {
                found = true;
            }
        }
    }
    if (!found) {
        fail();
    }
}
Also used : NullProgressMonitor(com.liferay.blade.util.NullProgressMonitor) Migration(com.liferay.blade.api.Migration) Problem(com.liferay.blade.api.Problem) File(java.io.File) Test(org.junit.Test)

Example 72 with Problem

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

the class AUILayoutTagsTest method findProblems.

@Test
public void findProblems() throws Exception {
    ServiceReference<Migration> sr = context.getServiceReference(Migration.class);
    Migration m = context.getService(sr);
    List<Problem> problems = m.findProblems(new File("jsptests/aui-layout/"), new NullProgressMonitor());
    assertEquals(1, problems.size());
    boolean found = false;
    for (Problem problem : problems) {
        if (problem.file.getName().endsWith("AUILayoutTagTest.jsp")) {
            if (problem.lineNumber == 1) {
                found = true;
            }
        }
    }
    if (!found) {
        fail();
    }
}
Also used : NullProgressMonitor(com.liferay.blade.util.NullProgressMonitor) Migration(com.liferay.blade.api.Migration) Problem(com.liferay.blade.api.Problem) File(java.io.File) Test(org.junit.Test)

Example 73 with Problem

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

the class AUILiferayTagsTest method findProblems.

@Test
public void findProblems() throws Exception {
    ServiceReference<Migration> sr = context.getServiceReference(Migration.class);
    Migration m = context.getService(sr);
    List<Problem> problems = m.findProblems(new File("jsptests/aui-liferay/"), new NullProgressMonitor());
    assertEquals(1, problems.size());
    boolean found = false;
    for (Problem problem : problems) {
        if (problem.file.getName().endsWith("AUILiferayTagTest.jsp")) {
            if (problem.lineNumber == 1 && problem.startOffset == 16 && problem.endOffset == 48) {
                found = true;
            }
        }
    }
    if (!found) {
        fail();
    }
}
Also used : NullProgressMonitor(com.liferay.blade.util.NullProgressMonitor) Migration(com.liferay.blade.api.Migration) Problem(com.liferay.blade.api.Problem) File(java.io.File) Test(org.junit.Test)

Example 74 with Problem

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

the class AllProblemsTest method allProblems.

@Test
@Ignore
public void allProblems() throws Exception {
    ServiceReference<Migration> sr = context.getServiceReference(Migration.class);
    Migration m = context.getService(sr);
    List<Problem> problems = m.findProblems(new File("../com.liferay.blade.upgrade.liferay70/projects/"), new NullProgressMonitor());
    final int expectedSize = 304;
    final int size = problems.size();
    if (size != expectedSize) {
        System.err.println("All problems size is " + size + ", expected size is " + expectedSize);
    }
    assertEquals(expectedSize, size);
    for (Problem problem : problems) {
        if (problem.html != null && problem.html.equals("#legacy"))
            continue;
        // if (problem.html == null || problem.html.equals("")) {
        // for (ServiceReference<FileMigrator> ref : refs) {
        // String section = (String) ref.getProperty("problem.section");
        // String title = (String) ref.getProperty("problem.title");
        // if (title.equals(problem.title)) {
        // for (String line : lines) {
        // if (section.startsWith(line)) {
        // fail("line=" + line + ", section=" + section);
        // }
        // }
        // }
        // }
        // }
        assertNotNull("problem.title=" + problem.title + ", problem.file=" + problem.file, problem.html);
        assertTrue("problem.title=" + problem.title + ", problem.file=" + problem.file, problem.html.length() > 0);
    }
}
Also used : NullProgressMonitor(com.liferay.blade.util.NullProgressMonitor) Migration(com.liferay.blade.api.Migration) Problem(com.liferay.blade.api.Problem) File(java.io.File) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 75 with Problem

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

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