2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.policy.test;
23 import static org.junit.Assert.assertNull;
24 import java.util.Properties;
26 import org.junit.Test;
27 import org.openecomp.policy.utils.BackUpMonitor;
30 public class testBackUpMonitor {
33 public void backUpMonitorTestFail() throws Exception{
34 Properties properties = new Properties();
35 properties.setProperty("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
36 properties.setProperty("javax.persistence.jdbc.url", "jdbc:mysql://localhost:3306/xacml");
37 properties.setProperty("javax.persistence.jdbc.user", "policy_user");
38 properties.setProperty("javax.persistence.jdbc.password", "");
39 //properties.setProperty("ping_interval", "500000");
40 BackUpMonitor bum = BackUpMonitor.getInstance(BackUpMonitor.ResourceNode.BRMS.toString(), "brms_test" , properties, new Handler());
45 public void backUpMonitorTestFailNoUser() throws Exception{
46 Properties properties = new Properties();
47 properties.setProperty("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
48 properties.setProperty("javax.persistence.jdbc.url", "jdbc:mysql://localhost:3306/xacml");
49 properties.setProperty("javax.persistence.jdbc.user", "");
50 properties.setProperty("javax.persistence.jdbc.password", "password");
51 //properties.setProperty("ping_interval", "500000");
52 BackUpMonitor bum = BackUpMonitor.getInstance(BackUpMonitor.ResourceNode.BRMS.toString(), "brms_test" , properties, new Handler());
57 public void backUpMonitorTestFailNoURL() throws Exception{
58 Properties properties = new Properties();
59 properties.setProperty("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
60 properties.setProperty("javax.persistence.jdbc.url", "");
61 properties.setProperty("javax.persistence.jdbc.user", "test");
62 properties.setProperty("javax.persistence.jdbc.password", "password");
63 //properties.setProperty("ping_interval", "500000");
64 BackUpMonitor bum = BackUpMonitor.getInstance(BackUpMonitor.ResourceNode.BRMS.toString(), "brms_test" , properties, new Handler());
69 public void backUpMonitorTestFailNoDriver() throws Exception{
70 Properties properties = new Properties();
71 properties.setProperty("javax.persistence.jdbc.driver", "");
72 properties.setProperty("javax.persistence.jdbc.url", "jdbc:mysql://localhost:3306/xacml");
73 properties.setProperty("javax.persistence.jdbc.user", "test");
74 properties.setProperty("javax.persistence.jdbc.password", "password");
75 //properties.setProperty("ping_interval", "500000");
76 BackUpMonitor bum = BackUpMonitor.getInstance(BackUpMonitor.ResourceNode.BRMS.toString(), "brms_test" , properties, new Handler());
81 public void backUpMonitorTestFailNoNode() throws Exception{
82 Properties properties = new Properties();
83 properties.setProperty("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
84 properties.setProperty("javax.persistence.jdbc.url", "jdbc:mysql://localhost:3306/xacml");
85 properties.setProperty("javax.persistence.jdbc.user", "test");
86 properties.setProperty("javax.persistence.jdbc.password", "password");
87 //properties.setProperty("ping_interval", "500000");
88 BackUpMonitor bum = BackUpMonitor.getInstance(null, "brms_test" , properties, new Handler());
93 public void backUpMonitorTestFailNoResource() throws Exception{
94 Properties properties = new Properties();
95 properties.setProperty("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
96 properties.setProperty("javax.persistence.jdbc.url", "jdbc:mysql://localhost:3306/xacml");
97 properties.setProperty("javax.persistence.jdbc.user", "test");
98 properties.setProperty("javax.persistence.jdbc.password", "password");
99 //properties.setProperty("ping_interval", "500000");
100 BackUpMonitor bum = BackUpMonitor.getInstance(BackUpMonitor.ResourceNode.BRMS.toString(), null , properties, new Handler());
105 public void backUpMonitorTestFailNoProperties() throws Exception{
106 BackUpMonitor bum = BackUpMonitor.getInstance(BackUpMonitor.ResourceNode.BRMS.toString(), "brms_test" , null, new Handler());
111 public void backUpMonitorTestFailNoHandler() throws Exception{
112 Properties properties = new Properties();
113 properties.setProperty("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
114 properties.setProperty("javax.persistence.jdbc.url", "jdbc:mysql://localhost:3306/xacml");
115 properties.setProperty("javax.persistence.jdbc.user", "test");
116 properties.setProperty("javax.persistence.jdbc.password", "password");
117 //properties.setProperty("ping_interval", "500000");
118 BackUpMonitor bum = BackUpMonitor.getInstance(BackUpMonitor.ResourceNode.BRMS.toString(), "brms_test" , properties, null);