use of com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp in project liferay-ide by liferay.
the class ImportWorkspaceProjectTests method testImportLiferayWorkspaceCustomBundleURL.
@Test
public void testImportLiferayWorkspaceCustomBundleURL() throws Exception {
IWorkspace ws = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = ws.getRoot();
File src = new File("projects/testWorkspaceCustomBundleUrl");
File dst = new File(root.getLocation().toFile(), src.getName());
TestUtil.copyDir(src, dst);
ImportLiferayWorkspaceOp op = ImportLiferayWorkspaceOp.TYPE.instantiate();
op.setWorkspaceLocation(dst.getAbsolutePath());
String bundleUrl = op.getBundleUrl().content(true);
assertEquals("https://api.liferay.com/downloads/portal/7.0.10.6/liferay-dxp-digital-enterprise-tomcat-7.0-sp6-20171010144253003.zip", bundleUrl);
}
use of com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp in project liferay-ide by liferay.
the class ImportWorkspaceProjectTests method testImportLiferayWorkspaceDontOverrideGradleProperties.
@Test
public void testImportLiferayWorkspaceDontOverrideGradleProperties() 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);
op.execute(ProgressMonitorBridge.create(new NullProgressMonitor()));
IProject eeProject = CoreUtil.getProject("testWorkspace");
assertNotNull(eeProject);
Util.waitForBuildAndValidation();
assertNotLiferayProject("testWorkspace");
assertLiferayProject("sample-portlet");
File originalProperities = new File("projects/testWorkspace/gradle.properties");
File importedProperties = eeProject.getFile("gradle.properties").getLocation().toFile();
String originalContent = CoreUtil.readStreamToString(Files.newInputStream(originalProperities.toPath()));
String importedContent = CoreUtil.readStreamToString(Files.newInputStream(importedProperties.toPath()));
originalContent = originalContent.replaceAll("\r", "");
importedContent = importedContent.replaceAll("\r", "");
assertEquals(importedContent, originalContent, importedContent);
}
use of com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp 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 com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp 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