2
2
3
3
import cloud .localstack .Constants ;
4
4
import cloud .localstack .LocalstackTestRunner ;
5
+ import cloud .localstack .sample .LambdaHandler ;
6
+ import cloud .localstack .utils .LocalTestUtil ;
7
+
8
+ import lombok .val ;
5
9
6
- import com .amazonaws .services .dynamodbv2 .model .ListTablesResult ;
7
- import org .assertj .core .api .Assertions ;
8
10
import software .amazon .awssdk .core .SdkSystemSetting ;
9
11
import software .amazon .awssdk .services .cloudwatch .*;
10
12
import software .amazon .awssdk .services .cloudwatch .model .*;
11
13
import software .amazon .awssdk .services .dynamodb .DynamoDbAsyncClient ;
12
14
import software .amazon .awssdk .services .dynamodb .model .*;
13
15
import software .amazon .awssdk .services .kinesis .*;
14
16
import software .amazon .awssdk .services .kinesis .model .*;
17
+ import software .amazon .awssdk .services .lambda .model .CreateFunctionRequest ;
18
+ import software .amazon .awssdk .services .lambda .model .Runtime ;
15
19
import software .amazon .awssdk .services .s3 .*;
16
20
import software .amazon .awssdk .services .s3 .model .*;
17
21
import software .amazon .awssdk .services .secretsmanager .SecretsManagerAsyncClient ;
@@ -214,7 +218,7 @@ public void testCWMultipleDimentionsAndMetrics() throws Exception {
214
218
.name ("UNIQUE_PAGES" +i )
215
219
.value ("URLS" +i )
216
220
.build ());
217
- };
221
+ }
218
222
219
223
// Set an Instant object
220
224
String time = ZonedDateTime .now ( ZoneOffset .UTC ).format ( DateTimeFormatter .ISO_INSTANT );
@@ -229,7 +233,7 @@ public void testCWMultipleDimentionsAndMetrics() throws Exception {
229
233
.value (dataPoint )
230
234
.timestamp (instant )
231
235
.dimensions (awsDimensionList ).build ());
232
- };
236
+ }
233
237
234
238
PutMetricDataRequest request = PutMetricDataRequest .builder ()
235
239
.namespace ("SITE/TRAFFIC" )
@@ -238,4 +242,20 @@ public void testCWMultipleDimentionsAndMetrics() throws Exception {
238
242
PutMetricDataResponse response = clientCW .putMetricData (request ).get ();
239
243
Assert .assertNotNull (response );
240
244
}
245
+
246
+ @ Test
247
+ public void testLambdaCreateListFunctions () throws Exception {
248
+ val functionName = "test-f-" +UUID .randomUUID ().toString ();
249
+ val lambdaClient = TestUtils .getClientLambdaAsyncV2 ();
250
+ val createFunctionRequest = CreateFunctionRequest .builder ().functionName (functionName )
251
+ .runtime (Runtime .JAVA8 )
252
+ .role ("r1" )
253
+ .code (LocalTestUtil .createFunctionCodeSDKV2 (LambdaHandler .class ))
254
+ .handler (LambdaHandler .class .getName ()).build ();
255
+ val response = lambdaClient .createFunction (createFunctionRequest ).get ();
256
+ Assert .assertNotNull (response );
257
+ val functions = lambdaClient .listFunctions ().get ();
258
+ val function = functions .functions ().stream ().filter (f -> f .functionName ().equals (functionName )).findFirst ().get ();
259
+ Assert .assertNotNull (function );
260
+ }
241
261
}
0 commit comments