use of com.aws.greengrass.provisioning.ProvisionConfiguration.NucleusConfiguration in project aws-greengrass-nucleus by aws-greengrass.
the class KernelLifecycleTest method createMockProvisioningConforguration.
private ProvisionConfiguration createMockProvisioningConforguration() {
ProvisionConfiguration provisionConfiguration = new ProvisionConfiguration();
NucleusConfiguration nucleusConfiguration = new NucleusConfiguration();
nucleusConfiguration.setIotRoleAlias(MOCK_IOT_ROLE_ALIAS);
nucleusConfiguration.setAwsRegion(MOCK_AWS_REGION);
nucleusConfiguration.setIotDataEndpoint(MOCK_IOT_DATA_ENDPOINT);
nucleusConfiguration.setIotCredentialsEndpoint(MOCK_IOT_CREDENTIAL_ENDPOINT);
provisionConfiguration.setNucleusConfiguration(nucleusConfiguration);
SystemConfiguration systemConfiguration = new SystemConfiguration();
systemConfiguration.setThingName(MOCK_THING_NAME);
systemConfiguration.setRootCAPath(MOCK_ROOT_CA_PATH);
systemConfiguration.setPrivateKeyPath(MOCK_PRIVATE_KEY_PATH);
systemConfiguration.setCertificateFilePath(MOCK_CERTIFICATE_KEY_PATH);
provisionConfiguration.setSystemConfiguration(systemConfiguration);
return provisionConfiguration;
}
use of com.aws.greengrass.provisioning.ProvisionConfiguration.NucleusConfiguration in project aws-greengrass-nucleus by aws-greengrass.
the class KernelLifecycleTest method GIVEN_kernel_WHEN_launch_with_provisioning_plugin_THEN_configuration_is_updated.
@SuppressWarnings("PMD.CloseResource")
@Test
void GIVEN_kernel_WHEN_launch_with_provisioning_plugin_THEN_configuration_is_updated() throws Exception {
mockProvisioning();
ProvisionConfiguration mockProvisionConfiguration = createMockProvisioningConforguration();
when(mockProvisioningPlugin.updateIdentityConfiguration(any())).thenReturn(mockProvisionConfiguration);
EZPlugins pluginMock = mock(EZPlugins.class);
when(mockContext.get(EZPlugins.class)).thenReturn(pluginMock);
doAnswer((i) -> {
ImplementingClassMatchProcessor func = i.getArgument(1);
func.processMatch(mockPluginClass);
return null;
}).when(pluginMock).implementing(eq(DeviceIdentityInterface.class), any());
kernelLifecycle.launch();
ArgumentCaptor<NucleusConfiguration> nucleusConfigCaptor = ArgumentCaptor.forClass(NucleusConfiguration.class);
verify(mockProvisioningConfigUpdateHelper, timeout(500).times(1)).updateNucleusConfiguration(nucleusConfigCaptor.capture(), eq(UpdateBehaviorTree.UpdateBehavior.MERGE));
ArgumentCaptor<SystemConfiguration> systemConfigCaptor = ArgumentCaptor.forClass(SystemConfiguration.class);
verify(mockProvisioningConfigUpdateHelper, timeout(500).times(1)).updateSystemConfiguration(systemConfigCaptor.capture(), eq(UpdateBehaviorTree.UpdateBehavior.MERGE));
assertEquals(mockProvisionConfiguration.getNucleusConfiguration(), nucleusConfigCaptor.getValue());
assertEquals(mockProvisionConfiguration.getSystemConfiguration(), systemConfigCaptor.getValue());
}
Aggregations