File tree Expand file tree Collapse file tree 4 files changed +30
-9
lines changed
cdk/src/test/java/airhacks Expand file tree Collapse file tree 4 files changed +30
-9
lines changed Original file line number Diff line number Diff line change
1
+ package airhacks ;
2
+
3
+ import java .io .IOException ;
4
+ import java .nio .file .Files ;
5
+
6
+ public interface FunctionZip {
7
+
8
+ public static String createEmptyFunctionZip () throws IOException {
9
+ var path = Files .createTempDirectory ("function" );
10
+ var functionZip = path .resolve ("function.zip" );
11
+ var existingFile = Files .createFile (functionZip );
12
+ System .out .println ("existingFile = " + existingFile );
13
+ return existingFile .toString ();
14
+ }
15
+ }
Original file line number Diff line number Diff line change 12
12
13
13
import software .amazon .awscdk .App ;
14
14
15
- @ Disabled ("builder is not available yet" )
16
15
public class LambdaAlbStackTest {
17
16
private final static ObjectMapper JSON =
18
- new ObjectMapper ().configure (SerializationFeature .INDENT_OUTPUT , true );
19
-
17
+ new ObjectMapper ().configure (SerializationFeature .INDENT_OUTPUT , true );
18
+
20
19
@ Test
21
- public void testStack () throws IOException {
20
+ @ Disabled ("builder is not available yet" )
21
+ public void stack () throws IOException {
22
22
App app = new App ();
23
23
var stack = new LambdaAlbStack (app , "test" );
24
24
Original file line number Diff line number Diff line change 7
7
import com .fasterxml .jackson .databind .ObjectMapper ;
8
8
import com .fasterxml .jackson .databind .SerializationFeature ;
9
9
10
+ import airhacks .FunctionZip ;
10
11
import airhacks .InfrastructureBuilder ;
11
12
12
13
import org .junit .jupiter .api .Test ;
@@ -17,10 +18,12 @@ public class LambdaApiGatewayStackTest {
17
18
private final static ObjectMapper JSON = new ObjectMapper ().configure (SerializationFeature .INDENT_OUTPUT , true );
18
19
19
20
@ Test
20
- public void testStack () throws IOException {
21
+ public void stack () throws IOException {
22
+ var mockFunctionZip = FunctionZip .createEmptyFunctionZip ();
21
23
App app = new App ();
22
24
var stack = new InfrastructureBuilder (app , "function-url" )
23
25
.functionName ("functionurl-test" )
26
+ .functionZip (mockFunctionZip )
24
27
.apiGatewayBuilder ()
25
28
.build ();
26
29
Original file line number Diff line number Diff line change 7
7
import com .fasterxml .jackson .databind .ObjectMapper ;
8
8
import com .fasterxml .jackson .databind .SerializationFeature ;
9
9
10
+ import airhacks .FunctionZip ;
10
11
import airhacks .InfrastructureBuilder ;
11
12
12
13
import org .junit .jupiter .api .Test ;
@@ -18,12 +19,14 @@ public class FunctionURLStackTest {
18
19
private final static ObjectMapper JSON = new ObjectMapper ().configure (SerializationFeature .INDENT_OUTPUT , true );
19
20
20
21
@ Test
21
- public void functionURLSynth () throws IOException {
22
+ void stack () throws IOException {
23
+ var mockFunctionZip = FunctionZip .createEmptyFunctionZip ();
22
24
App app = new App ();
23
25
var stack = new InfrastructureBuilder (app , "function-url" )
24
- .functionName ("functionurl-test" )
25
- .functionURLBuilder ()
26
- .build ();
26
+ .functionName ("functionurl-test" )
27
+ .functionZip (mockFunctionZip )
28
+ .functionURLBuilder ()
29
+ .build ();
27
30
28
31
// synthesize the stack to a CloudFormation template
29
32
var actual = JSON .valueToTree (app .synth ().getStackArtifact (stack .getArtifactId ()).getTemplate ());
You can’t perform that action at this time.
0 commit comments