SimpleAclRule { public static SimpleAclRule fromCrd(AclRule rule) { return new SimpleAclRule(rule.getType(), SimpleAclRuleResource.fromCrd(rule.getResource()), rule.getHost(), rule.getOperation()); } SimpleAclRule(AclRuleType type, SimpleAclRuleResource resource, String host, AclOperation operation); AclRuleType getType(); SimpleAclRuleResource getResource(); String getHost(); AclOperation getOperation(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); AclBinding toKafkaAclBinding(KafkaPrincipal principal); static SimpleAclRule fromAclBinding(AclBinding aclBinding); static SimpleAclRule fromCrd(AclRule rule);  }
@Test public void testFromCrd() { AclRule rule = new AclRuleBuilder() .withType(AclRuleType.ALLOW) .withResource(aclRuleTopicResource) .withHost("127.0.0.1") .withOperation(AclOperation.READ) .build(); SimpleAclRule simple = SimpleAclRule.fromCrd(rule); assertThat(simple.getOperation(), is(AclOperation.READ)); assertThat(simple.getType(), is(AclRuleType.ALLOW)); assertThat(simple.getHost(), is("127.0.0.1")); assertThat(simple.getResource(), is(resource)); }