Package by.stub.yaml.stubs

Examples of by.stub.yaml.stubs.StubRequest


                      final HttpServletResponse response) throws IOException, ServletException {
      ConsoleUtils.logIncomingRequest(request);

      baseRequest.setHandled(true);

      final StubRequest assertionStubRequest = StubRequest.createFromHttpServletRequest(request);
      final StubResponse foundStubResponse = stubbedDataManager.findStubResponseFor(assertionStubRequest);
      final StubResponseHandlingStrategy strategyStubResponse = StubsResponseHandlingStrategyFactory.getStrategy(foundStubResponse);
      final HttpServletResponseWithGetStatus wrapper = new HttpServletResponseWithGetStatus(response);

      try {
         strategyStubResponse.handle(wrapper, assertionStubRequest);
      } catch (final Exception ex) {
         HandlerUtils.configureErrorResponse(response, HttpStatus.INTERNAL_SERVER_ERROR_500, ex.toString());
      }

      ConsoleUtils.logOutgoingResponse(assertionStubRequest.getUrl(), wrapper);

   }
View Full Code Here


         .newStubbedResponse()
         .withStatus("301").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();

      assertThat(actualRequest.getUrl()).isEqualTo(url);
   }
View Full Code Here

         .newStubbedResponse()
         .withStatus("301").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();

      assertThat(actualRequest.getMethod()).contains(HttpMethods.GET, HttpMethods.HEAD);
   }
View Full Code Here

         .newStubbedResponse()
         .withStatus("201").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();

      assertThat(actualRequest.getPost()).isEqualTo(stubbedRequestPost);
   }
View Full Code Here

         .withStatus("201").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);

      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();

      assertThat(actualRequest.getFile()).isEqualTo(new byte[]{});
      assertThat(actualRequest.getPostBody()).isEqualTo(expectedPost);
   }
View Full Code Here

         .newStubbedResponse()
         .withStatus("201").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();

      assertThat(actualRequest.getPost()).isEqualTo(stubbedRequestPost);
   }
View Full Code Here

         .newStubbedResponse()
         .withStatus("500").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();
      final MapEntry queryEntryOne = MapEntry.entry(expectedParamOne, expectedParamOneValue);
      final MapEntry queryEntryTwo = MapEntry.entry(expectedParamTwo, expectedParamTwoValue);

      assertThat(actualRequest.getUrl()).contains(fullQueryOne);
      assertThat(actualRequest.getUrl()).contains(fullQueryTwo);
      assertThat(actualRequest.getQuery()).contains(queryEntryOne, queryEntryTwo);
   }
View Full Code Here

         .withStatus("301").build();


      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();

      final String encodedAuthorizationHeader = String.format("%s %s", "Basic", StringUtils.encodeBase64(authorization));
      final MapEntry headerOneEntry = MapEntry.entry("authorization", encodedAuthorizationHeader);

      assertThat(actualRequest.getHeaders()).contains(headerOneEntry);
   }
View Full Code Here

         .withStatus("301").build();


      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();

      final String encodedAuthorizationHeader = String.format("%s %s", "Basic", StringUtils.encodeBase64(authorization));
      final MapEntry headerOneEntry = MapEntry.entry("authorization", encodedAuthorizationHeader);

      assertThat(actualRequest.getHeaders()).contains(headerOneEntry);
   }
View Full Code Here

         .newStubbedResponse()
         .withStatus("201").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();
      final MapEntry queryEntryOne = MapEntry.entry(expectedParamOne, expectedParamOneValue);

      assertThat(actualRequest.getUrl()).contains(fullQueryOne);
      assertThat(actualRequest.getQuery()).contains(queryEntryOne);
   }
View Full Code Here

TOP

Related Classes of by.stub.yaml.stubs.StubRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.