Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 11 additions & 70 deletions powertools-idempotency/powertools-idempotency-dynamodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Expand All @@ -89,15 +99,6 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<!-- DynamoDB Local for testing -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>DynamoDBLocal</artifactId>
<!-- >2.2.0 is not compatible with Java 11 anymore -->
<!-- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocalHistory.html -->
<version>2.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
Expand Down Expand Up @@ -125,6 +126,7 @@
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<configuration>
<skipNativeTests>true</skipNativeTests>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not skip GraalVM native tests. Instead, we need to use the mockito subclass mock maker which is the only supported mock maker for native unit tests.

You can take a look at the metrics module for an example. Basically, we just need to add the subclass mocker maker dependency for the native profile to tell mockito to auto-load this mock maker instead of the default inline mock maker.

See:

<profile>
<id>native</id>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-subclass</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<configuration>
<imageName>powertools-metrics</imageName>
<agent>
<metadataCopy>
<outputDirectory>src/main/resources/META-INF/native-image/software.amazon.lambda/powertools-metrics</outputDirectory>
</metadataCopy>
</agent>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<imageName>powertools-idempotency-dynamodb</imageName>
<exclusions>
<exclusion>
Expand All @@ -149,57 +151,6 @@

<build>
<plugins>
<!-- Copy DynamoDB Local JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dynamodb-local</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>test</includeScope>
<excludeTransitive>false</excludeTransitive>
<!-- MDEP-187: Avoids Maven phase circular dependency by not trying to copy unpacked reactor
artifacts (powertools-idempotency-core) -->
<excludeGroupIds>software.amazon.lambda</excludeGroupIds>
<outputDirectory>${project.build.directory}/dynamodb-local</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- Start DynamoDB Local before tests -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>start-dynamodb-local</id>
<phase>process-test-classes</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<workingDirectory>${project.build.directory}/dynamodb-local</workingDirectory>
<arguments>
<argument>-Djava.library.path=${project.build.directory}/dynamodb-local</argument>
<argument>-cp</argument>
<argument>${project.build.directory}/dynamodb-local/*</argument>
<argument>com.amazonaws.services.dynamodbv2.local.main.ServerRunner</argument>
<argument>-inMemory</argument>
<argument>-port</argument>
<argument>8000</argument>
</arguments>
<async>true</async>
<asyncDestroyOnShutdown>true</asyncDestroyOnShutdown>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Expand All @@ -212,16 +163,6 @@
</archive>
</configuration>
</plugin>
<!-- Configure Surefire to expose external DynamoDB Local address -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<dynamodb.endpoint>http://localhost:8000</dynamodb.endpoint>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>dev.aspectj</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
Expand Down

This file was deleted.

Loading
Loading