EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.cloudloadbalancers.loadbalancer.strategy]

COVERAGE SUMMARY FOR SOURCE FILE [CloudLoadBalancersListLoadBalancersStrategy.java]

nameclass, %method, %block, %line, %
CloudLoadBalancersListLoadBalancersStrategy.java0%   (0/2)0%   (0/5)0%   (0/64)0%   (0/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CloudLoadBalancersListLoadBalancersStrategy0%   (0/1)0%   (0/3)0%   (0/51)0%   (0/9)
CloudLoadBalancersListLoadBalancersStrategy (CloudLoadBalancersAsyncClient, F... 0%   (0/1)0%   (0/30)0%   (0/7)
access$000 (CloudLoadBalancersListLoadBalancersStrategy): CloudLoadBalancersA... 0%   (0/1)0%   (0/3)0%   (0/1)
listLoadBalancers (): Iterable 0%   (0/1)0%   (0/18)0%   (0/1)
     
class CloudLoadBalancersListLoadBalancersStrategy$10%   (0/1)0%   (0/2)0%   (0/13)0%   (0/2)
CloudLoadBalancersListLoadBalancersStrategy$1 (CloudLoadBalancersListLoadBala... 0%   (0/1)0%   (0/6)0%   (0/1)
apply (String): ListenableFuture 0%   (0/1)0%   (0/7)0%   (0/1)

1/**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *   http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.jclouds.cloudloadbalancers.loadbalancer.strategy;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22import static com.google.common.collect.Iterables.concat;
23import static com.google.common.collect.Iterables.transform;
24import static org.jclouds.concurrent.FutureIterables.transformParallel;
25 
26import java.util.Set;
27import java.util.concurrent.ExecutorService;
28import java.util.concurrent.Future;
29 
30import org.jclouds.javax.annotation.Nullable;
31import javax.annotation.Resource;
32import javax.inject.Inject;
33import javax.inject.Named;
34import javax.inject.Singleton;
35 
36import org.jclouds.Constants;
37import org.jclouds.cloudloadbalancers.CloudLoadBalancersAsyncClient;
38import org.jclouds.cloudloadbalancers.domain.LoadBalancer;
39import org.jclouds.loadbalancer.domain.LoadBalancerMetadata;
40import org.jclouds.loadbalancer.reference.LoadBalancerConstants;
41import org.jclouds.loadbalancer.strategy.ListLoadBalancersStrategy;
42import org.jclouds.location.Region;
43import org.jclouds.logging.Logger;
44 
45import com.google.common.base.Function;
46import com.google.common.util.concurrent.ListenableFuture;
47 
48/**
49 * 
50 * @author Adrian Cole
51 */
52@Singleton
53public class CloudLoadBalancersListLoadBalancersStrategy implements ListLoadBalancersStrategy {
54   @Resource
55   @Named(LoadBalancerConstants.LOADBALANCER_LOGGER)
56   protected Logger logger = Logger.NULL;
57 
58   private final CloudLoadBalancersAsyncClient aclient;
59   private final Function<LoadBalancer, LoadBalancerMetadata> converter;
60   private final ExecutorService executor;
61   private final Set<String> regions;
62 
63   @Inject
64   protected CloudLoadBalancersListLoadBalancersStrategy(CloudLoadBalancersAsyncClient aclient,
65            Function<LoadBalancer, LoadBalancerMetadata> converter,
66            @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, @Nullable @Region Set<String> regions) {
67      this.aclient = checkNotNull(aclient, "aclient");
68      this.regions = checkNotNull(regions, "regions");
69      this.converter = checkNotNull(converter, "converter");
70      this.executor = checkNotNull(executor, "executor");
71   }
72 
73   @Override
74   public Iterable<? extends LoadBalancerMetadata> listLoadBalancers() {
75      return transform(concat(transformParallel(regions, new Function<String, Future<Set<LoadBalancer>>>() {
76 
77         @Override
78         public ListenableFuture<Set<LoadBalancer>> apply(String from) {
79            return aclient.getLoadBalancerClient(from).listLoadBalancers();
80         }
81 
82      }, executor, null, logger, "loadbalancers")), converter);
83   }
84}

[all classes][org.jclouds.cloudloadbalancers.loadbalancer.strategy]
EMMA 2.0.5312 (C) Vladimir Roubtsov