Search in sources :

Example 6 with ValidationService

use of org.eclipse.sapphire.services.ValidationService in project liferay-ide by liferay.

the class NewLiferayPluginProjectMavenTests method testPortletFrameworkValidation.

@Test
@Ignore
public void testPortletFrameworkValidation() throws Exception {
    if (shouldSkipBundleTests())
        return;
    NewLiferayPluginProjectOp op = newProjectOp("test-portlet-framework-validation");
    op.setPluginType("portlet");
    final ValidationService vs = op.getPortletFramework().service(ValidationService.class);
    assertEquals(true, vs.validation().ok());
    final SDK newSDK = createNewSDK();
    newSDK.setVersion("6.0.0");
    final IPortletFramework jsf = ProjectCore.getPortletFramework("jsf");
    op.setProjectProvider("ant");
    op.setPortletFramework("jsf");
    assertEquals("Selected portlet framework requires SDK version at least " + jsf.getRequiredSDKVersion(), vs.validation().message());
// Value is not excepted.
/*
         * assertEquals( "Selected portlet framework requires SDK version at least " + jsf.getRequiredSDKVersion(),
         * op.getPortletFramework().validation().message() );
         */
}
Also used : IPortletFramework(com.liferay.ide.project.core.IPortletFramework) ValidationService(org.eclipse.sapphire.services.ValidationService) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) SDK(com.liferay.ide.sdk.core.SDK) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 7 with ValidationService

use of org.eclipse.sapphire.services.ValidationService in project liferay-ide by liferay.

the class NewLiferayPluginProjectMavenTests method testParentFolderLocationValidation.

@Test
public void testParentFolderLocationValidation() throws Exception {
    File parentFolder = CoreUtil.getWorkspaceRoot().getLocation().append("test-parent-folder-location-validation-service").toFile();
    if (!parentFolder.exists()) {
        parentFolder.mkdir();
    }
    File pomFile = new File("projects/validations/location/pom.xml");
    FileUtil.copyFileToDir(pomFile, parentFolder);
    final NewLiferayPluginProjectOp op = NewLiferayPluginProjectOp.TYPE.instantiate();
    op.setProjectName("test-parent-folder-location-validation-service");
    final ValidationService vs = op.getLocation().service(ValidationService.class);
    op.setProjectProvider("maven");
    op.setPluginType("portlet");
    op.setUseDefaultLocation(false);
    op.setLocation(parentFolder.getAbsolutePath());
    String projectName = op.getProjectName().content();
    String expected = "The project name \"" + projectName + "\" can't be the same as the parent.";
    assertEquals(expected, vs.validation().message());
    assertEquals(expected, op.getLocation().validation().message());
}
Also used : ValidationService(org.eclipse.sapphire.services.ValidationService) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) File(java.io.File) Test(org.junit.Test)

Example 8 with ValidationService

use of org.eclipse.sapphire.services.ValidationService in project liferay-ide by liferay.

the class NewLiferayPluginProjectMavenTests method testGroupIdValidation.

@Test
public void testGroupIdValidation() throws Exception {
    final NewLiferayPluginProjectOp op = newProjectOp("test-group-id-validation");
    op.setProjectProvider("maven");
    final ValidationService vs = op.getGroupId().service(ValidationService.class);
    op.setGroupId(".com.liferay.test");
    final String expected = "A package name cannot start or end with a dot";
    assertEquals(expected, vs.validation().message());
    assertEquals(expected, op.getGroupId().validation().message());
    op.setGroupId("com.life*ray.test");
    final String expected2 = "'life*ray' is not a valid Java identifier";
    assertEquals(expected2, vs.validation().message());
    assertEquals(expected2, op.getGroupId().validation().message());
}
Also used : ValidationService(org.eclipse.sapphire.services.ValidationService) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) Test(org.junit.Test)

Aggregations

ValidationService (org.eclipse.sapphire.services.ValidationService)8 Test (org.junit.Test)7 NewLiferayPluginProjectOp (com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)6 LayoutTplElement (com.liferay.ide.layouttpl.core.model.LayoutTplElement)2 PortletColumnElement (com.liferay.ide.layouttpl.core.model.PortletColumnElement)2 PortletLayoutElement (com.liferay.ide.layouttpl.core.model.PortletLayoutElement)2 IProject (org.eclipse.core.resources.IProject)2 Ignore (org.junit.Ignore)2 LiferayPortlet (com.liferay.ide.portlet.core.lfportlet.model.LiferayPortlet)1 LiferayPortletXml (com.liferay.ide.portlet.core.lfportlet.model.LiferayPortletXml)1 NumberValueValidationService (com.liferay.ide.portlet.core.lfportlet.model.internal.NumberValueValidationService)1 IPortletFramework (com.liferay.ide.project.core.IPortletFramework)1 SDK (com.liferay.ide.sdk.core.SDK)1 File (java.io.File)1 IPath (org.eclipse.core.runtime.IPath)1