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

COVERAGE SUMMARY FOR SOURCE FILE [AllVDCsInOrg.java]

nameclass, %method, %block, %line, %
AllVDCsInOrg.java50%  (1/2)20%  (1/5)23%  (12/53)50%  (5/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AllVDCsInOrg$10%   (0/1)0%   (0/2)0%   (0/13)0%   (0/2)
AllVDCsInOrg$1 (AllVDCsInOrg): void 0%   (0/1)0%   (0/6)0%   (0/1)
apply (ReferenceType): Future 0%   (0/1)0%   (0/7)0%   (0/1)
     
class AllVDCsInOrg100% (1/1)33%  (1/3)30%  (12/40)62%  (5/8)
access$000 (AllVDCsInOrg): VCloudAsyncClient 0%   (0/1)0%   (0/3)0%   (0/1)
apply (Org): Iterable 0%   (0/1)0%   (0/25)0%   (0/2)
AllVDCsInOrg (VCloudAsyncClient, ExecutorService): void 100% (1/1)100% (12/12)100% (5/5)

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.vcloud.functions;
20 
21import static org.jclouds.concurrent.FutureIterables.transformParallel;
22 
23import java.util.concurrent.ExecutorService;
24import java.util.concurrent.Future;
25 
26import javax.annotation.Resource;
27import javax.inject.Inject;
28import javax.inject.Named;
29import javax.inject.Singleton;
30 
31import org.jclouds.Constants;
32import org.jclouds.logging.Logger;
33import org.jclouds.vcloud.VCloudAsyncClient;
34import org.jclouds.vcloud.domain.Org;
35import org.jclouds.vcloud.domain.ReferenceType;
36 
37import com.google.common.base.Function;
38 
39/**
40 * @author Adrian Cole
41 */
42@Singleton
43public class AllVDCsInOrg implements Function<Org, Iterable<? extends org.jclouds.vcloud.domain.VDC>> {
44   @Resource
45   public Logger logger = Logger.NULL;
46 
47   private final VCloudAsyncClient aclient;
48   private final ExecutorService executor;
49 
50   @Inject
51   AllVDCsInOrg(VCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
52      this.aclient = aclient;
53      this.executor = executor;
54   }
55 
56   @Override
57   public Iterable<? extends org.jclouds.vcloud.domain.VDC> apply(final Org org) {
58 
59      Iterable<org.jclouds.vcloud.domain.VDC> catalogItems = transformParallel(org.getVDCs().values(),
60            new Function<ReferenceType, Future<org.jclouds.vcloud.domain.VDC>>() {
61               @SuppressWarnings("unchecked")
62               @Override
63               public Future<org.jclouds.vcloud.domain.VDC> apply(ReferenceType from) {
64                  return (Future<org.jclouds.vcloud.domain.VDC>) aclient.getVDC(from.getHref());
65               }
66 
67            }, executor, null, logger, "vdcs in org " + org.getName());
68      return catalogItems;
69   }
70 
71}

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