public class org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin extends org.apache.drill.test.ClusterTest
{
private static final org.slf4j.Logger logger;
private static final int MOCK_SERVER_PORT;
private static java.lang.String TEST_JSON_RESPONSE_WITH_DATATYPES;
private static java.lang.String ACCESS_TOKEN_RESPONSE;
private static int portNumber;
public static final org.apache.drill.test.BaseDirTestWatcher dirTestWatcher;
public void <init>()
{
org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin v;
v := @this: org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin;
specialinvoke v.<org.apache.drill.test.ClusterTest: void <init>()>();
return;
}
public void cleanup() throws java.lang.Exception
{
org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin v;
org.apache.drill.test.BaseDirTestWatcher v;
java.io.File v;
v := @this: org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin;
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.BaseDirTestWatcher dirTestWatcher>;
v = virtualinvoke v.<org.apache.drill.test.BaseDirTestWatcher: java.io.File getStoreDir()>();
staticinvoke <org.apache.commons.io.FileUtils: void cleanDirectory(java.io.File)>(v);
return;
}
public static void setup() throws java.lang.Exception
{
org.apache.drill.test.BaseDirTestWatcher v;
org.apache.drill.shaded.guava.com.google.common.io.CharSource v, v;
java.lang.Integer v, v, v, v, v, v;
org.apache.drill.common.logical.security.PlainCredentialsProvider v, v;
org.apache.drill.exec.store.http.HttpApiConfig v;
org.apache.drill.common.logical.StoragePluginConfig$AuthMode v, v;
org.apache.drill.test.ClusterFixtureBuilder v, v, v, v;
org.apache.drill.common.logical.OAuthConfig v;
org.apache.drill.exec.server.Drillbit v;
java.util.HashMap v, v, v;
org.apache.drill.common.logical.OAuthConfig$OAuthConfigBuilder v, v;
java.nio.charset.Charset v, v;
org.apache.drill.exec.store.http.HttpApiConfig$HttpApiConfigBuilder v, v, v, v, v, v;
int v;
java.lang.Boolean v, v, v, v, v, v, v;
java.lang.String v, v, v, v, v, v, v;
org.apache.drill.test.ClusterFixture v, v, v;
java.io.File v, v;
org.apache.drill.exec.store.http.HttpStoragePluginConfig v, v;
v = staticinvoke <org.apache.drill.common.util.DrillFileUtils: java.io.File getResourceAsFile(java.lang.String)>("/data/response.json");
v = <org.apache.drill.shaded.guava.com.google.common.base.Charsets: java.nio.charset.Charset UTF_8>;
v = staticinvoke <org.apache.drill.shaded.guava.com.google.common.io.Files: org.apache.drill.shaded.guava.com.google.common.io.CharSource asCharSource(java.io.File,java.nio.charset.Charset)>(v, v);
v = virtualinvoke v.<org.apache.drill.shaded.guava.com.google.common.io.CharSource: java.lang.String read()>();
<org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: java.lang.String TEST_JSON_RESPONSE_WITH_DATATYPES> = v;
v = staticinvoke <org.apache.drill.common.util.DrillFileUtils: java.io.File getResourceAsFile(java.lang.String)>("/data/oauth_access_token_response.json");
v = <org.apache.drill.shaded.guava.com.google.common.base.Charsets: java.nio.charset.Charset UTF_8>;
v = staticinvoke <org.apache.drill.shaded.guava.com.google.common.io.Files: org.apache.drill.shaded.guava.com.google.common.io.CharSource asCharSource(java.io.File,java.nio.charset.Charset)>(v, v);
v = virtualinvoke v.<org.apache.drill.shaded.guava.com.google.common.io.CharSource: java.lang.String read()>();
<org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: java.lang.String ACCESS_TOKEN_RESPONSE> = v;
v = new org.apache.drill.test.ClusterFixtureBuilder;
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.BaseDirTestWatcher dirTestWatcher>;
specialinvoke v.<org.apache.drill.test.ClusterFixtureBuilder: void <init>(org.apache.drill.test.BaseDirTestWatcher)>(v);
v = staticinvoke <java.lang.Boolean: java.lang.Boolean valueOf(boolean)>(1);
v = virtualinvoke v.<org.apache.drill.test.ClusterFixtureBuilder: org.apache.drill.test.ClusterFixtureBuilder configProperty(java.lang.String,java.lang.Object)>("drill.exec.http.enabled", v);
v = staticinvoke <java.lang.Boolean: java.lang.Boolean valueOf(boolean)>(1);
v = virtualinvoke v.<org.apache.drill.test.ClusterFixtureBuilder: org.apache.drill.test.ClusterFixtureBuilder configProperty(java.lang.String,java.lang.Object)>("drill.exec.http.porthunt", v);
v = staticinvoke <java.lang.Boolean: java.lang.Boolean valueOf(boolean)>(1);
v = virtualinvoke v.<org.apache.drill.test.ClusterFixtureBuilder: org.apache.drill.test.ClusterFixtureBuilder configProperty(java.lang.String,java.lang.Object)>("drill.exec.impersonation.enabled", v);
staticinvoke <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: void startCluster(org.apache.drill.test.ClusterFixtureBuilder)>(v);
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.ClusterFixture cluster>;
v = virtualinvoke v.<org.apache.drill.test.ClusterFixture: org.apache.drill.exec.server.Drillbit drillbit()>();
v = virtualinvoke v.<org.apache.drill.exec.server.Drillbit: int getWebServerPort()>();
<org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: int portNumber> = v;
v = staticinvoke <org.apache.drill.exec.store.http.HttpApiConfig: org.apache.drill.exec.store.http.HttpApiConfig$HttpApiConfigBuilder builder()>();
v = staticinvoke <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: java.lang.String makeUrl(java.lang.String)>("http://localhost:%d/json");
v = virtualinvoke v.<org.apache.drill.exec.store.http.HttpApiConfig$HttpApiConfigBuilder: org.apache.drill.exec.store.http.HttpApiConfig$HttpApiConfigBuilder url(java.lang.String)>(v);
v = virtualinvoke v.<org.apache.drill.exec.store.http.HttpApiConfig$HttpApiConfigBuilder: org.apache.drill.exec.store.http.HttpApiConfig$HttpApiConfigBuilder method(java.lang.String)>("GET");
v = virtualinvoke v.<org.apache.drill.exec.store.http.HttpApiConfig$HttpApiConfigBuilder: org.apache.drill.exec.store.http.HttpApiConfig$HttpApiConfigBuilder requireTail(boolean)>(0);
v = virtualinvoke v.<org.apache.drill.exec.store.http.HttpApiConfig$HttpApiConfigBuilder: org.apache.drill.exec.store.http.HttpApiConfig$HttpApiConfigBuilder authType(java.lang.String)>("basic");
v = virtualinvoke v.<org.apache.drill.exec.store.http.HttpApiConfig$HttpApiConfigBuilder: org.apache.drill.exec.store.http.HttpApiConfig$HttpApiConfigBuilder errorOn400(boolean)>(1);
v = virtualinvoke v.<org.apache.drill.exec.store.http.HttpApiConfig$HttpApiConfigBuilder: org.apache.drill.exec.store.http.HttpApiConfig build()>();
v = staticinvoke <org.apache.drill.common.logical.OAuthConfig: org.apache.drill.common.logical.OAuthConfig$OAuthConfigBuilder builder()>();
v = staticinvoke <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: java.lang.String makeUrl(java.lang.String)>("http://localhost:%d");
v = dynamicinvoke "makeConcatWithConstants" <java.lang.String (java.lang.String)>(v) <java.lang.invoke.StringConcatFactory: java.lang.invoke.CallSite makeConcatWithConstants(java.lang.invoke.MethodHandles$Lookup,java.lang.String,java.lang.invoke.MethodType,java.lang.String,java.lang.Object[])>("\u0001/update_oauth2_authtoken");
v = virtualinvoke v.<org.apache.drill.common.logical.OAuthConfig$OAuthConfigBuilder: org.apache.drill.common.logical.OAuthConfig$OAuthConfigBuilder callbackURL(java.lang.String)>(v);
v = virtualinvoke v.<org.apache.drill.common.logical.OAuthConfig$OAuthConfigBuilder: org.apache.drill.common.logical.OAuthConfig build()>();
v = new java.util.HashMap;
specialinvoke v.<java.util.HashMap: void <init>()>();
interfaceinvoke v.<java.util.Map: java.lang.Object put(java.lang.Object,java.lang.Object)>("clientID", "12345");
interfaceinvoke v.<java.util.Map: java.lang.Object put(java.lang.Object,java.lang.Object)>("clientSecret", "54321");
interfaceinvoke v.<java.util.Map: java.lang.Object put(java.lang.Object,java.lang.Object)>("tokenURI", "http://localhost:47778/get_access_token");
v = new org.apache.drill.common.logical.security.PlainCredentialsProvider;
specialinvoke v.<org.apache.drill.common.logical.security.PlainCredentialsProvider: void <init>(java.util.Map)>(v);
v = new java.util.HashMap;
specialinvoke v.<java.util.HashMap: void <init>()>();
interfaceinvoke v.<java.util.Map: java.lang.Object put(java.lang.Object,java.lang.Object)>("sharedEndpoint", v);
v = new java.util.HashMap;
specialinvoke v.<java.util.HashMap: void <init>()>();
interfaceinvoke v.<java.util.Map: java.lang.Object put(java.lang.Object,java.lang.Object)>("username", "user2user");
interfaceinvoke v.<java.util.Map: java.lang.Object put(java.lang.Object,java.lang.Object)>("password", "user2pass");
v = new org.apache.drill.common.logical.security.PlainCredentialsProvider;
specialinvoke v.<org.apache.drill.common.logical.security.PlainCredentialsProvider: void <init>(java.lang.String,java.util.Map)>("testUser2", v);
v = new org.apache.drill.exec.store.http.HttpStoragePluginConfig;
v = staticinvoke <java.lang.Boolean: java.lang.Boolean valueOf(boolean)>(0);
v = staticinvoke <java.lang.Integer: java.lang.Integer valueOf(int)>(2);
v = staticinvoke <java.lang.Integer: java.lang.Integer valueOf(int)>(1000);
v = staticinvoke <java.lang.Integer: java.lang.Integer valueOf(int)>(80);
v = <org.apache.drill.common.logical.StoragePluginConfig$AuthMode: org.apache.drill.common.logical.StoragePluginConfig$AuthMode USER_TRANSLATION>;
v = virtualinvoke v.<org.apache.drill.common.logical.StoragePluginConfig$AuthMode: java.lang.String name()>();
specialinvoke v.<org.apache.drill.exec.store.http.HttpStoragePluginConfig: void <init>(java.lang.Boolean,java.util.Map,java.lang.Integer,java.lang.Integer,java.lang.String,java.lang.String,java.lang.String,java.lang.Integer,java.lang.String,java.lang.String,java.lang.String,org.apache.drill.common.logical.OAuthConfig,org.apache.drill.common.logical.security.CredentialsProvider,java.lang.String)>(v, v, v, v, null, null, "", v, "", "", "", null, v, v);
v = staticinvoke <java.lang.Boolean: java.lang.Boolean valueOf(boolean)>(1);
virtualinvoke v.<org.apache.drill.exec.store.http.HttpStoragePluginConfig: void setEnabled(java.lang.Boolean)>(v);
v = new org.apache.drill.exec.store.http.HttpStoragePluginConfig;
v = staticinvoke <java.lang.Boolean: java.lang.Boolean valueOf(boolean)>(0);
v = staticinvoke <java.lang.Integer: java.lang.Integer valueOf(int)>(2);
v = staticinvoke <java.lang.Integer: java.lang.Integer valueOf(int)>(1000);
v = staticinvoke <java.lang.Integer: java.lang.Integer valueOf(int)>(80);
v = <org.apache.drill.common.logical.StoragePluginConfig$AuthMode: org.apache.drill.common.logical.StoragePluginConfig$AuthMode USER_TRANSLATION>;
v = virtualinvoke v.<org.apache.drill.common.logical.StoragePluginConfig$AuthMode: java.lang.String name()>();
specialinvoke v.<org.apache.drill.exec.store.http.HttpStoragePluginConfig: void <init>(java.lang.Boolean,java.util.Map,java.lang.Integer,java.lang.Integer,java.lang.String,java.lang.String,java.lang.String,java.lang.Integer,java.lang.String,java.lang.String,java.lang.String,org.apache.drill.common.logical.OAuthConfig,org.apache.drill.common.logical.security.CredentialsProvider,java.lang.String)>(v, v, v, v, null, null, "", v, "", "", "", v, v, v);
v = staticinvoke <java.lang.Boolean: java.lang.Boolean valueOf(boolean)>(1);
virtualinvoke v.<org.apache.drill.exec.store.http.HttpStoragePluginConfig: void setEnabled(java.lang.Boolean)>(v);
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.ClusterFixture cluster>;
virtualinvoke v.<org.apache.drill.test.ClusterFixture: void defineStoragePlugin(java.lang.String,org.apache.drill.common.logical.StoragePluginConfig)>("local", v);
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.ClusterFixture cluster>;
virtualinvoke v.<org.apache.drill.test.ClusterFixture: void defineStoragePlugin(java.lang.String,org.apache.drill.common.logical.StoragePluginConfig)>("oauth", v);
return;
}
public void testEmptyUserCredentials() throws java.lang.Exception
{
org.apache.drill.exec.store.StoragePluginRegistry v;
org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin v;
org.apache.drill.exec.store.StoragePlugin v;
org.apache.drill.test.ClusterFixture v, v;
org.apache.drill.common.logical.security.CredentialsProvider v;
org.apache.drill.test.ClientFixture$ClientBuilder v, v, v;
java.util.Map v;
org.apache.drill.common.logical.StoragePluginConfig v;
java.lang.Object v, v;
v := @this: org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin;
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.ClusterFixture cluster>;
v = virtualinvoke v.<org.apache.drill.test.ClusterFixture: org.apache.drill.test.ClientFixture$ClientBuilder clientBuilder()>();
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture$ClientBuilder property(java.lang.String,java.lang.Object)>("user", "testUser1");
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture$ClientBuilder property(java.lang.String,java.lang.Object)>("password", "testUser1Password");
virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture build()>();
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.ClusterFixture cluster>;
v = virtualinvoke v.<org.apache.drill.test.ClusterFixture: org.apache.drill.exec.store.StoragePluginRegistry storageRegistry()>();
v = interfaceinvoke v.<org.apache.drill.exec.store.StoragePluginRegistry: org.apache.drill.exec.store.StoragePlugin getPlugin(java.lang.String)>("local");
v = interfaceinvoke v.<org.apache.drill.exec.store.StoragePlugin: org.apache.drill.common.logical.StoragePluginConfig getConfig()>();
v = virtualinvoke v.<org.apache.drill.common.logical.StoragePluginConfig: org.apache.drill.common.logical.security.CredentialsProvider getCredentialsProvider()>();
v = virtualinvoke v.<org.apache.drill.common.logical.security.PlainCredentialsProvider: java.util.Map getUserCredentials(java.lang.String)>("testUser1");
staticinvoke <org.junit.Assert: void assertNotNull(java.lang.Object)>(v);
v = interfaceinvoke v.<java.util.Map: java.lang.Object get(java.lang.Object)>("username");
staticinvoke <org.junit.Assert: void assertNull(java.lang.Object)>(v);
v = interfaceinvoke v.<java.util.Map: java.lang.Object get(java.lang.Object)>("password");
staticinvoke <org.junit.Assert: void assertNull(java.lang.Object)>(v);
return;
}
public void testQueryWithValidCredentials() throws java.lang.Exception
{
java.lang.Throwable v;
org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin v;
org.apache.drill.test.ClientFixture$ClientBuilder v, v, v;
okhttp.Headers v;
org.apache.drill.exec.physical.rowSet.DirectRowSet v;
int v;
okhttp.mockwebserver.MockWebServer v;
java.lang.String v, v, v;
org.apache.drill.test.ClientFixture v;
org.apache.drill.test.QueryBuilder v, v;
okhttp.mockwebserver.RecordedRequest v;
org.apache.drill.test.ClusterFixture v;
okhttp.mockwebserver.MockResponse v, v, v;
v := @this: org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin;
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.ClusterFixture cluster>;
v = virtualinvoke v.<org.apache.drill.test.ClusterFixture: org.apache.drill.test.ClientFixture$ClientBuilder clientBuilder()>();
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture$ClientBuilder property(java.lang.String,java.lang.Object)>("user", "testUser2");
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture$ClientBuilder property(java.lang.String,java.lang.Object)>("password", "testUser2Password");
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture build()>();
v = staticinvoke <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: okhttp.mockwebserver.MockWebServer startServer()>();
label:
v = new okhttp.mockwebserver.MockResponse;
specialinvoke v.<okhttp.mockwebserver.MockResponse: void <init>()>();
v = virtualinvoke v.<okhttp.mockwebserver.MockResponse: okhttp.mockwebserver.MockResponse setResponseCode(int)>(200);
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: java.lang.String TEST_JSON_RESPONSE_WITH_DATATYPES>;
v = virtualinvoke v.<okhttp.mockwebserver.MockResponse: okhttp.mockwebserver.MockResponse setBody(java.lang.String)>(v);
virtualinvoke v.<okhttp.mockwebserver.MockWebServer: void enqueue(okhttp.mockwebserver.MockResponse)>(v);
v = virtualinvoke v.<org.apache.drill.test.ClientFixture: org.apache.drill.test.QueryBuilder queryBuilder()>();
v = virtualinvoke v.<org.apache.drill.test.QueryBuilder: org.apache.drill.test.QueryBuilder sql(java.lang.String)>("SELECT * FROM local.sharedEndpoint");
v = virtualinvoke v.<org.apache.drill.test.QueryBuilder: org.apache.drill.exec.physical.rowSet.DirectRowSet rowSet()>();
v = interfaceinvoke v.<org.apache.drill.exec.physical.rowSet.RowSet: int rowCount()>();
staticinvoke <org.junit.Assert: void assertEquals(long,long)>(v, 2L);
interfaceinvoke v.<org.apache.drill.exec.physical.rowSet.RowSet: void clear()>();
v = virtualinvoke v.<okhttp.mockwebserver.MockWebServer: okhttp.mockwebserver.RecordedRequest takeRequest()>();
v = virtualinvoke v.<okhttp.mockwebserver.RecordedRequest: okhttp.Headers getHeaders()>();
v = virtualinvoke v.<okhttp.Headers: java.lang.String get(java.lang.String)>("Authorization");
v = staticinvoke <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: java.lang.String createEncodedText(java.lang.String,java.lang.String)>("user2user", "user2pass");
staticinvoke <org.junit.Assert: void assertEquals(java.lang.Object,java.lang.Object)>(v, v);
label:
virtualinvoke v.<okhttp.mockwebserver.MockWebServer: void close()>();
goto label;
label:
v := @caughtexception;
throw v;
label:
return;
catch java.lang.Throwable from label to label with label;
}
public void testQueryWithMissingCredentials() throws java.lang.Exception
{
java.lang.Throwable v, v;
org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin v;
org.apache.drill.test.ClientFixture$ClientBuilder v, v, v;
okhttp.mockwebserver.MockWebServer v;
java.lang.String v, v;
org.apache.drill.test.ClientFixture v;
boolean v;
org.apache.drill.test.QueryBuilder v, v;
org.apache.drill.test.ClusterFixture v;
okhttp.mockwebserver.MockResponse v, v, v;
v := @this: org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin;
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.ClusterFixture cluster>;
v = virtualinvoke v.<org.apache.drill.test.ClusterFixture: org.apache.drill.test.ClientFixture$ClientBuilder clientBuilder()>();
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture$ClientBuilder property(java.lang.String,java.lang.Object)>("user", "testUser1");
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture$ClientBuilder property(java.lang.String,java.lang.Object)>("password", "testUser1Password");
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture build()>();
v = staticinvoke <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: okhttp.mockwebserver.MockWebServer startServer()>();
label:
v = new okhttp.mockwebserver.MockResponse;
specialinvoke v.<okhttp.mockwebserver.MockResponse: void <init>()>();
v = virtualinvoke v.<okhttp.mockwebserver.MockResponse: okhttp.mockwebserver.MockResponse setResponseCode(int)>(200);
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: java.lang.String TEST_JSON_RESPONSE_WITH_DATATYPES>;
v = virtualinvoke v.<okhttp.mockwebserver.MockResponse: okhttp.mockwebserver.MockResponse setBody(java.lang.String)>(v);
virtualinvoke v.<okhttp.mockwebserver.MockWebServer: void enqueue(okhttp.mockwebserver.MockResponse)>(v);
label:
v = virtualinvoke v.<org.apache.drill.test.ClientFixture: org.apache.drill.test.QueryBuilder queryBuilder()>();
v = virtualinvoke v.<org.apache.drill.test.QueryBuilder: org.apache.drill.test.QueryBuilder sql(java.lang.String)>("SELECT * FROM local.sharedEndpoint");
virtualinvoke v.<org.apache.drill.test.QueryBuilder: org.apache.drill.test.QueryBuilder$QuerySummary run()>();
staticinvoke <org.junit.Assert: void fail()>();
label:
goto label;
label:
v := @caughtexception;
v = virtualinvoke v.<org.apache.drill.common.exceptions.UserException: java.lang.String getMessage()>();
v = virtualinvoke v.<java.lang.String: boolean contains(java.lang.CharSequence)>("You do not have valid credentials for this API.");
staticinvoke <org.junit.Assert: void assertTrue(boolean)>(v);
label:
virtualinvoke v.<okhttp.mockwebserver.MockWebServer: void close()>();
goto label;
label:
v := @caughtexception;
throw v;
label:
return;
catch org.apache.drill.common.exceptions.UserException from label to label with label;
catch java.lang.Throwable from label to label with label;
}
public void testQueryWithOAuth() throws java.lang.Exception
{
org.apache.drill.exec.memory.BufferAllocator v;
org.apache.drill.test.ClientFixture$ClientBuilder v, v, v;
org.apache.drill.exec.record.metadata.SchemaBuilder v, v, v, v;
java.lang.Integer v, v;
org.apache.drill.common.types.TypeProtos$MinorType v, v, v;
org.apache.drill.exec.oauth.PersistentTokenTable v;
okhttp.mockwebserver.MockWebServer v;
okhttp.mockwebserver.RecordedRequest v;
org.apache.drill.exec.physical.rowSet.RowSetBuilder v, v, v;
org.apache.drill.exec.record.metadata.TupleMetadata v;
java.lang.Exception v;
okhttp.mockwebserver.MockResponse v, v, v;
java.lang.Throwable v;
org.apache.drill.exec.store.StoragePluginRegistry v;
org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin v;
java.lang.Object[] v, v;
java.lang.Double v, v;
org.apache.drill.exec.physical.rowSet.DirectRowSet v;
org.apache.drill.common.types.TypeProtos$DataMode v, v, v;
java.lang.String v, v, v, v, v;
org.apache.drill.test.ClientFixture v;
org.apache.drill.test.QueryBuilder v, v;
org.apache.drill.exec.physical.rowSet.RowSet$SingleRowSet v;
org.slf4j.Logger v;
org.apache.drill.exec.oauth.TokenRegistry v;
org.apache.drill.exec.store.StoragePlugin v;
org.apache.drill.test.ClusterFixture v, v;
v := @this: org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin;
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.ClusterFixture cluster>;
v = virtualinvoke v.<org.apache.drill.test.ClusterFixture: org.apache.drill.test.ClientFixture$ClientBuilder clientBuilder()>();
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture$ClientBuilder property(java.lang.String,java.lang.Object)>("user", "testUser2");
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture$ClientBuilder property(java.lang.String,java.lang.Object)>("password", "testUser2Password");
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture build()>();
label:
v = staticinvoke <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: okhttp.mockwebserver.MockWebServer startServer()>();
label:
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.ClusterFixture cluster>;
v = virtualinvoke v.<org.apache.drill.test.ClusterFixture: org.apache.drill.exec.store.StoragePluginRegistry storageRegistry()>();
v = interfaceinvoke v.<org.apache.drill.exec.store.StoragePluginRegistry: org.apache.drill.exec.store.StoragePlugin getPlugin(java.lang.String)>("oauth");
v = virtualinvoke v.<org.apache.drill.exec.store.http.HttpStoragePlugin: org.apache.drill.exec.oauth.TokenRegistry getTokenRegistry(java.lang.String)>("testUser2");
v = interfaceinvoke v.<org.apache.drill.exec.oauth.TokenRegistry: org.apache.drill.exec.oauth.PersistentTokenTable getTokenTable(java.lang.String)>("oauth");
virtualinvoke v.<org.apache.drill.exec.oauth.PersistentTokenTable: void setAccessToken(java.lang.String)>("you_have_access_2");
virtualinvoke v.<org.apache.drill.exec.oauth.PersistentTokenTable: void setRefreshToken(java.lang.String)>("refresh_me_2");
v = virtualinvoke v.<org.apache.drill.exec.oauth.PersistentTokenTable: java.lang.String getAccessToken()>();
staticinvoke <org.junit.Assert: void assertEquals(java.lang.Object,java.lang.Object)>("you_have_access_2", v);
v = virtualinvoke v.<org.apache.drill.exec.oauth.PersistentTokenTable: java.lang.String getRefreshToken()>();
staticinvoke <org.junit.Assert: void assertEquals(java.lang.Object,java.lang.Object)>("refresh_me_2", v);
v = new okhttp.mockwebserver.MockResponse;
specialinvoke v.<okhttp.mockwebserver.MockResponse: void <init>()>();
v = virtualinvoke v.<okhttp.mockwebserver.MockResponse: okhttp.mockwebserver.MockResponse setResponseCode(int)>(200);
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: java.lang.String TEST_JSON_RESPONSE_WITH_DATATYPES>;
v = virtualinvoke v.<okhttp.mockwebserver.MockResponse: okhttp.mockwebserver.MockResponse setBody(java.lang.String)>(v);
virtualinvoke v.<okhttp.mockwebserver.MockWebServer: void enqueue(okhttp.mockwebserver.MockResponse)>(v);
v = virtualinvoke v.<org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.QueryBuilder queryBuilder()>();
v = virtualinvoke v.<org.apache.drill.test.QueryBuilder: org.apache.drill.test.QueryBuilder sql(java.lang.String)>("SELECT * FROM oauth.sharedEndpoint");
v = virtualinvoke v.<org.apache.drill.test.QueryBuilder: org.apache.drill.exec.physical.rowSet.DirectRowSet rowSet()>();
v = new org.apache.drill.exec.record.metadata.SchemaBuilder;
specialinvoke v.<org.apache.drill.exec.record.metadata.SchemaBuilder: void <init>()>();
v = <org.apache.drill.common.types.TypeProtos$MinorType: org.apache.drill.common.types.TypeProtos$MinorType FLOAT8>;
v = <org.apache.drill.common.types.TypeProtos$DataMode: org.apache.drill.common.types.TypeProtos$DataMode OPTIONAL>;
v = virtualinvoke v.<org.apache.drill.exec.record.metadata.SchemaBuilder: org.apache.drill.exec.record.metadata.SchemaBuilder add(java.lang.String,org.apache.drill.common.types.TypeProtos$MinorType,org.apache.drill.common.types.TypeProtos$DataMode)>("col_1", v, v);
v = <org.apache.drill.common.types.TypeProtos$MinorType: org.apache.drill.common.types.TypeProtos$MinorType BIGINT>;
v = <org.apache.drill.common.types.TypeProtos$DataMode: org.apache.drill.common.types.TypeProtos$DataMode OPTIONAL>;
v = virtualinvoke v.<org.apache.drill.exec.record.metadata.SchemaBuilder: org.apache.drill.exec.record.metadata.SchemaBuilder add(java.lang.String,org.apache.drill.common.types.TypeProtos$MinorType,org.apache.drill.common.types.TypeProtos$DataMode)>("col_2", v, v);
v = <org.apache.drill.common.types.TypeProtos$MinorType: org.apache.drill.common.types.TypeProtos$MinorType VARCHAR>;
v = <org.apache.drill.common.types.TypeProtos$DataMode: org.apache.drill.common.types.TypeProtos$DataMode OPTIONAL>;
v = virtualinvoke v.<org.apache.drill.exec.record.metadata.SchemaBuilder: org.apache.drill.exec.record.metadata.SchemaBuilder add(java.lang.String,org.apache.drill.common.types.TypeProtos$MinorType,org.apache.drill.common.types.TypeProtos$DataMode)>("col_3", v, v);
v = virtualinvoke v.<org.apache.drill.exec.record.metadata.SchemaBuilder: org.apache.drill.exec.record.metadata.TupleMetadata build()>();
v = new org.apache.drill.exec.physical.rowSet.RowSetBuilder;
v = virtualinvoke v.<org.apache.drill.test.ClientFixture: org.apache.drill.exec.memory.BufferAllocator allocator()>();
specialinvoke v.<org.apache.drill.exec.physical.rowSet.RowSetBuilder: void <init>(org.apache.drill.exec.memory.BufferAllocator,org.apache.drill.exec.record.metadata.TupleMetadata)>(v, v);
v = newarray (java.lang.Object)[3];
v = staticinvoke <java.lang.Double: java.lang.Double valueOf(double)>(1.0);
v[0] = v;
v = staticinvoke <java.lang.Integer: java.lang.Integer valueOf(int)>(2);
v[1] = v;
v[2] = "3.0";
v = virtualinvoke v.<org.apache.drill.exec.physical.rowSet.RowSetBuilder: org.apache.drill.exec.physical.rowSet.RowSetBuilder addRow(java.lang.Object[])>(v);
v = newarray (java.lang.Object)[3];
v = staticinvoke <java.lang.Double: java.lang.Double valueOf(double)>(4.0);
v[0] = v;
v = staticinvoke <java.lang.Integer: java.lang.Integer valueOf(int)>(5);
v[1] = v;
v[2] = "6.0";
v = virtualinvoke v.<org.apache.drill.exec.physical.rowSet.RowSetBuilder: org.apache.drill.exec.physical.rowSet.RowSetBuilder addRow(java.lang.Object[])>(v);
v = virtualinvoke v.<org.apache.drill.exec.physical.rowSet.RowSetBuilder: org.apache.drill.exec.physical.rowSet.RowSet$SingleRowSet build()>();
staticinvoke <org.apache.drill.test.rowSet.RowSetUtilities: void verify(org.apache.drill.exec.physical.rowSet.RowSet,org.apache.drill.exec.physical.rowSet.RowSet)>(v, v);
v = virtualinvoke v.<okhttp.mockwebserver.MockWebServer: okhttp.mockwebserver.RecordedRequest takeRequest()>();
v = virtualinvoke v.<okhttp.mockwebserver.RecordedRequest: java.lang.String getHeader(java.lang.String)>("Authorization");
staticinvoke <org.junit.Assert: void assertEquals(java.lang.Object,java.lang.Object)>("you_have_access_2", v);
label:
virtualinvoke v.<okhttp.mockwebserver.MockWebServer: void close()>();
goto label;
label:
v := @caughtexception;
throw v;
label:
v := @caughtexception;
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.slf4j.Logger logger>;
v = virtualinvoke v.<java.lang.Exception: java.lang.String getMessage()>();
interfaceinvoke v.<org.slf4j.Logger: void debug(java.lang.String)>(v);
staticinvoke <org.junit.Assert: void fail()>();
label:
return;
catch java.lang.Throwable from label to label with label;
catch java.lang.Exception from label to label with label;
}
public void testUnrelatedQueryWithUser() throws java.lang.Exception
{
org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin v;
org.apache.drill.test.QueryBuilder v, v;
org.apache.drill.test.ClusterFixture v;
org.apache.drill.test.ClientFixture$ClientBuilder v, v, v;
org.apache.drill.test.QueryBuilder$QuerySummary v;
org.apache.drill.test.ClientFixture v;
boolean v;
v := @this: org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin;
v = <org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.ClusterFixture cluster>;
v = virtualinvoke v.<org.apache.drill.test.ClusterFixture: org.apache.drill.test.ClientFixture$ClientBuilder clientBuilder()>();
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture$ClientBuilder property(java.lang.String,java.lang.Object)>("user", "testUser1");
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture$ClientBuilder property(java.lang.String,java.lang.Object)>("password", "testUser1Password");
v = virtualinvoke v.<org.apache.drill.test.ClientFixture$ClientBuilder: org.apache.drill.test.ClientFixture build()>();
v = virtualinvoke v.<org.apache.drill.test.ClientFixture: org.apache.drill.test.QueryBuilder queryBuilder()>();
v = virtualinvoke v.<org.apache.drill.test.QueryBuilder: org.apache.drill.test.QueryBuilder sql(java.lang.String)>("SHOW FILES IN dfs");
v = virtualinvoke v.<org.apache.drill.test.QueryBuilder: org.apache.drill.test.QueryBuilder$QuerySummary run()>();
v = virtualinvoke v.<org.apache.drill.test.QueryBuilder$QuerySummary: boolean succeeded()>();
staticinvoke <org.junit.Assert: void assertTrue(boolean)>(v);
return;
}
private static okhttp.mockwebserver.MockWebServer startServer() throws java.io.IOException
{
int v;
okhttp.mockwebserver.MockWebServer v;
v = new okhttp.mockwebserver.MockWebServer;
specialinvoke v.<okhttp.mockwebserver.MockWebServer: void <init>()>();
v = (int) 47778;
virtualinvoke v.<okhttp.mockwebserver.MockWebServer: void start(int)>(v);
return v;
}
private static java.lang.String makeUrl(java.lang.String)
{
java.lang.Object[] v;
int v;
java.lang.String v, v;
java.lang.Integer v;
v := @parameter: java.lang.String;
v = newarray (java.lang.Object)[1];
v = (int) 47778;
v = staticinvoke <java.lang.Integer: java.lang.Integer valueOf(int)>(v);
v[0] = v;
v = staticinvoke <java.lang.String: java.lang.String format(java.lang.String,java.lang.Object[])>(v, v);
return v;
}
private static java.lang.String createEncodedText(java.lang.String, java.lang.String)
{
byte[] v, v;
java.nio.charset.Charset v, v;
java.lang.String v, v, v, v, v;
v := @parameter: java.lang.String;
v := @parameter: java.lang.String;
v = dynamicinvoke "makeConcatWithConstants" <java.lang.String (java.lang.String,java.lang.String)>(v, v) <java.lang.invoke.StringConcatFactory: java.lang.invoke.CallSite makeConcatWithConstants(java.lang.invoke.MethodHandles$Lookup,java.lang.String,java.lang.invoke.MethodType,java.lang.String,java.lang.Object[])>("\u0001:\u0001");
v = <java.nio.charset.StandardCharsets: java.nio.charset.Charset UTF_8>;
v = virtualinvoke v.<java.lang.String: byte[] getBytes(java.nio.charset.Charset)>(v);
v = staticinvoke <org.apache.commons.net.util.Base64: byte[] encodeBase64(byte[])>(v);
v = new java.lang.String;
v = <java.nio.charset.StandardCharsets: java.nio.charset.Charset UTF_8>;
specialinvoke v.<java.lang.String: void <init>(byte[],java.nio.charset.Charset)>(v, v);
v = dynamicinvoke "makeConcatWithConstants" <java.lang.String (java.lang.String)>(v) <java.lang.invoke.StringConcatFactory: java.lang.invoke.CallSite makeConcatWithConstants(java.lang.invoke.MethodHandles$Lookup,java.lang.String,java.lang.invoke.MethodType,java.lang.String,java.lang.Object[])>("Basic \u0001");
return v;
}
static void <clinit>()
{
org.apache.drill.test.BaseDirTestWatcher v;
org.slf4j.Logger v;
v = staticinvoke <org.slf4j.LoggerFactory: org.slf4j.Logger getLogger(java.lang.Class)>(class "Lorg/apache/drill/exec/store/http/TestUserTranslationInHttpPlugin;");
<org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.slf4j.Logger logger> = v;
v = new org.apache.drill.test.BaseDirTestWatcher;
specialinvoke v.<org.apache.drill.test.BaseDirTestWatcher: void <init>()>();
<org.apache.drill.exec.store.http.TestUserTranslationInHttpPlugin: org.apache.drill.test.BaseDirTestWatcher dirTestWatcher> = v;
return;
}
}