use of com.microsoft.azure.maven.webapp.configuration.Deployment in project azure-maven-plugins by microsoft.
the class ConfigParserTest method getWebAppConfiguration.
@Test
public void getWebAppConfiguration() throws AzureExecutionException {
final ConfigParser parserSpy = spy(parser);
doReturn("appName").when(parserSpy).getAppName();
doReturn("resourceGroupName").when(parserSpy).getResourceGroup();
final MavenProject project = mock(MavenProject.class);
final MavenResourcesFiltering filtering = mock(MavenResourcesFiltering.class);
final MavenSession session = mock(MavenSession.class);
doReturn(project).when(deployMojo).getProject();
doReturn(filtering).when(deployMojo).getMavenResourcesFiltering();
doReturn(session).when(deployMojo).getSession();
doReturn("test-staging-path").when(deployMojo).getDeploymentStagingDirectoryPath();
doReturn("test-build-directory-path").when(deployMojo).getBuildDirectoryAbsolutePath();
doReturn("P1v2").when(deployMojo).getPricingTier();
final Runtime mockRuntime = Runtime.getRuntime(OperatingSystem.WINDOWS, WebContainer.TOMCAT_85, JavaVersion.JAVA_8);
doReturn(mockRuntime).when(parserSpy).getRuntime();
final List<Resource> resources = new ArrayList<>();
resources.add(new Resource());
final Deployment deployment = mock(Deployment.class);
doReturn(deployment).when(deployMojo).getDeployment();
doReturn(resources).when(deployment).getResources();
doReturn(Region.US_WEST.getName()).when(deployMojo).getRegion();
final WebAppConfiguration webAppConfiguration = parserSpy.getWebAppConfiguration();
assertEquals(Region.US_WEST, parser.getRegion());
assertEquals(resources, webAppConfiguration.getResources());
assertEquals("appName", webAppConfiguration.getAppName());
assertEquals("resourceGroupName", webAppConfiguration.getResourceGroup());
assertEquals("P1v2", webAppConfiguration.getPricingTier());
assertNull(webAppConfiguration.getServicePlanName());
assertNull(webAppConfiguration.getServicePlanResourceGroup());
assertEquals(OperatingSystem.WINDOWS, webAppConfiguration.getOs());
assertNull(webAppConfiguration.getMavenSettings());
assertEquals(project, webAppConfiguration.getProject());
assertEquals(session, webAppConfiguration.getSession());
assertEquals(filtering, webAppConfiguration.getFiltering());
assertEquals("test-staging-path", webAppConfiguration.getStagingDirectoryPath());
assertEquals("test-build-directory-path", webAppConfiguration.getBuildDirectoryAbsolutePath());
}
Aggregations