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 [VAppTemplatesForCatalogItems.java]

nameclass, %method, %block, %line, %
VAppTemplatesForCatalogItems.java0%   (0/3)0%   (0/7)0%   (0/59)0%   (0/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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