@@ -171,32 +171,31 @@ void testNoAuthorizer() throws Exception {
171171 conf .setString ("client.security.sasl.password" , "password" );
172172 try (Connection connection = ConnectionFactory .createConnection (conf );
173173 Admin admin = connection .getAdmin ()) {
174- assertThatThrownBy (
175- () -> {
176- admin .listAcls (AclBindingFilter .ANY ).get ();
177- })
174+ assertThatThrownBy (() -> admin .listAcls (AclBindingFilter .ANY ).get ())
178175 .hasMessageContaining ("No Authorizer is configured." );
179176 assertThatThrownBy (
180- () -> {
181- admin .createAcls (
182- Collections .singletonList (
183- new AclBinding (
184- Resource .cluster (),
185- new AccessControlEntry (
186- WILD_CARD_PRINCIPAL ,
187- WILD_CARD_HOST ,
188- OperationType .CREATE ,
189- PermissionType .ALLOW ))))
190- .all ()
191- .get ();
192- })
177+ () ->
178+ admin .createAcls (
179+ Collections .singletonList (
180+ new AclBinding (
181+ Resource .cluster (),
182+ new AccessControlEntry (
183+ WILD_CARD_PRINCIPAL ,
184+ WILD_CARD_HOST ,
185+ OperationType
186+ .CREATE ,
187+ PermissionType
188+ .ALLOW ))))
189+ .all ()
190+ .get ())
193191 .hasMessageContaining ("No Authorizer is configured." );
194192 assertThatThrownBy (
195- () -> {
196- admin .dropAcls (Collections .singletonList (AclBindingFilter .ANY ))
197- .all ()
198- .get ();
199- })
193+ () ->
194+ admin .dropAcls (
195+ Collections .singletonList (
196+ AclBindingFilter .ANY ))
197+ .all ()
198+ .get ())
200199 .hasMessageContaining ("No Authorizer is configured." );
201200
202201 // test initWriter without authorizer and empty table paths
@@ -455,21 +454,15 @@ void testInitWriter() throws Exception {
455454 TableDescriptor .builder ().schema (DATA1_SCHEMA ).distributedBy (1 ).build ();
456455 rootAdmin .createTable (writeAclTable , descriptor , false ).get ();
457456 // create acl to allow guest write.
458- rootAdmin
459- .createAcls (
460- Collections .singletonList (
461- new AclBinding (
462- Resource .table (writeAclTable ),
463- new AccessControlEntry (
464- guestPrincipal ,
465- "*" ,
466- OperationType .WRITE ,
467- PermissionType .ALLOW ))))
468- .all ()
469- .get ();
457+ AclBinding aclBinding =
458+ new AclBinding (
459+ Resource .table (writeAclTable ),
460+ new AccessControlEntry (
461+ guestPrincipal , "*" , OperationType .WRITE , PermissionType .ALLOW ));
462+ rootAdmin .createAcls (Collections .singletonList (aclBinding )).all ().get ();
470463
471- FLUSS_CLUSTER_EXTENSION .waitUtilTableReady (
472- rootAdmin .getTableInfo (writeAclTable ).get ().getTableId ());
464+ FLUSS_CLUSTER_EXTENSION .waitUtilTableReadyWithAuthorization (
465+ rootAdmin .getTableInfo (writeAclTable ).get ().getTableId (), aclBinding );
473466
474467 FlussConnection flussConnection = (FlussConnection ) guestConn ;
475468 TabletServerGateway tabletServerGateway =
@@ -520,35 +513,24 @@ void testProduceWithNoWriteAuthorization() throws Exception {
520513 rootAdmin .createTable (noWriteAclTable , descriptor , false ).get ();
521514
522515 // create acl to allow guest write for writeAclTable.
523- rootAdmin
524- .createAcls (
525- Collections .singletonList (
526- new AclBinding (
527- Resource .table (writeAclTable ),
528- new AccessControlEntry (
529- guestPrincipal ,
530- "*" ,
531- OperationType .WRITE ,
532- PermissionType .ALLOW ))))
533- .all ()
534- .get ();
535- rootAdmin
536- .createAcls (
537- Collections .singletonList (
538- new AclBinding (
539- Resource .table (noWriteAclTable ),
540- new AccessControlEntry (
541- guestPrincipal ,
542- "*" ,
543- OperationType .READ ,
544- PermissionType .ALLOW ))))
545- .all ()
546- .get ();
547-
548- FLUSS_CLUSTER_EXTENSION .waitUtilTableReady (
549- rootAdmin .getTableInfo (writeAclTable ).get ().getTableId ());
550- FLUSS_CLUSTER_EXTENSION .waitUtilTableReady (
551- rootAdmin .getTableInfo (noWriteAclTable ).get ().getTableId ());
516+ AclBinding aclBindingOfWriteAclTable =
517+ new AclBinding (
518+ Resource .table (writeAclTable ),
519+ new AccessControlEntry (
520+ guestPrincipal , "*" , OperationType .WRITE , PermissionType .ALLOW ));
521+ AclBinding aclBindingOfNoWriteAclTable =
522+ new AclBinding (
523+ Resource .table (noWriteAclTable ),
524+ new AccessControlEntry (guestPrincipal , "*" , READ , PermissionType .ALLOW ));
525+ rootAdmin .createAcls (Collections .singletonList (aclBindingOfWriteAclTable )).all ().get ();
526+ rootAdmin .createAcls (Collections .singletonList (aclBindingOfNoWriteAclTable )).all ().get ();
527+
528+ FLUSS_CLUSTER_EXTENSION .waitUtilTableReadyWithAuthorization (
529+ rootAdmin .getTableInfo (writeAclTable ).get ().getTableId (),
530+ aclBindingOfWriteAclTable );
531+ FLUSS_CLUSTER_EXTENSION .waitUtilTableReadyWithAuthorization (
532+ rootAdmin .getTableInfo (noWriteAclTable ).get ().getTableId (),
533+ aclBindingOfNoWriteAclTable );
552534
553535 // 1. Try to write data to noWriteAclTable. It should throw AuthorizationException because
554536 // of request writeId failed.
@@ -595,20 +577,14 @@ void testProduceAndConsumer() throws Exception {
595577 TableDescriptor .builder ().schema (DATA1_SCHEMA ).distributedBy (1 ).build ();
596578 rootAdmin .createTable (DATA1_TABLE_PATH , descriptor , false ).get ();
597579 // create acl to allow guest write.
598- rootAdmin
599- .createAcls (
600- Collections .singletonList (
601- new AclBinding (
602- Resource .table (DATA1_TABLE_PATH ),
603- new AccessControlEntry (
604- guestPrincipal ,
605- "*" ,
606- OperationType .WRITE ,
607- PermissionType .ALLOW ))))
608- .all ()
609- .get ();
610- FLUSS_CLUSTER_EXTENSION .waitUtilTableReady (
611- rootAdmin .getTableInfo (DATA1_TABLE_PATH ).get ().getTableId ());
580+ AclBinding aclBinding =
581+ new AclBinding (
582+ Resource .table (DATA1_TABLE_PATH ),
583+ new AccessControlEntry (
584+ guestPrincipal , "*" , OperationType .WRITE , PermissionType .ALLOW ));
585+ rootAdmin .createAcls (Collections .singletonList (aclBinding )).all ().get ();
586+ FLUSS_CLUSTER_EXTENSION .waitUtilTableReadyWithAuthorization (
587+ rootAdmin .getTableInfo (DATA1_TABLE_PATH ).get ().getTableId (), aclBinding );
612588 try (Table table = guestConn .getTable (DATA1_TABLE_PATH )) {
613589 AppendWriter appendWriter = table .newAppend ().createWriter ();
614590 appendWriter .append (row (1 , "a" )).get ();
0 commit comments