use of com.liferay.ide.project.core.modules.ImportLiferayModuleProjectOp in project liferay-ide by liferay.
the class ImportLiferayModuleProjectOpTest method testImportGradleModuleProject.
@Test
public void testImportGradleModuleProject() throws Exception {
String projectName = "testGradleProject";
String projectLocation = unzipFile(projectName);
ImportLiferayModuleProjectOp importOp = ImportLiferayModuleProjectOp.TYPE.instantiate();
importOp.setLocation(projectLocation);
assertEquals("gradle", importOp.getBuildType().text(false));
assertTrue(importOp.validation().ok());
assertTrue(importOp.execute(ProgressMonitorBridge.create(new NullProgressMonitor())).ok());
IProject project = ProjectUtil.getProject(projectName);
assertTrue(project.exists());
importOp = ImportLiferayModuleProjectOp.TYPE.instantiate();
importOp.setLocation(projectLocation);
assertEquals("A project with that name already exists.", importOp.validation().message());
projectLocation = unzipFile("gradle-liferay-workspace");
importOp.setLocation(projectLocation);
assertEquals("Can't import Liferay Workspace, please use Import Liferay Workspace Project wizard.", importOp.validation().message());
}
use of com.liferay.ide.project.core.modules.ImportLiferayModuleProjectOp in project liferay-ide by liferay.
the class PortalSourceLookupTests method setUpTest.
@Before
public void setUpTest() throws Exception {
Stream.of(CoreUtil.getAllProjects()).forEach(this::deleteProject);
Assert.assertEquals(0, CoreUtil.getAllProjects().length);
Stream.of(ServerCore.getServers()).forEach(this::deleteServer);
Assert.assertEquals(0, ServerCore.getServers().length);
Stream.of(getPortalServerLaunchConfigurations()).forEach(this::deleteLaunchConfig);
Assert.assertEquals(0, getPortalServerLaunchConfigurations().length);
File tempDir = tempFolder.getRoot();
TestUtil.copyDir(new File("test-projects/debug-parent"), tempDir);
ImportLiferayModuleProjectOp op = ImportLiferayModuleProjectOp.TYPE.instantiate();
op.setLocation(tempDir.getAbsolutePath());
op.execute(ProgressMonitorBridge.create(new NullProgressMonitor()));
TestUtil.waitForBuildAndValidation();
Assert.assertTrue(CoreUtil.getProject("debug-lib").exists());
Assert.assertTrue(CoreUtil.getProject("debug-test").exists());
}
use of com.liferay.ide.project.core.modules.ImportLiferayModuleProjectOp in project liferay-ide by liferay.
the class CustomJspConverter method doExecute.
public void doExecute(String[] projectPaths, String[] projectNames, String targetPath, boolean liferayWorkspace) {
Job job = new WorkspaceJob("Converting Jsp hook to fragments...") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
IStatus retval = Status.OK_STATUS;
try {
convertJspHookProject(projectPaths, projectNames, targetPath, monitor, liferayWorkspace);
String[] projectPaths = getConvertResult(resultPrefix);
if (ListUtil.isNotEmpty(projectPaths)) {
for (String path : projectPaths) {
ImportLiferayModuleProjectOp importOp = ImportLiferayModuleProjectOp.TYPE.instantiate();
importOp.setLocation(path);
if (importOp.validation().severity() != org.eclipse.sapphire.modeling.Status.Severity.ERROR) {
ImportLiferayModuleProjectOpMethods.execute(importOp, ProgressMonitorBridge.create(monitor));
}
}
refreshUI();
}
} catch (Exception e) {
retval = ProjectUI.createErrorStatus("Error in convert jsp", e);
}
return retval;
}
};
try {
IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
progressService.showInDialog(Display.getDefault().getActiveShell(), job);
job.schedule();
} catch (Exception e) {
}
}
use of com.liferay.ide.project.core.modules.ImportLiferayModuleProjectOp in project liferay-ide by liferay.
the class ImportLiferayModuleProjectOpTest method testImportMavenModuleProject.
@Test
public void testImportMavenModuleProject() throws Exception {
String projectName = "testMavenProjects";
String projectLocation = unzipFile(projectName);
ImportLiferayModuleProjectOp importOp = ImportLiferayModuleProjectOp.TYPE.instantiate();
importOp.setLocation(projectLocation);
assertEquals("maven", importOp.getBuildType().text(false));
assertTrue(importOp.validation().ok());
assertTrue(importOp.execute(ProgressMonitorBridge.create(new NullProgressMonitor())).ok());
IProject project = ProjectUtil.getProject(projectName);
assertTrue(project.exists());
importOp = ImportLiferayModuleProjectOp.TYPE.instantiate();
importOp.setLocation(projectLocation);
assertEquals("A project with that name already exists.", importOp.validation().message());
projectLocation = unzipFile("maven-liferay-workspace");
importOp.setLocation(projectLocation);
assertEquals("Can't import Liferay Workspace, please use Import Liferay Workspace Project wizard.", importOp.validation().message());
}
Aggregations