src/integration-test/java/GreengrassUpdateWithoutDockerIT.java
@Test
    public void shouldAddNodeFunctionToGroup() {
        // Create two groups with different names so we can do the update later
        Optional<GreengrassGroupName> optionalGroup1Name = Optional.of(ImmutableGreengrassGroupName.builder().groupName(ioHelper.getUuid()).build());
        Optional<GreengrassGroupName> optionalGroup2Name = Optional.of(ImmutableGreengrassGroupName.builder().groupName(ioHelper.getUuid()).build());

        AwsGreengrassProvisioner.main(greengrassITShared.split(greengrassITShared.getPython3HelloWorldDeploymentCommand(optionalGroup1Name)));
        AwsGreengrassProvisioner.main(greengrassITShared.split(greengrassITShared.getNodeHelloWorldDeploymentCommand(optionalGroup2Name)));

        GreengrassGroupName group1Name = optionalGroup1Name.get();
        GreengrassGroupName group2Name = optionalGroup2Name.get();

        // Get the information for group 2 so we can pull the Hello World function out of it
        GroupInformation group2Information = v2GreengrassHelper.getGroupInformation(group2Name).findFirst()
                .orElseThrow(() -> new RuntimeException("Group 2 information not present"));

        // Pull the Hello World function out of the group
        Optional<Function> optionalGroup2HelloWorldNodeFunction = getFunctionFromGroupInformation(group2Information, HELLO_WORLD_NODE);

        // Make sure the function is present
        Assert.assertTrue(optionalGroup2HelloWorldNodeFunction.isPresent());

        // Get the function information, extract the short name, and create a new alias
        Function helloWorldNodeFunction = optionalGroup2HelloWorldNodeFunction.get();
        FunctionName helloWorldNodeFunctionName = extractFunctionName(helloWorldNodeFunction);
        FunctionAlias functionAlias = ImmutableFunctionAlias.builder().alias(ioHelper.getUuid()).build();

        // Make sure the function isn't present in group 1 before the update
        GroupInformation group1InformationBeforeUpdate = v2GreengrassHelper.getGroupInformation(group1Name).findFirst()
                .orElseThrow(() -> new RuntimeException("Group 1 information not present before update"));

        Optional<Function> optionalGroup1HelloWorldNodeFunctionBeforeUpdate = getFunctionFromGroupInformation(group1InformationBeforeUpdate, HELLO_WORLD_NODE);

        Assert.assertFalse(optionalGroup1HelloWorldNodeFunctionBeforeUpdate.isPresent());

        // Update group 1 with the function
        AwsGreengrassProvisioner.main(greengrassITShared.split(greengrassITShared.getAddFunctionCommand(group1Name, helloWorldNodeFunctionName, functionAlias)));

        // Make sure the function is present in group 1 after the update
        GroupInformation group1InformationAfterUpdate = v2GreengrassHelper.getGroupInformation(group1Name).findFirst()
                .orElseThrow(() -> new RuntimeException("Group 1 information not present after update"));

        Optional<Function> optionalGroup1HelloWorldNodeFunctionAfterUpdate = getFunctionFromGroupInformation(group1InformationAfterUpdate, HELLO_WORLD_NODE);

        Assert.assertTrue(optionalGroup1HelloWorldNodeFunctionAfterUpdate.isPresent());
    }
// Test set 1: Build a group with Python 2 Hello World, build another group with Node Hello World, add Node Hello World to first group
Test set 1: Build a group with Python 2 Hello World, build another group with Node Hello World, add Node Hello World to first group
Test set 1 : Build a group with Python 2 Hello World build another group with Node Hello World add Node Hello World to first group
@Test
    public void shouldAddNodeFunctionToGroup() {
        Optional<GreengrassGroupName> optionalGroup1Name = Optional.of(ImmutableGreengrassGroupName.builder().groupName(ioHelper.getUuid()).build());
        Optional<GreengrassGroupName> optionalGroup2Name = Optional.of(ImmutableGreengrassGroupName.builder().groupName(ioHelper.getUuid()).build());
        AwsGreengrassProvisioner.main(greengrassITShared.split(greengrassITShared.getPython3HelloWorldDeploymentCommand(optionalGroup1Name)));
        AwsGreengrassProvisioner.main(greengrassITShared.split(greengrassITShared.getNodeHelloWorldDeploymentCommand(optionalGroup2Name)));
        GreengrassGroupName group1Name = optionalGroup1Name.get();
        GreengrassGroupName group2Name = optionalGroup2Name.get();
        GroupInformation group2Information = v2GreengrassHelper.getGroupInformation(group2Name).findFirst()
                .orElseThrow(() -> new RuntimeException("Group 2 information not present"));
        Optional<Function> optionalGroup2HelloWorldNodeFunction = getFunctionFromGroupInformation(group2Information, HELLO_WORLD_NODE);
        Assert.assertTrue(optionalGroup2HelloWorldNodeFunction.isPresent());
        Function helloWorldNodeFunction = optionalGroup2HelloWorldNodeFunction.get();
        FunctionName helloWorldNodeFunctionName = extractFunctionName(helloWorldNodeFunction);
        FunctionAlias functionAlias = ImmutableFunctionAlias.builder().alias(ioHelper.getUuid()).build();
        GroupInformation group1InformationBeforeUpdate = v2GreengrassHelper.getGroupInformation(group1Name).findFirst()
                .orElseThrow(() -> new RuntimeException("Group 1 information not present before update"));
        Optional<Function> optionalGroup1HelloWorldNodeFunctionBeforeUpdate = getFunctionFromGroupInformation(group1InformationBeforeUpdate, HELLO_WORLD_NODE);
        Assert.assertFalse(optionalGroup1HelloWorldNodeFunctionBeforeUpdate.isPresent());
        AwsGreengrassProvisioner.main(greengrassITShared.split(greengrassITShared.getAddFunctionCommand(group1Name, helloWorldNodeFunctionName, functionAlias)));
         in group 1 after the update
        GroupInformation group1InformationAfterUpdate = v2GreengrassHelper.getGroupInformation(group1Name).findFirst()
                .orElseThrow(() -> new RuntimeException("Group 1 information not present after update"));
        Optional<Function> optionalGroup1HelloWorldNodeFunctionAfterUpdate = getFunctionFromGroupInformation(group1InformationAfterUpdate, HELLO_WORLD_NODE);
        Assert.assertTrue(optionalGroup1HelloWorldNodeFunctionAfterUpdate.isPresent());
    }
