Search in sources :

Example 1 with CacheNode

use of com.amazonaws.services.elasticache.model.CacheNode in project spring-cloud-aws by awspring.

the class ElastiCacheFactoryBeanTest method getObject_clusterWithRedisEngineConfigured_reportsError.

@Test
void getObject_clusterWithRedisEngineConfigured_reportsError() throws Exception {
    // Arrange
    AmazonElastiCache amazonElastiCache = mock(AmazonElastiCacheClient.class);
    DescribeCacheClustersRequest memcached = new DescribeCacheClustersRequest().withCacheClusterId("memcached");
    memcached.setShowCacheNodeInfo(true);
    when(amazonElastiCache.describeCacheClusters(memcached)).thenReturn(new DescribeCacheClustersResult().withCacheClusters(new CacheCluster().withEngine("redis").withCacheNodes(new CacheNode().withEndpoint(new Endpoint().withAddress("localhost").withPort(45678)))));
    ElastiCacheFactoryBean elastiCacheFactoryBean = new ElastiCacheFactoryBean(amazonElastiCache, "memcached", Collections.singletonList(new TestCacheFactory("testCache", "localhost", 45678)));
    // Assert
    assertThatThrownBy(elastiCacheFactoryBean::afterPropertiesSet).isInstanceOf(IllegalArgumentException.class).hasMessageContaining("engine");
}
Also used : CacheNode(com.amazonaws.services.elasticache.model.CacheNode) Endpoint(com.amazonaws.services.elasticache.model.Endpoint) DescribeCacheClustersResult(com.amazonaws.services.elasticache.model.DescribeCacheClustersResult) AmazonElastiCache(com.amazonaws.services.elasticache.AmazonElastiCache) DescribeCacheClustersRequest(com.amazonaws.services.elasticache.model.DescribeCacheClustersRequest) CacheCluster(com.amazonaws.services.elasticache.model.CacheCluster) Test(org.junit.jupiter.api.Test)

Aggregations

AmazonElastiCache (com.amazonaws.services.elasticache.AmazonElastiCache)1 CacheCluster (com.amazonaws.services.elasticache.model.CacheCluster)1 CacheNode (com.amazonaws.services.elasticache.model.CacheNode)1 DescribeCacheClustersRequest (com.amazonaws.services.elasticache.model.DescribeCacheClustersRequest)1 DescribeCacheClustersResult (com.amazonaws.services.elasticache.model.DescribeCacheClustersResult)1 Endpoint (com.amazonaws.services.elasticache.model.Endpoint)1 Test (org.junit.jupiter.api.Test)1