EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.trmk.vcloud_0_8.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 * 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.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.trmk.vcloud_0_8.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.trmk.vcloud_0_8.compute.strategy]
EMMA 2.0.5312 (C) Vladimir Roubtsov