@ Test public void shouldAddNodeFunctionToGroup ( ) { Optional < GreengrassGroupName > optionalGroup1Name = Optional . of ( ImmutableGreengrassGroupName . builder ( ) . groupName ( ioHelper . getUuid ( ) ) . build ( ) ) ; Optional < GreengrassGroupName > optionalGroup2Name = Optional . of ( ImmutableGreengrassGroupName . builder ( ) . groupName ( ioHelper . getUuid ( ) ) . build ( ) ) ; AwsGreengrassProvisioner . main ( greengrassITShared . split ( greengrassITShared . getPython3HelloWorldDeploymentCommand ( optionalGroup1Name ) ) ) ; AwsGreengrassProvisioner . main ( greengrassITShared . split ( greengrassITShared . getNodeHelloWorldDeploymentCommand ( optionalGroup2Name ) ) ) ; GreengrassGroupName group1Name = optionalGroup1Name . get ( ) ; GreengrassGroupName group2Name = optionalGroup2Name . get ( ) ; GroupInformation group2Information = v2GreengrassHelper . getGroupInformation ( group2Name ) . findFirst ( ) . orElseThrow ( ( ) -> new RuntimeException ( "Group 2 information not present" ) ) ; Optional < Function > optionalGroup2HelloWorldNodeFunction = getFunctionFromGroupInformation ( group2Information , HELLO_WORLD_NODE ) ; Assert . assertTrue ( optionalGroup2HelloWorldNodeFunction . isPresent ( ) ) ; Function helloWorldNodeFunction = optionalGroup2HelloWorldNodeFunction . get ( ) ; FunctionName helloWorldNodeFunctionName = extractFunctionName ( helloWorldNodeFunction ) ; FunctionAlias functionAlias = ImmutableFunctionAlias . builder ( ) . alias ( ioHelper . getUuid ( ) ) . build ( ) ; GroupInformation group1InformationBeforeUpdate = v2GreengrassHelper . getGroupInformation ( group1Name ) . findFirst ( ) . orElseThrow ( ( ) -> new RuntimeException ( "Group 1 information not present before update" ) ) ; Optional < Function > optionalGroup1HelloWorldNodeFunctionBeforeUpdate = getFunctionFromGroupInformation ( group1InformationBeforeUpdate , HELLO_WORLD_NODE ) ; Assert . assertFalse ( optionalGroup1HelloWorldNodeFunctionBeforeUpdate . isPresent ( ) ) ; AwsGreengrassProvisioner . main ( greengrassITShared . split ( greengrassITShared . getAddFunctionCommand ( group1Name , helloWorldNodeFunctionName , functionAlias ) ) ) ; GroupInformation group1InformationAfterUpdate = v2GreengrassHelper . getGroupInformation ( group1Name ) . findFirst ( ) . orElseThrow ( ( ) -> new RuntimeException ( "Group 1 information not present after update" ) ) ; Optional < Function > optionalGroup1HelloWorldNodeFunctionAfterUpdate = getFunctionFromGroupInformation ( group1InformationAfterUpdate , HELLO_WORLD_NODE ) ; Assert . assertTrue ( optionalGroup1HelloWorldNodeFunctionAfterUpdate . isPresent ( ) ) ; }
Test set 1: Build a group with Python 2 Hello World, build another group with Node Hello World, add Node Hello World to first group
Test set 1 : Build a group with Python 2 Hello World build another group with Node Hello World add Node Hello World to first group
// Create two groups with different names so we can do the update later // Get the information for group 2 so we can pull the Hello World function out of it // Pull the Hello World function out of the group // Make sure the function is present // Get the function information, extract the short name, and create a new alias // Make sure the function isn't present in group 1 before the update // Update group 1 with the function // Make sure the function is present in group 1 after the update