Search in sources :

Example 6 with NewLiferayWorkspaceOp

use of com.liferay.ide.project.core.workspace.NewLiferayWorkspaceOp in project liferay-ide by liferay.

the class NewMavenLiferayWorkspaceOpTests method testNewMavenLiferayWorkspaceSetUrl.

@Test
public void testNewMavenLiferayWorkspaceSetUrl() throws Exception {
    NewLiferayWorkspaceOp op = NewLiferayWorkspaceOp.TYPE.instantiate();
    String projectName = "test-liferay-workspace-url";
    String bundleUrl = "https://cdn.lfrs.sl/releases.liferay.com/portal/7.0.4-ga5/liferay-ce-portal-tomcat-7.0-ga5-20171018150113838.zip";
    IPath workspaceLocation = CoreUtil.getWorkspaceRoot().getLocation();
    op.setWorkspaceName(projectName);
    op.setUseDefaultLocation(false);
    op.setLocation(workspaceLocation.toPortableString());
    op.setProjectProvider("maven-liferay-workspace");
    op.setProvisionLiferayBundle(true);
    op.setBundleUrl(bundleUrl);
    op.execute(new ProgressMonitor());
    String projectLocation = workspaceLocation.append(projectName).toPortableString();
    File pomFile = new File(projectLocation, "pom.xml");
    assertTrue(pomFile.exists());
    File bundleDir = new File(projectLocation, "bundles");
    assertTrue(bundleDir.exists());
    String content = FileUtil.readContents(pomFile);
    assertEquals(content.contains(bundleUrl), true);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ProgressMonitor(org.eclipse.sapphire.modeling.ProgressMonitor) NewLiferayWorkspaceOp(com.liferay.ide.project.core.workspace.NewLiferayWorkspaceOp) IPath(org.eclipse.core.runtime.IPath) File(java.io.File) Test(org.junit.Test)

Aggregations

NewLiferayWorkspaceOp (com.liferay.ide.project.core.workspace.NewLiferayWorkspaceOp)6 File (java.io.File)5 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 ProgressMonitor (org.eclipse.sapphire.modeling.ProgressMonitor)5 Test (org.junit.Test)5 IPath (org.eclipse.core.runtime.IPath)4 Properties (java.util.Properties)2 IProject (org.eclipse.core.resources.IProject)2 ILiferayProjectImporter (com.liferay.ide.core.ILiferayProjectImporter)1 NewLiferayModuleProjectOp (com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp)1 URL (java.net.URL)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1