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