lambdora-common-test/src/main/java/org/fcrepo/lambdora/common/test/IntegrationTestBase.java
/*
     * Builds the DynamoDB table as defined in serverless.yml
     */
Builds the DynamoDB table as defined in serverless.yml
Builds the DynamoDB table as defined in serverless . yml
private CreateTableResult createTable() {
        final List<AttributeDefinition> attributeDefinitions = new ArrayList<>();
        attributeDefinitions.add(new AttributeDefinition(RESOURCE_NAME_ATT, ScalarAttributeType.S));
        attributeDefinitions.add(new AttributeDefinition(RDF_TRIPLE_ATT, ScalarAttributeType.S));
        attributeDefinitions.add(new AttributeDefinition(RDF_PREDICATE_ATT, ScalarAttributeType.S));
        attributeDefinitions.add(new AttributeDefinition(RDF_OBJECT_ATT, ScalarAttributeType.S));
        final List<KeySchemaElement> keySchema = new ArrayList<>();
        keySchema.add(new KeySchemaElement(RESOURCE_NAME_ATT, KeyType.HASH));
        keySchema.add(new KeySchemaElement(RDF_TRIPLE_ATT, KeyType.RANGE));
        final ProvisionedThroughput provisionedthroughput =
            new ProvisionedThroughput(10L, 10L);
        final LocalSecondaryIndex predicateIndex = new LocalSecondaryIndex()
            .withIndexName(PREDICATE_INDEX_NAME)
            .withKeySchema(new KeySchemaElement(RESOURCE_NAME_ATT, KeyType.HASH))
            .withKeySchema(new KeySchemaElement(RDF_PREDICATE_ATT, KeyType.RANGE))
            .withProjection(new Projection().withNonKeyAttributes(RDF_SUBJECT_ATT, RDF_OBJECT_ATT)
                                            .withProjectionType(ProjectionType.INCLUDE));
        final GlobalSecondaryIndex objectIndex = new GlobalSecondaryIndex()
            .withIndexName(OBJECT_INDEX_NAME)
            .withKeySchema(new KeySchemaElement(RDF_OBJECT_ATT, KeyType.HASH))
            .withKeySchema(new KeySchemaElement(RDF_PREDICATE_ATT, KeyType.RANGE))
            .withProjection(new Projection().withNonKeyAttributes(RDF_SUBJECT_ATT)
                                            .withProjectionType(ProjectionType.INCLUDE))
            .withProvisionedThroughput(new ProvisionedThroughput(10L, 10L));
        final CreateTableRequest request =
            new CreateTableRequest()
                .withTableName(TABLE_NAME)
                .withAttributeDefinitions(attributeDefinitions)
                .withKeySchema(keySchema)
                .withProvisionedThroughput(provisionedthroughput)
                .withLocalSecondaryIndexes(predicateIndex)
                .withGlobalSecondaryIndexes(objectIndex);
        return dynamodbClient.createTable(request);
    }
private CreateTableResult createTable ( ) { final List < AttributeDefinition > attributeDefinitions = new ArrayList < > ( ) ; attributeDefinitions . add ( new AttributeDefinition ( RESOURCE_NAME_ATT , ScalarAttributeType . S ) ) ; attributeDefinitions . add ( new AttributeDefinition ( RDF_TRIPLE_ATT , ScalarAttributeType . S ) ) ; attributeDefinitions . add ( new AttributeDefinition ( RDF_PREDICATE_ATT , ScalarAttributeType . S ) ) ; attributeDefinitions . add ( new AttributeDefinition ( RDF_OBJECT_ATT , ScalarAttributeType . S ) ) ; final List < KeySchemaElement > keySchema = new ArrayList < > ( ) ; keySchema . add ( new KeySchemaElement ( RESOURCE_NAME_ATT , KeyType . HASH ) ) ; keySchema . add ( new KeySchemaElement ( RDF_TRIPLE_ATT , KeyType . RANGE ) ) ; final ProvisionedThroughput provisionedthroughput = new ProvisionedThroughput ( 10L , 10L ) ; final LocalSecondaryIndex predicateIndex = new LocalSecondaryIndex ( ) . withIndexName ( PREDICATE_INDEX_NAME ) . withKeySchema ( new KeySchemaElement ( RESOURCE_NAME_ATT , KeyType . HASH ) ) . withKeySchema ( new KeySchemaElement ( RDF_PREDICATE_ATT , KeyType . RANGE ) ) . withProjection ( new Projection ( ) . withNonKeyAttributes ( RDF_SUBJECT_ATT , RDF_OBJECT_ATT ) . withProjectionType ( ProjectionType . INCLUDE ) ) ; final GlobalSecondaryIndex objectIndex = new GlobalSecondaryIndex ( ) . withIndexName ( OBJECT_INDEX_NAME ) . withKeySchema ( new KeySchemaElement ( RDF_OBJECT_ATT , KeyType . HASH ) ) . withKeySchema ( new KeySchemaElement ( RDF_PREDICATE_ATT , KeyType . RANGE ) ) . withProjection ( new Projection ( ) . withNonKeyAttributes ( RDF_SUBJECT_ATT ) . withProjectionType ( ProjectionType . INCLUDE ) ) . withProvisionedThroughput ( new ProvisionedThroughput ( 10L , 10L ) ) ; final CreateTableRequest request = new CreateTableRequest ( ) . withTableName ( TABLE_NAME ) . withAttributeDefinitions ( attributeDefinitions ) . withKeySchema ( keySchema ) . withProvisionedThroughput ( provisionedthroughput ) . withLocalSecondaryIndexes ( predicateIndex ) . withGlobalSecondaryIndexes ( objectIndex ) ; return dynamodbClient . createTable ( request ) ; }
Builds the DynamoDB table as defined in serverless.yml
Builds the DynamoDB table as defined in serverless . yml