@@ -34,26 +34,27 @@ public void setup() throws Exception {
3434 try {
3535 DeleteTableRequest deleteTableRequest = new DeleteTableRequest (tableName );
3636 ots .deleteTable (deleteTableRequest );
37+ Thread .sleep (5000 );
3738 } catch (Exception ex ) {;}
3839 }
3940
4041 @ Test
4142 public void testTableOperation () throws Exception {
4243 LOG .info ("Start testTableOperation" );
4344
44- // create table
45+ LOG . info ( " create table" );
4546 TableMeta tableMeta = getTestTableMeta ();
4647 CapacityUnit tableCU = getTestCapacityUnit ();
4748 CreateTableRequest request = new CreateTableRequest ();
4849 request .setTableMeta (tableMeta );
4950 request .setReservedThroughput (tableCU );
5051 ots .createTable (request );
5152
52- // list table to check table is exist
53+ LOG . info ( " list table to check table is exist" );
5354 List <String > tableNames = ots .listTable ().getTableNames ();
5455 assertTrue (tableNames .contains (tableName ));
5556
56- // get table meta and check table meta
57+ LOG . info ( " get table meta and check table meta" );
5758 DescribeTableRequest dtRequest = new DescribeTableRequest (tableName );
5859 DescribeTableResult dtResult = ots .describeTable (dtRequest );
5960 TableMeta meta = dtResult .getTableMeta ();
@@ -62,8 +63,8 @@ public void testTableOperation() throws Exception {
6263 assertEquals (dtResult .getReservedThroughputDetails ().getLastDecreaseTime (), 0 );
6364 assertEquals (dtResult .getReservedThroughputDetails ().getNumberOfDecreasesToday (), 0 );
6465
65- // update table
66- // decrease read capacity
66+ LOG . info ( " update table" );
67+ LOG . info ( " decrease read capacity" );
6768 Thread .sleep (70 * 1000 + 10 ); // sleep more than 70 seconds
6869 UpdateTableRequest utRequest = new UpdateTableRequest (tableName );
6970 ReservedThroughputChange capacityChange = new ReservedThroughputChange ();
@@ -76,7 +77,7 @@ public void testTableOperation() throws Exception {
7677 assertEquals (utResponse .getReservedThroughputDetails ().getCapacityUnit ().getReadCapacityUnit (), 97 );
7778 assertEquals (utResponse .getReservedThroughputDetails ().getCapacityUnit ().getWriteCapacityUnit (), 1 );
7879
79- // get table meta and check table is updated
80+ LOG . info ( " get table meta and check table is updated" );
8081 dtResult = ots .describeTable (dtRequest );
8182 compareTableMeta (tableMeta ,dtResult .getTableMeta ());
8283 assertTrue (dtResult .getReservedThroughputDetails ().getLastDecreaseTime () != 0 );
@@ -85,7 +86,7 @@ public void testTableOperation() throws Exception {
8586 assertEquals (dtResult .getReservedThroughputDetails ().getCapacityUnit ().getReadCapacityUnit (), 97 );
8687 assertEquals (dtResult .getReservedThroughputDetails ().getCapacityUnit ().getWriteCapacityUnit (), 1 );
8788
88- // decrease write capacity
89+ LOG . info ( " decrease write capacity" );
8990 Thread .sleep (70 * 1000 + 10 ); // sleep more than 70 seconds
9091 capacityChange = new ReservedThroughputChange ();
9192 capacityChange .setWriteCapacityUnit (98 );
@@ -97,7 +98,7 @@ public void testTableOperation() throws Exception {
9798 assertEquals (utResponse .getReservedThroughputDetails ().getCapacityUnit ().getReadCapacityUnit (), 97 );
9899 assertEquals (utResponse .getReservedThroughputDetails ().getCapacityUnit ().getWriteCapacityUnit (), 98 );
99100
100- // get table meta and check table is updated
101+ LOG . info ( " get table meta and check table is updated" );
101102 dtResult = ots .describeTable (dtRequest );
102103 compareTableMeta (tableMeta ,dtResult .getTableMeta ());
103104 assertTrue (dtResult .getReservedThroughputDetails ().getLastDecreaseTime () != 0 );
@@ -106,11 +107,12 @@ public void testTableOperation() throws Exception {
106107 assertEquals (dtResult .getReservedThroughputDetails ().getCapacityUnit ().getReadCapacityUnit (), 97 );
107108 assertEquals (dtResult .getReservedThroughputDetails ().getCapacityUnit ().getWriteCapacityUnit (), 98 );
108109
109- // delete table
110+ LOG . info ( " delete table" );
110111 DeleteTableRequest delRequest = new DeleteTableRequest (tableName );
111112 ots .deleteTable (delRequest );
113+ Thread .sleep (5000 );
112114
113- // list table to check table is not exist
115+ LOG . info ( " list table to check table is not exist" );
114116 tableNames = ots .listTable ().getTableNames ();
115117 assertTrue (!tableNames .contains (tableName ));
116118 }
0 commit comments