Replace non-Javadoc comments with inheritDocs
[policy/apex-pdp.git] / testsuites / integration / integration-common / src / main / java / org / onap / policy / apex / testsuites / integration / common / testclasses / PingTestClass.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * 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  * 
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.apex.testsuites.integration.common.testclasses;
22
23 import java.io.Serializable;
24
25 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
26
27 /**
28  * The Class TestPing.
29  *
30  * @author Liam Fallon (liam.fallon@ericsson.com)
31  */
32 public class PingTestClass implements Serializable {
33     private static final long serialVersionUID = -3400711508992955886L;
34
35     private String name = "Rose";
36     private String description = "A rose by any other name would smell as sweet";
37     private long pingTime = System.currentTimeMillis();
38     private long pongTime = -1;
39
40     /**
41      * Gets the name.
42      *
43      * @return the name
44      */
45     public String getName() {
46         return name;
47     }
48
49     /**
50      * Sets the name.
51      *
52      * @param name the new name
53      */
54     public void setName(final String name) {
55         this.name = name;
56     }
57
58     /**
59      * Gets the description.
60      *
61      * @return the description
62      */
63     public String getDescription() {
64         return description;
65     }
66
67     /**
68      * Sets the description.
69      *
70      * @param description the new description
71      */
72     public void setDescription(final String description) {
73         this.description = description;
74     }
75
76     /**
77      * Gets the ping time.
78      *
79      * @return the ping time
80      */
81     public long getPingTime() {
82         return pingTime;
83     }
84
85     /**
86      * Sets the ping time.
87      *
88      * @param pingTime the new ping time
89      */
90     public void setPingTime(final long pingTime) {
91         this.pingTime = pingTime;
92     }
93
94     /**
95      * Gets the pong time.
96      *
97      * @return the pong time
98      */
99     public long getPongTime() {
100         return pongTime;
101     }
102
103     /**
104      * Sets the pong time.
105      *
106      * @param pongTime the new pong time
107      */
108     public void setPongTime(final long pongTime) {
109         this.pongTime = pongTime;
110     }
111
112     /**
113      * {@inheritDoc}.
114      */
115     @Override
116     public String toString() {
117         return "TestPing [name=" + name + ", description=" + description + ", pingTime=" + pingTime + ", pongTime="
118                 + pongTime + "]";
119     }
120
121     /**
122      * Verify the class.
123      *
124      * @throws ApexException the apex event exception
125      */
126     public void verify() throws ApexException {
127         if (name == null || name.length() < 4) {
128             throw new ApexException("TestPing is not valid, name length null or less than 4");
129         }
130
131         if (!name.startsWith("Rose")) {
132             throw new ApexException("TestPing is not valid, name does not start with \"Rose\"");
133         }
134
135         if (description == null || description.length() <= 44) {
136             throw new ApexException("TestPing is not valid, description length null or less than 44");
137         }
138
139         if (!description.startsWith("A rose by any other name would smell as sweet")) {
140             throw new ApexException("TestPing is not valid, description is incorrect");
141         }
142
143         if (pongTime <= pingTime) {
144             throw new ApexException("TestPing is not valid, pong time is not greater than ping time");
145         }
146     }
147 }