2 * Copyright 2017 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.holmes.common.api.entity;
19 import static org.hamcrest.core.IsEqual.equalTo;
20 import static org.junit.Assert.assertThat;
22 import java.util.Date;
23 import java.util.Properties;
24 import org.junit.After;
25 import org.junit.Before;
26 import org.junit.Test;
28 public class CorrelationRuleTest {
30 private CorrelationRule correlationRule;
33 public void before() throws Exception {
34 correlationRule = new CorrelationRule();
38 public void after() throws Exception {
43 public void getterAndSetter4Rid() throws Exception {
44 final String rid = "rid";
45 correlationRule.setRid(rid);
46 assertThat(correlationRule.getRid(), equalTo(rid));
50 public void getterAndSetter4Name() throws Exception {
51 final String name = "name";
52 correlationRule.setName(name);
53 assertThat(correlationRule.getName(), equalTo(name));
57 public void getterAndSetter4Description() throws Exception {
58 final String description = "description";
59 correlationRule.setDescription(description);
60 assertThat(correlationRule.getDescription(), equalTo(description));
64 public void getterAndSetter4Enabled() throws Exception {
65 final int enabled = 1;
66 correlationRule.setEnabled(enabled);
67 assertThat(correlationRule.getEnabled(), equalTo(enabled));
71 public void getterAndSetter4TemplateID() throws Exception {
72 final long templateId = 1L;
73 correlationRule.setTemplateID(templateId);
74 assertThat(correlationRule.getTemplateID(), equalTo(templateId));
78 public void getterAndSetter4EngineId() throws Exception {
79 final String engineId = "engineId";
80 correlationRule.setEngineID(engineId);
81 assertThat(correlationRule.getEngineID(), equalTo(engineId));
85 public void getterAndSetter4EngineType() throws Exception {
86 final String engineType = "engineType";
87 correlationRule.setEngineType(engineType);
88 assertThat(correlationRule.getEngineType(), equalTo(engineType));
92 public void getterAndSetter4Creator() throws Exception {
93 final String creator = "creator";
94 correlationRule.setCreator(creator);
95 assertThat(correlationRule.getCreator(), equalTo(creator));
99 public void getterAndSetter4Modifier() throws Exception {
100 final String modifier = "modifier";
101 correlationRule.setModifier(modifier);
102 assertThat(correlationRule.getModifier(), equalTo(modifier));
106 public void getterAndSetter4Params() throws Exception {
107 final Properties params = new Properties();
108 correlationRule.setParams(params);
109 assertThat(correlationRule.getParams(), equalTo(params));
113 public void getterAndSetter4Content() throws Exception {
114 final String content = "content";
115 correlationRule.setContent(content);
116 assertThat(correlationRule.getContent(), equalTo(content));
120 public void getterAndSetter4Vendor() throws Exception {
121 final String vendor = "vendor";
122 correlationRule.setVendor(vendor);
123 assertThat(correlationRule.getVendor(), equalTo(vendor));
127 public void getterAndSetter4CreateTime() throws Exception {
128 Date createTime = new Date();
129 correlationRule.setCreateTime(createTime);
130 assertThat(correlationRule.getCreateTime(), equalTo(createTime));
134 public void getterAndSetter4UpdateTime() throws Exception {
135 final Date updateTime = new Date();
136 correlationRule.setUpdateTime(updateTime);
137 assertThat(correlationRule.getUpdateTime(), equalTo(updateTime));
141 public void getterAndSetter4PackageName() throws Exception {
142 final String packageName = "packageName";
143 correlationRule.setPackageName(packageName);
144 assertThat(correlationRule.getPackageName(), equalTo(packageName));