Examples of StubHttpLifecycle


Examples of by.stub.yaml.stubs.StubHttpLifecycle

         .withQuery(expectedParamTwo, expectedParamTwoValue)
         .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);
View Full Code Here

Examples of by.stub.yaml.stubs.StubHttpLifecycle

         .newStubbedResponse()
         .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

Examples of by.stub.yaml.stubs.StubHttpLifecycle

         .newStubbedResponse()
         .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

Examples of by.stub.yaml.stubs.StubHttpLifecycle

         .withHeaderContentType(contentType)
         .withHeaderLocation(location).build();


      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubResponse actualResponse = actualHttpLifecycle.getResponse(true);
      final MapEntry headerOneEntry = MapEntry.entry("location", location);
      final MapEntry headerTwoEntry = MapEntry.entry("content-type", contentType);

      assertThat(actualResponse.getHeaders()).contains(headerOneEntry);
      assertThat(actualResponse.getHeaders()).contains(headerTwoEntry);
View Full Code Here

Examples of by.stub.yaml.stubs.StubHttpLifecycle

         .withQuery(expectedParamOne, String.format("'%s'", expectedParamOneValue))
         .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

Examples of by.stub.yaml.stubs.StubHttpLifecycle

         .withQuery(expectedParamOne, String.format("\"%s\"", expectedParamOneValue))
         .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

Examples of by.stub.yaml.stubs.StubHttpLifecycle

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(String.format("%s\n%s", cycleOne, cycleTwo));
      assertThat(loadedHttpCycles.size()).isEqualTo(2);

      for (int idx = 0; idx < loadedHttpCycles.size(); idx++) {
         final StubHttpLifecycle cycle = loadedHttpCycles.get(idx);
         final StubResponse cycleResponse = cycle.getResponse(true);

         assertThat(cycleResponse.getHeaders()).containsKey(StubResponse.STUBBY_RESOURCE_ID_HEADER);
         assertThat(cycleResponse.getHeaders().get(StubResponse.STUBBY_RESOURCE_ID_HEADER)).isEqualTo(String.valueOf(idx));
      }
   }
View Full Code Here

Examples of by.stub.yaml.stubs.StubHttpLifecycle

         .build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      assertThat(loadedHttpCycles.size()).isEqualTo(1);

      final StubHttpLifecycle cycle = loadedHttpCycles.get(0);
      final List<StubResponse> allResponses = cycle.getAllResponses();

      for (int idx = 0; idx < allResponses.size(); idx++) {
         final StubResponse sequenceStubResponse = allResponses.get(idx);
         assertThat(sequenceStubResponse.getHeaders()).containsKey(StubResponse.STUBBY_RESOURCE_ID_HEADER);
         assertThat(sequenceStubResponse.getHeaders().get(StubResponse.STUBBY_RESOURCE_ID_HEADER)).isEqualTo(String.valueOf(0));
View Full Code Here

Examples of by.stub.yaml.stubs.StubHttpLifecycle

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(String.format("%s%s%s%s%s", cycleOne, BR, cycleTwo, BR, cycleThree));
      assertThat(loadedHttpCycles.size()).isEqualTo(3);

      for (int resourceId = 0; resourceId < loadedHttpCycles.size(); resourceId++) {
         final StubHttpLifecycle cycle = loadedHttpCycles.get(resourceId);
         final List<StubResponse> allResponses = cycle.getAllResponses();

         for (int sequence = 0; sequence < allResponses.size(); sequence++) {
            final StubResponse sequenceStubResponse = allResponses.get(sequence);
            assertThat(sequenceStubResponse.getHeaders()).containsKey(StubResponse.STUBBY_RESOURCE_ID_HEADER);
            assertThat(sequenceStubResponse.getHeaders().get(StubResponse.STUBBY_RESOURCE_ID_HEADER)).isEqualTo(String.valueOf(resourceId));
View Full Code Here

Examples of by.stub.yaml.stubs.StubHttpLifecycle

      BUILDER.setLength(0);

      final List<StubHttpLifecycle> loadedHttpCycles = loadYamlToDataStore(rawYaml);
      assertThat(loadedHttpCycles.size()).isEqualTo(NUMBER_OF_HTTPCYCLES);

      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(498);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();
      final StubResponse actualResponse = actualHttpLifecycle.getResponse(true);

      assertThat(actualRequest.getUrl()).contains(String.format("%s/%s", baseRequestUrl, 499));
      assertThat(actualRequest.getUrl()).contains(String.format("%s=%s", expectedParamOne, 499));
      assertThat(actualRequest.getUrl()).contains(String.format("%s=%s", expectedParamTwo, 499));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.