-
-
Notifications
You must be signed in to change notification settings - Fork 157
Expand file tree
/
Copy pathAthenaClientTest.php
More file actions
332 lines (267 loc) · 11.6 KB
/
Copy pathAthenaClientTest.php
File metadata and controls
332 lines (267 loc) · 11.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
<?php
namespace AsyncAws\Athena\Tests\Unit;
use AsyncAws\Athena\AthenaClient;
use AsyncAws\Athena\Input\GetCalculationExecutionRequest;
use AsyncAws\Athena\Input\GetCalculationExecutionStatusRequest;
use AsyncAws\Athena\Input\GetDatabaseInput;
use AsyncAws\Athena\Input\GetDataCatalogInput;
use AsyncAws\Athena\Input\GetNamedQueryInput;
use AsyncAws\Athena\Input\GetQueryExecutionInput;
use AsyncAws\Athena\Input\GetQueryResultsInput;
use AsyncAws\Athena\Input\GetSessionRequest;
use AsyncAws\Athena\Input\GetSessionStatusRequest;
use AsyncAws\Athena\Input\GetTableMetadataInput;
use AsyncAws\Athena\Input\GetWorkGroupInput;
use AsyncAws\Athena\Input\ListDatabasesInput;
use AsyncAws\Athena\Input\ListNamedQueriesInput;
use AsyncAws\Athena\Input\ListQueryExecutionsInput;
use AsyncAws\Athena\Input\ListTableMetadataInput;
use AsyncAws\Athena\Input\StartCalculationExecutionRequest;
use AsyncAws\Athena\Input\StartQueryExecutionInput;
use AsyncAws\Athena\Input\StartSessionRequest;
use AsyncAws\Athena\Input\StopCalculationExecutionRequest;
use AsyncAws\Athena\Input\StopQueryExecutionInput;
use AsyncAws\Athena\Input\TerminateSessionRequest;
use AsyncAws\Athena\Result\GetCalculationExecutionResponse;
use AsyncAws\Athena\Result\GetCalculationExecutionStatusResponse;
use AsyncAws\Athena\Result\GetDatabaseOutput;
use AsyncAws\Athena\Result\GetDataCatalogOutput;
use AsyncAws\Athena\Result\GetNamedQueryOutput;
use AsyncAws\Athena\Result\GetQueryExecutionOutput;
use AsyncAws\Athena\Result\GetQueryResultsOutput;
use AsyncAws\Athena\Result\GetSessionResponse;
use AsyncAws\Athena\Result\GetSessionStatusResponse;
use AsyncAws\Athena\Result\GetTableMetadataOutput;
use AsyncAws\Athena\Result\GetWorkGroupOutput;
use AsyncAws\Athena\Result\ListDatabasesOutput;
use AsyncAws\Athena\Result\ListNamedQueriesOutput;
use AsyncAws\Athena\Result\ListQueryExecutionsOutput;
use AsyncAws\Athena\Result\ListTableMetadataOutput;
use AsyncAws\Athena\Result\StartCalculationExecutionResponse;
use AsyncAws\Athena\Result\StartQueryExecutionOutput;
use AsyncAws\Athena\Result\StartSessionResponse;
use AsyncAws\Athena\Result\StopCalculationExecutionResponse;
use AsyncAws\Athena\Result\StopQueryExecutionOutput;
use AsyncAws\Athena\Result\TerminateSessionResponse;
use AsyncAws\Athena\ValueObject\EngineConfiguration;
use AsyncAws\Core\Credentials\NullProvider;
use AsyncAws\Core\Test\TestCase;
use Symfony\Component\HttpClient\MockHttpClient;
class AthenaClientTest extends TestCase
{
public function testGetCalculationExecution(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new GetCalculationExecutionRequest([
'CalculationExecutionId' => 'iad-6855-254589-ef4r4z5',
]);
$result = $client->getCalculationExecution($input);
self::assertInstanceOf(GetCalculationExecutionResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testGetCalculationExecutionStatus(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new GetCalculationExecutionStatusRequest([
'CalculationExecutionId' => 'iad-6855-254589-ef4r4z5',
]);
$result = $client->getCalculationExecutionStatus($input);
self::assertInstanceOf(GetCalculationExecutionStatusResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testGetDataCatalog(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new GetDataCatalogInput([
'Name' => 'iadCatalog',
]);
$result = $client->getDataCatalog($input);
self::assertInstanceOf(GetDataCatalogOutput::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testGetDatabase(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new GetDatabaseInput([
'CatalogName' => 'iadCatalog',
'DatabaseName' => 'iadDatabase',
]);
$result = $client->getDatabase($input);
self::assertInstanceOf(GetDatabaseOutput::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testGetNamedQuery(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new GetNamedQueryInput([
'NamedQueryId' => 'iad-query-12536',
]);
$result = $client->getNamedQuery($input);
self::assertInstanceOf(GetNamedQueryOutput::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testGetQueryExecution(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new GetQueryExecutionInput([
'QueryExecutionId' => 'iad-145r55t-11446',
]);
$result = $client->getQueryExecution($input);
self::assertInstanceOf(GetQueryExecutionOutput::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testGetQueryResults(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new GetQueryResultsInput([
'QueryExecutionId' => 'iad-145r55t-11446',
]);
$result = $client->getQueryResults($input);
self::assertInstanceOf(GetQueryResultsOutput::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testGetSession(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new GetSessionRequest([
'SessionId' => 'session-iad-2563',
]);
$result = $client->getSession($input);
self::assertInstanceOf(GetSessionResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testGetSessionStatus(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new GetSessionStatusRequest([
'SessionId' => 'session-iad-2563',
]);
$result = $client->getSessionStatus($input);
self::assertInstanceOf(GetSessionStatusResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testGetTableMetadata(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new GetTableMetadataInput([
'CatalogName' => 'iadCatalog',
'DatabaseName' => 'iadDatabase',
'TableName' => 'product_catalog',
]);
$result = $client->getTableMetadata($input);
self::assertInstanceOf(GetTableMetadataOutput::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testGetWorkGroup(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new GetWorkGroupInput([
'WorkGroup' => 'iadinternational',
]);
$result = $client->getWorkGroup($input);
self::assertInstanceOf(GetWorkGroupOutput::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testListDatabases(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new ListDatabasesInput([
'CatalogName' => 'iadCatalog',
]);
$result = $client->listDatabases($input);
self::assertInstanceOf(ListDatabasesOutput::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testListNamedQueries(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new ListNamedQueriesInput([
]);
$result = $client->listNamedQueries($input);
self::assertInstanceOf(ListNamedQueriesOutput::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testListQueryExecutions(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new ListQueryExecutionsInput([
]);
$result = $client->listQueryExecutions($input);
self::assertInstanceOf(ListQueryExecutionsOutput::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testListTableMetadata(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new ListTableMetadataInput([
'CatalogName' => 'iadCatalog',
'DatabaseName' => 'iadDatabase',
]);
$result = $client->listTableMetadata($input);
self::assertInstanceOf(ListTableMetadataOutput::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testStartCalculationExecution(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new StartCalculationExecutionRequest([
'SessionId' => 'session-iad-2563',
]);
$result = $client->startCalculationExecution($input);
self::assertInstanceOf(StartCalculationExecutionResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testStartQueryExecution(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new StartQueryExecutionInput([
'QueryString' => 'SELECT * FROM iadDatabase.catalog LIMIT 10',
]);
$result = $client->startQueryExecution($input);
self::assertInstanceOf(StartQueryExecutionOutput::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testStartSession(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new StartSessionRequest([
'WorkGroup' => 'iadinternational',
'EngineConfiguration' => new EngineConfiguration([
'MaxConcurrentDpus' => 1337,
]),
]);
$result = $client->startSession($input);
self::assertInstanceOf(StartSessionResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testStopCalculationExecution(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new StopCalculationExecutionRequest([
'CalculationExecutionId' => 'iad-e222-4619-ac1f',
]);
$result = $client->stopCalculationExecution($input);
self::assertInstanceOf(StopCalculationExecutionResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testStopQueryExecution(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new StopQueryExecutionInput([
'QueryExecutionId' => 'irq-iad-25',
]);
$result = $client->stopQueryExecution($input);
self::assertInstanceOf(StopQueryExecutionOutput::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testTerminateSession(): void
{
$client = new AthenaClient([], new NullProvider(), new MockHttpClient());
$input = new TerminateSessionRequest([
'SessionId' => 'session-iad-2563',
]);
$result = $client->terminateSession($input);
self::assertInstanceOf(TerminateSessionResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
}