2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * Modifications Copyright (C) 2020 Nordix Foundation.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.apex.testsuites.integration.common.testclasses;
24 import java.io.Serializable;
28 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
33 * @author Liam Fallon (liam.fallon@ericsson.com)
36 public class PingTestClass implements Serializable {
37 private static final long serialVersionUID = -3400711508992955886L;
40 private String name = "Rose";
41 private String description = "A rose by any other name would smell as sweet";
42 private long pingTime = System.currentTimeMillis();
43 private long pongTime = -1;
48 * @throws ApexException the apex event exception
50 public void verify() throws ApexException {
51 if (name == null || name.length() < 4) {
52 throw new ApexException("TestPing is not valid, name length null or less than 4");
55 if (!name.startsWith("Rose")) {
56 throw new ApexException("TestPing is not valid, name does not start with \"Rose\"");
59 if (description == null || description.length() <= 44) {
60 throw new ApexException("TestPing is not valid, description length null or less than 44");
63 if (!description.startsWith("A rose by any other name would smell as sweet")) {
64 throw new ApexException("TestPing is not valid, description is incorrect");
67 if (pongTime < pingTime) {
68 throw new ApexException(
69 "TestPing is not valid, pong time " + pongTime + " is less than ping time " + pingTime);