Package com.amazonaws.services.dynamodb.model

Examples of com.amazonaws.services.dynamodb.model.DescribeTableResult


        if ("activeTable".equals(tableName)) {
            return tableWithStatus(TableStatus.ACTIVE);
        } else if ("creatibleTable".equals(tableName) && createTableRequest != null) {
            return tableWithStatus(TableStatus.ACTIVE);
        } else if ("FULL_DESCRIBE_TABLE".equals(tableName)) {
            return new DescribeTableResult().withTable(new TableDescription()
                    .withTableName(tableName)
                    .withTableStatus(TableStatus.ACTIVE)
                    .withCreationDateTime(new Date(NOW))
                    .withItemCount(100L)
                    .withKeySchema(new KeySchema(new KeySchemaElement().withAttributeName("name")))
View Full Code Here


        }
        throw new ResourceNotFoundException(tableName + " is missing");
    }

    private DescribeTableResult tableWithStatus(TableStatus active) {
        return new DescribeTableResult().withTable(new TableDescription().withTableStatus(active));
    }
View Full Code Here

        super(ddbClient, configuration, exchange);
    }

    @Override
    public void execute() {
        DescribeTableResult result = ddbClient.describeTable(new DescribeTableRequest()
                .withTableName(determineTableName()));

        Message msg = getMessageForResponse(exchange);
        msg.setHeader(DdbConstants.TABLE_NAME, result.getTable().getTableName());
        msg.setHeader(DdbConstants.TABLE_STATUS, result.getTable().getTableStatus());
        msg.setHeader(DdbConstants.CREATION_DATE, result.getTable().getCreationDateTime());
        msg.setHeader(DdbConstants.ITEM_COUNT, result.getTable().getItemCount());
        msg.setHeader(DdbConstants.KEY_SCHEMA, result.getTable().getKeySchema());
        msg.setHeader(DdbConstants.READ_CAPACITY,
                result.getTable().getProvisionedThroughput().getReadCapacityUnits());
        msg.setHeader(DdbConstants.WRITE_CAPACITY,
                result.getTable().getProvisionedThroughput().getWriteCapacityUnits());
        msg.setHeader(DdbConstants.TABLE_SIZE, result.getTable().getTableSizeBytes());
    }
View Full Code Here

      throw new AmazonServiceException(errors.toString());
    }

    // get information
    String tableName = request.getTableName();
    DescribeTableResult result = null;

    // Check to make sure table with same name doesn't exist
    if (this.tables.containsKey(tableName)) {
      Table table = this.tables.get(tableName);
      result = new DescribeTableResult().withTable(table.getTableDescription());
    } else {
      throw new ResourceNotFoundException("The table '" + tableName + "' does not exist.");
    }
    return result;
  }
View Full Code Here

    return result;
  }

  public com.amazonaws.services.dynamodbv2.model.DescribeTableResult describeTableV2(com.amazonaws.services.dynamodbv2.model.DescribeTableRequest v2Request) throws InternalServerErrorException, ResourceNotFoundException {
        DescribeTableRequest request = AlternatorDBApiVersion2Mapper.MapV2DescribeTableRequestToV1(v2Request);
        DescribeTableResult result = describeTable(request);
        return AlternatorDBApiVersion2Mapper.MapV1DescribeTableResultToV2(result);
  }
View Full Code Here

  @Test
  public void describeTable() {
    String name = createTableName();
    createTable(name);
    DescribeTableResult res = getClient().describeTable(new DescribeTableRequest().withTableName(name));
    Assert.assertNotNull(res.getTable());
    Assert.assertEquals(res.getTable().getTableName(), name);
  }
View Full Code Here

  @Test
  public void describeTableWithoutTableName() {
    createTable();
    boolean wasError = false;
    try {
      DescribeTableResult res = getClient().describeTable(new DescribeTableRequest());
      wasError = res.getTable() == null;
    } catch (Exception e) {
      wasError = true;
    }
    Assert.assertTrue(wasError);
  }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodb.model.DescribeTableResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.