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

COVERAGE SUMMARY FOR SOURCE FILE [BaseDriveToMap.java]

nameclass, %method, %block, %line, %
BaseDriveToMap.java100% (1/1)100% (2/2)100% (68/68)100% (12/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BaseDriveToMap100% (1/1)100% (2/2)100% (68/68)100% (12/12)
BaseDriveToMap (): void 100% (1/1)100% (3/3)100% (1/1)
apply (Drive): Map 100% (1/1)100% (65/65)100% (11/11)

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.cloudsigma.functions;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.util.Map;
24 
25import javax.inject.Singleton;
26 
27import org.jclouds.cloudsigma.domain.ClaimType;
28import org.jclouds.cloudsigma.domain.Drive;
29 
30import com.google.common.base.Function;
31import com.google.common.base.Joiner;
32import com.google.common.collect.ImmutableMap;
33 
34/**
35 * 
36 * @author Adrian Cole
37 */
38@Singleton
39public class BaseDriveToMap implements Function<Drive, Map<String, String>> {
40   @Override
41   public Map<String, String> apply(Drive from) {
42      checkNotNull(from, "drive");
43      ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
44      builder.put("name", from.getName());
45      builder.put("size", from.getSize() + "");
46      if (from.getClaimType() != ClaimType.EXCLUSIVE)
47         builder.put("claim:type", from.getClaimType().toString());
48      if (from.getReaders().size() != 0)
49         builder.put("readers", Joiner.on(' ').join(from.getReaders()));
50      if (from.getUse().size() != 0)
51         builder.put("use", Joiner.on(' ').join(from.getUse()));
52      return builder.build();
53   }
54}

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