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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.testsuites.integration.common.testclasses;
23 import java.io.Serializable;
25 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
30 * @author Liam Fallon (liam.fallon@ericsson.com)
32 public class PingTestClass implements Serializable {
33 private static final long serialVersionUID = -3400711508992955886L;
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;
45 public String getName() {
52 * @param name the new name
54 public void setName(final String name) {
59 * Gets the description.
61 * @return the description
63 public String getDescription() {
68 * Sets the description.
70 * @param description the new description
72 public void setDescription(final String description) {
73 this.description = description;
79 * @return the ping time
81 public long getPingTime() {
88 * @param pingTime the new ping time
90 public void setPingTime(final long pingTime) {
91 this.pingTime = pingTime;
97 * @return the pong time
99 public long getPongTime() {
104 * Sets the pong time.
106 * @param pongTime the new pong time
108 public void setPongTime(final long pongTime) {
109 this.pongTime = pongTime;
116 public String toString() {
117 return "TestPing [name=" + name + ", description=" + description + ", pingTime=" + pingTime + ", pongTime="
124 * @throws ApexException the apex event exception
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");
131 if (!name.startsWith("Rose")) {
132 throw new ApexException("TestPing is not valid, name does not start with \"Rose\"");
135 if (description == null || description.length() <= 44) {
136 throw new ApexException("TestPing is not valid, description length null or less than 44");
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");
143 if (pongTime <= pingTime) {
144 throw new ApexException("TestPing is not valid, pong time is not greater than ping time");