use of pipelite.executor.describe.cache.AwsBatchDescribeJobsCache in project pipelite by enasequence.
the class AwsBatchDescribeJobsCacheTest method test.
@Test
public void test() {
AwsBatchDescribeJobsCache cache = new AwsBatchDescribeJobsCache(Mockito.mock(ServiceConfiguration.class), Mockito.mock(InternalErrorService.class));
AwsBatchExecutorParameters region1 = AwsBatchExecutorParameters.builder().region("1").build();
AwsBatchExecutorParameters region2 = AwsBatchExecutorParameters.builder().region("2").build();
AwsBatchExecutor executor1Region1 = new AwsBatchExecutor();
AwsBatchExecutor executor2Region1 = new AwsBatchExecutor();
AwsBatchExecutor executor3Region2 = new AwsBatchExecutor();
AwsBatchExecutor executor4Region1 = new AwsBatchExecutor();
executor1Region1.setExecutorParams(region1);
executor2Region1.setExecutorParams(region1);
executor3Region2.setExecutorParams(region2);
executor4Region1.setExecutorParams(region1);
assertThat(cache.getCacheContext(executor1Region1).getRegion()).isEqualTo(region1.getRegion());
assertThat(cache.getCacheContext(executor2Region1).getRegion()).isEqualTo(region1.getRegion());
assertThat(cache.getCacheContext(executor3Region2).getRegion()).isEqualTo(region2.getRegion());
assertThat(cache.getCacheContext(executor4Region1).getRegion()).isEqualTo(region1.getRegion());
DescribeJobs<String, AwsBatchDescribeJobsCache.ExecutorContext> describeJobs1 = cache.getDescribeJobs(executor1Region1);
DescribeJobs<String, AwsBatchDescribeJobsCache.ExecutorContext> describeJobs2 = cache.getDescribeJobs(executor2Region1);
DescribeJobs<String, AwsBatchDescribeJobsCache.ExecutorContext> describeJobs3 = cache.getDescribeJobs(executor3Region2);
DescribeJobs<String, AwsBatchDescribeJobsCache.ExecutorContext> describeJobs4 = cache.getDescribeJobs(executor4Region1);
assertThat(describeJobs1 == describeJobs2).isTrue();
assertThat(describeJobs1 != describeJobs3).isTrue();
assertThat(describeJobs1 == describeJobs4).isTrue();
}
Aggregations