Tabnine Logo
RoutingService.redirectRequestToStub
Code IndexAdd Tabnine to your IDE (free)

How to use
redirectRequestToStub
method
in
com.epam.wilma.router.RoutingService

Best Java code snippets using com.epam.wilma.router.RoutingService.redirectRequestToStub (Showing top 8 results out of 315)

origin: epam/Wilma

/**
* Redirects requests by changing their URI.
* @param request the request that is redirected
*/
public void reroute(final WilmaHttpRequest request) {
  if (routingService.redirectRequestToStub(request)) {
    try {
      request.setUri(getURI());
    } catch (URISyntaxException e) {
      logger.error(e.getMessage());
    }
  }
}
origin: epam/Wilma

@Test
public void testRerouteWhenUriNotCorrectShouldLogError() throws URISyntaxException {
  //GIVEN
  doThrow(new URISyntaxException("", "")).when(underTest).getURI();
  given(routingService.redirectRequestToStub(request)).willReturn(true);
  //WHEN
  underTest.reroute(request);
  //THEN
  verify(logger).error(Mockito.anyString());
}
origin: epam/Wilma

@Test
public void testRerouteShouldNotSetNewUri() throws URISyntaxException {
  //GIVEN
  uri = new URI("http://127.0.0.1:" + internalPort + "/stub/");
  given(routingService.redirectRequestToStub(request)).willReturn(false);
  //WHEN
  underTest.reroute(request);
  //TEST
  verify(request, times(0)).setUri(uri);
}
origin: epam/Wilma

@Test
public void testRerouteShouldSetNewUri() throws URISyntaxException {
  //GIVEN
  uri = new URI("http://127.0.0.1:" + internalPort + "/stub/");
  given(routingService.redirectRequestToStub(request)).willReturn(true);
  //WHEN
  underTest.reroute(request);
  //TEST
  verify(request).setUri(uri);
}
origin: epam/Wilma

@Test
public void testRerouteShouldReturnRequestWithNewUri() throws URISyntaxException {
  //GIVEN
  uri = new URI("http://127.0.0.1:" + internalPort + "/stub/");
  given(request.getUri()).willReturn(uri);
  given(routingService.redirectRequestToStub(request)).willReturn(true);
  //WHEN
  underTest.reroute(request);
  //TEST
  verify(request).setUri(uri);
}
origin: epam/Wilma

@Test
public void testRedirectRequestToStubShouldReturnTrueWhenNewResponseDescriptorIsCreated() {
  //GIVEN
  requestBody = MSG_ID;
  given(request.getBody()).willReturn(requestBody);
  given(stubDescriptorEvaluator.findResponseDescriptor(stubDescriptors, request)).willReturn(responseDescriptorDTO);
  //WHEN
  boolean actual = underTest.redirectRequestToStub(request);
  //THEN
  assertEquals(actual, true);
}
origin: epam/Wilma

@Test
public void testRedirectRequestToStubShouldReturnFalseWhenResponseDescriptorIsNull() {
  //GIVEN
  given(request.getBody()).willReturn(requestBody);
  given(stubDescriptorEvaluator.findResponseDescriptor(stubDescriptors, request)).willReturn(null);
  //WHEN
  boolean actual = underTest.redirectRequestToStub(request);
  //THEN
  assertEquals(actual, false);
}
origin: epam/Wilma

@Test
public void testRedirectRequestToStubShouldCallStubModeEvaluatorGetResponseDescriptorForStubModeMethod() {
  //GIVEN
  Whitebox.setInternalState(underTest, "operationMode", OperationMode.STUB);
  given(request.getBody()).willReturn(requestBody);
  given(stubDescriptorEvaluator.findResponseDescriptor(stubDescriptors, request)).willReturn(null);
  //WHEN
  underTest.redirectRequestToStub(request);
  //THEN
  verify(stubModeEvaluator).getResponseDescriptorForStubMode(request, OperationMode.STUB);
}
com.epam.wilma.routerRoutingServiceredirectRequestToStub

Javadoc

Redirects requests based on their content. If a request needs to be redirected to the stub, it will be added to a map that will provide response information for the stub.

Popular methods of RoutingService

  • performModification
    This method execute the given command. The given command is any operation which works with the stubD
  • getStubDescriptors
  • getResponseDescriptorDTOAndRemove
    Reads a value matched to a key from the response descriptor map and if the value is found it deletes
  • setOperationMode
    Sets the new operation mode.
  • isStubModeOn
  • getOperationMode
  • saveInResponseDescriptorMap

Popular in Java

  • Start an intent from android
  • getResourceAsStream (ClassLoader)
  • setContentView (Activity)
  • findViewById (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top 12 Jupyter Notebook extensions
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