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

COVERAGE SUMMARY FOR SOURCE FILE [ContainerPropertiesImpl.java]

nameclass, %method, %block, %line, %
ContainerPropertiesImpl.java100% (1/1)56%  (5/9)73%  (154/210)60%  (29.4/49)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ContainerPropertiesImpl100% (1/1)56%  (5/9)73%  (154/210)60%  (29.4/49)
getETag (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getLastModified (): Date 0%   (0/1)0%   (0/3)0%   (0/1)
getMetadata (): Map 0%   (0/1)0%   (0/3)0%   (0/1)
getUrl (): URI 0%   (0/1)0%   (0/3)0%   (0/1)
equals (Object): boolean 100% (1/1)60%  (51/85)46%  (13/28)
compareTo (ContainerProperties): int 100% (1/1)82%  (9/11)81%  (0.8/1)
hashCode (): int 100% (1/1)86%  (50/58)94%  (6.6/7)
ContainerPropertiesImpl (URI, Date, String, Map): void 100% (1/1)100% (41/41)100% (8/8)
getName (): String 100% (1/1)100% (3/3)100% (1/1)

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.azureblob.domain.internal;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.io.Serializable;
24import java.net.URI;
25import java.util.Date;
26import java.util.Map;
27 
28import org.jclouds.azureblob.domain.ContainerProperties;
29 
30import com.google.common.collect.Maps;
31 
32/**
33 * Allows you to manipulate metadata.
34 * 
35 * @author Adrian Cole
36 */
37public class ContainerPropertiesImpl implements Serializable, ContainerProperties {
38 
39   /** The serialVersionUID */
40   private static final long serialVersionUID = -4648755473986695062L;
41 
42   private final String name;
43   private final URI url;
44   private final Date lastModified;
45   private final String eTag;
46   private final Map<String, String> metadata = Maps.newLinkedHashMap();
47 
48   public ContainerPropertiesImpl(URI url, Date lastModified, String eTag,Map<String, String> metadata) {
49      this.url = checkNotNull(url, "url");
50      this.name = checkNotNull(url.getPath(), "url.getPath()").replaceFirst("/", "");
51      this.lastModified = checkNotNull(lastModified, "lastModified");
52      this.eTag = checkNotNull(eTag, "eTag");
53      this.metadata.putAll(checkNotNull(metadata, "metadata"));
54   }
55 
56   /**
57    *{@inheritDoc}
58    */
59   @Override
60   public String getName() {
61      return name;
62   }
63 
64   /**
65    *{@inheritDoc}
66    */
67   @Override
68   public Date getLastModified() {
69      return lastModified;
70   }
71 
72   /**
73    *{@inheritDoc}
74    */
75   @Override
76   public String getETag() {
77      return eTag;
78   }
79   /**
80    *{@inheritDoc}
81    */
82   @Override
83   public int compareTo(ContainerProperties o) {
84      return (this == o) ? 0 : getName().compareTo(o.getName());
85   }
86   /**
87    *{@inheritDoc}
88    */
89   @Override
90   public Map<String, String> getMetadata() {
91      return metadata;
92   }   /**
93    *{@inheritDoc}
94    */
95   @Override
96   public URI getUrl() {
97      return url;
98   }
99 
100   @Override
101   public int hashCode() {
102      final int prime = 31;
103      int result = 1;
104      result = prime * result + ((eTag == null) ? 0 : eTag.hashCode());
105      result = prime * result + ((lastModified == null) ? 0 : lastModified.hashCode());
106      result = prime * result + ((name == null) ? 0 : name.hashCode());
107      result = prime * result + ((url == null) ? 0 : url.hashCode());
108      return result;
109   }
110 
111   @Override
112   public boolean equals(Object obj) {
113      if (this == obj)
114         return true;
115      if (obj == null)
116         return false;
117      if (getClass() != obj.getClass())
118         return false;
119      ContainerPropertiesImpl other = (ContainerPropertiesImpl) obj;
120      if (eTag == null) {
121         if (other.eTag != null)
122            return false;
123      } else if (!eTag.equals(other.eTag))
124         return false;
125      if (lastModified == null) {
126         if (other.lastModified != null)
127            return false;
128      } else if (!lastModified.equals(other.lastModified))
129         return false;
130      if (name == null) {
131         if (other.name != null)
132            return false;
133      } else if (!name.equals(other.name))
134         return false;
135      if (url == null) {
136         if (other.url != null)
137            return false;
138      } else if (!url.equals(other.url))
139         return false;
140      return true;
141   }
142 
143}

[all classes][org.jclouds.azureblob.domain.internal]
EMMA 2.0.5312 (C) Vladimir Roubtsov