EMMA Coverage Report (generated Wed Jun 22 19:47:49 EDT 2011)
[all classes][org.jclouds.vcloud.terremark.compute.strategy]

COVERAGE SUMMARY FOR SOURCE FILE [TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy.java]

nameclass, %method, %block, %line, %
TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy.java0%   (0/1)0%   (0/3)0%   (0/89)0%   (0/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy0%   (0/1)0%   (0/3)0%   (0/89)0%   (0/9)
<static initializer> 0%   (0/1)0%   (0/8)0%   (0/1)
TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy (CreateNodeWithGroupEnc... 0%   (0/1)0%   (0/11)0%   (0/3)
execute (String, int, Template, Set, Map, Multimap): Map 0%   (0/1)0%   (0/70)0%   (0/5)

1/**
2 *
3 * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4 *
5 * ====================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * 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, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ====================================================================
18 */
19package org.jclouds.vcloud.terremark.compute.strategy;
20 
21import java.net.URI;
22import java.util.Map;
23import java.util.Set;
24import java.util.concurrent.ExecutorService;
25import java.util.concurrent.Future;
26 
27import javax.inject.Inject;
28import javax.inject.Named;
29import javax.inject.Singleton;
30 
31import org.jclouds.Constants;
32import org.jclouds.compute.config.CustomizationResponse;
33import org.jclouds.compute.domain.NodeMetadata;
34import org.jclouds.compute.domain.Template;
35import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
36import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap;
37import org.jclouds.compute.strategy.ListNodesStrategy;
38import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
39import org.jclouds.domain.LocationScope;
40import org.jclouds.vcloud.terremark.compute.options.TerremarkVCloudTemplateOptions;
41 
42import com.google.common.collect.Multimap;
43 
44/**
45 * creates futures that correlate to
46 * 
47 * @author Adrian Cole
48 */
49@Singleton
50public class TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy extends CreateNodesWithGroupEncodedIntoNameThenAddToSet {
51 
52   private final CreateNewKeyPairUnlessUserSpecifiedOtherwise createNewKeyPairUnlessUserSpecifiedOtherwise;
53 
54   @Inject
55   protected TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy(
56            CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy,
57            ListNodesStrategy listNodesStrategy,
58            @Named("NAMING_CONVENTION") String nodeNamingConvention,
59            CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
60            @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor,
61            CreateNewKeyPairUnlessUserSpecifiedOtherwise createNewKeyPairUnlessUserSpecifiedOtherwise) {
62      super(addNodeWithTagStrategy, listNodesStrategy, nodeNamingConvention, executor,
63               customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
64      this.createNewKeyPairUnlessUserSpecifiedOtherwise = createNewKeyPairUnlessUserSpecifiedOtherwise;
65   }
66 
67   @Override
68   public Map<?, Future<Void>> execute(String tag, int count, Template template, Set<NodeMetadata> goodNodes,
69            Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
70      assert template.getLocation().getParent().getScope() == LocationScope.REGION : "template location should have a parent of org, which should be mapped to region: "
71               + template.getLocation();
72      String orgId = template.getLocation().getParent().getId();
73      assert orgId.startsWith("http") : "parent id should be a rest url: " + template.getLocation().getParent();
74      createNewKeyPairUnlessUserSpecifiedOtherwise.execute(URI.create(orgId), tag, template.getImage()
75               .getDefaultCredentials().identity, template.getOptions().as(TerremarkVCloudTemplateOptions.class));
76      return super.execute(tag, count, template, goodNodes, badNodes, customizationResponses);
77   }
78}

[all classes][org.jclouds.vcloud.terremark.compute.strategy]
EMMA 2.0.5312 (C) Vladimir Roubtsov