Search in sources :

Example 36 with NewLiferayModuleProjectOp

use of com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp in project liferay-ide by liferay.

the class MavenModuleProjectTests method testThemeProjectPluginDetection.

@Test
public void testThemeProjectPluginDetection() throws Exception {
    NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();
    op.setProjectName("maven-theme-test");
    op.setProjectProvider("maven-module");
    op.setProjectTemplateName("theme");
    op.execute(ProgressMonitorBridge.create(new NullProgressMonitor()));
    IProject project = CoreUtil.getProject("maven-theme-test");
    assertNotNull(project);
    IBundleProject bundleProject = LiferayCore.create(IBundleProject.class, project);
    assertNotNull(bundleProject);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IBundleProject(com.liferay.ide.core.IBundleProject) NewLiferayModuleProjectOp(com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 37 with NewLiferayModuleProjectOp

use of com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp in project liferay-ide by liferay.

the class MavenModuleProjectTests method testProjectTemplateFormField.

@Test
public void testProjectTemplateFormField() throws Exception {
    NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();
    op.setProjectName("form-field-test");
    op.setProjectProvider("maven-module");
    op.setProjectTemplateName("form-field");
    createAndBuild(op);
}
Also used : NewLiferayModuleProjectOp(com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp) Test(org.junit.Test)

Example 38 with NewLiferayModuleProjectOp

use of com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp in project liferay-ide by liferay.

the class NewLiferayComponentOpTests method testNewLiferayComponentActionCommandPortlet.

@Test
public void testNewLiferayComponentActionCommandPortlet() throws Exception {
    NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();
    op.setProjectName("action-command-test");
    op.setProjectTemplateName("activator");
    op.setProjectProvider("gradle-module");
    Status modulePorjectStatus = NewLiferayModuleProjectOpMethods.execute(op, ProgressMonitorBridge.create(new NullProgressMonitor()));
    assertTrue(modulePorjectStatus.ok());
    IProject modProject = CoreUtil.getProject(op.getProjectName().content());
    modProject.open(new NullProgressMonitor());
    NewLiferayComponentOp cop = NewLiferayComponentOp.TYPE.instantiate();
    cop.setProjectName(op.getProjectName().content());
    cop.setComponentClassTemplateName("PortletActionCommand");
    Status status = NewLiferayComponentOpMethods.execute(cop, ProgressMonitorBridge.create(new NullProgressMonitor()));
    assertEquals(Status.createOkStatus(), status);
    IFile javaFile = modProject.getFile("/src/main/java/action/command/test/ActionCommandTestActionCommand.java");
    assertTrue(javaFile.exists());
    String javaFileContent = FileUtil.readContents(javaFile.getLocation().toFile(), true);
    assertTrue(javaFileContent.contains("javax.portlet.name=action_command_test_ActionCommandTestPortlet"));
    assertTrue(javaFileContent.contains("mvc.command.name=greet"));
    IFile initFile = modProject.getFile("/src/main/resources/META-INF/resources/actioncommandtestportletactioncommand/init.ftl");
    assertTrue(initFile.exists());
    IFile viewFile = modProject.getFile("/src/main/resources/META-INF/resources/actioncommandtestportletactioncommand/view.ftl");
    assertTrue(viewFile.exists());
}
Also used : Status(org.eclipse.sapphire.modeling.Status) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IFile(org.eclipse.core.resources.IFile) NewLiferayModuleProjectOp(com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp) NewLiferayComponentOp(com.liferay.ide.project.core.modules.NewLiferayComponentOp) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 39 with NewLiferayModuleProjectOp

use of com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp in project liferay-ide by liferay.

the class NewLiferayComponentOpTests method testNewLiferayComponentProjectValidation.

@Test
public void testNewLiferayComponentProjectValidation() throws Exception {
    deleteAllWorkspaceProjects();
    NewLiferayComponentOp cop = NewLiferayComponentOp.TYPE.instantiate();
    Status projectValidationStatus = cop.getProjectName().validation();
    assertEquals("No suitable Liferay module project.", projectValidationStatus.message());
    NewLiferayModuleProjectOp pop = NewLiferayModuleProjectOp.TYPE.instantiate();
    pop.setProjectName("testProjectValidation");
    pop.setProjectTemplateName("portlet");
    pop.setProjectProvider("gradle-module");
    Status moduleProjectStatus = NewLiferayModuleProjectOpMethods.execute(pop, ProgressMonitorBridge.create(new NullProgressMonitor()));
    assertTrue(moduleProjectStatus.ok());
    IProject modProject = CoreUtil.getProject(pop.getProjectName().content());
    modProject.open(new NullProgressMonitor());
    IFile bndFile = modProject.getFile("bnd.bnd");
    bndFile.delete(true, true, new NullProgressMonitor());
    cop.setProjectName(pop.getProjectName().content());
    projectValidationStatus = cop.getProjectName().validation();
    assertEquals("Can't find bnd.bnd file in the project.", projectValidationStatus.message());
}
Also used : Status(org.eclipse.sapphire.modeling.Status) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IFile(org.eclipse.core.resources.IFile) NewLiferayModuleProjectOp(com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp) NewLiferayComponentOp(com.liferay.ide.project.core.modules.NewLiferayComponentOp) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 40 with NewLiferayModuleProjectOp

use of com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp in project liferay-ide by liferay.

the class NewLiferayModuleProjectOpTests method testNewLiferayModuleProjectDefaultValueServiceDots.

@Test
@Ignore
public void testNewLiferayModuleProjectDefaultValueServiceDots() throws Exception {
    NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();
    op.setProjectName("my.test.project");
    op.setProjectTemplateName("portlet");
    assertEquals("MyTestProject", op.getComponentName().content(true));
}
Also used : NewLiferayModuleProjectOp(com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

NewLiferayModuleProjectOp (com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp)95 Test (org.junit.Test)94 IProject (org.eclipse.core.resources.IProject)30 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)18 IFile (org.eclipse.core.resources.IFile)12 Status (org.eclipse.sapphire.modeling.Status)9 Ignore (org.junit.Ignore)6 IBundleProject (com.liferay.ide.core.IBundleProject)5 NewLiferayComponentOp (com.liferay.ide.project.core.modules.NewLiferayComponentOp)5 PropertyKey (com.liferay.ide.project.core.modules.PropertyKey)3 SearchFilesVisitor (com.liferay.ide.project.core.util.SearchFilesVisitor)3 IPath (org.eclipse.core.runtime.IPath)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 File (java.io.File)2 URL (java.net.URL)2 ILiferayProjectImporter (com.liferay.ide.core.ILiferayProjectImporter)1 IProjectBuilder (com.liferay.ide.project.core.IProjectBuilder)1 ProjectName (com.liferay.ide.project.core.model.ProjectName)1 NewLiferayWorkspaceOp (com.liferay.ide.project.core.workspace.NewLiferayWorkspaceOp)1 ArrayList (java.util.ArrayList)1