/** * <p class="changed_added_2_0"> * </p> * * @param url * @throws MalformedURLException * @throws FacesException */ public FacesRequest createFacesRequest(String url) throws MalformedURLException, FacesException { FacesRequest request = new FacesRequest(); request.connection = getServer().getConnection(new URL(url)); requests.add(request); return request; }
/** * JSF and Virtual server instance cleanup. * * @throws java.lang.Exception */ public void release() { checkInitialized(); for (FacesRequest request : this.requests) { request.release(); } facesServer.destroy(); Thread.currentThread().setContextClassLoader(contextClassLoader); facesServer = null; application = null; lifecycle = null; initialized = false; }
public FacesRequest submit() throws MalformedURLException, FacesException { if (!connection.isFinished()) { throw new IllegalStateException(); } // Extract VIEW_STATE value. Map<String, String> fields = getHiddenFields(connection.getContentAsString()); if (!fields.containsKey(ResponseStateManager.VIEW_STATE_PARAM)) { throw new FacesException("No view state field in response"); } FacesRequest facesRequest = createFacesRequest(connection.getRequest().getRequestURL().toString()) .withViewId(viewId); facesRequest.connection.setRequestMethod(HttpMethod.POST); for (Map.Entry<String, String> entry : fields.entrySet()) { facesRequest.withParameter(entry.getKey(), entry.getValue()); } return facesRequest; }
public FacesRequest submit() throws MalformedURLException, FacesException { if (!connection.isFinished()) { throw new IllegalStateException(); } // Extract VIEW_STATE value. Map<String, String> fields = getHiddenFields(connection.getContentAsString()); if (!fields.containsKey(ResponseStateManager.VIEW_STATE_PARAM)) { throw new FacesException("No view state field in response"); } FacesRequest facesRequest = createFacesRequest(connection.getRequest().getRequestURL().toString()) .withViewId(viewId); facesRequest.connection.setRequestMethod(HttpMethod.POST); for (Map.Entry<String, String> entry : fields.entrySet()) { facesRequest.withParameter(entry.getKey(), entry.getValue()); } return facesRequest; }
/** * Setup virtual server connection to run tests inside JSF lifecycle. The default implementation setups virtual * request to the "http://localhost/test.jsf" URL and creates {@link FacesContext} instance. Two template methods * are called : * <ol> * <li>{@link #setupConnection()} to prepare request method, parameters, headers and so</li> * <li>{@link #setupView()} to create default view.</li> * </ol> * * @throws Exception */ public FacesRequest createFacesRequest() throws Exception { String url = "http://localhost/test.jsf"; return createFacesRequest(url).withViewId("/test.xhtml"); }
/** * JSF and Virtual server instance cleanup. * * @throws java.lang.Exception */ public void release() { checkInitialized(); for (FacesRequest request : this.requests) { request.release(); } facesServer.destroy(); Thread.currentThread().setContextClassLoader(contextClassLoader); facesServer = null; application = null; lifecycle = null; initialized = false; }
/** * Setup virtual server connection to run tests inside JSF lifecycle. The default implementation setups virtual * request to the "http://localhost/test.jsf" URL and creates {@link FacesContext} instance. Two template methods * are called : * <ol> * <li>{@link #setupConnection()} to prepare request method, parameters, headers and so</li> * <li>{@link #setupView()} to create default view.</li> * </ol> * * @throws Exception */ public FacesRequest createFacesRequest() throws Exception { String url = "http://localhost/test.jsf"; return createFacesRequest(url).withViewId("/test.xhtml"); }
/** * <p class="changed_added_2_0"> * </p> * * @param url * @throws MalformedURLException * @throws FacesException */ public FacesRequest createFacesRequest(String url) throws MalformedURLException, FacesException { FacesRequest request = new FacesRequest(); request.connection = getServer().getConnection(new URL(url)); requests.add(request); return request; }