Search in sources :

Example 1 with MavenResourcesFiltering

use of org.apache.maven.shared.filtering.MavenResourcesFiltering 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());
}
Also used : MavenSession(org.apache.maven.execution.MavenSession) Runtime(com.microsoft.azure.toolkit.lib.appservice.model.Runtime) MavenProject(org.apache.maven.project.MavenProject) WebAppConfiguration(com.microsoft.azure.maven.webapp.WebAppConfiguration) Resource(org.apache.maven.model.Resource) ArrayList(java.util.ArrayList) Deployment(com.microsoft.azure.maven.webapp.configuration.Deployment) MavenResourcesFiltering(org.apache.maven.shared.filtering.MavenResourcesFiltering) Test(org.junit.Test)

Aggregations

WebAppConfiguration (com.microsoft.azure.maven.webapp.WebAppConfiguration)1 Deployment (com.microsoft.azure.maven.webapp.configuration.Deployment)1 Runtime (com.microsoft.azure.toolkit.lib.appservice.model.Runtime)1 ArrayList (java.util.ArrayList)1 MavenSession (org.apache.maven.execution.MavenSession)1 Resource (org.apache.maven.model.Resource)1 MavenProject (org.apache.maven.project.MavenProject)1 MavenResourcesFiltering (org.apache.maven.shared.filtering.MavenResourcesFiltering)1 Test (org.junit.Test)1