use of com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp in project liferay-ide by liferay.
the class ImportWorkspaceProjectTests method testImportLiferayWorkspaceInitBundle.
@Test
public void testImportLiferayWorkspaceInitBundle() throws Exception {
IWorkspace ws = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = ws.getRoot();
File src = new File("projects/testWorkspace");
File dst = new File(root.getLocation().toFile(), src.getName());
TestUtil.copyDir(src, dst);
ImportLiferayWorkspaceOp op = ImportLiferayWorkspaceOp.TYPE.instantiate();
op.setWorkspaceLocation(dst.getAbsolutePath());
op.setProvisionLiferayBundle(true);
String bundleUrl = op.getBundleUrl().content(true);
assertEquals("https://cdn.lfrs.sl/releases.liferay.com/portal/7.0.4-ga5/liferay-ce-portal-tomcat-7.0-ga5-20171018150113838.zip", bundleUrl);
final NullProgressMonitor monitor = new NullProgressMonitor();
op.execute(ProgressMonitorBridge.create(monitor));
IProject eeProject = CoreUtil.getProject("testWorkspace");
assertNotNull(eeProject);
Util.waitForBuildAndValidation();
eeProject.refreshLocal(IResource.DEPTH_INFINITE, monitor);
final IFolder bundlesFolder = eeProject.getFolder("bundles");
assertTrue(bundlesFolder.exists());
}
use of com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp in project liferay-ide by liferay.
the class AllBladeSamplesPublishTest method importAllBladeSamples.
@BeforeClass
public static void importAllBladeSamples() throws Exception {
Util.deleteAllWorkspaceProjects();
ImportLiferayWorkspaceOp op = ImportLiferayWorkspaceOp.TYPE.instantiate();
File projectDir = copyTestProjectToWorkspace("projects/all-blade-samples");
op.setWorkspaceLocation(projectDir.getCanonicalPath());
op.setProvisionLiferayBundle(true);
op.setServerName(WORKSPACE_SERVER_NAME);
final NullProgressMonitor monitor = new NullProgressMonitor();
op.execute(ProgressMonitorBridge.create(monitor));
Util.waitForBuildAndValidation();
IProject rootProject = CoreUtil.getWorkspaceRoot().getProject("all-blade-samples");
assertNotNull(rootProject);
assertTrue(rootProject.exists());
assertLiferayProject("blade.portlet.jsp");
assertLiferayProject("blade.gogo");
IServer wsServer = ServerUtil.getServer(WORKSPACE_SERVER_NAME);
assertNotNull(wsServer);
long timeoutExpiredMs = System.currentTimeMillis() + 300000;
wsServer.start("run", monitor);
while (true) {
assertEquals(wsServer.getServerState(), IServer.STATE_STARTING, wsServer.getServerState());
Thread.sleep(500);
if (wsServer.getServerState() == IServer.STATE_STARTED || System.currentTimeMillis() >= timeoutExpiredMs) {
break;
}
}
assertEquals(wsServer.getServerState(), IServer.STATE_STARTED, wsServer.getServerState());
}
use of com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp in project liferay-ide by liferay.
the class ImportMavenLiferayWorkspaceOpTests method testImportMavenLiferayWorkspaceInitBundleSetUrl.
@Test
public void testImportMavenLiferayWorkspaceInitBundleSetUrl() throws Exception {
ImportLiferayWorkspaceOp op = ImportLiferayWorkspaceOp.TYPE.instantiate();
URL wsZipUrl = Platform.getBundle("com.liferay.ide.maven.core.tests").getEntry("projects/maven-liferay-workspace-bundleUrl.zip");
String bundleUrl = "https://cdn.lfrs.sl/releases.liferay.com/portal/7.0.4-ga5/liferay-ce-portal-tomcat-7.0-ga5-20171018150113838.zip";
String existUrl = "http://www.example.com/";
String emailConfig = "<emailAddress>example@liferay.com</emailAddress>";
String projectName = "maven-liferay-workspace";
File wsZipFile = new File(FileLocator.toFileURL(wsZipUrl).getFile());
IPath workspaceLocation = CoreUtil.getWorkspaceRoot().getLocation();
String projectLocation = workspaceLocation.append(projectName).toPortableString();
ZipUtil.unzip(wsZipFile, workspaceLocation.toFile());
File wsFolder = new File(workspaceLocation.toFile(), projectName);
File pomFile = new File(projectLocation, "pom.xml");
assertTrue(pomFile.exists());
String content = FileUtil.readContents(pomFile);
assertTrue(content.contains(existUrl));
assertTrue(content.contains(emailConfig));
op.setWorkspaceLocation(wsFolder.getAbsolutePath());
op.setProvisionLiferayBundle(true);
op.setBundleUrl(bundleUrl);
op.execute(new ProgressMonitor());
content = FileUtil.readContents(pomFile);
File bundleDir = new File(projectLocation, "bundles");
assertTrue(bundleDir.exists());
assertFalse(content.contains(existUrl));
assertTrue(content.contains(bundleUrl));
assertTrue(content.contains(emailConfig));
IProject project = CoreUtil.getProject("maven-liferay-workspace");
project.delete(true, true, new NullProgressMonitor());
}
use of com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp in project liferay-ide by liferay.
the class ImportLiferayWorkspaceWizard method performPostFinish.
@Override
protected void performPostFinish() {
super.performPostFinish();
final ImportLiferayWorkspaceOp op = element().nearest(ImportLiferayWorkspaceOp.class);
Path projectPath = op.getWorkspaceLocation().content();
final IProject newProject = CoreUtil.getProject(projectPath.lastSegment());
try {
addToWorkingSets(newProject);
} catch (Exception ex) {
ProjectUI.logError("Unable to add project to working set", ex);
}
openLiferayPerspective(newProject);
ProjectExplorerLayoutUtil.setNested(true);
}
use of com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp in project liferay-ide by liferay.
the class ImportLiferayWorkspaceFromInstallerAction method run.
@Override
public void run(IIntroSite site, Properties params) {
Location platformLocation = Platform.getInstallLocation();
File location = new File(platformLocation.getURL().getFile());
if (Platform.getOS().equals(Platform.OS_MACOSX)) {
location = location.getParentFile().getParentFile();
}
IPath path = new Path(location.getAbsolutePath());
File workspaceDir = path.append("../liferay-workspace").toFile();
if (!workspaceDir.exists()) {
MessageDialog.openInformation(site.getShell(), "Liferay", "Can't import liferay workspace.\nDirectory \"" + workspaceDir.getAbsolutePath() + "\" doesn't exist.");
return;
}
Job job = new WorkspaceJob("Importing Liferay Workspace...") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
ImportLiferayWorkspaceWizard wizard = new ImportLiferayWorkspaceWizard();
ImportLiferayWorkspaceOp op = wizard.element().nearest(ImportLiferayWorkspaceOp.class);
op.setWorkspaceLocation(workspaceDir.getAbsolutePath());
op.setProvisionLiferayBundle(true);
if (op.validation().ok()) {
op.execute(ProgressMonitorBridge.create(monitor));
return Status.OK_STATUS;
} else {
return StatusBridge.create(op.validation());
}
}
};
job.schedule();
_openLiferayPerspective();
ProjectExplorerLayoutUtil.setNested(true);
IntroPlugin.closeIntro();
}
Aggregations