Search in sources :

Example 81 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class LiferayPortletXmlTest method testPortletNameValidationService.

@Test
public void testPortletNameValidationService() throws Exception {
    if (shouldSkipBundleTests())
        return;
    NewLiferayPluginProjectOp newProjectOp = NewLiferayPluginProjectOp.TYPE.instantiate();
    newProjectOp.setProjectName("test-validation");
    newProjectOp.setPluginType(PluginType.portlet);
    newProjectOp.setIncludeSampleCode(true);
    newProjectOp.setPortletFramework("mvc");
    newProjectOp.setPortletName("testPortlet");
    final IProject testProject = createAntProject(newProjectOp);
    LiferayPortletXml liferayPortletApp = op(testProject);
    for (LiferayPortlet liferayPortlet : liferayPortletApp.getPortlets()) {
        final ValidationService vs = liferayPortlet.getPortletName().service(ValidationService.class);
        assertEquals("ok", vs.validation().message());
        assertEquals("ok", liferayPortlet.getPortletName().validation().message());
    }
    for (LiferayPortlet liferayPortlet : liferayPortletApp.getPortlets()) {
        liferayPortlet.setPortletName("test1");
        final ValidationService vs = liferayPortlet.getPortletName().service(ValidationService.class);
        assertEquals(false, "ok".equals(vs.validation().message()));
        assertEquals(false, "ok".equals(liferayPortlet.getPortletName().validation().message()));
    }
}
Also used : LiferayPortletXml(com.liferay.ide.portlet.core.lfportlet.model.LiferayPortletXml) NumberValueValidationService(com.liferay.ide.portlet.core.lfportlet.model.internal.NumberValueValidationService) ValidationService(org.eclipse.sapphire.services.ValidationService) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) LiferayPortlet(com.liferay.ide.portlet.core.lfportlet.model.LiferayPortlet) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 82 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class ProjectCoreBase method newProjectOp.

protected NewLiferayPluginProjectOp newProjectOp(final String projectName) throws Exception {
    final NewLiferayPluginProjectOp op = NewLiferayPluginProjectOp.TYPE.instantiate();
    op.setProjectName(projectName + "-" + getRuntimeVersion());
    IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
    if (vmInstall == null) {
        throw new CoreException(SDKCorePlugin.createErrorStatus("Could not get default VM install"));
    }
    return op;
}
Also used : IVMInstall(org.eclipse.jdt.launching.IVMInstall) CoreException(org.eclipse.core.runtime.CoreException) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)

Example 83 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class NewLiferayPluginProjectOp625Tests method testNewSDKProjects.

@Override
@Test
public void testNewSDKProjects() throws Exception {
    if (shouldSkipBundleTests())
        return;
    createAntProject(newProjectOp("test-name-1"));
    createAntProject(newProjectOp("test_name_1"));
    createAntProject(newProjectOp("-portlet-portlet"));
    createAntProject(newProjectOp("-portlet-hook"));
    final NewLiferayPluginProjectOp op = newProjectOp("-hook-hook");
    op.setPluginType(PluginType.hook);
    createAntProject(op);
}
Also used : NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) Test(org.junit.Test)

Example 84 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class NewLiferayPluginProjectOp701Tests method testNewLayoutAntProject.

@Override
@Test
public void testNewLayoutAntProject() throws Exception {
    String projectName = "test-layouttpl-project-sdk";
    NewLiferayPluginProjectOp op = newProjectOp(projectName);
    op.setPluginType(PluginType.layouttpl);
    IProject layouttplProject = createAntProject(op);
    IFolder webappRoot = LiferayCore.create(IWebProject.class, layouttplProject).getDefaultDocrootFolder();
    assertNotNull(webappRoot);
    IFile layoutXml = webappRoot.getFile("WEB-INF/liferay-layout-templates.xml");
    assertEquals(true, layoutXml.exists());
    IFile wapTpl = webappRoot.getFile("test_layouttpl_project_sdk_7.0.2.wap.tpl");
    assertFalse(wapTpl.exists());
    IDataModel model = DataModelFactory.createDataModel(new NewLayoutTplDataModelProvider());
    model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_TEMPLATE_ID, "newtemplate");
    model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_TEMPLATE_NAME, "New Template");
    model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_THUMBNAIL_FILE, "/newtemplate.png");
    model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_WAP_TEMPLATE_FILE, "/newtemplate.wap.tpl");
    model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_TEMPLATE_FILE, "/newtemplate.tpl");
    LayoutTplDescriptorHelper layoutHelper = new LayoutTplDescriptorHelper(layouttplProject);
    layoutHelper.addNewLayoutTemplate(model);
    String contents = CoreUtil.readStreamToString(layoutXml.getContents(true));
    assertFalse(contents.contains("<wap-template-path>"));
}
Also used : IFile(org.eclipse.core.resources.IFile) IWebProject(com.liferay.ide.core.IWebProject) NewLayoutTplDataModelProvider(com.liferay.ide.layouttpl.core.operation.NewLayoutTplDataModelProvider) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) IDataModel(org.eclipse.wst.common.frameworks.datamodel.IDataModel) LayoutTplDescriptorHelper(com.liferay.ide.layouttpl.core.operation.LayoutTplDescriptorHelper) IProject(org.eclipse.core.resources.IProject) IFolder(org.eclipse.core.resources.IFolder) Test(org.junit.Test)

Example 85 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class NewLiferayPluginProjectOp7sp3Tests method testNewExtAntProjectNotSupportedWithWorkspaceSDK.

@Test
public void testNewExtAntProjectNotSupportedWithWorkspaceSDK() throws Exception {
    if (shouldSkipBundleTests())
        return;
    final String projectName = "test-ext-project-sdk";
    final NewLiferayPluginProjectOp op = newProjectOp(projectName);
    op.setPluginType(PluginType.ext);
    op.setSdkLocation(PathBridge.create(getLiferayPluginsSdkDir()));
    Status validation = op.validation();
    assertEquals(true, validation.ok());
    final IProject extProject = createAntProject(op);
    assertNotNull(extProject);
}
Also used : Status(org.eclipse.sapphire.modeling.Status) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Aggregations

NewLiferayPluginProjectOp (com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)122 Test (org.junit.Test)61 IProject (org.eclipse.core.resources.IProject)48 IWebProject (com.liferay.ide.core.IWebProject)18 IFile (org.eclipse.core.resources.IFile)18 IPath (org.eclipse.core.runtime.IPath)14 IFolder (org.eclipse.core.resources.IFolder)13 SDK (com.liferay.ide.sdk.core.SDK)12 Status (org.eclipse.sapphire.modeling.Status)10 PropertyContentEvent (org.eclipse.sapphire.PropertyContentEvent)9 Path (org.eclipse.sapphire.modeling.Path)8 CoreException (org.eclipse.core.runtime.CoreException)7 IPortletFramework (com.liferay.ide.project.core.IPortletFramework)6 HashSet (java.util.HashSet)5 PossibleValuesService (org.eclipse.sapphire.PossibleValuesService)5 ValidationService (org.eclipse.sapphire.services.ValidationService)5 IVirtualComponent (org.eclipse.wst.common.componentcore.resources.IVirtualComponent)5 NewLiferayProfile (com.liferay.ide.project.core.model.NewLiferayProfile)4 IStatus (org.eclipse.core.runtime.IStatus)4 LayoutTplDescriptorHelper (com.liferay.ide.layouttpl.core.operation.LayoutTplDescriptorHelper)3