当前位置: 首页>>代码示例>>Java>>正文


Java StackResource类代码示例

本文整理汇总了Java中com.amazonaws.services.cloudformation.model.StackResource的典型用法代码示例。如果您正苦于以下问题:Java StackResource类的具体用法?Java StackResource怎么用?Java StackResource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StackResource类属于com.amazonaws.services.cloudformation.model包,在下文中一共展示了StackResource类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetStackPhysicalResourceId

import com.amazonaws.services.cloudformation.model.StackResource; //导入依赖的package包/类
@Test
public void testGetStackPhysicalResourceId() {
    final StackResource stackResource1 = new StackResource();
    stackResource1.setLogicalResourceId("logical1");
    stackResource1.setPhysicalResourceId("physical1");

    final StackResource stackResource2 = new StackResource();
    stackResource2.setLogicalResourceId("logical2");
    stackResource2.setPhysicalResourceId("physical2");

    final List<StackResource> stackResources = new ArrayList<>();
    stackResources.add(stackResource1);
    stackResources.add(stackResource2);

    final DescribeStackResourcesResult result = mock(DescribeStackResourcesResult.class);
    when(result.getStackResources()).thenReturn(stackResources);

    when(amazonCloudFormationClient.describeStackResources(any(DescribeStackResourcesRequest.class))).thenReturn(result);

    assertThat(awsHelperService.getStackPhysicalResourceId("testStackName", "logical2"), equalTo("physical2"));

    final ArgumentCaptor<DescribeStackResourcesRequest> argumentCaptor = ArgumentCaptor.forClass(DescribeStackResourcesRequest.class);
    verify(amazonCloudFormationClient).describeStackResources(argumentCaptor.capture());
    assertThat(argumentCaptor.getValue().getStackName(), equalTo("testStackName"));
}
 
开发者ID:shinesolutions,项目名称:aem-orchestrator,代码行数:26,代码来源:AwsHelperServiceTest.java

示例2: GenericXmlApplicationContext

import com.amazonaws.services.cloudformation.model.StackResource; //导入依赖的package包/类
@Test
public void stackResourceRegistry_stackConfigurationWithoutStaticName_stackResourceRegistryBeanExposedUnderGeneratedName() throws Exception {
    // Arrange
    HttpServer server = MetaDataServer.setupHttpServer();
    HttpContext httpContext = server.createContext("/latest/meta-data/instance-id", new MetaDataServer.HttpResponseWriterHandler("foo"));

    GenericXmlApplicationContext applicationContext = new GenericXmlApplicationContext();
    AmazonCloudFormation amazonCloudFormation = Mockito.mock(AmazonCloudFormation.class);

    when(amazonCloudFormation.describeStackResources(new DescribeStackResourcesRequest().withPhysicalResourceId("foo"))).
            thenReturn(new DescribeStackResourcesResult().withStackResources(new StackResource().withStackName("test")));

    when(amazonCloudFormation.listStackResources(new ListStackResourcesRequest().withStackName("test"))).
            thenReturn(new ListStackResourcesResult().withStackResourceSummaries(new StackResourceSummary()));

    applicationContext.load(new ClassPathResource(getClass().getSimpleName() + "-autoDetectStackName.xml", getClass()));
    applicationContext.getBeanFactory().registerSingleton(getBeanName(AmazonCloudFormation.class.getName()), amazonCloudFormation);

    applicationContext.refresh();

    // Act
    StackResourceRegistry autoDetectingStackNameProviderBasedStackResourceRegistry = applicationContext.getBean("org.springframework.cloud.aws.core.env.stack.config.StackResourceRegistryFactoryBean#0", StackResourceRegistry.class);

    // Assert
    assertThat(autoDetectingStackNameProviderBasedStackResourceRegistry, is(not(nullValue())));

    server.removeContext(httpContext);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-aws,代码行数:29,代码来源:StackConfigurationBeanDefinitionParserTest.java

示例3: getByLogicalId

import com.amazonaws.services.cloudformation.model.StackResource; //导入依赖的package包/类
protected String getByLogicalId(String id) {
    for (StackResource stackResource : this.stackResources.getStackResources()) {
        if (stackResource.getLogicalResourceId().equals(id)) {
            return stackResource.getPhysicalResourceId();
        }
    }
    return null;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-aws,代码行数:9,代码来源:TestStackEnvironment.java

示例4: getResourcesForStack

import com.amazonaws.services.cloudformation.model.StackResource; //导入依赖的package包/类
public List<StackResource> getResourcesForStack(String stackName) {

		List<StackResource> resources;
		if (stackResources.containsStack(stackName)) {
			logger.info("Cache hit on stack resources for stack " + stackName);
			resources = stackResources.getStackResources(stackName);
		} else {
			logger.info("Cache miss, loading resources for stack " + stackName);
			resources = formationClient.describeStackResources(stackName);
		
			stackResources.addStackResources(stackName, resources);
		}
		return resources;
	}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:15,代码来源:StackCache.java

示例5: getStackResources

import com.amazonaws.services.cloudformation.model.StackResource; //导入依赖的package包/类
public List<StackResource> getStackResources(String stackName) {
	List<StackResource> resource = theResources.get(stackName);
	return resource;
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:5,代码来源:StackResources.java

示例6: addStackResources

import com.amazonaws.services.cloudformation.model.StackResource; //导入依赖的package包/类
public void addStackResources(String stackName,
		List<StackResource> resources) {
	logger.info("Adding resources for stack: " + stackName);
	theResources.put(stackName, resources);		
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:6,代码来源:StackResources.java


注:本文中的com.amazonaws.services.cloudformation.model.StackResource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。