Search in sources :

Example 96 with NewLiferayPluginProjectOp

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

the class NewLiferayPluginProjectOpBase method testDisplayNameDefaultValue.

@Test
public void testDisplayNameDefaultValue() throws Exception {
    if (shouldSkipBundleTests())
        return;
    final NewLiferayPluginProjectOp op = newProjectOp("display-name-default-value");
    final DefaultValueService dvs = op.getDisplayName().service(DefaultValueService.class);
    final String exceptedDisplayName = "Test Display Name Default Value";
    op.setProjectName("test display name default value");
    assertEquals(exceptedDisplayName, op.getDisplayName().content());
    assertEquals(exceptedDisplayName, dvs.value());
    op.setProjectName("Test-Display-Name-Default-Value");
    assertEquals(exceptedDisplayName, op.getDisplayName().content());
    assertEquals(exceptedDisplayName, dvs.value());
    op.setProjectName("Test_Display_Name_Default_Value");
    assertEquals(exceptedDisplayName, op.getDisplayName().content());
    assertEquals(exceptedDisplayName, dvs.value());
    op.setProjectName("test-Display_name Default-value");
    assertEquals(exceptedDisplayName, op.getDisplayName().content());
    assertEquals(exceptedDisplayName, dvs.value());
    final String projectName = "test-display_name default value";
    final String[] suffixs = { "-portlet", "-hook", "-theme", "-layouttpl", "-ext" };
    for (String suffix : suffixs) {
        op.setProjectName(projectName + suffix);
        assertEquals(exceptedDisplayName, op.getDisplayName().content());
        assertEquals(exceptedDisplayName, dvs.value());
    }
}
Also used : DefaultValueService(org.eclipse.sapphire.DefaultValueService) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) Test(org.junit.Test)

Example 97 with NewLiferayPluginProjectOp

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

the class NewLiferayPluginProjectOpBase method testNewHookAntProject.

@Test
public void testNewHookAntProject() throws Exception {
    if (shouldSkipBundleTests())
        return;
    final NewLiferayPluginProjectOp op = newProjectOp("test-hook-project-sdk");
    op.setPluginType(PluginType.hook);
    final IProject hookProject = createAntProject(op);
    final IFolder webappRoot = LiferayCore.create(IWebProject.class, hookProject).getDefaultDocrootFolder();
    assertNotNull(webappRoot);
    final IFile hookXml = webappRoot.getFile("WEB-INF/liferay-hook.xml");
    assertEquals(true, hookXml.exists());
}
Also used : IFile(org.eclipse.core.resources.IFile) IWebProject(com.liferay.ide.core.IWebProject) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) IProject(org.eclipse.core.resources.IProject) IFolder(org.eclipse.core.resources.IFolder) Test(org.junit.Test)

Example 98 with NewLiferayPluginProjectOp

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

the class NewLiferayPluginProjectOpBase method testNewSDKProjects.

@Test
public void testNewSDKProjects() throws Exception {
    if (shouldSkipBundleTests())
        return;
    createAntProject(newProjectOp("test-name-1"));
    createAntProject(newProjectOp("Test With Spaces"));
    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 99 with NewLiferayPluginProjectOp

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

the class NewLiferayPluginProjectOpBase method testLocationListener.

protected void testLocationListener() throws Exception {
    final NewLiferayPluginProjectOp op = newProjectOp("location-listener");
    op.setProjectProvider("ant");
    op.setUseDefaultLocation(false);
    final String projectNameWithoutSuffix = "project-name-without-suffix";
    final String locationWithoutSuffix = "location-without-suffix";
    op.setPluginType("portlet");
    final String suffix = "-portlet";
    // Both of project name and location are without type suffix.
    op.setProjectName(projectNameWithoutSuffix);
    op.setLocation(locationWithoutSuffix);
    assertEquals(locationWithoutSuffix + "/" + projectNameWithoutSuffix + suffix, op.getLocation().content().toString());
    // Location does't have a type suffix, project name has one.
    op.setProjectName(projectNameWithoutSuffix + suffix);
    op.setLocation(locationWithoutSuffix);
    assertEquals(locationWithoutSuffix, op.getLocation().content().toString());
    // Location has a type suffix.
    op.setLocation(locationWithoutSuffix + suffix);
    assertEquals(locationWithoutSuffix + suffix, op.getLocation().content().toString());
}
Also used : NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)

Example 100 with NewLiferayPluginProjectOp

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

the class NewLiferayPluginProjectOpBase method testNewExtAntProject.

@Test
@Ignore
public void testNewExtAntProject() throws Exception {
    if (shouldSkipBundleTests())
        return;
    final NewLiferayPluginProjectOp op = newProjectOp("ext");
    op.setPluginType(PluginType.ext);
    IProject extProject = null;
    try {
        extProject = createAntProject(op);
    } catch (Throwable e) {
    }
    assertNotNull(extProject);
    final IFolder defaultDocroot = LiferayCore.create(IWebProject.class, extProject).getDefaultDocrootFolder();
    assertNotNull(defaultDocroot);
    final IFile extFile = defaultDocroot.getFile("WEB-INF/liferay-portlet-ext.xml");
    assertEquals(true, extFile.exists());
}
Also used : IFile(org.eclipse.core.resources.IFile) IWebProject(com.liferay.ide.core.IWebProject) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) IProject(org.eclipse.core.resources.IProject) IFolder(org.eclipse.core.resources.IFolder) Ignore(org.junit.Ignore) 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