use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.
the class NewLiferayPluginProjectMavenTests method testProjectProviderListener.
@Test
public void testProjectProviderListener() throws Exception {
if (shouldSkipBundleTests())
return;
final NewLiferayPluginProjectOp op = newProjectOp("test-project-provider-listener");
final String projectName = op.getProjectName().content();
op.setPluginType("portlet");
op.setUseDefaultLocation(true);
final SDK sdk = SDKUtil.createSDKFromLocation(getLiferayPluginsSdkDir());
IPath exceptedLocation = null;
op.setProjectProvider("ant");
exceptedLocation = sdk.getLocation().append("portlets").append(projectName + "-portlet");
assertEquals(exceptedLocation, PathBridge.create(op.getLocation().content()));
op.setProjectProvider("maven");
exceptedLocation = CoreUtil.getWorkspaceRoot().getLocation().append(projectName);
assertEquals(exceptedLocation, PathBridge.create(op.getLocation().content()));
}
use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.
the class NewLiferayPluginProjectMavenTests method testUseDefaultLocationListener.
protected void testUseDefaultLocationListener(boolean versionRestriction) throws Exception {
final NewLiferayPluginProjectOp op = newProjectOp("test-use-default-location-listener");
final String projectName = op.getProjectName().content();
op.setProjectProvider("maven");
IPath exceptedLocation = null;
op.setUseDefaultLocation(true);
exceptedLocation = CoreUtil.getWorkspaceRoot().getLocation().append(projectName);
assertEquals(exceptedLocation, PathBridge.create(op.getLocation().content()));
op.setUseDefaultLocation(false);
assertEquals(null, op.getLocation().content());
if (versionRestriction) {
op.setProjectProvider("ant");
op.setPluginType("portlet");
op.setUseDefaultLocation(true);
final SDK sdk = SDKUtil.createSDKFromLocation(getLiferayPluginsSdkDir());
exceptedLocation = sdk.getLocation().append("portlets").append(projectName + "-portlet");
assertEquals(exceptedLocation, PathBridge.create(op.getLocation().content()));
op.setUseDefaultLocation(false);
assertEquals(null, op.getLocation().content());
}
}
use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.
the class NewLiferayPluginProjectMavenTests method testPortletProjectName.
@Test
public void testPortletProjectName() throws Exception {
final NewLiferayPluginProjectOp op = newProjectOp("test-name");
op.setProjectProvider("maven");
op.setPluginType(PluginType.portlet);
op.setUseDefaultLocation(true);
op.setPortletFramework("mvc");
op.setPortletName("testPortlet");
IProject expectedProject = createMavenProject(op);
String expectedProjectName = expectedProject.getName();
String actualProjectName = op.getProjectNames().get(0).getName().content();
assertEquals(expectedProjectName, actualProjectName);
}
use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.
the class NewLiferayPluginProjectMavenTests method testProjectProviderPossibleValues.
@Test
public void testProjectProviderPossibleValues() throws Exception {
if (shouldSkipBundleTests())
return;
final NewLiferayPluginProjectOp op = newProjectOp("test-project-provider-possbile-values");
final Set<String> acturalValues = op.getProjectProvider().service(PossibleValuesService.class).values();
assertNotNull(acturalValues);
Set<String> exceptedValues = new HashSet<>();
exceptedValues.add("ant");
exceptedValues.add("maven");
assertEquals(true, exceptedValues.containsAll(acturalValues));
assertEquals(true, acturalValues.containsAll(exceptedValues));
}
use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.
the class NewLiferayPluginProjectMavenTests method testLocationValidation.
@Test
@Ignore
public void testLocationValidation() throws Exception {
final NewLiferayPluginProjectOp op = newProjectOp("test-location-validation-service");
op.setProjectProvider("maven");
op.setPluginType("portlet");
op.setUseDefaultLocation(false);
final ValidationService vs = op.getLocation().service(ValidationService.class);
String invalidLocation = null;
invalidLocation = "not-absolute-location";
op.setLocation(invalidLocation);
final String expected = "\"" + invalidLocation + "\"" + " is not an absolute path.";
assertEquals(normalize(expected), normalize(vs.validation().message()));
assertEquals(normalize(expected), normalize(op.getLocation().validation().message()));
if (CoreUtil.isWindows()) {
invalidLocation = "Z:\\test-location-validation-service";
} else {
invalidLocation = "/test-location-validation-service";
}
op.setLocation(invalidLocation);
final String expected2 = "Cannot create project content at " + "\"" + invalidLocation + "\"";
assertEquals(expected2, vs.validation().message());
assertEquals(expected2, op.getLocation().validation().message());
if (CoreUtil.isWindows()) {
invalidLocation = CoreUtil.getWorkspaceRoot().getLocation().getDevice() + "\\";
} else {
invalidLocation = "/";
}
op.setLocation(invalidLocation);
final String expected3 = "Project location is not empty or a parent pom.";
assertEquals(expected3, vs.validation().message());
// assertEquals( expected3, op.getLocation().validation().message() );
// IDE-2069
invalidLocation = getLiferayRuntimeDir().removeLastSegments(2).toOSString();
op.setLocation(invalidLocation);
final String expected5 = "Project location is not empty or a parent pom.";
assertEquals(expected5, vs.validation().message());
op.setLocation("");
final String expected4 = "Location must be specified.";
assertEquals(expected4, vs.validation().message());
assertEquals(expected4, op.getLocation().validation().message());
}
Aggregations