1313import tech .ydb .table .description .TableDescription ;
1414import tech .ydb .table .impl .SimpleTableClient ;
1515import tech .ydb .table .rpc .grpc .GrpcTableRpc ;
16- import tech .ydb .table .settings .CreateTableSettings ;
1716import tech .ydb .table .values .PrimitiveType ;
1817import tech .ydb .table .values .PrimitiveValue ;
1918import tech .ydb .test .junit4 .GrpcTransportRule ;
2019
21- import java .time .Duration ;
22- import java .time .temporal .ChronoUnit ;
23-
2420/**
2521 * @author Kirill Kurdyukov
2622 */
@@ -44,8 +40,7 @@ public void smallSerialTest() {
4440 .setPrimaryKey ("id" )
4541 .build ();
4642
47- Status createStatus = ctx .supplyStatus (session ->
48- session .createTable (tablePath , tableDescription , new CreateTableSettings ())).join ();
43+ Status createStatus = ctx .supplyStatus (session -> session .createTable (tablePath , tableDescription )).join ();
4944 Assert .assertTrue ("Create table with small serial " + createStatus , createStatus .isSuccess ());
5045
5146 Result <TableDescription > describeResult = ctx .supplyResult (session -> session .describeTable (tablePath )).join ();
@@ -66,7 +61,7 @@ public void serialTest() {
6661 .build ();
6762
6863 Status createStatus = ctx .supplyStatus (session ->
69- session .createTable (tablePath , tableDescription , new CreateTableSettings () )).join ();
64+ session .createTable (tablePath , tableDescription )).join ();
7065 Assert .assertTrue ("Create table with serial " + createStatus , createStatus .isSuccess ());
7166
7267 Result <TableDescription > describeResult = ctx .supplyResult (session -> session .describeTable (tablePath )).join ();
@@ -89,7 +84,7 @@ public void bigSerialTest() {
8984 .build ();
9085
9186 Status createStatus = ctx .supplyStatus (session ->
92- session .createTable (tablePath , tableDescription , new CreateTableSettings () )).join ();
87+ session .createTable (tablePath , tableDescription )).join ();
9388 Assert .assertTrue ("Create table with big serial " + createStatus , createStatus .isSuccess ());
9489
9590 Result <TableDescription > describeResult = ctx .supplyResult (session -> session .describeTable (tablePath )).join ();
@@ -112,23 +107,20 @@ public void defaultValueTest() {
112107 .setPrimaryKey ("id" )
113108 .build ();
114109
115- Status createStatus = ctx .supplyStatus (session ->
116- session .createTable (tablePath , tableDescription , new CreateTableSettings ())).join ();
110+ Status createStatus = ctx .supplyStatus (session -> session .createTable (tablePath , tableDescription )).join ();
117111 Assert .assertTrue ("Create table with indexes " + createStatus , createStatus .isSuccess ());
118-
119112 Result <TableDescription > describeResult = ctx .supplyResult (session -> session .describeTable (tablePath )).join ();
120113 Assert .assertTrue ("Describe table with indexes " + describeResult .getStatus (), describeResult .isSuccess ());
121114 TableColumn tableColumn = describeResult .getValue ().getColumns ().get (0 );
122115 Assert .assertNull (tableColumn .getSequenceDescription ());
123116 Assert .assertEquals ("text" , tableColumn .getLiteralDefaultValue ().getText ());
124117 Assert .assertEquals (PrimitiveType .Text , tableColumn .getType ());
125- ctx .supplyStatus (session -> session .dropTable (tablePath )).join ();
126-
127118
119+ ctx .supplyStatus (session -> session .dropTable (tablePath )).join ();
128120 }
129121
130122 @ Test
131- public void customSequenceDescriptionTest () throws InterruptedException {
123+ public void customSequenceDescriptionTest () {
132124 String tablePath = ydbTransport .getDatabase () + "/default_value_table" ;
133125
134126 TableDescription tableDescription = TableDescription .newBuilder ()
@@ -145,7 +137,6 @@ public void customSequenceDescriptionTest() throws InterruptedException {
145137 .setPrimaryKey ("id" )
146138 .build ();
147139
148- Thread .sleep (10_000 );
149140 Status createStatus = ctx .supplyStatus (session -> session .createTable (tablePath , tableDescription )).join ();
150141 Assert .assertTrue ("Create table with sequence description " + createStatus , createStatus .isSuccess ());
151142 Result <TableDescription > describeResult = ctx .supplyResult (session -> session .describeTable (tablePath )).join ();
@@ -162,24 +153,5 @@ public void customSequenceDescriptionTest() throws InterruptedException {
162153 Assert .assertEquals (2L , (long ) sequenceDescription .getIncrement ());
163154 Assert .assertEquals (12L , (long ) sequenceDescription .getStartValue ());
164155 ctx .supplyStatus (session -> session .dropTable (tablePath )).join ();
165-
166- createStatus = ctx .supplyStatus (session -> session .createTable (tablePath + "_copy" , description )).join ();
167- Assert .assertTrue ("Create copy table with sequence description " + createStatus ,
168- createStatus .isSuccess ());
169- Result <TableDescription > describeResultCopy = ctx .supplyResult (session ->
170- session .describeTable (tablePath )).join ();
171- Assert .assertTrue ("Describe copy table with sequence description " + describeResultCopy .getStatus (),
172- describeResultCopy .isSuccess ());
173- SequenceDescription sequenceDescriptionCopy = describeResultCopy .getValue ()
174- .getColumns ().get (0 ).getSequenceDescription ();
175- Assert .assertNotNull (sequenceDescription );
176- Assert .assertEquals ("custom_sequence_description" , sequenceDescriptionCopy .getName ());
177- Assert .assertEquals (Integer .MAX_VALUE , sequenceDescriptionCopy .getMaxValue ().intValue ());
178- Assert .assertEquals (10L , (long ) sequenceDescriptionCopy .getMinValue ());
179- Assert .assertEquals (5L , (long ) sequenceDescriptionCopy .getCache ());
180- Assert .assertEquals (true , sequenceDescriptionCopy .getCycle ());
181- Assert .assertEquals (2L , (long ) sequenceDescriptionCopy .getIncrement ());
182- Assert .assertEquals (12L , (long ) sequenceDescriptionCopy .getStartValue ());
183- ctx .supplyStatus (session -> session .dropTable (tablePath + "_copy" )).join ();
184156 }
185157}
0 commit comments