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

COVERAGE SUMMARY FOR SOURCE FILE [TaskImpl.java]

nameclass, %method, %block, %line, %
TaskImpl.java100% (1/1)18%  (2/11)33%  (116/351)46%  (32/70)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TaskImpl100% (1/1)18%  (2/11)33%  (116/351)46%  (32/70)
getEndTime (): Date 0%   (0/1)0%   (0/3)0%   (0/1)
getError (): VCloudError 0%   (0/1)0%   (0/3)0%   (0/1)
getExpiryTime (): Date 0%   (0/1)0%   (0/3)0%   (0/1)
getOperation (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getOwner (): ReferenceType 0%   (0/1)0%   (0/3)0%   (0/1)
getStartTime (): Date 0%   (0/1)0%   (0/3)0%   (0/1)
getStatus (): TaskStatus 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/98)0%   (0/10)
toString (): String 0%   (0/1)0%   (0/67)0%   (0/1)
equals (Object): boolean 100% (1/1)64%  (86/135)53%  (23/43)
TaskImpl (URI, String, TaskStatus, Date, Date, Date, ReferenceType, VCloudErr... 100% (1/1)100% (30/30)100% (9/9)

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.trmk.vcloud_0_8.domain.internal;
20 
21import java.net.URI;
22import java.util.Date;
23 
24import org.jclouds.javax.annotation.Nullable;
25import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType;
26import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
27import org.jclouds.trmk.vcloud_0_8.domain.Task;
28import org.jclouds.trmk.vcloud_0_8.domain.TaskStatus;
29import org.jclouds.trmk.vcloud_0_8.domain.VCloudError;
30 
31import static com.google.common.base.Preconditions.checkNotNull;
32 
33/**
34 * 
35 * @author Adrian Cole
36 * 
37 */
38public class TaskImpl extends ReferenceTypeImpl implements Task {
39 
40   private final String operation;
41   private final TaskStatus status;
42   private final Date startTime;
43   @Nullable
44   private final Date endTime;
45   @Nullable
46   private final Date expiryTime;
47   private final ReferenceType owner;
48   @Nullable
49   private final VCloudError error;
50 
51   public TaskImpl(URI id, String operation, TaskStatus status, Date startTime, @Nullable Date endTime,
52            @Nullable Date expiryTime, ReferenceType owner, VCloudError error) {
53      super(null, TerremarkVCloudMediaType.TASK_XML, id);
54      this.operation = operation;
55      this.status = checkNotNull(status, "status");
56      this.startTime = startTime;
57      this.endTime = endTime;
58      this.expiryTime = expiryTime;
59      this.owner = owner;
60      this.error = error;
61   }
62 
63   @Override
64   public TaskStatus getStatus() {
65      return status;
66   }
67 
68   @Override
69   public Date getStartTime() {
70      return startTime;
71   }
72 
73   @Override
74   public ReferenceType getOwner() {
75      return owner;
76   }
77 
78   @Override
79   public Date getEndTime() {
80      return endTime;
81   }
82 
83   @Override
84   public VCloudError getError() {
85      return error;
86   }
87 
88   @Override
89   public String toString() {
90      return "TaskImpl [endTime=" + endTime + ", error=" + error + ", expiryTime=" + expiryTime + ", operation="
91               + operation + ", owner=" + owner + ", startTime=" + startTime + ", status=" + status + ", getHref()="
92               + getHref() + ", getName()=" + getName() + ", getType()=" + getType() + ", toString()="
93               + super.toString() + ", getClass()=" + getClass() + "]";
94   }
95 
96   public Date getExpiryTime() {
97      return expiryTime;
98   }
99 
100   @Override
101   public String getOperation() {
102      return operation;
103   }
104 
105   @Override
106   public int hashCode() {
107      final int prime = 31;
108      int result = super.hashCode();
109      result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
110      result = prime * result + ((error == null) ? 0 : error.hashCode());
111      result = prime * result + ((expiryTime == null) ? 0 : expiryTime.hashCode());
112      result = prime * result + ((operation == null) ? 0 : operation.hashCode());
113      result = prime * result + ((owner == null) ? 0 : owner.hashCode());
114      result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
115      result = prime * result + ((status == null) ? 0 : status.hashCode());
116      return result;
117   }
118 
119   @Override
120   public boolean equals(Object obj) {
121      if (this == obj)
122         return true;
123      if (!super.equals(obj))
124         return false;
125      if (getClass() != obj.getClass())
126         return false;
127      TaskImpl other = (TaskImpl) obj;
128      if (endTime == null) {
129         if (other.endTime != null)
130            return false;
131      } else if (!endTime.equals(other.endTime))
132         return false;
133      if (error == null) {
134         if (other.error != null)
135            return false;
136      } else if (!error.equals(other.error))
137         return false;
138      if (expiryTime == null) {
139         if (other.expiryTime != null)
140            return false;
141      } else if (!expiryTime.equals(other.expiryTime))
142         return false;
143      if (operation == null) {
144         if (other.operation != null)
145            return false;
146      } else if (!operation.equals(other.operation))
147         return false;
148      if (owner == null) {
149         if (other.owner != null)
150            return false;
151      } else if (!owner.equals(other.owner))
152         return false;
153      if (startTime == null) {
154         if (other.startTime != null)
155            return false;
156      } else if (!startTime.equals(other.startTime))
157         return false;
158      if (status == null) {
159         if (other.status != null)
160            return false;
161      } else if (!status.equals(other.status))
162         return false;
163      return true;
164   }
165 
166}

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