use of com.microsoft.azure.maven.springcloud.config.AppRawConfig in project azure-maven-plugins by microsoft.
the class ConfigMojo method doExecute.
@Override
protected void doExecute() throws AzureExecutionException {
if (!settings.isInteractiveMode()) {
throw new UnsupportedOperationException("The goal 'config' must be run at interactive mode.");
}
if (!MavenConfigUtils.isPomPackaging(this.project) && !MavenConfigUtils.isJarPackaging(this.project)) {
throw new UnsupportedOperationException(String.format("The project (%s) with packaging %s is not supported for azure spring cloud service.", this.project.getName(), this.project.getPackaging()));
}
if (isProjectConfigured(this.project)) {
getLog().warn(String.format("Project (%s) is already configured and won't be affected by this command.", this.project.getName()));
return;
}
appSettings = new AppRawConfig();
deploymentSettings = new AppDeploymentRawConfig();
parentMode = MavenConfigUtils.isPomPackaging(this.project);
if (parentMode && advancedOptions) {
throw new UnsupportedOperationException("The \"advancedOptions\" mode is not supported at parent folder.");
}
final ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator(session, mojoExecution);
try {
this.wrapper = new ConfigurationPrompter(expressionEvaluator, getLog());
this.wrapper.initialize();
this.wrapper.putCommonVariable("project", this.project);
selectProjects();
if (targetProjects == null || targetProjects.isEmpty()) {
// no need to proceed when there are no projects need to be configured
return;
}
// select subscription in spring cloud -> config is different from other goals since it is prompted after select project.
// set up account and select subscription here
getAzureAccount();
promptAndSelectSubscription();
selectAppCluster();
configCommon();
confirmAndSave();
} catch (IOException | InvalidConfigurationException | UnsupportedOperationException | MavenDecryptException | LoginFailureException e) {
throw new AzureExecutionException(e.getMessage());
} finally {
if (this.wrapper != null) {
try {
this.wrapper.close();
} catch (IOException e) {
// ignore at final step
}
}
}
}
use of com.microsoft.azure.maven.springcloud.config.AppRawConfig in project azure-maven-plugins by microsoft.
the class SpringCloudAppSettingsTest method testSetSubscriptionId.
@Test
public void testSetSubscriptionId() {
final AppRawConfig app = new AppRawConfig();
app.setSubscriptionId("subscriptionId1");
assertEquals("subscriptionId1", app.getSubscriptionId());
}
use of com.microsoft.azure.maven.springcloud.config.AppRawConfig in project azure-maven-plugins by microsoft.
the class SpringCloudAppSettingsTest method testSetClusterName.
@Test
public void testSetClusterName() {
final AppRawConfig app = new AppRawConfig();
app.setClusterName("clusterName1");
assertEquals("clusterName1", app.getClusterName());
}
use of com.microsoft.azure.maven.springcloud.config.AppRawConfig in project azure-maven-plugins by microsoft.
the class SpringCloudAppSettingsTest method testSetIsPublic.
@Test
public void testSetIsPublic() {
final AppRawConfig app = new AppRawConfig();
app.setIsPublic("true");
assertEquals("true", app.getIsPublic());
}
use of com.microsoft.azure.maven.springcloud.config.AppRawConfig in project azure-maven-plugins by microsoft.
the class SpringCloudAppSettingsTest method testSetAppName.
@Test
public void testSetAppName() {
final AppRawConfig app = new AppRawConfig();
app.setAppName("appName1");
assertEquals("appName1", app.getAppName());
}
Aggregations