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

COVERAGE SUMMARY FOR SOURCE FILE [AzureBlobImpl.java]

nameclass, %method, %block, %line, %
AzureBlobImpl.java100% (1/1)67%  (6/9)36%  (43/121)38%  (12/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AzureBlobImpl100% (1/1)67%  (6/9)36%  (43/121)38%  (12/32)
compareTo (AzureBlob): int 0%   (0/1)0%   (0/19)0%   (0/3)
equals (Object): boolean 0%   (0/1)0%   (0/39)0%   (0/13)
hashCode (): int 0%   (0/1)0%   (0/20)0%   (0/4)
AzureBlobImpl (MutableBlobProperties): void 100% (1/1)100% (9/9)100% (4/4)
getAllHeaders (): Multimap 100% (1/1)100% (3/3)100% (1/1)
getProperties (): MutableBlobProperties 100% (1/1)100% (3/3)100% (1/1)
setAllHeaders (Multimap): void 100% (1/1)100% (7/7)100% (2/2)
setPayload (Payload): void 100% (1/1)100% (9/9)100% (3/3)
toString (): String 100% (1/1)100% (12/12)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 javax.inject.Inject;
24 
25import org.jclouds.azureblob.domain.AzureBlob;
26import org.jclouds.azureblob.domain.MutableBlobProperties;
27import org.jclouds.http.internal.PayloadEnclosingImpl;
28import org.jclouds.io.Payload;
29 
30import com.google.common.collect.LinkedHashMultimap;
31import com.google.common.collect.Multimap;
32 
33/**
34 * Default Implementation of {@link AzureBlob}.
35 * 
36 * @author Adrian Cole
37 */
38public class AzureBlobImpl extends PayloadEnclosingImpl implements AzureBlob, Comparable<AzureBlob> {
39 
40   private final MutableBlobProperties properties;
41   private Multimap<String, String> allHeaders = LinkedHashMultimap.create();
42 
43   @Inject
44   public AzureBlobImpl(MutableBlobProperties properties) {
45      super();
46      this.properties = properties;
47   }
48 
49   /**
50    * {@inheritDoc}
51    */
52   @Override
53   public MutableBlobProperties getProperties() {
54      return properties;
55   }
56 
57   /**
58    * {@inheritDoc}
59    */
60   @Override
61   public Multimap<String, String> getAllHeaders() {
62      return allHeaders;
63   }
64 
65   /**
66    * {@inheritDoc}
67    */
68   @Override
69   public void setAllHeaders(Multimap<String, String> allHeaders) {
70      this.allHeaders = checkNotNull(allHeaders, "allHeaders");
71   }
72 
73   /**
74    * {@inheritDoc}
75    */
76   @Override
77   public int compareTo(AzureBlob o) {
78      if (getProperties().getName() == null)
79         return -1;
80      return (this == o) ? 0 : getProperties().getName().compareTo(o.getProperties().getName());
81   }
82 
83   @Override
84   public int hashCode() {
85      final int prime = 31;
86      int result = super.hashCode();
87      result = prime * result + ((properties == null) ? 0 : properties.hashCode());
88      return result;
89   }
90 
91   @Override
92   public boolean equals(Object obj) {
93      if (this == obj)
94         return true;
95      if (!super.equals(obj))
96         return false;
97      if (getClass() != obj.getClass())
98         return false;
99      AzureBlobImpl other = (AzureBlobImpl) obj;
100      if (properties == null) {
101         if (other.properties != null)
102            return false;
103      } else if (!properties.equals(other.properties))
104         return false;
105      return true;
106   }
107 
108   @Override
109   public String toString() {
110      return "[properties=" + properties + "]";
111   }
112 
113   @Override
114   public void setPayload(Payload data) {
115      super.setPayload(data);
116      properties.setContentMetadata(data.getContentMetadata());
117   }
118 
119}

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