Package by.stub.yaml.stubs

Examples of by.stub.yaml.stubs.StubHttpLifecycle


      final List<StubHttpLifecycle> originalHttpLifecycles = buildHttpLifeCycles("/resource/item/1");
      final boolean resetResult = stubbedDataManager.resetStubHttpLifecycles(originalHttpLifecycles);
      assertThat(resetResult).isTrue();
      assertThat(stubbedDataManager.getStubHttpLifecycles().size()).isNotZero();

      final StubHttpLifecycle matchedHttpLifecycle = stubbedDataManager.getMatchedStubHttpLifecycle(0);
      assertThat(matchedHttpLifecycle).isNotNull();
   }
View Full Code Here


      final List<StubHttpLifecycle> originalHttpLifecycles = buildHttpLifeCycles("/resource/item/1");
      final boolean resetResult = stubbedDataManager.resetStubHttpLifecycles(originalHttpLifecycles);
      assertThat(resetResult).isTrue();
      assertThat(stubbedDataManager.getStubHttpLifecycles().size()).isNotZero();

      final StubHttpLifecycle matchedHttpLifecycle = stubbedDataManager.getMatchedStubHttpLifecycle(9999);
      assertThat(matchedHttpLifecycle).isNull();
   }
View Full Code Here

      final List<StubHttpLifecycle> originalHttpLifecycles = buildHttpLifeCycles("/resource/item/1");
      final boolean resetResult = stubbedDataManager.resetStubHttpLifecycles(originalHttpLifecycles);
      assertThat(resetResult).isTrue();
      assertThat(stubbedDataManager.getStubHttpLifecycles().size()).isNotZero();

      final StubHttpLifecycle deletedHttpLifecycle = stubbedDataManager.deleteStubHttpLifecycleByIndex(0);
      assertThat(deletedHttpLifecycle).isNotNull();
      assertThat(stubbedDataManager.getStubHttpLifecycles().size()).isZero();
   }
View Full Code Here

      assertThat(stubbedRequest.getUrl()).isEqualTo(expectedOriginalUrl);

      final String expectedNewUrl = "/resource/completely/new";
      final List<StubHttpLifecycle> newHttpLifecycles = buildHttpLifeCycles(expectedNewUrl);
      final StubHttpLifecycle newStubHttpLifecycle = newHttpLifecycles.get(0);
      stubbedDataManager.updateStubHttpLifecycleByIndex(0, newStubHttpLifecycle);
      final StubRequest stubbedNewRequest = stubbedDataManager.getStubHttpLifecycles().get(0).getRequest();

      assertThat(stubbedNewRequest.getUrl()).isEqualTo(expectedNewUrl);
   }
View Full Code Here

      assertThat(stubbedRequest.getUrl()).isEqualTo(expectedOriginalUrl);

      final String expectedNewUrl = "/resource/completely/new";
      final List<StubHttpLifecycle> newHttpLifecycles = buildHttpLifeCycles(expectedNewUrl);
      final StubHttpLifecycle newStubHttpLifecycle = newHttpLifecycles.get(0);
      stubbedDataManager.updateStubHttpLifecycleByIndex(10, newStubHttpLifecycle);
   }
View Full Code Here

         REQUEST_BUILDER
            .withUrl(url)
            .withMethodGet()
            .withHeaders("content-type", "application/json")
            .build();
      final StubHttpLifecycle originalHttpLifecycle = new StubHttpLifecycle();
      originalHttpLifecycle.setRequest(originalRequest);
      originalHttpLifecycle.setResponse(StubResponse.newStubResponse());
      final String expectedMarshalledYaml = "This is marshalled yaml snippet";
      originalHttpLifecycle.setHttpLifeCycleAsYaml(expectedMarshalledYaml);

      return new LinkedList<StubHttpLifecycle>() {{
         add(originalHttpLifecycle);
      }};
   }
View Full Code Here


   @SuppressWarnings("unchecked")
   protected StubHttpLifecycle unmarshallYamlNodeToHttpLifeCycle(final Map<String, Object> parentNodesMap) throws Exception {

      final StubHttpLifecycle httpLifecycle = new StubHttpLifecycle();

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

         final Object parentNodeValue = parentNode.getValue();

         if (parentNodeValue instanceof Map) {
            handleMapNode(httpLifecycle, parentNode);

         } else if (parentNodeValue instanceof List) {
            handleListNode(httpLifecycle, parentNode);
         }
      }

      httpLifecycle.setMarshalledYaml(marshallNodeMapToYamlSnippet(parentNodesMap));

      return httpLifecycle;
   }
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();
         final String url = parentStub.getRequest().getUrl();
         final String loadedMsg = String.format("Loaded: %s %s", method, url);
         ANSITerminal.loaded(loadedMsg);
      }

      return httpLifecycles;
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();
         final String url = parentStub.getRequest().getUrl();
         final String loadedMsg = String.format("Loaded: %s %s", method, url);
         ANSITerminal.loaded(loadedMsg);
      }

      return httpLifecycles;
View Full Code Here

      final String htmlTemplateContent = HandlerUtils.getHtmlResourceByName("snippet_request_response_tables");

      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++) {

            String responseTableTitle = (allResponses.size() == 1 ? "response" : String.format("response/%s", sequenceId));

            final StubResponse stubResponse = allResponses.get(sequenceId);
View Full Code Here

TOP

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

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.