use of com.liferay.ide.project.core.modules.PropertyKey in project liferay-ide by liferay.
the class MavenModuleProjectTests method testNewLiferayModuleProjectNewProperties.
@Test
public void testNewLiferayModuleProjectNewProperties() throws Exception {
NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();
op.setProjectName("test-properties-in-portlet");
op.setProjectProvider("maven-module");
op.setProjectTemplateName("portlet");
op.setComponentName("Test");
PropertyKey pk = op.getPropertyKeys().insert();
pk.setName("property-test-key");
pk.setValue("property-test-value");
Status exStatus = NewLiferayModuleProjectOpMethods.execute(op, ProgressMonitorBridge.create(monitor));
assertEquals("OK", exStatus.message());
IProject modProject = CoreUtil.getProject(op.getProjectName().content());
modProject.open(new NullProgressMonitor());
SearchFilesVisitor sv = new SearchFilesVisitor();
List<IFile> searchFiles = sv.searchFiles(modProject, "TestPortlet.java");
IFile componentClassFile = searchFiles.get(0);
assertEquals(componentClassFile.exists(), true);
String actual = CoreUtil.readStreamToString(componentClassFile.getContents());
assertTrue(actual, actual.contains("\"property-test-key=property-test-value\""));
}
Aggregations