EMMA Coverage Report (generated Wed Jun 22 19:47:49 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 *
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.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