@Test public void testClusterResourceNameIsRestricted() throws Exception { try { KafkaModelAuthorizables.from("Cluster=cluster1"); fail("Cluster with name other than " + Cluster.NAME + " must not have been created."); } catch (ConfigurationException cex) { assertEquals("Exception message is not as expected.", "Kafka's cluster resource can only have name " + Cluster.NAME, cex.getMessage()); } catch (Exception ex) { fail("Configuration exception was expected for invalid Cluster name."); } }
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);  }