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

COVERAGE SUMMARY FOR SOURCE FILE [NodesParsedFromSupplier.java]

nameclass, %method, %block, %line, %
NodesParsedFromSupplier.java100% (1/1)100% (2/2)98%  (46/47)100% (8/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NodesParsedFromSupplier100% (1/1)100% (2/2)98%  (46/47)100% (8/8)
get (): Cache 100% (1/1)97%  (28/29)99%  (3/3)
NodesParsedFromSupplier (Supplier, Function): void 100% (1/1)100% (18/18)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.byon.suppliers;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22import static com.google.common.base.Preconditions.checkState;
23 
24import java.io.InputStream;
25 
26import javax.annotation.Resource;
27import javax.inject.Inject;
28import javax.inject.Singleton;
29 
30import org.jclouds.byon.Node;
31import org.jclouds.location.Provider;
32import org.jclouds.logging.Logger;
33 
34import com.google.common.base.Function;
35import com.google.common.base.Supplier;
36import com.google.common.cache.Cache;
37 
38/**
39 * 
40 * @author Adrian Cole
41 */
42@Singleton
43public class NodesParsedFromSupplier implements Supplier<Cache<String, Node>> {
44   @Resource
45   protected Logger logger = Logger.NULL;
46 
47   private final Supplier<InputStream> supplier;
48   private final Function<InputStream, Cache<String, Node>> parser;
49 
50   @Inject
51   NodesParsedFromSupplier(@Provider Supplier<InputStream> supplier, Function<InputStream, Cache<String, Node>> parser) {
52      this.supplier = checkNotNull(supplier, "supplier");
53      this.parser = checkNotNull(parser, "parser");
54   }
55 
56   @Override
57   public Cache<String, Node> get() {
58      Cache<String, Node> nodes = parser.apply(supplier.get());
59      checkState(nodes != null && nodes.size() > 0, "no nodes parsed from supplier: %s", supplier);
60      return nodes;
61   }
62 
63}

[all classes][org.jclouds.byon.suppliers]
EMMA 2.0.5312 (C) Vladimir Roubtsov