EMMA Coverage Report (generated Mon Dec 09 15:12:29 EST 2013)
[all classes][org.jclouds.glesys.compute.functions]

COVERAGE SUMMARY FOR SOURCE FILE [OSTemplateToImage.java]

nameclass, %method, %block, %line, %
OSTemplateToImage.java100% (1/1)100% (2/2)100% (55/55)100% (8/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OSTemplateToImage100% (1/1)100% (2/2)100% (55/55)100% (8/8)
OSTemplateToImage (Function): void 100% (1/1)100% (6/6)100% (3/3)
apply (OSTemplate): Image 100% (1/1)100% (49/49)100% (5/5)

1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17package org.jclouds.glesys.compute.functions;
18 
19import static com.google.common.base.Preconditions.checkNotNull;
20 
21import javax.inject.Inject;
22import javax.inject.Singleton;
23 
24import org.jclouds.compute.domain.Image;
25import org.jclouds.compute.domain.Image.Status;
26import org.jclouds.compute.domain.ImageBuilder;
27import org.jclouds.compute.domain.OperatingSystem;
28import org.jclouds.compute.domain.OperatingSystem.Builder;
29import org.jclouds.compute.domain.OsFamilyVersion64Bit;
30import org.jclouds.glesys.domain.OSTemplate;
31 
32import com.google.common.base.Function;
33 
34/**
35 * @author Adrian Cole
36 */
37@Singleton
38public class OSTemplateToImage implements Function<OSTemplate, Image> {
39   private final Function<String, OsFamilyVersion64Bit> osParser;
40 
41   @Inject
42   public OSTemplateToImage(Function<String, OsFamilyVersion64Bit> osParser) {
43      this.osParser = osParser;
44   }
45 
46   @Override
47   public Image apply(OSTemplate template) {
48      checkNotNull(template, "template");
49      OsFamilyVersion64Bit parsed = osParser.apply(template.getName());
50      Builder builder = OperatingSystem.builder();
51      builder.name(template.getName()).description(template.getName()).is64Bit(parsed.is64Bit).version(parsed.version)
52               .family(parsed.family);
53      return new ImageBuilder().ids(template.getName()).name(template.getName()).description(template.getName())
54            .operatingSystem(builder.build()).status(Status.AVAILABLE).build();
55   }
56}

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