in PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-hdinsight-lib/src/main/java/com/microsoft/azure/hdinsight/serverexplore/ui/AddNewClusterForm.java [390:433]
protected String doInputValidate() {
switch (getSparkClusterType()) {
case HDINSIGHT_CLUSTER:
if (isBlank(clusterNameOrUrlField.getText())) {
return "Cluster name can't be empty";
} else {
String clusterName = getClusterName(clusterNameOrUrlField.getText());
if (clusterName == null) {
return "Cluster URL is not a valid URL";
} else if (ctrlProvider.doesClusterNameExistInLinkedHDInsightClusters(
clusterName)) {
return "Cluster already exists in linked clusters";
}
}
break;
case LIVY_LINK_CLUSTER:
if (isBlank(livyEndpointField.getText()) ||
isBlank(livyClusterNameField.getText())) {
return "Livy Endpoint and cluster name can't be empty";
} else if (!ctrlProvider.isURLValid(livyEndpointField.getText())) {
return "Livy Endpoint is not a valid URL";
} else if (ctrlProvider.doesClusterLivyEndpointExistInAllHDInsightClusters(
livyEndpointField.getText())) {
return "The same name Livy Endpoint already exists in clusters";
} else if (ctrlProvider.doesClusterNameExistInAllHDInsightClusters(
livyClusterNameField.getText())) {
return "Cluster Name already exists in clusters";
} else if (!isEmpty(yarnEndpointField.getText()) &&
!ctrlProvider.isURLValid(yarnEndpointField.getText())) {
return "Yarn Endpoint is not a valid URL";
}
break;
default:
break;
}
if (isBasicAuthSelected()) {
if (isBlank(userNameField.getText()) || isBlank(passwordField.getText())) {
return "Username and password can't be empty in Basic Authentication";
}
}
return EMPTY;
}