Examples of TableDescription


Examples of com.amazonaws.services.dynamodbv2.model.TableDescription

     */
    private static boolean tableHasCorrectSchema(AmazonDynamoDBClient client, String tableName, String key) {
        DescribeTableRequest describeTableRequest = new DescribeTableRequest();
        describeTableRequest.setTableName(tableName);
        DescribeTableResult describeTableResult = client.describeTable(describeTableRequest);
        TableDescription tableDescription = describeTableResult.getTable();
        if (tableDescription.getAttributeDefinitions().size() != 1) {
            LOG.error("The number of attribute definitions does not match the existing table.");
            return false;
        }
        AttributeDefinition attributeDefinition = tableDescription.getAttributeDefinitions().get(0);
        if (!attributeDefinition.getAttributeName().equals(key)
                || !attributeDefinition.getAttributeType().equals(ScalarAttributeType.S.toString())) {
            LOG.error("Attribute name or type does not match existing table.");
            return false;
        }
        List<KeySchemaElement> KSEs = tableDescription.getKeySchema();
        if (KSEs.size() != 1) {
            LOG.error("The number of key schema elements does not match the existing table.");
            return false;
        }
        KeySchemaElement kse = KSEs.get(0);
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.TableDescription

     * A convenient blocking call that can be used, typically during table
     * creation, to wait for the table to become active by polling the table
     * every 5 seconds.
     */
    public TableDescription waitForActive() throws InterruptedException {
        TableDescription desc = describe();
        String status = desc.getTableStatus();
        for (;; status = desc.getTableStatus()) {
            if ("ACTIVE".equals(status))
                return desc;
            if ("CREATING".equals(status) || "UPDATING".equals(status)) {
                Thread.sleep(SLEEP_TIME_MILLIS);
                desc = describe();
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.TableDescription

     * deletion, to wait for the table to become deleted by polling the table
     * every 5 seconds.
     */
    public void waitForDelete() throws InterruptedException {
        try {
            TableDescription desc = describe();
            String status = desc.getTableStatus();
            for (;; status = desc.getTableStatus()) {
                if ("DELETING".equals(status)) {
                    Thread.sleep(SLEEP_TIME_MILLIS);
                    desc = describe();
                    continue;
                }
View Full Code Here

Examples of com.nurkiewicz.jdbcrepository.TableDescription

            mapping.put("FAVOURITE_COUNT", comment.getFavouriteCount());
            return mapping;
          }
        },
        new CommentWithUserMssqlGenerator(),
        new TableDescription("COMMENTS", "COMMENTS c JOIN USERS u ON c.USER_NAME = u.USER_NAME", "ID")
    );
  }
View Full Code Here

Examples of com.nurkiewicz.jdbcrepository.TableDescription

            mapping.put("FAVOURITE_COUNT", comment.getFavouriteCount());
            return mapping;
          }
        },
        new CommentWithUserDerbySqlGenerator(),
        new TableDescription("COMMENTS", "COMMENTS c JOIN USERS u ON c.USER_NAME = u.USER_NAME", "ID")
    );
  }
View Full Code Here

Examples of com.nurkiewicz.jdbcrepository.TableDescription

  public BoardingPassRepository() {
    this("BOARDING_PASS");
  }

  public BoardingPassRepository(String tableName) {
    super(MAPPER, UNMAPPER, new TableDescription(tableName, null, "flight_no", "seq_no")
    );
  }
View Full Code Here

Examples of com.nurkiewicz.jdbcrepository.TableDescription

  private final SqlGenerator sqlGenerator = new SqlGenerator();

  @Test
  public void buildSqlForSelectByIdsWhenSingleIdColumnAndNoId() throws Exception {
    //given
    final TableDescription table = new TableDescription("table", "num");

    //when
    final String sql = sqlGenerator.selectByIds(table, 0);

    //then
View Full Code Here

Examples of com.nurkiewicz.jdbcrepository.TableDescription

  }

  @Test
  public void buildSqlForSelectByIdsWhenSingleIdColumnAndOneId() throws Exception {
    //given
    final TableDescription table = new TableDescription("table", "num");

    //when
    final String sql = sqlGenerator.selectByIds(table, 1);

    //then
View Full Code Here

Examples of com.nurkiewicz.jdbcrepository.TableDescription

  }

  @Test
  public void buildSqlForSelectByIdsWhenSingleIdColumnAndTwoIds() throws Exception {
    //given
    final TableDescription table = new TableDescription("table", "num");

    //when
    final String sql = sqlGenerator.selectByIds(table, 2);

    //then
View Full Code Here

Examples of com.nurkiewicz.jdbcrepository.TableDescription

  }

  @Test
  public void buildSqlForSelectByIdsWhenSingleIdColumnAndSeveralIds() throws Exception {
    //given
    final TableDescription table = new TableDescription("table", "num");

    //when
    final String sql = sqlGenerator.selectByIds(table, 4);

    //then
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.