src/test/java/com/digitalglobe/util/maven/plugin/TestCloudFormationDeploy.java
/**
     * Use this method to test the Deploy Maven Plugin for an assumed role with a CLI Command.  Also tests the update
     * stack scenario.
     */
Use this method to test the Deploy Maven Plugin for an assumed role with a CLI Command.  Also tests the update
stack scenario.
Use this method to test the Deploy Maven Plugin for an assumed role with a CLI Command . Also tests the update stack scenario .
@Test(groups = {"unit"})
    public void TestCliCommandWithDeploy() throws Exception {
        StackScenario.createTest = false;
        StackScenario.changeset = true;
        OverridePlugin plugin =  new OverridePlugin();
        String file = new File("test-repository/com/test/application-test/1.0/application-test-1.0.jar")
                .getAbsolutePath();
        HashMap<String, CloudFormationDeployMavenPlugin.StackOutputParameterMapping> map = new HashMap<>();
        map.put("Name", new CloudFormationDeployMavenPlugin.StackOutputParameterMapping()
                .withDescription("Person")
                .withParameterName("/hello/world/people[0]/name")
                .withMapParameterName("Michael"));
        map.put("Jane", new CloudFormationDeployMavenPlugin.StackOutputParameterMapping()
                .withDescription("Person")
                .withParameterName("/hello/world/people[1]/name"));
        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::1111:role/test", "Test",
                "test-repository", "com.test", "application-test", "1.0",
                "Test", stackPath, new String[] {parameterPath}, null,
                new CloudFormationDeployMavenPlugin.StackInputParameter[]
                        {
                                new CloudFormationDeployMavenPlugin.StackInputParameter()
                                        .withParameterName("s3Bucket")
                                        .withMatchingParameterName("ArtifactS3Bucket"),
                                new CloudFormationDeployMavenPlugin.StackInputParameter()
                                        .withParameterName("s3Key")
                                        .withMatchingParameterName("ArtifactS3Key")
                        },
                new CloudFormationDeployMavenPlugin.CliCommandOutputParameterMapping[]
                        {
                                new CloudFormationDeployMavenPlugin.CliCommandOutputParameterMapping()
                                .withCommand("java -jar " + file)
                                .withDescription("Test Command Execution.")
                                .withParameters(map)
                        });
        Assert.assertNull(ex);
        validateLogFile(true, false, true);
    }
@ Test ( groups = { "unit" } ) public void TestCliCommandWithDeploy ( ) throws Exception { StackScenario . createTest = false ; StackScenario . changeset = true ; OverridePlugin plugin = new OverridePlugin ( ) ; String file = new File ( "test-repository/com/test/application-test/1.0/application-test-1.0.jar" ) . getAbsolutePath ( ) ; HashMap < String , CloudFormationDeployMavenPlugin . StackOutputParameterMapping > map = new HashMap < > ( ) ; map . put ( "Name" , new CloudFormationDeployMavenPlugin . StackOutputParameterMapping ( ) . withDescription ( "Person" ) . withParameterName ( "/hello/world/people[0]/name" ) . withMapParameterName ( "Michael" ) ) ; map . put ( "Jane" , new CloudFormationDeployMavenPlugin . StackOutputParameterMapping ( ) . withDescription ( "Person" ) . withParameterName ( "/hello/world/people[1]/name" ) ) ; 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::1111:role/test" , "Test" , "test-repository" , "com.test" , "application-test" , "1.0" , "Test" , stackPath , new String [ ] { parameterPath } , null , new CloudFormationDeployMavenPlugin . StackInputParameter [ ] { new CloudFormationDeployMavenPlugin . StackInputParameter ( ) . withParameterName ( "s3Bucket" ) . withMatchingParameterName ( "ArtifactS3Bucket" ) , new CloudFormationDeployMavenPlugin . StackInputParameter ( ) . withParameterName ( "s3Key" ) . withMatchingParameterName ( "ArtifactS3Key" ) } , new CloudFormationDeployMavenPlugin . CliCommandOutputParameterMapping [ ] { new CloudFormationDeployMavenPlugin . CliCommandOutputParameterMapping ( ) . withCommand ( "java -jar " + file ) . withDescription ( "Test Command Execution." ) . withParameters ( map ) } ) ; Assert . assertNull ( ex ) ; validateLogFile ( true , false , true ) ; }
Use this method to test the Deploy Maven Plugin for an assumed role with a CLI Command.
Use this method to test the Deploy Maven Plugin for an assumed role with a CLI Command .
// Validate the log information to determine if the function ran successfully.