public void validate()

in PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appservice-java/src/main/java/com/microsoft/azure/toolkit/intellij/legacy/webapp/runner/webappconfig/WebAppConfiguration.java [98:148]


    public void validate() throws ConfigurationException {
        final AppServiceConfig config = this.webAppSettingModel.getConfig();
        if (StringUtils.isEmpty(config.getAppName())) {
            throw new ConfigurationException(message("webapp.deploy.validate.noWebAppName"));
        }
        if (StringUtils.isEmpty(config.getSubscriptionId())) {
            throw new ConfigurationException(message("webapp.deploy.validate.noSubscription"));
        }
        if (StringUtils.isEmpty(config.getResourceGroup())) {
            throw new ConfigurationException(message("webapp.deploy.validate.noResourceGroup"));
        }
        if (StringUtils.isEmpty(config.getServicePlanName())) {
            throw new ConfigurationException(message("webapp.deploy.validate.noAppServicePlan"));
        }
        final DeploymentSlotConfig slotConfig = config.getSlotConfig();
        if (Objects.nonNull(slotConfig)) {
            if (StringUtils.isEmpty(slotConfig.getName())) {
                throw new ConfigurationException(message("webapp.deploy.validate.noSlotName"));
            }
            if (!slotConfig.getName().matches(SLOT_NAME_REGEX)) {
                throw new ConfigurationException(message("webapp.deploy.validate.invalidSlotName"));
            }
        }
        // validate runtime with artifact
        final WebAppRuntime runtime;
        try {
            runtime = (WebAppRuntime) RuntimeConfig.toWebAppRuntime(config.getRuntime());
        } catch (final RuntimeException e) {
            throw new ConfigurationException(message("webapp.validate_deploy_configuration.invalidRuntime"));
        }
        final OperatingSystem operatingSystem = runtime.getOperatingSystem();
        final JavaVersion javaVersion = runtime.getJavaVersion();
        if (operatingSystem == OperatingSystem.DOCKER) {
            throw new ConfigurationException(message("webapp.validate_deploy_configuration.dockerRuntime"));
        }
        if (Objects.equals(javaVersion, JavaVersion.OFF)) {
            throw new ConfigurationException(message("webapp.validate_deploy_configuration.invalidRuntime"));
        }
        final String containerName = runtime.getContainerName();
        final String artifactPackage = webAppSettingModel.getPackaging();
        if (StringUtils.containsIgnoreCase(containerName, TOMCAT) && !StringUtils.equalsAnyIgnoreCase(artifactPackage, "war")) {
            throw new ConfigurationException(message("webapp.deploy.validate.invalidTomcatArtifact"));
        } else if (StringUtils.containsIgnoreCase(containerName, JBOSS) && !StringUtils.equalsAnyIgnoreCase(artifactPackage, "war", "ear")) {
            throw new ConfigurationException(message("webapp.deploy.validate.invalidJbossArtifact"));
        } else if (StringUtils.containsIgnoreCase(containerName, "Java") && !StringUtils.equalsAnyIgnoreCase(artifactPackage, "jar")) {
            throw new ConfigurationException(message("webapp.deploy.validate.invalidJavaSeArtifact"));
        }
        if (StringUtils.isEmpty(webAppSettingModel.getArtifactIdentifier())) {
            throw new ConfigurationException(message("webapp.deploy.validate.missingArtifact"));
        }
    }