Examples of HttpCommand


Examples of com.betfair.cougar.transport.api.protocol.http.HttpCommand

            return contentType;
        }
    }

    private void logAccess(HttpServletRequest request, HttpServletResponse response, long bytesWritten, ResponseCode responseCode, RequestTimer timer) {
        HttpCommand cmd = getHttpCommand(request, response, timer);
        int keyLength = 0;
        if (request.getScheme().equals("https")) {
            keyLength = SSLRequestUtils.getTransportSecurityStrengthFactor(request, unknownCipherKeyLength);
        }
View Full Code Here

Examples of net.sf.myjaut.cmd.HttpCommand

    public String getLastSupportedVersion() throws NumberFormatException, ValueNotFoundException, CannotCheckVersionException {
        return getXmlProperties().getValue(LAST_SUPPORTED_VERSION_TAG_NAME);
    }

    private XmlProperties getXmlProperties() throws CannotCheckVersionException {
        HttpCommand hc = new HttpCommand(url);
        try {
            hc.addParameter("version", new VersionProvider().getVersion());
        }
        catch (VersionProvisionException exc) {
            throw new CannotCheckVersionException(exc);
        }
        try {
            hc.execute();
        }
        catch (HttpCommandException exc) {
            throw new CannotCheckVersionException(exc);
        }
        return hc.getXmlProperties();
    }
View Full Code Here

Examples of org.jclouds.http.HttpCommand

   private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
            String content, Class<? extends Exception> expected) {

      JenkinsErrorHandler function = new JenkinsErrorHandler();

      HttpCommand command = createMock(HttpCommand.class);
      HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
      HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
      response.getPayload().getContentMetadata().setContentType(contentType);

      expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
      command.setException(classEq(expected));

      replay(command);

      function.handleError(command, response);
View Full Code Here

Examples of org.jclouds.http.HttpCommand

@Test(groups = "unit", testName = "InvalidateSessionAndRetryOn401AndLogoutOnCloseTest")
public class InvalidateSessionAndRetryOn401AndLogoutOnCloseTest {
   @SuppressWarnings("unchecked")
   @Test
   public void test401ShouldInvalidateSessionAndRetry() {
      HttpCommand command = createMock(HttpCommand.class);
      SessionApi sessionApi = createMock(SessionApi.class);
      LoadingCache<Credentials, SessionWithToken> cache = createMock(LoadingCache.class);

      cache.invalidateAll();
      expectLastCall();
      expect(command.incrementFailureCount()).andReturn(1);
      expect(command.isReplayable()).andReturn(true);
      expect(command.getFailureCount()).andReturn(1).atLeastOnce();

      replay(cache, command);

      HttpResponse response = HttpResponse.builder().statusCode(401).build();
View Full Code Here

Examples of org.jclouds.http.HttpCommand

   }

   @SuppressWarnings("unchecked")
   @Test
   public void test403ShouldNotInvalidateSessionOrRetry() {
      HttpCommand command = createMock(HttpCommand.class);
      SessionApi sessionApi = createMock(SessionApi.class);
      LoadingCache<Credentials, SessionWithToken> cache = createMock(LoadingCache.class);

      replay(cache, command);
View Full Code Here

Examples of org.jclouds.http.HttpCommand

   private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
         String content, Class<? extends Exception> expected) {

      VCloudDirectorErrorHandler function = Guice.createInjector().getInstance(VCloudDirectorErrorHandler.class);

      HttpCommand command = createMock(HttpCommand.class);
      HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
      HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
      response.getPayload().getContentMetadata().setContentType(contentType);

      expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
      command.setException(classEq(expected));

      replay(command);

      function.handleError(command, response);
View Full Code Here

Examples of org.jclouds.http.HttpCommand

   private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
         String content, Class<? extends Exception> expected) {

      JoyentCloudErrorHandler function = new JoyentCloudErrorHandler();

      HttpCommand command = createMock(HttpCommand.class);
      HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
      HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
      response.getPayload().getContentMetadata().setContentType(contentType);

      expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
      command.setException(classEq(expected));

      replay(command);

      function.handleError(command, response);
View Full Code Here

Examples of org.jclouds.http.HttpCommand

   private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
            String content, Class<? extends Exception> expected) {

      VPDCErrorHandler function = Guice.createInjector().getInstance(VPDCErrorHandler.class);

      HttpCommand command = createMock(HttpCommand.class);
      HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
      HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
      response.getPayload().getContentMetadata().setContentType(contentType);

      expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
      command.setException(classEq(expected));

      replay(command);

      function.handleError(command, response);
View Full Code Here

Examples of org.jclouds.http.HttpCommand

   private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
         String content, Class<? extends Exception> expected) {

      OpSourceServersErrorHandler function = Guice.createInjector().getInstance(OpSourceServersErrorHandler.class);

      HttpCommand command = createMock(HttpCommand.class);
      HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
      HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
      response.getPayload().getContentMetadata().setContentType(contentType);

      expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
      command.setException(classEq(expected));

      replay(command);

      function.handleError(command, response);
View Full Code Here

Examples of org.jclouds.http.HttpCommand

   private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
            String content, Class<? extends Exception> expected) {

      CDMIErrorHandler function = new CDMIErrorHandler();

      HttpCommand command = createMock(HttpCommand.class);
      HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
      HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
      response.getPayload().getContentMetadata().setContentType(contentType);

      expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
      command.setException(classEq(expected));

      replay(command);

      function.handleError(command, response);
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.