@Test void createInstance_stackWithNestedStack_dontReturnDuplicateResourceId() throws Exception { Map<String, String> resourceIdMappings = new HashMap<>(); resourceIdMappings.put("logicalNested1Stack", "physicalStackId"); resourceIdMappings.put("logicalNested1Stack.logicalResource", "physicalResourceIdOne"); resourceIdMappings.put("logicalNested2Stack", "physicalStackId"); resourceIdMappings.put("logicalNested2Stack.logicalResource", "physicalResourceIdTwo"); StackResourceRegistryFactoryBean stackResourceRegistryFactoryBean = makeStackResourceRegistryFactoryBean( STACK_NAME, resourceIdMappings); ListableStackResourceFactory stackResourceRegistry = stackResourceRegistryFactoryBean .createInstance(); assertThat(stackResourceRegistry.getAllResources().size()).isEqualTo(4); assertThat(stackResourceRegistry .lookupPhysicalResourceId("logicalNested1Stack.logicalResource")) .isNotNull(); assertThat(stackResourceRegistry .lookupPhysicalResourceId("logicalNested2Stack.logicalResource")) .isNotNull(); assertThat(stackResourceRegistry.lookupPhysicalResourceId("logicalResource")) .isNull(); }
@Override protected ListableStackResourceFactory createInstance() { String stackName = this.stackNameProvider.getStackName(); return new StaticStackResourceRegistry(stackName, getResourceMappings("", stackName)); }
StackResourceRegistryFactoryBean extends AbstractFactoryBean<ListableStackResourceFactory> { @Override protected ListableStackResourceFactory createInstance() { String stackName = this.stackNameProvider.getStackName(); return new StaticStackResourceRegistry(stackName, getResourceMappings("", stackName)); } }
StackResourceRegistryFactoryBean extends AbstractFactoryBean<ListableStackResourceFactory> { @Override protected ListableStackResourceFactory createInstance() { String stackName = this.stackNameProvider.getStackName(); return new StaticStackResourceRegistry(stackName, getResourceMappings("", stackName)); } StackResourceRegistryFactoryBean(
			AmazonCloudFormation amazonCloudFormationClient,
			StackNameProvider stackNameProvider); }
StackResourceRegistryFactoryBean extends AbstractFactoryBean<ListableStackResourceFactory> { @Override protected ListableStackResourceFactory createInstance() { String stackName = this.stackNameProvider.getStackName(); return new StaticStackResourceRegistry(stackName, getResourceMappings("", stackName)); } StackResourceRegistryFactoryBean(
			AmazonCloudFormation amazonCloudFormationClient,
			StackNameProvider stackNameProvider); @Override Class<?> getObjectType(); }
StackResourceRegistryFactoryBean extends AbstractFactoryBean<ListableStackResourceFactory> { @Override protected ListableStackResourceFactory createInstance() { String stackName = this.stackNameProvider.getStackName(); return new StaticStackResourceRegistry(stackName, getResourceMappings("", stackName)); } StackResourceRegistryFactoryBean(
			AmazonCloudFormation amazonCloudFormationClient,
			StackNameProvider stackNameProvider); @Override Class<?> getObjectType();  }