Search in sources :

Example 6 with ProgressMonitor

use of org.eclipse.sapphire.modeling.ProgressMonitor in project liferay-ide by liferay.

the class NewMavenLiferayWorkspaceOpTests method testNewMavenLiferayWorkspaceInitBundle.

@Test
public void testNewMavenLiferayWorkspaceInitBundle() throws Exception {
    NewLiferayWorkspaceOp op = NewLiferayWorkspaceOp.TYPE.instantiate();
    String projectName = "test-liferay-workspace";
    IPath workspaceLocation = CoreUtil.getWorkspaceRoot().getLocation();
    op.setWorkspaceName(projectName);
    op.setUseDefaultLocation(false);
    op.setLocation(workspaceLocation.toPortableString());
    op.setProjectProvider("maven-liferay-workspace");
    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);
    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);
    assertTrue(content.contains("com.liferay.portal.tools.bundle.support"));
}
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)

Example 7 with ProgressMonitor

use of org.eclipse.sapphire.modeling.ProgressMonitor in project liferay-ide by liferay.

the class NewMavenLiferayWorkspaceOpTests method testNewMavenLiferayWorkspaceOp.

@Test
public void testNewMavenLiferayWorkspaceOp() throws Exception {
    NewLiferayWorkspaceOp op = NewLiferayWorkspaceOp.TYPE.instantiate();
    String projectName = "test-liferay-workspace";
    IPath workspaceLocation = CoreUtil.getWorkspaceRoot().getLocation();
    op.setWorkspaceName(projectName);
    op.setUseDefaultLocation(false);
    op.setLocation(workspaceLocation.toPortableString());
    op.setProjectProvider("maven-liferay-workspace");
    op.execute(new ProgressMonitor());
    String projectLocation = workspaceLocation.append(projectName).toPortableString();
    File pomFile = new File(projectLocation, "pom.xml");
    assertTrue(pomFile.exists());
    String content = FileUtil.readContents(pomFile);
    assertTrue(content.contains("com.liferay.portal.tools.bundle.support"));
}
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)

Example 8 with ProgressMonitor

use of org.eclipse.sapphire.modeling.ProgressMonitor 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)

Example 9 with ProgressMonitor

use of org.eclipse.sapphire.modeling.ProgressMonitor in project liferay-ide by liferay.

the class ImportMavenLiferayWorkspaceOpTests method testImportMavenLiferayWorkspaceInitBundle.

@Test
public void testImportMavenLiferayWorkspaceInitBundle() throws Exception {
    ImportLiferayWorkspaceOp op = ImportLiferayWorkspaceOp.TYPE.instantiate();
    final URL wsZipUrl = Platform.getBundle("com.liferay.ide.maven.core.tests").getEntry("projects/maven-liferay-workspace.zip");
    final File wsZipFile = new File(FileLocator.toFileURL(wsZipUrl).getFile());
    File eclipseWorkspaceLocation = CoreUtil.getWorkspaceRoot().getLocation().toFile();
    ZipUtil.unzip(wsZipFile, eclipseWorkspaceLocation);
    File wsFolder = new File(eclipseWorkspaceLocation, "maven-liferay-workspace");
    op.setWorkspaceLocation(wsFolder.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);
    op.setServerName("test-bundle");
    Status validationStatus = op.validation();
    assertTrue(validationStatus.ok());
    op.execute(new ProgressMonitor());
    File bundleDir = new File(wsFolder, "bundles");
    assertTrue(bundleDir.exists());
    IServer server = ServerUtil.getServer(op.getServerName().content());
    assertTrue(ServerUtil.isLiferayRuntime(server));
    IProject project = CoreUtil.getProject("maven-liferay-workspace");
    assertTrue(project.exists());
    op = ImportLiferayWorkspaceOp.TYPE.instantiate();
    assertEquals(LiferayWorkspaceUtil.hasLiferayWorkspaceMsg, op.validation().message());
    project = CoreUtil.getProject("maven-liferay-workspace");
    project.delete(true, true, new NullProgressMonitor());
}
Also used : ImportLiferayWorkspaceOp(com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp) Status(org.eclipse.sapphire.modeling.Status) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ProgressMonitor(org.eclipse.sapphire.modeling.ProgressMonitor) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServer(org.eclipse.wst.server.core.IServer) File(java.io.File) URL(java.net.URL) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 10 with ProgressMonitor

use of org.eclipse.sapphire.modeling.ProgressMonitor in project liferay-ide by liferay.

the class ImportMavenLiferayWorkspaceOpTests method testImportMavenLiferayWorkspaceOp.

@Test
public void testImportMavenLiferayWorkspaceOp() throws Exception {
    ImportLiferayWorkspaceOp op = ImportLiferayWorkspaceOp.TYPE.instantiate();
    final URL wsZipUrl = Platform.getBundle("com.liferay.ide.maven.core.tests").getEntry("projects/maven-liferay-workspace.zip");
    final File wsZipFile = new File(FileLocator.toFileURL(wsZipUrl).getFile());
    File eclipseWorkspaceLocation = CoreUtil.getWorkspaceRoot().getLocation().toFile();
    ZipUtil.unzip(wsZipFile, eclipseWorkspaceLocation);
    File wsFolder = new File(eclipseWorkspaceLocation, "maven-liferay-workspace");
    op.setWorkspaceLocation(wsFolder.getAbsolutePath());
    Status validationStatus = op.validation();
    assertTrue(validationStatus.ok());
    op.execute(new ProgressMonitor());
    IProject project = CoreUtil.getProject("maven-liferay-workspace");
    assertTrue(project.exists());
    project = CoreUtil.getProject("maven-liferay-workspace-modules");
    assertTrue(project.exists());
    project = CoreUtil.getProject("maven-liferay-workspace-themes");
    assertTrue(project.exists());
    project = CoreUtil.getProject("maven-liferay-workspace-wars");
    assertTrue(project.exists());
    op = ImportLiferayWorkspaceOp.TYPE.instantiate();
    assertEquals(LiferayWorkspaceUtil.hasLiferayWorkspaceMsg, op.validation().message());
    project = CoreUtil.getProject("maven-liferay-workspace");
    project.delete(true, true, new NullProgressMonitor());
}
Also used : ImportLiferayWorkspaceOp(com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp) Status(org.eclipse.sapphire.modeling.Status) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ProgressMonitor(org.eclipse.sapphire.modeling.ProgressMonitor) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) File(java.io.File) URL(java.net.URL) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Aggregations

ProgressMonitor (org.eclipse.sapphire.modeling.ProgressMonitor)10 Test (org.junit.Test)10 File (java.io.File)8 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)8 IPath (org.eclipse.core.runtime.IPath)7 NewLiferayWorkspaceOp (com.liferay.ide.project.core.workspace.NewLiferayWorkspaceOp)5 IProject (org.eclipse.core.resources.IProject)5 URL (java.net.URL)4 ImportLiferayWorkspaceOp (com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp)3 Status (org.eclipse.sapphire.modeling.Status)3 NewLiferayPluginProjectOp (com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)2 SDK (com.liferay.ide.sdk.core.SDK)2 Properties (java.util.Properties)2 ILiferayProjectImporter (com.liferay.ide.core.ILiferayProjectImporter)1 NewLiferayModuleProjectOp (com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 IServer (org.eclipse.wst.server.core.IServer)1