-
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.
Implement EventStoreManagement and extract interface (#11)
- Loading branch information
1 parent
64200d9
commit 58b7c3e
Showing
4 changed files
with
76 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace chrisjenkinson\DynamoDbEventStore; | ||
|
||
use Broadway\EventStore\EventStore; | ||
use Broadway\EventStore\Management\EventStoreManagement; | ||
|
||
interface DynamoDbEventStoreInterface extends EventStore, EventStoreManagement | ||
{ | ||
public function createTable(): void; | ||
|
||
public function deleteTable(): void; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace chrisjenkinson\DynamoDbEventStore\Tests; | ||
|
||
use AsyncAws\Core\Configuration; | ||
use AsyncAws\DynamoDb\DynamoDbClient; | ||
use Broadway\EventStore\Management\EventStoreManagement; | ||
use Broadway\EventStore\Management\Testing\EventStoreManagementTest; | ||
use Broadway\Serializer\SimpleInterfaceSerializer; | ||
use chrisjenkinson\DynamoDbEventStore\DomainMessageNormalizer; | ||
use chrisjenkinson\DynamoDbEventStore\DynamoDbEventStore; | ||
use chrisjenkinson\DynamoDbEventStore\InputBuilder; | ||
use chrisjenkinson\DynamoDbEventStore\JsonDecoder; | ||
use chrisjenkinson\DynamoDbEventStore\JsonEncoder; | ||
|
||
final class DynamoDbEventStoreManagementTest extends EventStoreManagementTest | ||
{ | ||
protected function createEventStore(): EventStoreManagement | ||
{ | ||
$client = new DynamoDbClient(Configuration::create([ | ||
'endpoint' => 'http://dynamodb-local:8000', | ||
'accessKeyId' => '', | ||
'accessKeySecret' => '', | ||
])); | ||
$inputBuilder = new InputBuilder(); | ||
$domainMessageNormalizer = new DomainMessageNormalizer(new SimpleInterfaceSerializer(), new SimpleInterfaceSerializer(), new JsonEncoder(), new JsonDecoder()); | ||
|
||
$eventStore = new DynamoDbEventStore($client, $inputBuilder, $domainMessageNormalizer, 'table'); | ||
|
||
$eventStore->deleteTable(); | ||
$eventStore->createTable(); | ||
|
||
return $eventStore; | ||
} | ||
} |