Package by.stub.yaml.stubs

Examples of by.stub.yaml.stubs.StubRequest


      stubbedDataManager.resetStubHttpLifecycles(originalHttpLifecycles);

      final StubResponse expectedResponse = stubbedDataManager.getStubHttpLifecycles().get(0).getResponse(true);
      assertThat(expectedResponse.getBody()).isEqualTo(recordingSource);

      final StubRequest matchedRequest = stubbedDataManager.getStubHttpLifecycles().get(0).getRequest();
      when(mockStubbyHttpTransport.fetchRecordableHTTPResponse(eq(matchedRequest), anyString())).thenThrow(Exception.class);

      final StubResponse actualResponse = stubbedDataManager.findStubResponseFor(originalHttpLifecycles.get(0).getRequest());
      assertThat(expectedResponse.getBody()).isEqualTo(recordingSource);
      assertThat(actualResponse.getBody()).isEqualTo(recordingSource);
View Full Code Here


      assertThat(httpCycleCaptor.getValue()).isEqualTo(originalHttpLifecycles);
   }

   private List<StubHttpLifecycle> buildHttpLifeCycles(final String url) {
      final StubRequest originalRequest =
         REQUEST_BUILDER
            .withUrl(url)
            .withMethodGet()
            .withHeaders("content-type", "application/json")
            .build();
View Full Code Here

      return this;
   }

   public StubRequest build() {
      final StubRequest stubRequest = new StubRequest(url, post, file, methods, headers, query);

      this.url = null;
      this.methods = new ArrayList<String>();
      this.post = null;
      this.file = null;
View Full Code Here

   private void handleMapNode(final StubHttpLifecycle stubHttpLifecycle, final Map.Entry<String, Object> parentNode) throws Exception {

      final Map<String, Object> yamlProperties = (Map<String, Object>) parentNode.getValue();

      if (parentNode.getKey().equals(YAML_NODE_REQUEST)) {
         final StubRequest targetStub = unmarshallYamlMapToTargetStub(yamlProperties, StubRequest.class);
         stubHttpLifecycle.setRequest(targetStub);

         ConsoleUtils.logUnmarshalledStubRequest(targetStub);

      } else {
View Full Code Here

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

      baseRequest.setHandled(true);

      final StubRequest assertionStubRequest = StubRequest.createFromHttpServletRequest(request);
      final StubResponse foundStubResponse = dataStore.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, "stubs");

   }
View Full Code Here

      for (final Object rawParentNode : loadedYamlData) {

         final LinkedHashMap<String, LinkedHashMap> parentNode = (LinkedHashMap<String, LinkedHashMap>) rawParentNode;

         final StubHttpLifecycle parentStub = new StubHttpLifecycle(new StubRequest(), new StubResponse());
         httpLifecycles.add(parentStub);

         mapParentYamlNodeToPojo(parentStub, parentNode);

         final ArrayList<String> method = parentStub.getRequest().getMethod();
View Full Code Here

      for (final Object rawParentNode : loadedYamlData) {

         final LinkedHashMap<String, LinkedHashMap> parentNode = (LinkedHashMap<String, LinkedHashMap>) rawParentNode;

         final StubHttpLifecycle parentStub = new StubHttpLifecycle(new StubRequest(), new StubResponse());
         httpLifecycles.add(parentStub);

         mapParentYamlNodeToPojo(parentStub, parentNode);

         final ArrayList<String> method = parentStub.getRequest().getMethod();
View Full Code Here

      for (int cycleIndex = 0; cycleIndex < stubHttpLifecycles.size(); cycleIndex ++) {

         final StubHttpLifecycle stubHttpLifecycle = stubHttpLifecycles.get(cycleIndex);
         final String resourceId = stubHttpLifecycle.getResourceId();
         final StubRequest stubRequest = stubHttpLifecycle.getRequest();
         builder.append(buildPageBodyHtml(resourceId, htmlTemplateContent, "request", ReflectionUtils.getProperties(stubRequest)));

         final List<StubResponse> allResponses = stubHttpLifecycle.getAllResponses();
         for (int sequenceId = 0; sequenceId < allResponses.size(); sequenceId++) {
View Full Code Here

      for (final Object rawParentNode : loadedYamlData) {

         final LinkedHashMap<String, LinkedHashMap> parentNode = (LinkedHashMap<String, LinkedHashMap>) rawParentNode;

         final StubHttpLifecycle parentStub = new StubHttpLifecycle(new StubRequest(), new StubResponse());
         httpLifecycles.add(parentStub);

         mapParentYamlNodeToPojo(parentStub, parentNode);

         final String method = parentStub.getRequest().getMethod();
View Full Code Here

      for (final Map.Entry<String, Object> parent : parentNode.entrySet()) {

         if (parent.getValue() instanceof LinkedHashMap) {

            final Object targetStub = parent.getKey().equals(YAML_NODE_REQUEST) ? new StubRequest() : new StubResponse();
            final Object populatedTargetStub = mapPairValueToRespectiveField(targetStub, (LinkedHashMap<String, Object>) parent.getValue());

            if (parent.getKey().equals(YAML_NODE_REQUEST)) {
               stubHttpLifecycle.setRequest((StubRequest) populatedTargetStub);
            } else {
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.