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

COVERAGE SUMMARY FOR SOURCE FILE [VAppTemplatesForResourceEntities.java]

nameclass, %method, %block, %line, %
VAppTemplatesForResourceEntities.java0%   (0/3)0%   (0/7)0%   (0/60)0%   (0/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VAppTemplatesForResourceEntities0%   (0/1)0%   (0/3)0%   (0/36)0%   (0/7)
VAppTemplatesForResourceEntities (TerremarkVCloudAsyncClient, ExecutorService... 0%   (0/1)0%   (0/12)0%   (0/5)
access$000 (VAppTemplatesForResourceEntities): TerremarkVCloudAsyncClient 0%   (0/1)0%   (0/3)0%   (0/1)
apply (Iterable): Iterable 0%   (0/1)0%   (0/21)0%   (0/1)
     
class VAppTemplatesForResourceEntities$10%   (0/1)0%   (0/2)0%   (0/11)0%   (0/2)
VAppTemplatesForResourceEntities$1 (VAppTemplatesForResourceEntities): void 0%   (0/1)0%   (0/6)0%   (0/1)
apply (ReferenceType): boolean 0%   (0/1)0%   (0/5)0%   (0/1)
     
class VAppTemplatesForResourceEntities$20%   (0/1)0%   (0/2)0%   (0/13)0%   (0/2)
VAppTemplatesForResourceEntities$2 (VAppTemplatesForResourceEntities): void 0%   (0/1)0%   (0/6)0%   (0/1)
apply (ReferenceType): Future 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.trmk.vcloud_0_8.functions;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22import static com.google.common.collect.Iterables.filter;
23import static org.jclouds.concurrent.FutureIterables.transformParallel;
24 
25import java.util.concurrent.ExecutorService;
26import java.util.concurrent.Future;
27 
28import javax.annotation.Resource;
29import javax.inject.Inject;
30import javax.inject.Named;
31import javax.inject.Singleton;
32 
33import org.jclouds.Constants;
34import org.jclouds.compute.reference.ComputeServiceConstants;
35import org.jclouds.logging.Logger;
36import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient;
37import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType;
38import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
39import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
40 
41import com.google.common.base.Function;
42import com.google.common.base.Predicate;
43 
44/**
45 * @author Adrian Cole
46 */
47@Singleton
48public class VAppTemplatesForResourceEntities implements
49         Function<Iterable<? extends ReferenceType>, Iterable<? extends VAppTemplate>> {
50   @Resource
51   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
52   public Logger logger = Logger.NULL;
53   private final TerremarkVCloudAsyncClient aclient;
54   private final ExecutorService executor;
55 
56   @Inject
57   VAppTemplatesForResourceEntities(TerremarkVCloudAsyncClient aclient,
58            @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
59      this.aclient = aclient;
60      this.executor = executor;
61   }
62 
63   @Override
64   public Iterable<? extends VAppTemplate> apply(Iterable<? extends ReferenceType> from) {
65      return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate<ReferenceType>() {
66 
67         @Override
68         public boolean apply(ReferenceType input) {
69            return input.getType().equals(TerremarkVCloudMediaType.VAPPTEMPLATE_XML);
70         }
71 
72      }), new Function<ReferenceType, Future<VAppTemplate>>() {
73 
74         @SuppressWarnings("unchecked")
75         @Override
76         public Future<VAppTemplate> apply(ReferenceType from) {
77            return (Future<VAppTemplate>) aclient.getVAppTemplate(from.getHref());
78         }
79 
80      }, executor, null, logger, "vappTemplates in");
81   }
82 
83}

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