forked from akka/alpakka
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request akka#157 from 2m/wip-dynamodb-tests-docker
Run DynamoDB local in docker
- Loading branch information
Showing
17 changed files
with
184 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 0 additions & 64 deletions
64
dynamodb/src/test/java/akka/stream/alpakka/dynamodb/ExampleJavaSpec.java
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
dynamodb/src/test/java/akka/stream/alpakka/dynamodb/ExampleTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (C) 2016 Lightbend Inc. <http://www.lightbend.com> | ||
*/ | ||
package akka.stream.alpakka.dynamodb; | ||
|
||
import akka.actor.ActorSystem; | ||
import akka.japi.Pair; | ||
import akka.stream.ActorMaterializer; | ||
import akka.stream.alpakka.dynamodb.impl.DynamoSettings; | ||
import akka.stream.alpakka.dynamodb.javadsl.DynamoClient; | ||
import com.amazonaws.services.dynamodbv2.model.ListTablesRequest; | ||
import com.amazonaws.services.dynamodbv2.model.ListTablesResult; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
import scala.concurrent.Await; | ||
import scala.concurrent.Future; | ||
import scala.concurrent.duration.Duration; | ||
|
||
public class ExampleTest { | ||
|
||
static ActorSystem system; | ||
static ActorMaterializer materializer; | ||
static DynamoSettings settings; | ||
static DynamoClient client; | ||
|
||
public static Pair<ActorSystem, ActorMaterializer> setupMaterializer() { | ||
//#init-client | ||
final ActorSystem system = ActorSystem.create(); | ||
final ActorMaterializer materializer = ActorMaterializer.create(system); | ||
//#init-client | ||
return Pair.create(system, materializer); | ||
} | ||
|
||
public static Pair<DynamoSettings, DynamoClient> setupClient() { | ||
//#client-construct | ||
final DynamoSettings settings = DynamoSettings.apply(system); | ||
final DynamoClient client = DynamoClient.create(settings, system, materializer); | ||
//#client-construct | ||
return Pair.create(settings, client); | ||
} | ||
|
||
@BeforeClass | ||
public static void setup() throws Exception { | ||
System.setProperty("aws.accessKeyId", "someKeyId"); | ||
System.setProperty("aws.secretKey", "someSecretKey"); | ||
|
||
final Pair<ActorSystem, ActorMaterializer> sysmat = setupMaterializer(); | ||
system = sysmat.first(); | ||
materializer = sysmat.second(); | ||
|
||
final Pair<DynamoSettings, DynamoClient> setclient = setupClient(); | ||
settings = setclient.first(); | ||
client = setclient.second(); | ||
} | ||
|
||
@Test | ||
public void listTables() throws Exception { | ||
//#simple-request | ||
final Future<ListTablesResult> listTablesResultFuture = client.listTables(new ListTablesRequest()); | ||
//#simple-request | ||
final Duration duration = Duration.create(5, "seconds"); | ||
ListTablesResult result = Await.result(listTablesResultFuture, duration); | ||
} | ||
|
||
} |
Oops, something went wrong.