src/test/java/com/digitalglobe/util/maven/plugin/TestCloudFormationDeploy.java
/**
     * Use this method to test the Deploy Maven Plugin in a scenario where the initiator configured the pom file
     * incorrectly by providing two master stack parameter files and only specifying one secondary stacks.
     */
Use this method to test the Deploy Maven Plugin in a scenario where the initiator configured the pom file
incorrectly by providing two master stack parameter files and only specifying one secondary stacks.
Use this method to test the Deploy Maven Plugin in a scenario where the initiator configured the pom file incorrectly by providing two master stack parameter files and only specifying one secondary stacks .
@Test(groups = {"unit"})
    public void TestNonMatchingArrayDeploy() throws Exception {
        StackScenario.createTest = false;
        StackScenario.changeset = true;
        OverridePlugin plugin =  new OverridePlugin();
        String stackPath = this.getClass().getClassLoader().getResource("Test-Template.json").getPath();
        String parameterPath = this.getClass().getClassLoader().getResource("Test-Parameters.json").getPath();
        Exception ex = plugin.beginTesting("bucket","aws:iam::1112:role/test", "Test",
                "test-repository", "com.test", "application-test", "1.0",
                "Test", stackPath, new String[] {parameterPath, parameterPath},
                new CloudFormationDeployMavenPlugin.StackGroup[]
                        {new CloudFormationDeployMavenPlugin.StackGroup()
                                .withRepositoryFilter("filter").withStacks(
                                        new CloudFormationDeployMavenPlugin.SecondaryStack[]
                                                {new CloudFormationDeployMavenPlugin.SecondaryStack()
                                                        .withStackName("stackName")
                                                        .withStackPath("stackPath")
                                                        .withStackParameterFilePath("parameterFilePath")
                                                })
                        },
                new CloudFormationDeployMavenPlugin.StackInputParameter[]
                        {
                                new CloudFormationDeployMavenPlugin.StackInputParameter()
                                        .withParameterName("s3Bucket")
                                        .withMatchingParameterName("ArtifactS3Bucket"),
                                new CloudFormationDeployMavenPlugin.StackInputParameter()
                                        .withParameterName("s3Key")
                                        .withMatchingParameterName("ArtifactS3Key")
                        }, null);
        Assert.assertNotNull(ex);
        Assert.assertNotNull(ex.getCause());
        Assert.assertTrue(ex.getCause().getMessage().equals("Array counts don't match."));
        int position = 0;
        File touch = new File("target/audit.txt");
        Object[] lines = Files.lines(Paths.get(touch.toURI())).toArray();
        Assert.assertTrue(lines[position++].equals("Array counts don't match."));
        Assert.assertTrue(lines[position++].equals("Error executing the template stack or stack group."));
        Assert.assertTrue(lines[position++].equals("Array counts don't match."));
        Assert.assertEquals(lines.length, position);
    }
@ Test ( groups = { "unit" } ) public void TestNonMatchingArrayDeploy ( ) throws Exception { StackScenario . createTest = false ; StackScenario . changeset = true ; OverridePlugin plugin = new OverridePlugin ( ) ; String stackPath = this . getClass ( ) . getClassLoader ( ) . getResource ( "Test-Template.json" ) . getPath ( ) ; String parameterPath = this . getClass ( ) . getClassLoader ( ) . getResource ( "Test-Parameters.json" ) . getPath ( ) ; Exception ex = plugin . beginTesting ( "bucket" , "aws:iam::1112:role/test" , "Test" , "test-repository" , "com.test" , "application-test" , "1.0" , "Test" , stackPath , new String [ ] { parameterPath , parameterPath } , new CloudFormationDeployMavenPlugin . StackGroup [ ] { new CloudFormationDeployMavenPlugin . StackGroup ( ) . withRepositoryFilter ( "filter" ) . withStacks ( new CloudFormationDeployMavenPlugin . SecondaryStack [ ] { new CloudFormationDeployMavenPlugin . SecondaryStack ( ) . withStackName ( "stackName" ) . withStackPath ( "stackPath" ) . withStackParameterFilePath ( "parameterFilePath" ) } ) } , new CloudFormationDeployMavenPlugin . StackInputParameter [ ] { new CloudFormationDeployMavenPlugin . StackInputParameter ( ) . withParameterName ( "s3Bucket" ) . withMatchingParameterName ( "ArtifactS3Bucket" ) , new CloudFormationDeployMavenPlugin . StackInputParameter ( ) . withParameterName ( "s3Key" ) . withMatchingParameterName ( "ArtifactS3Key" ) } , null ) ; Assert . assertNotNull ( ex ) ; Assert . assertNotNull ( ex . getCause ( ) ) ; Assert . assertTrue ( ex . getCause ( ) . getMessage ( ) . equals ( "Array counts don't match." ) ) ; int position = 0 ; File touch = new File ( "target/audit.txt" ) ; Object [ ] lines = Files . lines ( Paths . get ( touch . toURI ( ) ) ) . toArray ( ) ; Assert . assertTrue ( lines [ position ++ ] . equals ( "Array counts don't match." ) ) ; Assert . assertTrue ( lines [ position ++ ] . equals ( "Error executing the template stack or stack group." ) ) ; Assert . assertTrue ( lines [ position ++ ] . equals ( "Array counts don't match." ) ) ; Assert . assertEquals ( lines . length , position ) ; }
Use this method to test the Deploy Maven Plugin in a scenario where the initiator configured the pom file
 incorrectly by providing two master stack parameter files and only specifying one secondary stacks.
Use this method to test the Deploy Maven Plugin in a scenario where the initiator configured the pom file incorrectly by providing two master stack parameter files and only specifying one secondary stacks .
// Validate the log information to determine if the function ran successfully. // Validate Array Sizes