Skip to content

Instantly share code, notes, and snippets.

@thecarlhall
Last active February 28, 2018 18:34

Revisions

  1. thecarlhall renamed this gist Nov 15, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. thecarlhall revised this gist Nov 15, 2015. 1 changed file with 27 additions and 0 deletions.
    27 changes: 27 additions & 0 deletions 0test.log
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    [INFO] --- download-maven-plugin:1.2.1:wget (install-dynamodb_local) @ app ---
    [INFO] Got from cache: /home/carl/.m2/repository/.cache/maven-download-plugin/dynamodb_local_latest.zip
    [INFO]
    [INFO] --- process-exec-maven-plugin:0.7:start (dynamodb_local) @ app ---
    [INFO] arg: java
    [INFO] arg: -Djava.library.path=dynamodb/DynamoDBLocal_lib
    [INFO] arg: -jar
    [INFO] arg: dynamodb/DynamoDBLocal.jar
    [INFO] arg: -port
    [INFO] arg: 53351
    [INFO] arg: -sharedDb
    [INFO] arg: -inMemory
    [INFO] Full command line: java -Djava.library.path=dynamodb/DynamoDBLocal_lib -jar dynamodb/DynamoDBLocal.jar -port 53351 -sharedDb -inMemory
    [INFO] Starting process: dynamodb_local
    [INFO] Using working directory for this process: /home/carl/src/app/target
    [INFO] Initializing DynamoDB Local with the following configuration:
    [INFO] Port: 53351
    [INFO] InMemory: true
    [INFO] DbPath: null
    [INFO] SharedDb: true
    [INFO] shouldDelayTransientStatuses: false
    [INFO] CorsParams: *
    [INFO]
    [INFO] Started process: dynamodb_local
    [INFO]
    [INFO] --- maven-failsafe-plugin:2.18.1:integration-test (integration-test) @ app ---
    [INFO] Failsafe report directory: /home/carl/src/app/target/failsafe-reports
  3. thecarlhall revised this gist Nov 14, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions pom.xml
    Original file line number Diff line number Diff line change
    @@ -94,6 +94,9 @@
    -->
    <argument>-port</argument>
    <argument>${dynamodblocal.port}</argument>
    <!--
    You run your tests in parallel, right?
    -->
    <argument>-sharedDb</argument>
    <!--
    Remove this to keep data between restarts of the process.
  4. thecarlhall revised this gist Nov 14, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions pom.xml
    Original file line number Diff line number Diff line change
    @@ -117,6 +117,8 @@
    <systemPropertyVariables>
    <!--
    Set a system property for the test clients to use when connecting.
    Something like Apache's commons-configuration can pick this up
    transparently.
    -->
    <dynamo.endpoint>http://localhost:${dynamodblocal.port}</dynamo.endpoint>
    </systemPropertyVariables>
  5. thecarlhall revised this gist Nov 14, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions pom.xml
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,7 @@
    <plugin>
    <groupId>com.googlecode.maven-download-plugin</groupId>
    <artifactId>download-maven-plugin</artifactId>
    <version>1.2.1</version>
    <executions>
    <execution>
    <id>install-dynamodb_local</id>
    @@ -43,6 +44,7 @@
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.9.1</version>
    <executions>
    <execution>
    <goals>
    @@ -66,6 +68,7 @@
    <plugin>
    <groupId>com.bazaarvoice.maven.plugins</groupId>
    <artifactId>process-exec-maven-plugin</artifactId>
    <version>0.7</version>
    <executions>
    <execution>
    <id>dynamodb_local</id>
    @@ -109,6 +112,7 @@
    <plugin>
    <groupId>org.apache.maven.plugins </groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.19</version>
    <configuration>
    <systemPropertyVariables>
    <!--
  6. thecarlhall revised this gist Nov 14, 2015. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion pom.xml
    Original file line number Diff line number Diff line change
    @@ -60,7 +60,8 @@

    <!--
    Step 3: Start DynamoDB_Local just before integration tests are run.
    This plugin will also cleanup the process during the post-integration-test phase.
    This plugin will also cleanup the process during the
    post-integration-test phase.
    -->
    <plugin>
    <groupId>com.bazaarvoice.maven.plugins</groupId>
    @@ -74,6 +75,11 @@
    </goals>
    <configuration>
    <name>dynamodb_local</name>
    <!--
    We need to let DynamoDB finish starting, but don't have
    a good semamore. It's pretty quick to start, so 1 second
    should suffice.
    -->
    <waitAfterLaunch>1</waitAfterLaunch>
    <arguments>
    <argument>java</argument>
    @@ -86,6 +92,9 @@
    <argument>-port</argument>
    <argument>${dynamodblocal.port}</argument>
    <argument>-sharedDb</argument>
    <!--
    Remove this to keep data between restarts of the process.
    -->
    <argument>-inMemory</argument>
    </arguments>
    </configuration>
    @@ -95,6 +104,7 @@

    <!--
    Step 4: Use the failsafe plugin to run integration tests.
    https://maven.apache.org/surefire/maven-failsafe-plugin/
    -->
    <plugin>
    <groupId>org.apache.maven.plugins </groupId>
  7. thecarlhall revised this gist Nov 14, 2015. 1 changed file with 15 additions and 4 deletions.
    19 changes: 15 additions & 4 deletions pom.xml
    Original file line number Diff line number Diff line change
    @@ -4,14 +4,16 @@
    <!--
    Choose the region that is closest to you for fastest download.
    -->
    <aws.region>us-west-2</aws.region>
    <aws.s3.region>us-west-2</aws.s3.region>
    </properties>

    <build>
    <plugins>
    <!--
    Step 1: Downlaod the DynamoDB Local artifact.
    This will download to a Maven cache on disk and is kept unless the cache is cleared.
    This will download to a Maven cache on disk and is kept until
    the cache is cleared. The artifact is unpacked to the target
    directory of the build.
    -->
    <plugin>
    <groupId>com.googlecode.maven-download-plugin</groupId>
    @@ -24,7 +26,7 @@
    <goal>wget</goal>
    </goals>
    <configuration>
    <url>http://dynamodb-local.s3-website-${aws.region}.amazonaws.com/dynamodb_local_latest.zip</url>
    <url>http://dynamodb-local.s3-website-${aws.s3.region}.amazonaws.com/dynamodb_local_latest.zip</url>
    <unpack>true</unpack>
    <outputDirectory>${project.build.directory}/dynamodb</outputDirectory>
    </configuration>
    @@ -34,6 +36,9 @@

    <!--
    Step 2: Reserve a local port for Dynamo to start on.
    DynamoDB_Local normally runs on port 8000. Rather than hoping
    that port is open, have this plugin reserve an available port
    and set it as a property in the Maven build.
    -->
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    @@ -55,7 +60,7 @@

    <!--
    Step 3: Start DynamoDB_Local just before integration tests are run.
    This plugin will also cleanup the process during the post-integration-test phase.
    This plugin will also cleanup the process during the post-integration-test phase.
    -->
    <plugin>
    <groupId>com.bazaarvoice.maven.plugins</groupId>
    @@ -75,6 +80,9 @@
    <argument>-Djava.library.path=dynamodb/DynamoDBLocal_lib</argument>
    <argument>-jar</argument>
    <argument>dynamodb/DynamoDBLocal.jar</argument>
    <!--
    Use the port that was reserved in step 2
    -->
    <argument>-port</argument>
    <argument>${dynamodblocal.port}</argument>
    <argument>-sharedDb</argument>
    @@ -93,6 +101,9 @@
    <artifactId>maven-failsafe-plugin</artifactId>
    <configuration>
    <systemPropertyVariables>
    <!--
    Set a system property for the test clients to use when connecting.
    -->
    <dynamo.endpoint>http://localhost:${dynamodblocal.port}</dynamo.endpoint>
    </systemPropertyVariables>
    </configuration>
  8. thecarlhall revised this gist Nov 14, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion pom.xml
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,12 @@
    <project>
    <!-- ... -->
    <properties>
    <!--
    Choose the region that is closest to you for fastest download.
    -->
    <aws.region>us-west-2</aws.region>
    </properties>
    ...
    <build>
    <plugins>
    <!--
  9. thecarlhall revised this gist Nov 14, 2015. 1 changed file with 21 additions and 22 deletions.
    43 changes: 21 additions & 22 deletions pom.xml
    Original file line number Diff line number Diff line change
    @@ -1,28 +1,17 @@
    <project>
    <properties>
    <!--
    Choose the region that is closest to you for fastest download.
    -->
    <aws.region>us-west-2</aws.region>
    </properties>
    ...
    <build>
    <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <executions>
    <execution>
    <phase>package</phase>
    <goals>
    <goal>shade</goal>
    </goals>
    <configuration>
    <transformers>
    <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
    <mainClass>com.cloudability.tags.App</mainClass>
    </transformer>
    </transformers>
    </configuration>
    </execution>
    </executions>
    </plugin>

    <!--
    Step 1: Downlaod the DynamoDB Local artifact.
    This will download to a Maven cache on disk and is kept unless the cache is cleared.
    -->
    <plugin>
    <groupId>com.googlecode.maven-download-plugin</groupId>
    <artifactId>download-maven-plugin</artifactId>
    @@ -34,14 +23,17 @@
    <goal>wget</goal>
    </goals>
    <configuration>
    <url>http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.zip</url>
    <url>http://dynamodb-local.s3-website-${aws.region}.amazonaws.com/dynamodb_local_latest.zip</url>
    <unpack>true</unpack>
    <outputDirectory>${project.build.directory}/dynamodb</outputDirectory>
    </configuration>
    </execution>
    </executions>
    </plugin>

    <!--
    Step 2: Reserve a local port for Dynamo to start on.
    -->
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    @@ -60,6 +52,10 @@
    </executions>
    </plugin>

    <!--
    Step 3: Start DynamoDB_Local just before integration tests are run.
    This plugin will also cleanup the process during the post-integration-test phase.
    -->
    <plugin>
    <groupId>com.bazaarvoice.maven.plugins</groupId>
    <artifactId>process-exec-maven-plugin</artifactId>
    @@ -88,6 +84,9 @@
    </executions>
    </plugin>

    <!--
    Step 4: Use the failsafe plugin to run integration tests.
    -->
    <plugin>
    <groupId>org.apache.maven.plugins </groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
  10. thecarlhall created this gist Nov 14, 2015.
    102 changes: 102 additions & 0 deletions pom.xml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,102 @@
    <project>
    ...
    <build>
    <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <executions>
    <execution>
    <phase>package</phase>
    <goals>
    <goal>shade</goal>
    </goals>
    <configuration>
    <transformers>
    <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
    <mainClass>com.cloudability.tags.App</mainClass>
    </transformer>
    </transformers>
    </configuration>
    </execution>
    </executions>
    </plugin>

    <plugin>
    <groupId>com.googlecode.maven-download-plugin</groupId>
    <artifactId>download-maven-plugin</artifactId>
    <executions>
    <execution>
    <id>install-dynamodb_local</id>
    <phase>pre-integration-test</phase>
    <goals>
    <goal>wget</goal>
    </goals>
    <configuration>
    <url>http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.zip</url>
    <unpack>true</unpack>
    <outputDirectory>${project.build.directory}/dynamodb</outputDirectory>
    </configuration>
    </execution>
    </executions>
    </plugin>

    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
    <execution>
    <goals>
    <goal>reserve-network-port</goal>
    </goals>
    <phase>initialize</phase>
    <configuration>
    <portNames>
    <portName>dynamodblocal.port</portName>
    </portNames>
    </configuration>
    </execution>
    </executions>
    </plugin>

    <plugin>
    <groupId>com.bazaarvoice.maven.plugins</groupId>
    <artifactId>process-exec-maven-plugin</artifactId>
    <executions>
    <execution>
    <id>dynamodb_local</id>
    <phase>pre-integration-test</phase>
    <goals>
    <goal>start</goal>
    </goals>
    <configuration>
    <name>dynamodb_local</name>
    <waitAfterLaunch>1</waitAfterLaunch>
    <arguments>
    <argument>java</argument>
    <argument>-Djava.library.path=dynamodb/DynamoDBLocal_lib</argument>
    <argument>-jar</argument>
    <argument>dynamodb/DynamoDBLocal.jar</argument>
    <argument>-port</argument>
    <argument>${dynamodblocal.port}</argument>
    <argument>-sharedDb</argument>
    <argument>-inMemory</argument>
    </arguments>
    </configuration>
    </execution>
    </executions>
    </plugin>

    <plugin>
    <groupId>org.apache.maven.plugins </groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <configuration>
    <systemPropertyVariables>
    <dynamo.endpoint>http://localhost:${dynamodblocal.port}</dynamo.endpoint>
    </systemPropertyVariables>
    </configuration>
    </plugin>
    </plugins>
    </build>
    </project>