Skip to content

Commit 2f021d4

Browse files
authored
Add a new line between ARRANGE and ACT/ASSERT sections in permission tests (#2994)
1 parent c873095 commit 2f021d4

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

integration-test/src/main/java/com/scalar/db/api/DistributedStorageAdminPermissionIntegrationTestBase.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public void getImportTableMetadata_WithSufficientPermission_ShouldSucceed()
120120
// Arrange
121121
createNamespaceByRoot();
122122
createTableByRoot();
123+
123124
// Act Assert
124125
assertThatCode(() -> adminForNormalUser.getImportTableMetadata(NAMESPACE, TABLE))
125126
.doesNotThrowAnyException();
@@ -131,6 +132,7 @@ public void addRawColumnToTable_WithSufficientPermission_ShouldSucceed()
131132
// Arrange
132133
createNamespaceByRoot();
133134
createTableByRoot();
135+
134136
// Act Assert
135137
assertThatCode(
136138
() ->
@@ -142,6 +144,7 @@ public void addRawColumnToTable_WithSufficientPermission_ShouldSucceed()
142144
@Test
143145
public void createNamespace_WithSufficientPermission_ShouldSucceed() {
144146
// Arrange
147+
145148
// Act Assert
146149
assertThatCode(() -> adminForNormalUser.createNamespace(NAMESPACE, getCreationOptions()))
147150
.doesNotThrowAnyException();
@@ -151,6 +154,7 @@ public void createNamespace_WithSufficientPermission_ShouldSucceed() {
151154
public void createTable_WithSufficientPermission_ShouldSucceed() throws ExecutionException {
152155
// Arrange
153156
createNamespaceByRoot();
157+
154158
// Act Assert
155159
assertThatCode(
156160
() ->
@@ -164,6 +168,7 @@ public void dropTable_WithSufficientPermission_ShouldSucceed() throws ExecutionE
164168
// Arrange
165169
createNamespaceByRoot();
166170
createTableByRoot();
171+
167172
// Act Assert
168173
assertThatCode(() -> adminForNormalUser.dropTable(NAMESPACE, TABLE)).doesNotThrowAnyException();
169174
}
@@ -172,6 +177,7 @@ public void dropTable_WithSufficientPermission_ShouldSucceed() throws ExecutionE
172177
public void dropNamespace_WithSufficientPermission_ShouldSucceed() throws ExecutionException {
173178
// Arrange
174179
createNamespaceByRoot();
180+
175181
// Act Assert
176182
assertThatCode(() -> adminForNormalUser.dropNamespace(NAMESPACE, true))
177183
.doesNotThrowAnyException();
@@ -182,6 +188,7 @@ public void truncateTable_WithSufficientPermission_ShouldSucceed() throws Execut
182188
// Arrange
183189
createNamespaceByRoot();
184190
createTableByRoot();
191+
185192
// Act Assert
186193
assertThatCode(() -> adminForNormalUser.truncateTable(NAMESPACE, TABLE))
187194
.doesNotThrowAnyException();
@@ -192,6 +199,7 @@ public void createIndex_WithSufficientPermission_ShouldSucceed() throws Executio
192199
// Arrange
193200
createNamespaceByRoot();
194201
createTableByRoot();
202+
195203
// Act Assert
196204
assertThatCode(
197205
() -> adminForNormalUser.createIndex(NAMESPACE, TABLE, COL_NAME3, getCreationOptions()))
@@ -203,6 +211,7 @@ public void dropIndex_WithSufficientPermission_ShouldSucceed() throws ExecutionE
203211
// Arrange
204212
createNamespaceByRoot();
205213
createTableByRoot();
214+
206215
// Act Assert
207216
assertThatCode(() -> adminForNormalUser.dropIndex(NAMESPACE, TABLE, COL_NAME4))
208217
.doesNotThrowAnyException();
@@ -213,6 +222,7 @@ public void indexExists_WithSufficientPermission_ShouldSucceed() throws Executio
213222
// Arrange
214223
createNamespaceByRoot();
215224
createTableByRoot();
225+
216226
// Act Assert
217227
assertThatCode(() -> adminForNormalUser.indexExists(NAMESPACE, TABLE, COL_NAME4))
218228
.doesNotThrowAnyException();
@@ -223,6 +233,7 @@ public void getTableMetadata_WithSufficientPermission_ShouldSucceed() throws Exe
223233
// Arrange
224234
createNamespaceByRoot();
225235
createTableByRoot();
236+
226237
// Act Assert
227238
assertThatCode(() -> adminForNormalUser.getTableMetadata(NAMESPACE, TABLE))
228239
.doesNotThrowAnyException();
@@ -234,6 +245,7 @@ public void getNamespaceTableNames_WithSufficientPermission_ShouldSucceed()
234245
// Arrange
235246
createNamespaceByRoot();
236247
createTableByRoot();
248+
237249
// Act Assert
238250
assertThatCode(() -> adminForNormalUser.getNamespaceTableNames(NAMESPACE))
239251
.doesNotThrowAnyException();
@@ -244,6 +256,7 @@ public void namespaceExists_WithSufficientPermission_ShouldSucceed() throws Exec
244256
// Arrange
245257
createNamespaceByRoot();
246258
createTableByRoot();
259+
247260
// Act Assert
248261
assertThatCode(() -> adminForNormalUser.namespaceExists(NAMESPACE)).doesNotThrowAnyException();
249262
}
@@ -253,6 +266,7 @@ public void tableExists_WithSufficientPermission_ShouldSucceed() throws Executio
253266
// Arrange
254267
createNamespaceByRoot();
255268
createTableByRoot();
269+
256270
// Act Assert
257271
assertThatCode(() -> adminForNormalUser.tableExists(NAMESPACE, TABLE))
258272
.doesNotThrowAnyException();
@@ -269,6 +283,7 @@ public void repairNamespace_WithSufficientPermission_ShouldSucceed() throws Exce
269283
} finally {
270284
adminTestUtils.close();
271285
}
286+
272287
// Act Assert
273288
assertThatCode(() -> adminForNormalUser.repairNamespace(NAMESPACE, getCreationOptions()))
274289
.doesNotThrowAnyException();
@@ -286,6 +301,7 @@ public void repairTable_WithSufficientPermission_ShouldSucceed() throws Exceptio
286301
} finally {
287302
adminTestUtils.close();
288303
}
304+
289305
// Act Assert
290306
assertThatCode(
291307
() ->
@@ -300,6 +316,7 @@ public void addNewColumnToTable_WithSufficientPermission_ShouldSucceed()
300316
// Arrange
301317
createNamespaceByRoot();
302318
createTableByRoot();
319+
303320
// Act Assert
304321
assertThatCode(
305322
() ->
@@ -320,6 +337,7 @@ public void importTable_WithSufficientPermission_ShouldSucceed() throws Exceptio
320337
} finally {
321338
adminTestUtils.close();
322339
}
340+
323341
// Act Assert
324342
assertThatCode(() -> adminForNormalUser.importTable(NAMESPACE, TABLE, getCreationOptions()))
325343
.doesNotThrowAnyException();
@@ -329,6 +347,7 @@ public void importTable_WithSufficientPermission_ShouldSucceed() throws Exceptio
329347
public void getNamespaceNames_WithSufficientPermission_ShouldSucceed() throws ExecutionException {
330348
// Arrange
331349
createNamespaceByRoot();
350+
332351
// Act Assert
333352
assertThatCode(() -> adminForNormalUser.getNamespaceNames()).doesNotThrowAnyException();
334353
}
@@ -344,6 +363,7 @@ public void upgrade_WithSufficientPermission_ShouldSucceed() throws Exception {
344363
} finally {
345364
adminTestUtils.close();
346365
}
366+
347367
// Act Assert
348368
assertThatCode(() -> adminForNormalUser.upgrade(getCreationOptions()))
349369
.doesNotThrowAnyException();

integration-test/src/main/java/com/scalar/db/api/DistributedStoragePermissionIntegrationTestBase.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public void get_WithSufficientPermission_ShouldSucceed() {
117117
.partitionKey(Key.ofInt(COL_NAME1, PARTITION_KEY_VALUE))
118118
.clusteringKey(Key.ofText(COL_NAME2, CLUSTERING_KEY_VALUE1))
119119
.build();
120+
120121
// Act Assert
121122
assertThatCode(() -> storageForNormalUser.get(get)).doesNotThrowAnyException();
122123
}
@@ -130,6 +131,7 @@ public void get_WithIndexKey_WithSufficientPermission_ShouldSucceed() {
130131
.table(TABLE)
131132
.indexKey(Key.ofInt("c3", INT_COLUMN_VALUE1))
132133
.build();
134+
133135
// Act Assert
134136
assertThatCode(() -> storageForNormalUser.get(get)).doesNotThrowAnyException();
135137
}
@@ -143,6 +145,7 @@ public void scan_WithSufficientPermission_ShouldSucceed() {
143145
.table(TABLE)
144146
.partitionKey(Key.ofInt(COL_NAME1, PARTITION_KEY_VALUE))
145147
.build();
148+
146149
// Act Assert
147150
assertThatCode(() -> storageForNormalUser.scan(scan).close()).doesNotThrowAnyException();
148151
}
@@ -156,6 +159,7 @@ public void scan_WithIndexKey_WithSufficientPermission_ShouldSucceed() {
156159
.table(TABLE)
157160
.indexKey(Key.ofInt("c3", INT_COLUMN_VALUE1))
158161
.build();
162+
159163
// Act Assert
160164
assertThatCode(() -> storageForNormalUser.scan(scan).close()).doesNotThrowAnyException();
161165
}
@@ -164,6 +168,7 @@ public void scan_WithIndexKey_WithSufficientPermission_ShouldSucceed() {
164168
public void scanAll_WithSufficientPermission_ShouldSucceed() {
165169
// Arrange
166170
Scan scan = Scan.newBuilder().namespace(namespace).table(TABLE).all().build();
171+
167172
// Act Assert
168173
assertThatCode(() -> storageForNormalUser.scan(scan).close()).doesNotThrowAnyException();
169174
}
@@ -172,6 +177,7 @@ public void scanAll_WithSufficientPermission_ShouldSucceed() {
172177
public void put_WithoutCondition_WithSufficientPermission_ShouldSucceed() {
173178
// Arrange
174179
Put put = createPut(CLUSTERING_KEY_VALUE1, INT_COLUMN_VALUE1, null);
180+
175181
// Act Assert
176182
assertThatCode(() -> storageForNormalUser.put(put)).doesNotThrowAnyException();
177183
}
@@ -181,6 +187,7 @@ public void put_WithPutIfNotExists_WithSufficientPermission_ShouldSucceed() {
181187
// Arrange
182188
Put putWithPutIfNotExists =
183189
createPut(CLUSTERING_KEY_VALUE1, INT_COLUMN_VALUE1, ConditionBuilder.putIfNotExists());
190+
184191
// Act Assert
185192
assertThatCode(() -> storageForNormalUser.put(putWithPutIfNotExists))
186193
.doesNotThrowAnyException();
@@ -194,6 +201,7 @@ public void put_WithPutIfExists_WithSufficientPermission_ShouldSucceed()
194201
storageForNormalUser.put(put);
195202
Put putWithPutIfExists =
196203
createPut(CLUSTERING_KEY_VALUE1, INT_COLUMN_VALUE2, ConditionBuilder.putIfExists());
204+
197205
// Act Assert
198206
assertThatCode(() -> storageForNormalUser.put(putWithPutIfExists)).doesNotThrowAnyException();
199207
}
@@ -210,6 +218,7 @@ public void put_WithPutIf_WithSufficientPermission_ShouldSucceed() throws Execut
210218
ConditionBuilder.putIf(
211219
ConditionBuilder.column(COL_NAME3).isEqualToInt(INT_COLUMN_VALUE1))
212220
.build());
221+
213222
// Act Assert
214223
assertThatCode(() -> storageForNormalUser.put(putWithPutIf)).doesNotThrowAnyException();
215224
}
@@ -219,6 +228,7 @@ public void put_WithMultiplePuts_WithSufficientPermission_ShouldSucceed() {
219228
// Arrange
220229
Put put1 = createPut(CLUSTERING_KEY_VALUE1, INT_COLUMN_VALUE1, null);
221230
Put put2 = createPut(CLUSTERING_KEY_VALUE2, INT_COLUMN_VALUE2, null);
231+
222232
// Act Assert
223233
assertThatCode(() -> storageForNormalUser.put(Arrays.asList(put1, put2)))
224234
.doesNotThrowAnyException();
@@ -228,6 +238,7 @@ public void put_WithMultiplePuts_WithSufficientPermission_ShouldSucceed() {
228238
public void delete_WithSufficientPermission_ShouldSucceed() {
229239
// Arrange
230240
Delete delete = createDelete(CLUSTERING_KEY_VALUE1, null);
241+
231242
// Act Assert
232243
assertThatCode(() -> storageForNormalUser.delete(delete)).doesNotThrowAnyException();
233244
}
@@ -239,6 +250,7 @@ public void delete_WithDeleteIfExists_WithSufficientPermission_ShouldSucceed()
239250
Put put = createPut(CLUSTERING_KEY_VALUE1, INT_COLUMN_VALUE1, null);
240251
storageForNormalUser.put(put);
241252
Delete delete = createDelete(CLUSTERING_KEY_VALUE1, ConditionBuilder.deleteIfExists());
253+
242254
// Act Assert
243255
assertThatCode(() -> storageForNormalUser.delete(delete)).doesNotThrowAnyException();
244256
}
@@ -255,6 +267,7 @@ public void delete_WithDeleteIf_WithSufficientPermission_ShouldSucceed()
255267
ConditionBuilder.deleteIf(
256268
ConditionBuilder.column(COL_NAME3).isEqualToInt(INT_COLUMN_VALUE1))
257269
.build());
270+
258271
// Act Assert
259272
assertThatCode(() -> storageForNormalUser.delete(delete)).doesNotThrowAnyException();
260273
}
@@ -264,6 +277,7 @@ public void delete_WithMultipleDeletes_WithSufficientPermission_ShouldSucceed()
264277
// Arrange
265278
Delete delete1 = createDelete(CLUSTERING_KEY_VALUE1, null);
266279
Delete delete2 = createDelete(CLUSTERING_KEY_VALUE2, null);
280+
267281
// Act Assert
268282
assertThatCode(() -> storageForNormalUser.delete(Arrays.asList(delete1, delete2)))
269283
.doesNotThrowAnyException();
@@ -274,6 +288,7 @@ public void mutate_WithSufficientPermission_ShouldSucceed() {
274288
// Arrange
275289
Put put = createPut(CLUSTERING_KEY_VALUE1, INT_COLUMN_VALUE1, null);
276290
Delete delete = createDelete(CLUSTERING_KEY_VALUE2, null);
291+
277292
// Act Assert
278293
assertThatCode(() -> storageForNormalUser.mutate(Arrays.asList(put, delete)))
279294
.doesNotThrowAnyException();

0 commit comments

Comments
 (0)