This commit is contained in:
2022-06-10 21:38:30 +09:00
commit 27f5152838
51323 changed files with 12934539 additions and 0 deletions
@@ -0,0 +1,70 @@
.class public Lcom/google/api/client/testing/http/FixedClock;
.super Ljava/lang/Object;
.source "FixedClock.java"
# interfaces
.implements Lcom/google/api/client/util/Clock;
# annotations
.annotation build Lcom/google/api/client/util/Beta;
.end annotation
# instance fields
.field private currentTime:Ljava/util/concurrent/atomic/AtomicLong;
# direct methods
.method public constructor <init>()V
.locals 2
const-wide/16 v0, 0x0
.line 1
invoke-direct {p0, v0, v1}, Lcom/google/api/client/testing/http/FixedClock;-><init>(J)V
return-void
.end method
.method public constructor <init>(J)V
.locals 1
.line 2
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 3
new-instance v0, Ljava/util/concurrent/atomic/AtomicLong;
invoke-direct {v0, p1, p2}, Ljava/util/concurrent/atomic/AtomicLong;-><init>(J)V
iput-object v0, p0, Lcom/google/api/client/testing/http/FixedClock;->currentTime:Ljava/util/concurrent/atomic/AtomicLong;
return-void
.end method
# virtual methods
.method public currentTimeMillis()J
.locals 2
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/FixedClock;->currentTime:Ljava/util/concurrent/atomic/AtomicLong;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicLong;->get()J
move-result-wide v0
return-wide v0
.end method
.method public setTime(J)Lcom/google/api/client/testing/http/FixedClock;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/FixedClock;->currentTime:Ljava/util/concurrent/atomic/AtomicLong;
invoke-virtual {v0, p1, p2}, Ljava/util/concurrent/atomic/AtomicLong;->set(J)V
return-object p0
.end method
@@ -0,0 +1,40 @@
.class public final Lcom/google/api/client/testing/http/HttpTesting;
.super Ljava/lang/Object;
.source "HttpTesting.java"
# annotations
.annotation build Lcom/google/api/client/util/Beta;
.end annotation
# static fields
.field public static final SIMPLE_GENERIC_URL:Lcom/google/api/client/http/GenericUrl;
.field public static final SIMPLE_URL:Ljava/lang/String; = "http://google.com/"
# direct methods
.method public static constructor <clinit>()V
.locals 2
.line 1
new-instance v0, Lcom/google/api/client/http/GenericUrl;
const-string v1, "http://google.com/"
invoke-direct {v0, v1}, Lcom/google/api/client/http/GenericUrl;-><init>(Ljava/lang/String;)V
sput-object v0, Lcom/google/api/client/testing/http/HttpTesting;->SIMPLE_GENERIC_URL:Lcom/google/api/client/http/GenericUrl;
return-void
.end method
.method private constructor <init>()V
.locals 0
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
@@ -0,0 +1,153 @@
.class public Lcom/google/api/client/testing/http/MockHttpContent;
.super Ljava/lang/Object;
.source "MockHttpContent.java"
# interfaces
.implements Lcom/google/api/client/http/HttpContent;
# annotations
.annotation build Lcom/google/api/client/util/Beta;
.end annotation
# instance fields
.field private content:[B
.field private length:J
.field private type:Ljava/lang/String;
# direct methods
.method public constructor <init>()V
.locals 2
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const-wide/16 v0, -0x1
.line 2
iput-wide v0, p0, Lcom/google/api/client/testing/http/MockHttpContent;->length:J
const/4 v0, 0x0
new-array v0, v0, [B
.line 3
iput-object v0, p0, Lcom/google/api/client/testing/http/MockHttpContent;->content:[B
return-void
.end method
# virtual methods
.method public final getContent()[B
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockHttpContent;->content:[B
return-object v0
.end method
.method public getLength()J
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget-wide v0, p0, Lcom/google/api/client/testing/http/MockHttpContent;->length:J
return-wide v0
.end method
.method public getType()Ljava/lang/String;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockHttpContent;->type:Ljava/lang/String;
return-object v0
.end method
.method public retrySupported()Z
.locals 1
const/4 v0, 0x1
return v0
.end method
.method public setContent([B)Lcom/google/api/client/testing/http/MockHttpContent;
.locals 0
.line 1
invoke-static {p1}, Lcom/google/api/client/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, [B
iput-object p1, p0, Lcom/google/api/client/testing/http/MockHttpContent;->content:[B
return-object p0
.end method
.method public setLength(J)Lcom/google/api/client/testing/http/MockHttpContent;
.locals 2
const-wide/16 v0, -0x1
cmp-long v0, p1, v0
if-ltz v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
.line 1
:goto_0
invoke-static {v0}, Lcom/google/api/client/util/Preconditions;->checkArgument(Z)V
.line 2
iput-wide p1, p0, Lcom/google/api/client/testing/http/MockHttpContent;->length:J
return-object p0
.end method
.method public setType(Ljava/lang/String;)Lcom/google/api/client/testing/http/MockHttpContent;
.locals 0
.line 1
iput-object p1, p0, Lcom/google/api/client/testing/http/MockHttpContent;->type:Ljava/lang/String;
return-object p0
.end method
.method public writeTo(Ljava/io/OutputStream;)V
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockHttpContent;->content:[B
invoke-virtual {p1, v0}, Ljava/io/OutputStream;->write([B)V
.line 2
invoke-virtual {p1}, Ljava/io/OutputStream;->flush()V
return-void
.end method
@@ -0,0 +1,162 @@
.class public Lcom/google/api/client/testing/http/MockHttpTransport$Builder;
.super Ljava/lang/Object;
.source "MockHttpTransport.java"
# annotations
.annotation build Lcom/google/api/client/util/Beta;
.end annotation
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/google/api/client/testing/http/MockHttpTransport;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x9
name = "Builder"
.end annotation
# instance fields
.field public lowLevelHttpRequest:Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
.field public lowLevelHttpResponse:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.field public supportedMethods:Ljava/util/Set;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Set<",
"Ljava/lang/String;",
">;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>()V
.locals 0
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
# virtual methods
.method public build()Lcom/google/api/client/testing/http/MockHttpTransport;
.locals 1
.line 1
new-instance v0, Lcom/google/api/client/testing/http/MockHttpTransport;
invoke-direct {v0, p0}, Lcom/google/api/client/testing/http/MockHttpTransport;-><init>(Lcom/google/api/client/testing/http/MockHttpTransport$Builder;)V
return-object v0
.end method
.method public final getLowLevelHttpRequest()Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockHttpTransport$Builder;->lowLevelHttpRequest:Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
return-object v0
.end method
.method public getLowLevelHttpResponse()Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockHttpTransport$Builder;->lowLevelHttpResponse:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
return-object v0
.end method
.method public final getSupportedMethods()Ljava/util/Set;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/Set<",
"Ljava/lang/String;",
">;"
}
.end annotation
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockHttpTransport$Builder;->supportedMethods:Ljava/util/Set;
return-object v0
.end method
.method public final setLowLevelHttpRequest(Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;)Lcom/google/api/client/testing/http/MockHttpTransport$Builder;
.locals 2
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockHttpTransport$Builder;->lowLevelHttpResponse:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
if-nez v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
const-string v1, "Cannnot set a low level HTTP request when a low level HTTP response has been set."
invoke-static {v0, v1}, Lcom/google/api/client/util/Preconditions;->checkState(ZLjava/lang/Object;)V
.line 2
iput-object p1, p0, Lcom/google/api/client/testing/http/MockHttpTransport$Builder;->lowLevelHttpRequest:Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
return-object p0
.end method
.method public final setLowLevelHttpResponse(Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;)Lcom/google/api/client/testing/http/MockHttpTransport$Builder;
.locals 2
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockHttpTransport$Builder;->lowLevelHttpRequest:Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
if-nez v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
const-string v1, "Cannot set a low level HTTP response when a low level HTTP request has been set."
invoke-static {v0, v1}, Lcom/google/api/client/util/Preconditions;->checkState(ZLjava/lang/Object;)V
.line 2
iput-object p1, p0, Lcom/google/api/client/testing/http/MockHttpTransport$Builder;->lowLevelHttpResponse:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
return-object p0
.end method
.method public final setSupportedMethods(Ljava/util/Set;)Lcom/google/api/client/testing/http/MockHttpTransport$Builder;
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/Set<",
"Ljava/lang/String;",
">;)",
"Lcom/google/api/client/testing/http/MockHttpTransport$Builder;"
}
.end annotation
.line 1
iput-object p1, p0, Lcom/google/api/client/testing/http/MockHttpTransport$Builder;->supportedMethods:Ljava/util/Set;
return-object p0
.end method
@@ -0,0 +1,202 @@
.class public Lcom/google/api/client/testing/http/MockHttpTransport;
.super Lcom/google/api/client/http/HttpTransport;
.source "MockHttpTransport.java"
# annotations
.annotation build Lcom/google/api/client/util/Beta;
.end annotation
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/google/api/client/testing/http/MockHttpTransport$Builder;
}
.end annotation
# instance fields
.field private lowLevelHttpRequest:Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
.field private lowLevelHttpResponse:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.field private supportedMethods:Ljava/util/Set;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Set<",
"Ljava/lang/String;",
">;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>()V
.locals 0
.line 1
invoke-direct {p0}, Lcom/google/api/client/http/HttpTransport;-><init>()V
return-void
.end method
.method public constructor <init>(Lcom/google/api/client/testing/http/MockHttpTransport$Builder;)V
.locals 1
.line 2
invoke-direct {p0}, Lcom/google/api/client/http/HttpTransport;-><init>()V
.line 3
iget-object v0, p1, Lcom/google/api/client/testing/http/MockHttpTransport$Builder;->supportedMethods:Ljava/util/Set;
iput-object v0, p0, Lcom/google/api/client/testing/http/MockHttpTransport;->supportedMethods:Ljava/util/Set;
.line 4
iget-object v0, p1, Lcom/google/api/client/testing/http/MockHttpTransport$Builder;->lowLevelHttpRequest:Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
iput-object v0, p0, Lcom/google/api/client/testing/http/MockHttpTransport;->lowLevelHttpRequest:Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
.line 5
iget-object p1, p1, Lcom/google/api/client/testing/http/MockHttpTransport$Builder;->lowLevelHttpResponse:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
iput-object p1, p0, Lcom/google/api/client/testing/http/MockHttpTransport;->lowLevelHttpResponse:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
return-void
.end method
.method public static builder()Lcom/google/api/client/testing/http/MockHttpTransport$Builder;
.locals 1
.annotation runtime Ljava/lang/Deprecated;
.end annotation
.line 1
new-instance v0, Lcom/google/api/client/testing/http/MockHttpTransport$Builder;
invoke-direct {v0}, Lcom/google/api/client/testing/http/MockHttpTransport$Builder;-><init>()V
return-object v0
.end method
# virtual methods
.method public buildRequest(Ljava/lang/String;Ljava/lang/String;)Lcom/google/api/client/http/LowLevelHttpRequest;
.locals 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
invoke-virtual {p0, p1}, Lcom/google/api/client/testing/http/MockHttpTransport;->supportsMethod(Ljava/lang/String;)Z
move-result v0
const/4 v1, 0x1
new-array v1, v1, [Ljava/lang/Object;
const/4 v2, 0x0
aput-object p1, v1, v2
const-string p1, "HTTP method %s not supported"
invoke-static {v0, p1, v1}, Lcom/google/api/client/util/Preconditions;->checkArgument(ZLjava/lang/String;[Ljava/lang/Object;)V
.line 2
iget-object p1, p0, Lcom/google/api/client/testing/http/MockHttpTransport;->lowLevelHttpRequest:Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
if-eqz p1, :cond_0
return-object p1
.line 3
:cond_0
new-instance p1, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
invoke-direct {p1, p2}, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;-><init>(Ljava/lang/String;)V
.line 4
iget-object p2, p0, Lcom/google/api/client/testing/http/MockHttpTransport;->lowLevelHttpResponse:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
if-eqz p2, :cond_1
.line 5
invoke-virtual {p1, p2}, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->setResponse(Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;)Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
:cond_1
return-object p1
.end method
.method public final getLowLevelHttpRequest()Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockHttpTransport;->lowLevelHttpRequest:Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
return-object v0
.end method
.method public final getSupportedMethods()Ljava/util/Set;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/Set<",
"Ljava/lang/String;",
">;"
}
.end annotation
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockHttpTransport;->supportedMethods:Ljava/util/Set;
if-nez v0, :cond_0
const/4 v0, 0x0
goto :goto_0
:cond_0
invoke-static {v0}, Ljava/util/Collections;->unmodifiableSet(Ljava/util/Set;)Ljava/util/Set;
move-result-object v0
:goto_0
return-object v0
.end method
.method public supportsMethod(Ljava/lang/String;)Z
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockHttpTransport;->supportedMethods:Ljava/util/Set;
if-eqz v0, :cond_1
invoke-interface {v0, p1}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z
move-result p1
if-eqz p1, :cond_0
goto :goto_0
:cond_0
const/4 p1, 0x0
goto :goto_1
:cond_1
:goto_0
const/4 p1, 0x1
:goto_1
return p1
.end method
@@ -0,0 +1,61 @@
.class public Lcom/google/api/client/testing/http/MockHttpUnsuccessfulResponseHandler;
.super Ljava/lang/Object;
.source "MockHttpUnsuccessfulResponseHandler.java"
# interfaces
.implements Lcom/google/api/client/http/HttpUnsuccessfulResponseHandler;
# annotations
.annotation build Lcom/google/api/client/util/Beta;
.end annotation
# instance fields
.field private isCalled:Z
.field private successfullyHandleResponse:Z
# direct methods
.method public constructor <init>(Z)V
.locals 0
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 2
iput-boolean p1, p0, Lcom/google/api/client/testing/http/MockHttpUnsuccessfulResponseHandler;->successfullyHandleResponse:Z
return-void
.end method
# virtual methods
.method public handleResponse(Lcom/google/api/client/http/HttpRequest;Lcom/google/api/client/http/HttpResponse;Z)Z
.locals 0
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
const/4 p1, 0x1
.line 1
iput-boolean p1, p0, Lcom/google/api/client/testing/http/MockHttpUnsuccessfulResponseHandler;->isCalled:Z
.line 2
iget-boolean p1, p0, Lcom/google/api/client/testing/http/MockHttpUnsuccessfulResponseHandler;->successfullyHandleResponse:Z
return p1
.end method
.method public isCalled()Z
.locals 1
.line 1
iget-boolean v0, p0, Lcom/google/api/client/testing/http/MockHttpUnsuccessfulResponseHandler;->isCalled:Z
return v0
.end method
@@ -0,0 +1,396 @@
.class public Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
.super Lcom/google/api/client/http/LowLevelHttpRequest;
.source "MockLowLevelHttpRequest.java"
# annotations
.annotation build Lcom/google/api/client/util/Beta;
.end annotation
# instance fields
.field private final headersMap:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/String;",
"Ljava/util/List<",
"Ljava/lang/String;",
">;>;"
}
.end annotation
.end field
.field private response:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.field private url:Ljava/lang/String;
# direct methods
.method public constructor <init>()V
.locals 1
.line 1
invoke-direct {p0}, Lcom/google/api/client/http/LowLevelHttpRequest;-><init>()V
.line 2
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->headersMap:Ljava/util/Map;
.line 3
new-instance v0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
invoke-direct {v0}, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;-><init>()V
iput-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->response:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
return-void
.end method
.method public constructor <init>(Ljava/lang/String;)V
.locals 1
.line 4
invoke-direct {p0}, Lcom/google/api/client/http/LowLevelHttpRequest;-><init>()V
.line 5
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->headersMap:Ljava/util/Map;
.line 6
new-instance v0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
invoke-direct {v0}, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;-><init>()V
iput-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->response:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.line 7
iput-object p1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->url:Ljava/lang/String;
return-void
.end method
# virtual methods
.method public addHeader(Ljava/lang/String;Ljava/lang/String;)V
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
invoke-virtual {p1}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;
move-result-object p1
.line 2
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->headersMap:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/util/List;
if-nez v0, :cond_0
.line 3
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
.line 4
iget-object v1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->headersMap:Ljava/util/Map;
invoke-interface {v1, p1, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 5
:cond_0
invoke-interface {v0, p2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
return-void
.end method
.method public execute()Lcom/google/api/client/http/LowLevelHttpResponse;
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->response:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
return-object v0
.end method
.method public getContentAsString()Ljava/lang/String;
.locals 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
invoke-virtual {p0}, Lcom/google/api/client/http/LowLevelHttpRequest;->getStreamingContent()Lcom/google/api/client/util/StreamingContent;
move-result-object v0
if-nez v0, :cond_0
const-string v0, ""
return-object v0
.line 2
:cond_0
new-instance v0, Ljava/io/ByteArrayOutputStream;
invoke-direct {v0}, Ljava/io/ByteArrayOutputStream;-><init>()V
.line 3
invoke-virtual {p0}, Lcom/google/api/client/http/LowLevelHttpRequest;->getStreamingContent()Lcom/google/api/client/util/StreamingContent;
move-result-object v1
invoke-interface {v1, v0}, Lcom/google/api/client/util/StreamingContent;->writeTo(Ljava/io/OutputStream;)V
.line 4
invoke-virtual {p0}, Lcom/google/api/client/http/LowLevelHttpRequest;->getContentEncoding()Ljava/lang/String;
move-result-object v1
if-eqz v1, :cond_1
const-string v2, "gzip"
.line 5
invoke-virtual {v1, v2}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
move-result v1
if-eqz v1, :cond_1
.line 6
new-instance v1, Ljava/util/zip/GZIPInputStream;
new-instance v2, Ljava/io/ByteArrayInputStream;
invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
move-result-object v0
invoke-direct {v2, v0}, Ljava/io/ByteArrayInputStream;-><init>([B)V
invoke-direct {v1, v2}, Ljava/util/zip/GZIPInputStream;-><init>(Ljava/io/InputStream;)V
.line 7
new-instance v0, Ljava/io/ByteArrayOutputStream;
invoke-direct {v0}, Ljava/io/ByteArrayOutputStream;-><init>()V
.line 8
invoke-static {v1, v0}, Lcom/google/api/client/util/IOUtils;->copy(Ljava/io/InputStream;Ljava/io/OutputStream;)V
.line 9
:cond_1
invoke-virtual {p0}, Lcom/google/api/client/http/LowLevelHttpRequest;->getContentType()Ljava/lang/String;
move-result-object v1
if-eqz v1, :cond_2
.line 10
new-instance v2, Lcom/google/api/client/http/HttpMediaType;
invoke-direct {v2, v1}, Lcom/google/api/client/http/HttpMediaType;-><init>(Ljava/lang/String;)V
goto :goto_0
:cond_2
const/4 v2, 0x0
:goto_0
if-eqz v2, :cond_4
.line 11
invoke-virtual {v2}, Lcom/google/api/client/http/HttpMediaType;->getCharsetParameter()Ljava/nio/charset/Charset;
move-result-object v1
if-nez v1, :cond_3
goto :goto_1
:cond_3
invoke-virtual {v2}, Lcom/google/api/client/http/HttpMediaType;->getCharsetParameter()Ljava/nio/charset/Charset;
move-result-object v1
goto :goto_2
:cond_4
:goto_1
sget-object v1, Lcom/google/api/client/util/Charsets;->ISO_8859_1:Ljava/nio/charset/Charset;
.line 12
:goto_2
invoke-virtual {v1}, Ljava/nio/charset/Charset;->name()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/io/ByteArrayOutputStream;->toString(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method public getFirstHeaderValue(Ljava/lang/String;)Ljava/lang/String;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->headersMap:Ljava/util/Map;
invoke-virtual {p1}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;
move-result-object p1
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Ljava/util/List;
if-nez p1, :cond_0
const/4 p1, 0x0
goto :goto_0
:cond_0
const/4 v0, 0x0
.line 2
invoke-interface {p1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object p1
check-cast p1, Ljava/lang/String;
:goto_0
return-object p1
.end method
.method public getHeaderValues(Ljava/lang/String;)Ljava/util/List;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/String;",
")",
"Ljava/util/List<",
"Ljava/lang/String;",
">;"
}
.end annotation
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->headersMap:Ljava/util/Map;
invoke-virtual {p1}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;
move-result-object p1
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Ljava/util/List;
if-nez p1, :cond_0
.line 2
invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
move-result-object p1
goto :goto_0
:cond_0
invoke-static {p1}, Ljava/util/Collections;->unmodifiableList(Ljava/util/List;)Ljava/util/List;
move-result-object p1
:goto_0
return-object p1
.end method
.method public getHeaders()Ljava/util/Map;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/Map<",
"Ljava/lang/String;",
"Ljava/util/List<",
"Ljava/lang/String;",
">;>;"
}
.end annotation
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->headersMap:Ljava/util/Map;
invoke-static {v0}, Ljava/util/Collections;->unmodifiableMap(Ljava/util/Map;)Ljava/util/Map;
move-result-object v0
return-object v0
.end method
.method public getResponse()Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->response:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
return-object v0
.end method
.method public getUrl()Ljava/lang/String;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->url:Ljava/lang/String;
return-object v0
.end method
.method public setResponse(Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;)Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
.locals 0
.line 1
iput-object p1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->response:Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
return-object p0
.end method
.method public setUrl(Ljava/lang/String;)Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;
.locals 0
.line 1
iput-object p1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpRequest;->url:Ljava/lang/String;
return-object p0
.end method
@@ -0,0 +1,489 @@
.class public Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.super Lcom/google/api/client/http/LowLevelHttpResponse;
.source "MockLowLevelHttpResponse.java"
# annotations
.annotation build Lcom/google/api/client/util/Beta;
.end annotation
# instance fields
.field private content:Ljava/io/InputStream;
.field private contentEncoding:Ljava/lang/String;
.field private contentLength:J
.field private contentType:Ljava/lang/String;
.field private headerNames:Ljava/util/List;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/List<",
"Ljava/lang/String;",
">;"
}
.end annotation
.end field
.field private headerValues:Ljava/util/List;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/List<",
"Ljava/lang/String;",
">;"
}
.end annotation
.end field
.field private isDisconnected:Z
.field private reasonPhrase:Ljava/lang/String;
.field private statusCode:I
# direct methods
.method public constructor <init>()V
.locals 2
.line 1
invoke-direct {p0}, Lcom/google/api/client/http/LowLevelHttpResponse;-><init>()V
const/16 v0, 0xc8
.line 2
iput v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->statusCode:I
.line 3
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
iput-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->headerNames:Ljava/util/List;
.line 4
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
iput-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->headerValues:Ljava/util/List;
const-wide/16 v0, -0x1
.line 5
iput-wide v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->contentLength:J
return-void
.end method
# virtual methods
.method public addHeader(Ljava/lang/String;Ljava/lang/String;)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->headerNames:Ljava/util/List;
invoke-static {p1}, Lcom/google/api/client/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
.line 2
iget-object p1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->headerValues:Ljava/util/List;
invoke-static {p2}, Lcom/google/api/client/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p2
invoke-interface {p1, p2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
return-object p0
.end method
.method public disconnect()V
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
const/4 v0, 0x1
.line 1
iput-boolean v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->isDisconnected:Z
.line 2
invoke-super {p0}, Lcom/google/api/client/http/LowLevelHttpResponse;->disconnect()V
return-void
.end method
.method public getContent()Ljava/io/InputStream;
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->content:Ljava/io/InputStream;
return-object v0
.end method
.method public getContentEncoding()Ljava/lang/String;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->contentEncoding:Ljava/lang/String;
return-object v0
.end method
.method public getContentLength()J
.locals 2
.line 1
iget-wide v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->contentLength:J
return-wide v0
.end method
.method public final getContentType()Ljava/lang/String;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->contentType:Ljava/lang/String;
return-object v0
.end method
.method public getHeaderCount()I
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->headerNames:Ljava/util/List;
invoke-interface {v0}, Ljava/util/List;->size()I
move-result v0
return v0
.end method
.method public getHeaderName(I)Ljava/lang/String;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->headerNames:Ljava/util/List;
invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object p1
check-cast p1, Ljava/lang/String;
return-object p1
.end method
.method public final getHeaderNames()Ljava/util/List;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/List<",
"Ljava/lang/String;",
">;"
}
.end annotation
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->headerNames:Ljava/util/List;
return-object v0
.end method
.method public getHeaderValue(I)Ljava/lang/String;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->headerValues:Ljava/util/List;
invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object p1
check-cast p1, Ljava/lang/String;
return-object p1
.end method
.method public final getHeaderValues()Ljava/util/List;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/List<",
"Ljava/lang/String;",
">;"
}
.end annotation
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->headerValues:Ljava/util/List;
return-object v0
.end method
.method public getReasonPhrase()Ljava/lang/String;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->reasonPhrase:Ljava/lang/String;
return-object v0
.end method
.method public getStatusCode()I
.locals 1
.line 1
iget v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->statusCode:I
return v0
.end method
.method public getStatusLine()Ljava/lang/String;
.locals 2
.line 1
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
.line 2
iget v1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->statusCode:I
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
.line 3
iget-object v1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->reasonPhrase:Ljava/lang/String;
if-eqz v1, :cond_0
.line 4
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 5
:cond_0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method public isDisconnected()Z
.locals 1
.line 1
iget-boolean v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->isDisconnected:Z
return v0
.end method
.method public setContent(Ljava/io/InputStream;)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 0
.line 5
iput-object p1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->content:Ljava/io/InputStream;
return-object p0
.end method
.method public setContent(Ljava/lang/String;)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 0
if-nez p1, :cond_0
.line 1
invoke-virtual {p0}, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->setZeroContent()Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
move-result-object p1
goto :goto_0
:cond_0
invoke-static {p1}, Lcom/google/api/client/util/StringUtils;->getBytesUtf8(Ljava/lang/String;)[B
move-result-object p1
invoke-virtual {p0, p1}, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->setContent([B)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
move-result-object p1
:goto_0
return-object p1
.end method
.method public setContent([B)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 2
if-nez p1, :cond_0
.line 2
invoke-virtual {p0}, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->setZeroContent()Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
move-result-object p1
return-object p1
.line 3
:cond_0
new-instance v0, Lcom/google/api/client/testing/util/TestableByteArrayInputStream;
invoke-direct {v0, p1}, Lcom/google/api/client/testing/util/TestableByteArrayInputStream;-><init>([B)V
iput-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->content:Ljava/io/InputStream;
.line 4
array-length p1, p1
int-to-long v0, p1
invoke-virtual {p0, v0, v1}, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->setContentLength(J)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
return-object p0
.end method
.method public setContentEncoding(Ljava/lang/String;)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 0
.line 1
iput-object p1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->contentEncoding:Ljava/lang/String;
return-object p0
.end method
.method public setContentLength(J)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 2
.line 1
iput-wide p1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->contentLength:J
const-wide/16 v0, -0x1
cmp-long p1, p1, v0
if-ltz p1, :cond_0
const/4 p1, 0x1
goto :goto_0
:cond_0
const/4 p1, 0x0
.line 2
:goto_0
invoke-static {p1}, Lcom/google/api/client/util/Preconditions;->checkArgument(Z)V
return-object p0
.end method
.method public setContentType(Ljava/lang/String;)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 0
.line 1
iput-object p1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->contentType:Ljava/lang/String;
return-object p0
.end method
.method public setHeaderNames(Ljava/util/List;)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/List<",
"Ljava/lang/String;",
">;)",
"Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;"
}
.end annotation
.line 1
invoke-static {p1}, Lcom/google/api/client/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Ljava/util/List;
iput-object p1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->headerNames:Ljava/util/List;
return-object p0
.end method
.method public setHeaderValues(Ljava/util/List;)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/List<",
"Ljava/lang/String;",
">;)",
"Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;"
}
.end annotation
.line 1
invoke-static {p1}, Lcom/google/api/client/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Ljava/util/List;
iput-object p1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->headerValues:Ljava/util/List;
return-object p0
.end method
.method public setReasonPhrase(Ljava/lang/String;)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 0
.line 1
iput-object p1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->reasonPhrase:Ljava/lang/String;
return-object p0
.end method
.method public setStatusCode(I)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 0
.line 1
iput p1, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->statusCode:I
return-object p0
.end method
.method public setZeroContent()Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
.locals 2
const/4 v0, 0x0
.line 1
iput-object v0, p0, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->content:Ljava/io/InputStream;
const-wide/16 v0, 0x0
.line 2
invoke-virtual {p0, v0, v1}, Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;->setContentLength(J)Lcom/google/api/client/testing/http/MockLowLevelHttpResponse;
return-object p0
.end method
@@ -0,0 +1,64 @@
.class Lcom/google/api/client/testing/http/apache/MockHttpClient$1;
.super Ljava/lang/Object;
.source "MockHttpClient.java"
# interfaces
.implements Lorg/apache/http/client/RequestDirector;
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lcom/google/api/client/testing/http/apache/MockHttpClient;->createClientRequestDirector(Lorg/apache/http/protocol/HttpRequestExecutor;Lorg/apache/http/conn/ClientConnectionManager;Lorg/apache/http/ConnectionReuseStrategy;Lorg/apache/http/conn/ConnectionKeepAliveStrategy;Lorg/apache/http/conn/routing/HttpRoutePlanner;Lorg/apache/http/protocol/HttpProcessor;Lorg/apache/http/client/HttpRequestRetryHandler;Lorg/apache/http/client/RedirectHandler;Lorg/apache/http/client/AuthenticationHandler;Lorg/apache/http/client/AuthenticationHandler;Lorg/apache/http/client/UserTokenHandler;Lorg/apache/http/params/HttpParams;)Lorg/apache/http/client/RequestDirector;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x1
name = null
.end annotation
# instance fields
.field public final synthetic this$0:Lcom/google/api/client/testing/http/apache/MockHttpClient;
# direct methods
.method public constructor <init>(Lcom/google/api/client/testing/http/apache/MockHttpClient;)V
.locals 0
.line 1
iput-object p1, p0, Lcom/google/api/client/testing/http/apache/MockHttpClient$1;->this$0:Lcom/google/api/client/testing/http/apache/MockHttpClient;
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
# virtual methods
.method public execute(Lorg/apache/http/HttpHost;Lorg/apache/http/HttpRequest;Lorg/apache/http/protocol/HttpContext;)Lorg/apache/http/HttpResponse;
.locals 1
.annotation build Lcom/google/api/client/util/Beta;
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Lorg/apache/http/HttpException;,
Ljava/io/IOException;
}
.end annotation
.line 1
new-instance p1, Lorg/apache/http/message/BasicHttpResponse;
sget-object p2, Lorg/apache/http/HttpVersion;->HTTP_1_1:Lorg/apache/http/HttpVersion;
iget-object p3, p0, Lcom/google/api/client/testing/http/apache/MockHttpClient$1;->this$0:Lcom/google/api/client/testing/http/apache/MockHttpClient;
iget p3, p3, Lcom/google/api/client/testing/http/apache/MockHttpClient;->responseCode:I
const/4 v0, 0x0
invoke-direct {p1, p2, p3, v0}, Lorg/apache/http/message/BasicHttpResponse;-><init>(Lorg/apache/http/ProtocolVersion;ILjava/lang/String;)V
return-object p1
.end method
@@ -0,0 +1,67 @@
.class public Lcom/google/api/client/testing/http/apache/MockHttpClient;
.super Lorg/apache/http/impl/client/DefaultHttpClient;
.source "MockHttpClient.java"
# annotations
.annotation build Lcom/google/api/client/util/Beta;
.end annotation
# instance fields
.field public responseCode:I
# direct methods
.method public constructor <init>()V
.locals 0
.line 1
invoke-direct {p0}, Lorg/apache/http/impl/client/DefaultHttpClient;-><init>()V
return-void
.end method
# virtual methods
.method public createClientRequestDirector(Lorg/apache/http/protocol/HttpRequestExecutor;Lorg/apache/http/conn/ClientConnectionManager;Lorg/apache/http/ConnectionReuseStrategy;Lorg/apache/http/conn/ConnectionKeepAliveStrategy;Lorg/apache/http/conn/routing/HttpRoutePlanner;Lorg/apache/http/protocol/HttpProcessor;Lorg/apache/http/client/HttpRequestRetryHandler;Lorg/apache/http/client/RedirectHandler;Lorg/apache/http/client/AuthenticationHandler;Lorg/apache/http/client/AuthenticationHandler;Lorg/apache/http/client/UserTokenHandler;Lorg/apache/http/params/HttpParams;)Lorg/apache/http/client/RequestDirector;
.locals 0
.line 1
new-instance p1, Lcom/google/api/client/testing/http/apache/MockHttpClient$1;
invoke-direct {p1, p0}, Lcom/google/api/client/testing/http/apache/MockHttpClient$1;-><init>(Lcom/google/api/client/testing/http/apache/MockHttpClient;)V
return-object p1
.end method
.method public final getResponseCode()I
.locals 1
.line 1
iget v0, p0, Lcom/google/api/client/testing/http/apache/MockHttpClient;->responseCode:I
return v0
.end method
.method public setResponseCode(I)Lcom/google/api/client/testing/http/apache/MockHttpClient;
.locals 1
if-ltz p1, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
.line 1
:goto_0
invoke-static {v0}, Lcom/google/api/client/util/Preconditions;->checkArgument(Z)V
.line 2
iput p1, p0, Lcom/google/api/client/testing/http/apache/MockHttpClient;->responseCode:I
return-object p0
.end method
@@ -0,0 +1,389 @@
.class public Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;
.super Ljava/net/HttpURLConnection;
.source "MockHttpURLConnection.java"
# annotations
.annotation build Lcom/google/api/client/util/Beta;
.end annotation
# static fields
.field public static final ERROR_BUF:[B
.annotation runtime Ljava/lang/Deprecated;
.end annotation
.end field
.field public static final INPUT_BUF:[B
.annotation runtime Ljava/lang/Deprecated;
.end annotation
.end field
# instance fields
.field private doOutputCalled:Z
.field private errorStream:Ljava/io/InputStream;
.field private headers:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/String;",
"Ljava/util/List<",
"Ljava/lang/String;",
">;>;"
}
.end annotation
.end field
.field private inputStream:Ljava/io/InputStream;
.field private outputStream:Ljava/io/OutputStream;
# direct methods
.method public static constructor <clinit>()V
.locals 1
const/4 v0, 0x1
new-array v0, v0, [B
.line 1
sput-object v0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->INPUT_BUF:[B
const/4 v0, 0x5
new-array v0, v0, [B
.line 2
sput-object v0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->ERROR_BUF:[B
return-void
.end method
.method public constructor <init>(Ljava/net/URL;)V
.locals 1
.line 1
invoke-direct {p0, p1}, Ljava/net/HttpURLConnection;-><init>(Ljava/net/URL;)V
.line 2
new-instance p1, Ljava/io/ByteArrayOutputStream;
const/4 v0, 0x0
invoke-direct {p1, v0}, Ljava/io/ByteArrayOutputStream;-><init>(I)V
iput-object p1, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->outputStream:Ljava/io/OutputStream;
const/4 p1, 0x0
.line 3
iput-object p1, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->inputStream:Ljava/io/InputStream;
.line 4
iput-object p1, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->errorStream:Ljava/io/InputStream;
.line 5
new-instance p1, Ljava/util/LinkedHashMap;
invoke-direct {p1}, Ljava/util/LinkedHashMap;-><init>()V
iput-object p1, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->headers:Ljava/util/Map;
return-void
.end method
# virtual methods
.method public addHeader(Ljava/lang/String;Ljava/lang/String;)Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;
.locals 1
.line 1
invoke-static {p1}, Lcom/google/api/client/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 2
invoke-static {p2}, Lcom/google/api/client/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 3
iget-object v0, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->headers:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
.line 4
iget-object v0, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->headers:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Ljava/util/List;
invoke-interface {p1, p2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
goto :goto_0
.line 5
:cond_0
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
.line 6
invoke-virtual {v0, p2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
.line 7
iget-object p2, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->headers:Ljava/util/Map;
invoke-interface {p2, p1, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
:goto_0
return-object p0
.end method
.method public connect()V
.locals 0
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
return-void
.end method
.method public disconnect()V
.locals 0
return-void
.end method
.method public final doOutputCalled()Z
.locals 1
.line 1
iget-boolean v0, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->doOutputCalled:Z
return v0
.end method
.method public getErrorStream()Ljava/io/InputStream;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->errorStream:Ljava/io/InputStream;
return-object v0
.end method
.method public getHeaderField(Ljava/lang/String;)Ljava/lang/String;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->headers:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Ljava/util/List;
if-nez p1, :cond_0
const/4 p1, 0x0
goto :goto_0
:cond_0
const/4 v0, 0x0
.line 2
invoke-interface {p1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object p1
check-cast p1, Ljava/lang/String;
:goto_0
return-object p1
.end method
.method public getHeaderFields()Ljava/util/Map;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/Map<",
"Ljava/lang/String;",
"Ljava/util/List<",
"Ljava/lang/String;",
">;>;"
}
.end annotation
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->headers:Ljava/util/Map;
return-object v0
.end method
.method public getInputStream()Ljava/io/InputStream;
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget v0, p0, Ljava/net/HttpURLConnection;->responseCode:I
const/16 v1, 0x190
if-ge v0, v1, :cond_0
.line 2
iget-object v0, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->inputStream:Ljava/io/InputStream;
return-object v0
.line 3
:cond_0
new-instance v0, Ljava/io/IOException;
invoke-direct {v0}, Ljava/io/IOException;-><init>()V
throw v0
.end method
.method public getOutputStream()Ljava/io/OutputStream;
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget-object v0, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->outputStream:Ljava/io/OutputStream;
if-eqz v0, :cond_0
return-object v0
.line 2
:cond_0
invoke-super {p0}, Ljava/net/HttpURLConnection;->getOutputStream()Ljava/io/OutputStream;
move-result-object v0
return-object v0
.end method
.method public getResponseCode()I
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget v0, p0, Ljava/net/HttpURLConnection;->responseCode:I
return v0
.end method
.method public setDoOutput(Z)V
.locals 0
const/4 p1, 0x1
.line 1
iput-boolean p1, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->doOutputCalled:Z
return-void
.end method
.method public setErrorStream(Ljava/io/InputStream;)Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;
.locals 1
.line 1
invoke-static {p1}, Lcom/google/api/client/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 2
iget-object v0, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->errorStream:Ljava/io/InputStream;
if-nez v0, :cond_0
.line 3
iput-object p1, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->errorStream:Ljava/io/InputStream;
:cond_0
return-object p0
.end method
.method public setInputStream(Ljava/io/InputStream;)Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;
.locals 1
.line 1
invoke-static {p1}, Lcom/google/api/client/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 2
iget-object v0, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->inputStream:Ljava/io/InputStream;
if-nez v0, :cond_0
.line 3
iput-object p1, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->inputStream:Ljava/io/InputStream;
:cond_0
return-object p0
.end method
.method public setOutputStream(Ljava/io/OutputStream;)Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;
.locals 0
.line 1
iput-object p1, p0, Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;->outputStream:Ljava/io/OutputStream;
return-object p0
.end method
.method public setResponseCode(I)Lcom/google/api/client/testing/http/javanet/MockHttpURLConnection;
.locals 1
const/4 v0, -0x1
if-lt p1, v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
.line 1
:goto_0
invoke-static {v0}, Lcom/google/api/client/util/Preconditions;->checkArgument(Z)V
.line 2
iput p1, p0, Ljava/net/HttpURLConnection;->responseCode:I
return-object p0
.end method
.method public usingProxy()Z
.locals 1
const/4 v0, 0x0
return v0
.end method