Esempio n. 1
0
        protected DynamoDBOutboxBaseTest()
        {
            Client = CreateClient();
            _dynamoDbTableBuilder = new DynamoDbTableBuilder(Client);
            //create a table request
            var createTableRequest = new DynamoDbTableFactory().GenerateCreateTableMapper <MessageItem>(
                new DynamoDbCreateProvisionedThroughput(
                    new ProvisionedThroughput {
                ReadCapacityUnits = 10, WriteCapacityUnits = 10
            },
                    new Dictionary <string, ProvisionedThroughput>
            {
                { "Outstanding", new ProvisionedThroughput {
                      ReadCapacityUnits = 10, WriteCapacityUnits = 10
                  } },
                { "Delivered", new ProvisionedThroughput {
                      ReadCapacityUnits = 10, WriteCapacityUnits = 10
                  } }
            }
                    ));

            TableName = createTableRequest.TableName;
            (bool exist, IEnumerable <string> tables)hasTables = _dynamoDbTableBuilder.HasTables(new string[] { TableName }).Result;
            if (!hasTables.exist)
            {
                var buildTable = _dynamoDbTableBuilder.Build(createTableRequest).Result;
                _dynamoDbTableBuilder.EnsureTablesReady(new[] { createTableRequest.TableName }, TableStatus.ACTIVE).Wait();
            }
        }
Esempio n. 2
0
        protected DynamoDBInboxBaseTest()
        {
            //required by AWS 2.2
            Environment.SetEnvironmentVariable("AWS_ENABLE_ENDPOINT_DISCOVERY", "false");

            Client = CreateClient();
            _dynamoDbTableBuilder = new DynamoDbTableBuilder(Client);
            //create a table request
            var createTableRequest = new DynamoDbTableFactory().GenerateCreateTableMapper <CommandItem <MyCommand> >(
                new DynamoDbCreateProvisionedThroughput(
                    new ProvisionedThroughput {
                ReadCapacityUnits = 10, WriteCapacityUnits = 10
            },
                    new Dictionary <string, ProvisionedThroughput>()
                    ));

            TableName = createTableRequest.TableName;
            (bool exist, IEnumerable <string> tables)hasTables = _dynamoDbTableBuilder.HasTables(new string[] { TableName }).Result;
            if (!hasTables.exist)
            {
                var buildTable = _dynamoDbTableBuilder.Build(createTableRequest).Result;
                _dynamoDbTableBuilder.EnsureTablesReady(new[] { createTableRequest.TableName }, TableStatus.ACTIVE).Wait();
            }
        }