@Test public void testResourceNameIsCaseSensitive() throws Exception { Host host1 = (Host)KafkaModelAuthorizables.from("HOST=Host1"); assertEquals("Host1", host1.getName()); Cluster cluster1 = (Cluster)KafkaModelAuthorizables.from("Cluster=kafka-cluster"); assertEquals("kafka-cluster", cluster1.getName()); Topic topic1 = (Topic)KafkaModelAuthorizables.from("topic=topiC1"); assertEquals("topiC1", topic1.getName()); ConsumerGroup consumergroup1 = (ConsumerGroup)KafkaModelAuthorizables.from("ConsumerGroup=CG1"); assertEquals("CG1", consumergroup1.getName()); }
public static KafkaAuthorizable from(KeyValue keyValue) throws ConfigurationException { String prefix = keyValue.getKey().toLowerCase(); String name = keyValue.getValue(); for (AuthorizableType type : AuthorizableType.values()) { if (prefix.equalsIgnoreCase(type.name())) { return from(type, name); } } return null; }
KafkaModelAuthorizables { public static KafkaAuthorizable from(KeyValue keyValue) throws ConfigurationException { String prefix = keyValue.getKey().toLowerCase(); String name = keyValue.getValue(); for (AuthorizableType type : AuthorizableType.values()) { if (prefix.equalsIgnoreCase(type.name())) { return from(type, name); } } return null; } }
KafkaModelAuthorizables { public static KafkaAuthorizable from(KeyValue keyValue) throws ConfigurationException { String prefix = keyValue.getKey().toLowerCase(); String name = keyValue.getValue(); for (AuthorizableType type : AuthorizableType.values()) { if (prefix.equalsIgnoreCase(type.name())) { return from(type, name); } } return null; }  }
KafkaModelAuthorizables { public static KafkaAuthorizable from(KeyValue keyValue) throws ConfigurationException { String prefix = keyValue.getKey().toLowerCase(); String name = keyValue.getValue(); for (AuthorizableType type : AuthorizableType.values()) { if (prefix.equalsIgnoreCase(type.name())) { return from(type, name); } } return null; }  static KafkaAuthorizable from(KeyValue keyValue); static KafkaAuthorizable from(String keyValue); static KafkaAuthorizable from(AuthorizableType type, String name); }
KafkaModelAuthorizables { public static KafkaAuthorizable from(KeyValue keyValue) throws ConfigurationException { String prefix = keyValue.getKey().toLowerCase(); String name = keyValue.getValue(); for (AuthorizableType type : AuthorizableType.values()) { if (prefix.equalsIgnoreCase(type.name())) { return from(type, name); } } return null; }  static KafkaAuthorizable from(KeyValue keyValue); static KafkaAuthorizable from(String keyValue); static KafkaAuthorizable from(AuthorizableType type, String name);  }