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

COVERAGE SUMMARY FOR SOURCE FILE [LoadBalancerToLoadBalancerMetadata.java]

nameclass, %method, %block, %line, %
LoadBalancerToLoadBalancerMetadata.java0%   (0/2)0%   (0/4)0%   (0/60)0%   (0/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class LoadBalancerToLoadBalancerMetadata0%   (0/1)0%   (0/2)0%   (0/51)0%   (0/7)
LoadBalancerToLoadBalancerMetadata (Supplier, Supplier): void 0%   (0/1)0%   (0/9)0%   (0/4)
apply (LoadBalancer): LoadBalancerMetadata 0%   (0/1)0%   (0/42)0%   (0/3)
     
class LoadBalancerToLoadBalancerMetadata$10%   (0/1)0%   (0/2)0%   (0/9)0%   (0/2)
LoadBalancerToLoadBalancerMetadata$1 (LoadBalancerToLoadBalancerMetadata): void 0%   (0/1)0%   (0/6)0%   (0/1)
apply (VirtualIP): String 0%   (0/1)0%   (0/3)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.functions;
20 
21import java.util.Map;
22 
23import javax.inject.Inject;
24import javax.inject.Singleton;
25 
26import org.jclouds.cloudloadbalancers.domain.LoadBalancer;
27import org.jclouds.cloudloadbalancers.domain.VirtualIP;
28import org.jclouds.domain.Location;
29import org.jclouds.loadbalancer.domain.LoadBalancerMetadata;
30import org.jclouds.loadbalancer.domain.LoadBalancerType;
31import org.jclouds.loadbalancer.domain.internal.LoadBalancerMetadataImpl;
32 
33import com.google.common.base.Function;
34import com.google.common.base.Supplier;
35import com.google.common.collect.ImmutableMap;
36import com.google.common.collect.Iterables;
37 
38/**
39 * 
40 * @author Adrian Cole
41 */
42@Singleton
43public class LoadBalancerToLoadBalancerMetadata implements Function<LoadBalancer, LoadBalancerMetadata> {
44   protected final Supplier<Map<String, ? extends Location>> locationMap;
45   protected final Supplier<Location> defaultLocationSupplier;
46 
47   @Inject
48   public LoadBalancerToLoadBalancerMetadata(Supplier<Location> defaultLocationSupplier,
49            Supplier<Map<String, ? extends Location>> locationMap) {
50      this.locationMap = locationMap;
51      this.defaultLocationSupplier = defaultLocationSupplier;
52   }
53 
54   @Override
55   public LoadBalancerMetadata apply(LoadBalancer input) {
56 
57      Location location = locationMap.get().get(input.getRegion());
58 
59      String id = input.getRegion() + "/" + input.getId();
60      // TODO Builder
61      return new LoadBalancerMetadataImpl(LoadBalancerType.LB, input.getName(), input.getName(), id, location, null,
62               ImmutableMap.<String, String> of(), Iterables.transform(input.getVirtualIPs(),
63                        new Function<VirtualIP, String>() {
64 
65                           @Override
66                           public String apply(VirtualIP arg0) {
67                              return arg0.getAddress();
68                           }
69 
70                        }));
71   }
72}

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