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

COVERAGE SUMMARY FOR SOURCE FILE [Resource.java]

nameclass, %method, %block, %line, %
Resource.java100% (1/1)100% (2/2)80%  (45/56)73%  (8/11)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Resource100% (1/1)100% (2/2)80%  (45/56)73%  (8/11)
getURI (): URI 100% (1/1)78%  (39/50)67%  (6/9)
Resource (): void 100% (1/1)100% (6/6)100% (2/2)

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.openstack.nova.domain;
20 
21import java.net.URI;
22import java.net.URISyntaxException;
23import java.util.List;
24import java.util.Map;
25 
26import com.google.common.base.Functions;
27import com.google.common.collect.Lists;
28 
29/**
30 * @author Dmitri Babaev
31 */
32public class Resource {
33 
34   private List<Map<String, String>> links = Lists.newArrayList();
35 
36   public URI getURI() {
37      for (Map<String, String> linkProperties : links) {
38         try {
39            if (!Functions.forMap(linkProperties, "").apply("rel").equals("bookmark"))
40               continue;
41            if (!Functions.forMap(linkProperties, "").apply("type").contains("json"))
42               continue;
43            
44            return new URI(linkProperties.get("href"));
45         } catch (URISyntaxException e) {
46            throw new RuntimeException(e);
47         }
48      }
49 
50      throw new IllegalStateException("URI is not available");
51   }
52}

[all classes][org.jclouds.openstack.nova.domain]
EMMA 2.0.5312 (C) Vladimir Roubtsov