Tabnine Logo
ServletUnitClient.newInvocation
Code IndexAdd Tabnine to your IDE (free)

How to use
newInvocation
method
in
com.meterware.servletunit.ServletUnitClient

Best Java code snippets using com.meterware.servletunit.ServletUnitClient.newInvocation (Showing top 12 results out of 315)

origin: webx/citrus

public void request(WebRequest webRequest) {
  try {
    invocationContext = client.newInvocation(webRequest);
    rawRequest = new MyHttpRequest(invocationContext.getRequest(), webRequest.getURL().toExternalForm());
    rawResponse = new MyHttpResponse(invocationContext.getResponse());
    servletContext = invocationContext.getServlet().getServletConfig().getServletContext();
  } catch (RuntimeException e) {
    throw e;
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
  if (requestContexts != null) {
    requestContext = requestContexts.getRequestContext(servletContext, rawRequest, rawResponse);
  }
}
origin: webx/citrus

public void request(WebRequest webRequest) {
  try {
    invocationContext = client.newInvocation(webRequest);
    rawRequest = new MyHttpRequest(invocationContext.getRequest(), webRequest.getURL().toExternalForm());
    rawResponse = new MyHttpResponse(invocationContext.getResponse());
    servletContext = invocationContext.getServlet().getServletConfig().getServletContext();
  } catch (RuntimeException e) {
    throw e;
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
  if (requestContexts != null) {
    requestContext = requestContexts.getRequestContext(servletContext, rawRequest, rawResponse);
  }
}
origin: TEAMMATES/teammates

@Deprecated
private InvocationContext invokeWebRequest(String uri, String... parameters) {
  // This is not testing servlet, so any HTTP method suffices
  WebRequest request = new PostMethodWebRequest(SIMULATION_BASE_URL + uri);
  // TODO remove this portion once front-end migration is finished
  // Reason: CSRF protection is not part of action tests
  if (Const.SystemParams.PAGES_REQUIRING_ORIGIN_VALIDATION.contains(uri)) {
    request.setHeaderField("referer", SIMULATION_BASE_URL);
    String sessionId = sc.getSession(true).getId();
    String token = StringHelper.encrypt(sessionId);
    request.setParameter(Const.ParamsNames.SESSION_TOKEN, token);
  }
  Map<String, List<String>> paramMultiMap = new HashMap<>();
  for (int i = 0; i < parameters.length; i = i + 2) {
    paramMultiMap.computeIfAbsent(parameters[i], k -> new ArrayList<>()).add(parameters[i + 1]);
  }
  paramMultiMap.forEach((key, values) -> request.setParameter(key, values.toArray(new String[0])));
  try {
    return sc.newInvocation(request);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
origin: httpunit/httpunit

/**
 * Creates and returns a new invocation context to test calling of servlet methods.
 **/
public InvocationContext newInvocation( WebRequest request ) throws IOException, MalformedURLException {
  return newInvocation( request, FrameSelector.TOP_FRAME );
}
origin: org.kohsuke.httpunit/httpunit

/**
 * Creates and returns a new invocation context to test calling of servlet methods.
 **/
public InvocationContext newInvocation( WebRequest request ) throws IOException, MalformedURLException {
  return newInvocation( request, FrameSelector.TOP_FRAME );
}
origin: javanettasks/httpunit

/**
 * Creates and returns a new invocation context to test calling of servlet methods.
 **/
public InvocationContext newInvocation( WebRequest request ) throws IOException, MalformedURLException {
  return newInvocation( request, FrameSelector.TOP_FRAME );
}
origin: httpunit/httpunit

/**
 * Creates and returns a new invocation context from a GET request.
 **/
public InvocationContext newInvocation( String requestString ) throws IOException, MalformedURLException {
  return newInvocation( new GetMethodWebRequest( requestString ) );
}
origin: javanettasks/httpunit

/**
 * Creates and returns a new invocation context from a GET request.
 **/
public InvocationContext newInvocation( String requestString ) throws IOException, MalformedURLException {
  return newInvocation( new GetMethodWebRequest( requestString ) );
}
origin: org.kohsuke.httpunit/httpunit

/**
 * Creates and returns a new invocation context from a GET request.
 **/
public InvocationContext newInvocation( String requestString ) throws IOException, MalformedURLException {
  return newInvocation( new GetMethodWebRequest( requestString ) );
}
origin: httpunit/httpunit

/**
 * Creates a web response object which represents the response to the specified web request.
 **/
protected WebResponse newResponse( WebRequest request, FrameSelector targetFrame ) throws MalformedURLException,IOException {
  try {
    InvocationContext invocation = newInvocation( request, targetFrame );
    invocation.service();
    return invocation.getServletResponse();
  } catch (ServletException e) {
    throw new HttpInternalErrorException( request.getURL(), e );
  }
}
origin: javanettasks/httpunit

/**
 * Creates a web response object which represents the response to the specified web request.
 **/
protected WebResponse newResponse( WebRequest request, FrameSelector targetFrame ) throws MalformedURLException,IOException {
  try {
    InvocationContext invocation = newInvocation( request, targetFrame );
    invocation.service();
    return invocation.getServletResponse();
  } catch (ServletException e) {
    throw new HttpInternalErrorException( request.getURL(), e );
  }
}
origin: org.kohsuke.httpunit/httpunit

/**
 * Creates a web response object which represents the response to the specified web request.
 **/
protected WebResponse newResponse( WebRequest request, FrameSelector targetFrame ) throws MalformedURLException,IOException {
  try {
    InvocationContext invocation = newInvocation( request, targetFrame );
    invocation.service();
    return invocation.getServletResponse();
  } catch (ServletException e) {
    throw new HttpInternalErrorException( request.getURL(), e );
  }
}
com.meterware.servletunitServletUnitClientnewInvocation

Javadoc

Creates and returns a new invocation context to test calling of servlet methods.

Popular methods of ServletUnitClient

  • getResponse
  • getExceptionsThrownOnErrorStatus
  • getSession
    Returns the session that would be used by the next request (if it asks for one).
  • <init>
  • getMessageBody
  • newClient
    Creates and returns a new servlet unit client instance.
  • getCookieValue
  • getFrameContents
  • getHeaderFields
  • putCookie
  • updateMainWindow
  • writeMessageBody
  • updateMainWindow,
  • writeMessageBody,
  • setExceptionsThrownOnErrorStatus

Popular in Java

  • Reactive rest calls using spring rest template
  • getSharedPreferences (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • notifyDataSetChanged (ArrayAdapter)
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now