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"));
}
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"));
}
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);
}
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());
}
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());
}
Aggregations