Changes for checkstyle 8.32
[policy/apex-pdp.git] / testsuites / performance / performance-benchmark-test / src / main / java / org / onap / policy / apex / testsuites / performance / benchmark / eventgenerator / events / InputEvent.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 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.performance.benchmark.eventgenerator.events;
22
23 import com.google.gson.GsonBuilder;
24 import com.google.gson.annotations.SerializedName;
25 import java.util.Random;
26
27 /**
28  * This class is a POJO representing an input event for load testing.
29  */
30 public class InputEvent {
31     private String nameSpace = "org.onap.policy.apex.sample.events";
32     private String name;
33     private String version = "0.0.1";
34     private String source = "EventGenerator";
35     private String target = "Apex";
36
37     @SerializedName(value = "TestSlogan")
38     private String testSlogan;
39
40     @SerializedName(value = "TestMatchCase")
41     private int testMatchCase;
42
43     @SerializedName(value = "TestTimestamp")
44     private long testTimestamp = System.nanoTime();
45
46     @SerializedName(value = "TestTemperature")
47     private double testTemperature;
48
49     /**
50      * Constructor, assign default values to fields.
51      */
52     public InputEvent() {
53         final Random rand = new Random();
54         testMatchCase = rand.nextInt(4);
55         name = "Event0" + rand.nextInt(2) + "00";
56         testTemperature = rand.nextDouble() * 1000;
57     }
58
59     public String getNameSpace() {
60         return nameSpace;
61
62     }
63
64     public void setNameSpace(String nameSpace) {
65         this.nameSpace = nameSpace;
66     }
67
68     public String getName() {
69         return name;
70     }
71
72     public void setName(String name) {
73         this.name = name;
74     }
75
76     public String getVersion() {
77         return version;
78     }
79
80     public void setVersion(String version) {
81         this.version = version;
82     }
83
84     public String getSource() {
85         return source;
86     }
87
88     public void setSource(String source) {
89         this.source = source;
90     }
91
92     public String getTarget() {
93         return target;
94     }
95
96
97     public void setTarget(String target) {
98         this.target = target;
99     }
100
101     public String getTestSlogan() {
102         return testSlogan;
103     }
104
105     public void setTestSlogan(String testSlogan) {
106         this.testSlogan = testSlogan;
107     }
108
109     public int getTestMatchCase() {
110         return testMatchCase;
111     }
112
113     public void setTestMatchCase(int testMatchCase) {
114         this.testMatchCase = testMatchCase;
115     }
116
117     public long getTestTimestamp() {
118         return testTimestamp;
119     }
120
121     public void setTestTimestamp(long testTimestamp) {
122         this.testTimestamp = testTimestamp;
123     }
124
125     public double getTestTemperature() {
126         return testTemperature;
127     }
128
129     public void setTestTemperature(double testTemperature) {
130         this.testTemperature = testTemperature;
131     }
132
133     /**
134      * Get a JSON representation of the input event.
135      *
136      * @return the event in JSON format
137      */
138     public String asJson() {
139         return new GsonBuilder().setPrettyPrinting().create().toJson(this);
140     }
141 }