use of com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter in project liferay-faces-bridge-impl by liferay.
the class PortletSetsViewTestPortlet method outputInvalidViewPathTestResult.
private void outputInvalidViewPathTestResult(PortletRequest portletRequest, MimeResponse response, boolean pass) throws IOException {
if (getTestName().equals(SETSINVALIDVIEWPATH_TEST)) {
BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(getTestName());
if (pass) {
resultWriter.setStatus(BridgeTCKResultWriter.PASS);
resultWriter.setDetail("Correctly threw BridgeInvalidViewPathException when passed a bad path.");
} else {
resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
resultWriter.setDetail("Didn't throw BridgeInvalidViewPathException when passed a bad path.");
}
if (response instanceof RenderResponse) {
response.setContentType("text/html");
PrintWriter responsePrintWriter = response.getWriter();
responsePrintWriter.println(resultWriter.toString());
} else {
portletRequest.setAttribute(BridgeTCKResultWriter.class.getName(), resultWriter);
}
}
}
use of com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter in project liferay-faces-bridge-impl by liferay.
the class BridgeClassDefaultTestPortlet method render.
public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException {
String className = getBridgeClassName();
boolean pass = (className != null) && !(className.length() <= 0);
response.setContentType("text/html");
PrintWriter responsePrintWriter = response.getWriter();
BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(TEST_NAME);
if (pass) {
resultWriter.setStatus(BridgeTCKResultWriter.PASS);
resultWriter.setDetail("Bridge class name is " + className);
} else {
resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
resultWriter.setDetail("No bridge class name found.");
}
responsePrintWriter.println(resultWriter.toString());
}
use of com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter in project liferay-faces-bridge-impl by liferay.
the class FacesContextFactoryServiceProviderTest method render.
public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException {
response.setContentType("text/html");
PrintWriter responsePrintWriter = response.getWriter();
BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(TEST_NAME);
String className = getFromServicesPath(this.getPortletContext(), "META-INF/services/javax.faces.context.FacesContextFactory");
if (className == null) {
resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
resultWriter.setDetail("META-INF/services/javax.faces.context.FacesContextFactory not found.");
return;
}
// See if we can load the class
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Class c = (Class<? extends FacesContextFactory>) loader.loadClass(className);
resultWriter.setStatus(BridgeTCKResultWriter.PASS);
resultWriter.setDetail("Located and loaded the Bridge's FacesContextFactory class: " + className);
} catch (ClassNotFoundException cnfe) {
resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
resultWriter.setDetail("Located but unable to load the Bridge's FacesContextFactory class: " + className);
}
responsePrintWriter.println(resultWriter.toString());
}
use of com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter in project liferay-faces-bridge-impl by liferay.
the class GetDefaultViewIdMapMethodTestPortlet method render.
public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException {
response.setContentType("text/html");
PrintWriter responsePrintWriter = response.getWriter();
boolean pass = getPortletContext().getAttribute(TEST_PASS_PREFIX + getPortletName()) != null;
StringBuilder failMsg = null;
if (!pass) {
failMsg = new StringBuilder();
Enumeration<String> names = getPortletContext().getAttributeNames();
while (names.hasMoreElements()) {
String name = names.nextElement();
responsePrintWriter.println("--- " + name + " ---");
int idx = name.indexOf(TEST_FAIL_PREFIX + getPortletName() + ".");
if (name.startsWith(TEST_FAIL_PREFIX)) {
String prefix = TEST_FAIL_PREFIX + getPortletName() + ".";
failMsg.append("Missing mode: " + name.substring(prefix.length()) + ".");
}
}
}
BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(TEST_NAME);
if (pass) {
resultWriter.setStatus(BridgeTCKResultWriter.PASS);
resultWriter.setDetail("getDefaultViewIdMap() method returns successfully.");
} else {
resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
resultWriter.setDetail(failMsg.toString());
}
responsePrintWriter.println(resultWriter.toString());
}
use of com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter in project liferay-faces-bridge-impl by liferay.
the class GetExcludedRequestAttributesMethodTestPortlet method render.
public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException {
response.setContentType("text/html");
PrintWriter responsePrintWriter = response.getWriter();
boolean pass = getPortletContext().getAttribute(TEST_FAIL_PREFIX + getPortletName()) == null;
BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(getTestName());
if (pass) {
resultWriter.setStatus(BridgeTCKResultWriter.PASS);
resultWriter.setDetail((String) getPortletContext().getAttribute(TEST_PASS_PREFIX + getPortletName()));
} else {
resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
resultWriter.setDetail((String) getPortletContext().getAttribute(TEST_FAIL_PREFIX + getPortletName()));
}
responsePrintWriter.println(resultWriter.toString());
}
Aggregations