Search in sources :

Example 1 with FakeItemWithNumericSort

use of software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithNumericSort in project aws-sdk-java-v2 by aws.

the class CreateTableOperationTest method generateRequest_withNumericKey.

@Test
public void generateRequest_withNumericKey() {
    CreateTableOperation<FakeItemWithNumericSort> operation = CreateTableOperation.create(CreateTableEnhancedRequest.builder().build());
    CreateTableRequest request = operation.generateRequest(FakeItemWithNumericSort.getTableSchema(), PRIMARY_CONTEXT, null);
    assertThat(request.tableName(), is(TABLE_NAME));
    assertThat(request.keySchema(), containsInAnyOrder(KeySchemaElement.builder().attributeName("id").keyType(HASH).build(), KeySchemaElement.builder().attributeName("sort").keyType(RANGE).build()));
    assertThat(request.globalSecondaryIndexes(), is(DefaultSdkAutoConstructList.getInstance()));
    assertThat(request.localSecondaryIndexes(), is(DefaultSdkAutoConstructList.getInstance()));
    assertThat(request.attributeDefinitions(), containsInAnyOrder(AttributeDefinition.builder().attributeName("id").attributeType(ScalarAttributeType.S).build(), AttributeDefinition.builder().attributeName("sort").attributeType(ScalarAttributeType.N).build()));
}
Also used : FakeItemWithNumericSort(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithNumericSort) CreateTableRequest(software.amazon.awssdk.services.dynamodb.model.CreateTableRequest) Test(org.junit.Test)

Example 2 with FakeItemWithNumericSort

use of software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithNumericSort in project aws-sdk-java-v2 by aws.

the class QueryOperationConditionalTest method beginsWith_numericRange_throwsIllegalArgumentException.

@Test(expected = IllegalArgumentException.class)
public void beginsWith_numericRange_throwsIllegalArgumentException() {
    FakeItemWithNumericSort fakeItemWithNumericSort = FakeItemWithNumericSort.createUniqueFakeItemWithSort();
    QueryConditional.sortBeginsWith(getKey(fakeItemWithNumericSort)).expression(FakeItemWithNumericSort.getTableSchema(), TableMetadata.primaryIndexName());
}
Also used : FakeItemWithNumericSort(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithNumericSort) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 FakeItemWithNumericSort (software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithNumericSort)2 CreateTableRequest (software.amazon.awssdk.services.dynamodb.model.CreateTableRequest)1