diff --git a/src/test/java/com/michelin/ns4kafka/service/AclServiceTest.java b/src/test/java/com/michelin/ns4kafka/service/AclServiceTest.java index ad69adf6..7c3caa28 100644 --- a/src/test/java/com/michelin/ns4kafka/service/AclServiceTest.java +++ b/src/test/java/com/michelin/ns4kafka/service/AclServiceTest.java @@ -796,12 +796,14 @@ void shouldFindAllAclForNamespace() { Namespace ns = Namespace.builder() .metadata(Metadata.builder() .name("namespace1") + .cluster("local") .build()) .build(); AccessControlEntry ace1 = AccessControlEntry.builder() .metadata(Metadata.builder() .namespace("namespace1") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .grantedTo("namespace1") @@ -811,6 +813,7 @@ void shouldFindAllAclForNamespace() { AccessControlEntry ace2 = AccessControlEntry.builder() .metadata(Metadata.builder() .namespace("namespace1") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .grantedTo("namespace2") @@ -820,6 +823,7 @@ void shouldFindAllAclForNamespace() { AccessControlEntry ace3 = AccessControlEntry.builder() .metadata(Metadata.builder() .namespace("namespace2") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .grantedTo("namespace2") @@ -1039,6 +1043,7 @@ void shouldFindAclGrantedByNamespaceByWildcardName() { Namespace ns = Namespace.builder() .metadata(Metadata.builder() .name("namespace1") + .cluster("local") .build()) .build(); @@ -1046,6 +1051,7 @@ void shouldFindAclGrantedByNamespaceByWildcardName() { .metadata(Metadata.builder() .name("ns1-acl-topic") .namespace("namespace1") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) @@ -1057,6 +1063,7 @@ void shouldFindAclGrantedByNamespaceByWildcardName() { .metadata(Metadata.builder() .name("ns1-read-ns2") .namespace("namespace1") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) @@ -1068,6 +1075,7 @@ void shouldFindAclGrantedByNamespaceByWildcardName() { .metadata(Metadata.builder() .name("ns1-connect-write-to-ns2") .namespace("namespace1") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.CONNECT) @@ -1079,6 +1087,7 @@ void shouldFindAclGrantedByNamespaceByWildcardName() { .metadata(Metadata.builder() .name("ns2-acl-topic") .namespace("namespace2") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) @@ -1090,6 +1099,7 @@ void shouldFindAclGrantedByNamespaceByWildcardName() { .metadata(Metadata.builder() .name("ns3-read-topic-all") .namespace("namespace3") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) @@ -1110,6 +1120,7 @@ void shouldFindAclGrantedByNamespaceToOthersByWildcardName() { Namespace ns = Namespace.builder() .metadata(Metadata.builder() .name("namespace1") + .cluster("local") .build()) .build(); @@ -1117,6 +1128,7 @@ void shouldFindAclGrantedByNamespaceToOthersByWildcardName() { .metadata(Metadata.builder() .name("ns1-acl-topic") .namespace("namespace1") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) @@ -1128,6 +1140,7 @@ void shouldFindAclGrantedByNamespaceToOthersByWildcardName() { .metadata(Metadata.builder() .name("ns1-read-ns2") .namespace("namespace1") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) @@ -1139,6 +1152,7 @@ void shouldFindAclGrantedByNamespaceToOthersByWildcardName() { .metadata(Metadata.builder() .name("ns1-connect-write-to-ns2") .namespace("namespace1") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.CONNECT) @@ -1150,6 +1164,7 @@ void shouldFindAclGrantedByNamespaceToOthersByWildcardName() { .metadata(Metadata.builder() .name("ns2-acl-topic") .namespace("namespace2") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) @@ -1161,6 +1176,7 @@ void shouldFindAclGrantedByNamespaceToOthersByWildcardName() { .metadata(Metadata.builder() .name("ns3-read-topic-all") .namespace("namespace3") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) @@ -1182,6 +1198,7 @@ void shouldFindAclRelatedToNamespaceByWildcardName() { .metadata(Metadata.builder() .name("ns1-acl-topic") .namespace("namespace1") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) @@ -1193,6 +1210,7 @@ void shouldFindAclRelatedToNamespaceByWildcardName() { .metadata(Metadata.builder() .name("acl-ns2-read-to-ns1") .namespace("namespace2") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) @@ -1204,6 +1222,7 @@ void shouldFindAclRelatedToNamespaceByWildcardName() { .metadata(Metadata.builder() .name("ns1-acl-connect") .namespace("namespace1") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.CONNECT) @@ -1215,6 +1234,7 @@ void shouldFindAclRelatedToNamespaceByWildcardName() { .metadata(Metadata.builder() .name("ns2-acl-topic") .namespace("namespace2") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) @@ -1226,6 +1246,7 @@ void shouldFindAclRelatedToNamespaceByWildcardName() { .metadata(Metadata.builder() .name("ns3-read-topic-all") .namespace("namespace3") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) @@ -1237,6 +1258,7 @@ void shouldFindAclRelatedToNamespaceByWildcardName() { .metadata(Metadata.builder() .name("ns3-write-acl-ns1") .namespace("namespace3") + .cluster("local") .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.GROUP) @@ -1249,6 +1271,7 @@ void shouldFindAclRelatedToNamespaceByWildcardName() { Namespace ns1 = Namespace.builder() .metadata(Metadata.builder() .name("namespace1") + .cluster("local") .build()) .build(); @@ -1261,6 +1284,7 @@ void shouldFindAclRelatedToNamespaceByWildcardName() { Namespace ns2 = Namespace.builder() .metadata(Metadata.builder() .name("namespace2") + .cluster("local") .build()) .build(); @@ -1270,6 +1294,7 @@ void shouldFindAclRelatedToNamespaceByWildcardName() { Namespace ns3 = Namespace.builder() .metadata(Metadata.builder() .name("namespace3") + .cluster("local") .build()) .build(); @@ -1280,8 +1305,15 @@ void shouldFindAclRelatedToNamespaceByWildcardName() { @Test void shouldFindResourceWhereGivenNamespaceIsOwnerOf() { Namespace ns = Namespace.builder() - .metadata(Metadata.builder().name("namespace1").build()).build(); + .metadata(Metadata.builder() + .name("namespace1") + .cluster("local") + .build()) + .build(); AccessControlEntry acl1 = AccessControlEntry.builder() + .metadata(Metadata.builder() + .cluster("local") + .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) .permission(AccessControlEntry.Permission.OWNER) @@ -1289,6 +1321,9 @@ void shouldFindResourceWhereGivenNamespaceIsOwnerOf() { .build(); AccessControlEntry acl2 = AccessControlEntry.builder() + .metadata(Metadata.builder() + .cluster("local") + .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) .permission(AccessControlEntry.Permission.READ) @@ -1296,6 +1331,9 @@ void shouldFindResourceWhereGivenNamespaceIsOwnerOf() { .build(); AccessControlEntry acl3 = AccessControlEntry.builder() + .metadata(Metadata.builder() + .cluster("local") + .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.CONNECT) .permission(AccessControlEntry.Permission.OWNER) @@ -1303,6 +1341,9 @@ void shouldFindResourceWhereGivenNamespaceIsOwnerOf() { .build(); AccessControlEntry acl4 = AccessControlEntry.builder() + .metadata(Metadata.builder() + .cluster("local") + .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) .permission(AccessControlEntry.Permission.OWNER) @@ -1310,6 +1351,9 @@ void shouldFindResourceWhereGivenNamespaceIsOwnerOf() { .build(); AccessControlEntry acl5 = AccessControlEntry.builder() + .metadata(Metadata.builder() + .cluster("local") + .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.TOPIC) .permission(AccessControlEntry.Permission.READ) @@ -1317,6 +1361,9 @@ void shouldFindResourceWhereGivenNamespaceIsOwnerOf() { .build(); AccessControlEntry acl6 = AccessControlEntry.builder() + .metadata(Metadata.builder() + .cluster("local") + .build()) .spec(AccessControlEntry.AccessControlEntrySpec.builder() .resourceType(AccessControlEntry.ResourceType.GROUP) .permission(AccessControlEntry.Permission.WRITE)