Skip to content

Commit

Permalink
Merge pull request #220 from Aiven-Open/fix-operation-enum-parsing-typo
Browse files Browse the repository at this point in the history
Fix typo in operations parsing
  • Loading branch information
biggusdonzus authored Nov 15, 2024
2 parents d522a75 + 79f9ec5 commit 23cef43
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public enum AclOperationType {
All(org.apache.kafka.common.acl.AclOperation.ALL),
Read(org.apache.kafka.common.acl.AclOperation.READ),
Write(org.apache.kafka.common.acl.AclOperation.WRITE),
Create1(org.apache.kafka.common.acl.AclOperation.CREATE),
Create(org.apache.kafka.common.acl.AclOperation.CREATE),
Delete(org.apache.kafka.common.acl.AclOperation.DELETE),
Alter(org.apache.kafka.common.acl.AclOperation.ALTER),
Describe(org.apache.kafka.common.acl.AclOperation.DESCRIBE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,12 @@ public final void parseWrongOperations() {
final var jsonReader = new AclJsonReader(path);
assertThrows(JsonParseException.class, jsonReader::read);
}

@Test
public final void parseAllOperations() {
final var path = new File(this.getClass().getResource("/acl_all_operations.json").getPath()).toPath();
final var jsonReader = new AclJsonReader(path);
final var acls = jsonReader.read();
assertThat(acls).isNotEmpty();
}
}
128 changes: 128 additions & 0 deletions src/test/resources/acl_all_operations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
[
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Alter"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Alter"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["AlterConfigs"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["AlterConfigs"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["ClusterAction"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Create"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Create"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["CreateTokens"],
"resource": "^User:user2$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Delete"],
"resource": "^Group:group1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Delete"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Describe"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Describe"],
"resource": "^DelegationToken:foobar$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Describe", "Read"],
"resource": "^Group:group1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Describe"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Describe", "Write"],
"resource": "^TransactionalId:foobar$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["DescribeConfigs"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["DescribeConfigs"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["DescribeConfigs"],
"resource": "^User:user2$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["IdempotentWrite"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Read", "Write"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^all$",
"operations": ["All"],
"resource": "^Topic:topic1$"
}
]

0 comments on commit 23cef43

Please sign in to comment.