use of aQute.remote.util.JMXBundleDeployer in project liferay-blade-samples by liferay.
the class BladeSamplesUpdatePortletTest method tearDownClass.
@AfterClass
public static void tearDownClass() throws Exception {
new JMXBundleDeployer().uninstall(_helloWorldJarBSN);
if (_projectPath.exists()) {
IO.delete(_projectPath);
Assert.assertFalse(_projectPath.exists());
}
}
use of aQute.remote.util.JMXBundleDeployer in project liferay-blade-samples by liferay.
the class BladeSamplesUpdatePortletTest method create.
@Deployment
public static JavaArchive create() throws Exception {
final File jarFile = new File(System.getProperty("jspPortletJarFile"));
_appsDir = new File(System.getProperty("projectDir"), "apps");
_projectPath = BladeCLIUtil.createProject(_appsDir, "mvc-portlet", "helloworld");
BladeCLIUtil.execute(_projectPath, "gw", "assemble");
File buildOutput = new File(_projectPath + "/build/libs/helloworld-1.0.0.jar");
new JMXBundleDeployer().deploy(_helloWorldJarBSN, buildOutput);
return ShrinkWrap.createFromZipFile(JavaArchive.class, jarFile);
}
use of aQute.remote.util.JMXBundleDeployer in project liferay-blade-samples by liferay.
the class BladeSamplesUpdatePortletTest method testUpdateMVCPortletProject.
@Test
public void testUpdateMVCPortletProject() throws Exception {
_webDriver.get(_portletURL.toExternalForm());
Assert.assertTrue("Portlet was not deployed", BladeSampleFunctionalActionUtil.isVisible(_webDriver, _helloWorldPortlet));
Assert.assertTrue(_portletTitle.getText(), _portletTitle.getText().contentEquals("helloworld Portlet"));
Assert.assertTrue(_portletBody.getText(), _portletBody.getText().contentEquals("Hello from helloworld JSP!"));
File dynamicFile = new File(_projectPath + "/src/main/java/helloworld/portlet/HelloworldPortlet.java");
List<String> lines = new ArrayList<>();
String line = null;
try (BufferedReader reader = new BufferedReader(new FileReader(dynamicFile))) {
while ((line = reader.readLine()) != null) {
lines.add(line);
if (line.equals("import javax.portlet.Portlet;")) {
String imports = StringTestUtil.merge(Arrays.asList("import java.io.IOException;", "import javax.portlet.PortletException;", "import javax.portlet.RenderRequest;", "import javax.portlet.RenderResponse;"), "\n");
lines.add(imports);
}
if (line.equals("public class HelloworldPortlet extends MVCPortlet {")) {
StringBuilder sb = new StringBuilder();
sb.append("public void doView(\nRenderRequest renderRequest,").append(" RenderResponse renderResponse)\n").append("throws IOException, PortletException {\n").append("renderRequest.setAttribute(\n").append("\"foo\", \"bar\");\nsuper.doView(renderRequest, ").append("renderResponse);\n}\n");
lines.add(sb.toString());
}
}
}
try (Writer writer = new FileWriter(dynamicFile)) {
for (String string : lines) {
writer.write(string + "\n");
}
}
File staticFile = new File(_projectPath + "/src/main/resources/META-INF/resources/view.jsp");
String content = new String(Files.readAllBytes(staticFile.toPath()));
StringBuilder sb = new StringBuilder(content);
sb.insert(content.lastIndexOf("b") + 2, "<b><%= renderRequest.getAttribute(\"foo\") %></b>\n");
Files.write(staticFile.toPath(), sb.toString().getBytes());
_buildStatus = BladeCLIUtil.execute(_projectPath, "gw", "assemble");
Assert.assertTrue("Expected Build Successful, but saw: " + _buildStatus, !_buildStatus.contains("failed"));
File buildOutput = new File(_projectPath + "/build/libs/helloworld-1.0.0.jar");
new JMXBundleDeployer().deploy(_helloWorldJarBSN, buildOutput);
Thread.sleep(1000);
_webDriver.get(_portletURL.toExternalForm());
Assert.assertTrue("Portlet was not deployed", BladeSampleFunctionalActionUtil.isVisible(_webDriver, _helloWorldPortlet));
Assert.assertTrue(_portletTitle.getText(), _portletTitle.getText().contentEquals("helloworld Portlet"));
Assert.assertTrue(_portletBody.getText(), _portletBody.getText().contentEquals("Hello from helloworld JSP!bar"));
}
use of aQute.remote.util.JMXBundleDeployer in project liferay-blade-samples by liferay.
the class BladeJspWarPortletTest method create.
@Deployment
public static JavaArchive create() throws Exception {
final File jarFile = new File(System.getProperty("jarFile"));
final File fooApiJar = new File(System.getProperty("fooApiJarFile"));
final File fooServiceJar = new File(System.getProperty("fooServiceJarFile"));
new JMXBundleDeployer().deploy(_fooApiJarBSN, fooApiJar);
new JMXBundleDeployer().deploy(_fooServiceJarBSN, fooServiceJar);
final File jspPortletWarFile = new File(System.getProperty("jspPortletWarFile"));
String bundleID = BladeCLIUtil.installBundle(jspPortletWarFile);
BladeCLIUtil.startBundle(bundleID);
return ShrinkWrap.createFromZipFile(JavaArchive.class, jarFile);
}
use of aQute.remote.util.JMXBundleDeployer in project liferay-blade-samples by liferay.
the class BladeServiceBuilderTest method create.
@Deployment
public static JavaArchive create() throws Exception {
final File jarFile = new File(System.getProperty("jarFile"));
final File fooApiJar = new File(System.getProperty("fooApiJarFile"));
final File fooServiceJar = new File(System.getProperty("fooServiceJarFile"));
final File fooWebJar = new File(System.getProperty("fooWebJarFile"));
new JMXBundleDeployer().deploy(_fooApiJarBSN, fooApiJar);
new JMXBundleDeployer().deploy(_fooServiceJarBSN, fooServiceJar);
new JMXBundleDeployer().deploy(_fooWebJarBSN, fooWebJar);
return ShrinkWrap.createFromZipFile(JavaArchive.class, jarFile);
}
Aggregations