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;
26 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
31 * @author Liam Fallon (liam.fallon@ericsson.com)
34 public class PingTestClass implements Serializable {
35 private static final long serialVersionUID = -3400711508992955886L;
38 private String name = "Rose";
39 private String description = "A rose by any other name would smell as sweet";
40 private long pingTime = System.currentTimeMillis();
41 private long pongTime = -1;
46 * @throws ApexException the apex event exception
48 public void verify() throws ApexException {
49 if (name == null || name.length() < 4) {
50 throw new ApexException("TestPing is not valid, name length null or less than 4");
53 if (!name.startsWith("Rose")) {
54 throw new ApexException("TestPing is not valid, name does not start with \"Rose\"");
57 if (description == null || description.length() <= 44) {
58 throw new ApexException("TestPing is not valid, description length null or less than 44");
61 if (!description.startsWith("A rose by any other name would smell as sweet")) {
62 throw new ApexException("TestPing is not valid, description is incorrect");
65 if (pongTime < pingTime) {
66 throw new ApexException(
67 "TestPing is not valid, pong time " + pongTime + " is less than ping time " + pingTime);