blob: c958a2fe6af177f2883fe9bf7157136023c1acfc [file] [log] [blame]
Aharoni, Pavel (pa0916)ca3cb012018-10-22 15:29:57 +03001/*-
2 * ============LICENSE_START=======================================================
3 * OSAM
4 * ================================================================================
5 * Copyright (C) 2018 AT&T
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
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
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=========================================================
19 */
20
21
22
23package org.onap.osam.dao;
24
25import java.sql.Connection;
26import java.sql.PreparedStatement;
27import java.sql.ResultSet;
28
29import org.junit.Assert;
30import org.junit.Test;
31
32public class FnAppDoaImplTest {
33
34 private FnAppDoaImpl createTestSubject() {
35 return new FnAppDoaImpl();
36 }
37
38 @Test
39 public void testGetConnection() throws Exception {
40 String driver2 = "";
41 String url = "";
42 String username = "";
43 String password = "";
44 Connection result;
45
46 // test 1
47 url = null;
48 username = null;
49 password = null;
50 result = FnAppDoaImpl.getConnection(driver2, url, username);
51 Assert.assertEquals(null, result);
52
53 // test 2
54 url = "";
55 username = null;
56 password = null;
57 result = FnAppDoaImpl.getConnection(driver2, url, username);
58 Assert.assertEquals(null, result);
59
60 // test 3
61 username = null;
62 url = null;
63 password = null;
64 result = FnAppDoaImpl.getConnection(driver2, url, username);
65 Assert.assertEquals(null, result);
66
67 // test 4
68 username = "";
69 url = null;
70 password = null;
71 result = FnAppDoaImpl.getConnection(driver2, url, username);
72 Assert.assertEquals(null, result);
73
74 // test 5
75 password = null;
76 url = null;
77 username = null;
78 result = FnAppDoaImpl.getConnection(driver2, url, username);
79 Assert.assertEquals(null, result);
80
81 // test 6
82 password = "";
83 url = null;
84 username = null;
85 result = FnAppDoaImpl.getConnection(driver2, url, username);
86 Assert.assertEquals(null, result);
87 }
88
89 @Test
90 public void testCleanup() throws Exception {
91 ResultSet rs = null;
92 PreparedStatement st = null;
93
94 // test 1
95 rs = null;
96 FnAppDoaImpl.cleanup(rs, st, null);
97
98 // test 2
99 st = null;
100 FnAppDoaImpl.cleanup(rs, st, null);
101
102 // test 3
103 FnAppDoaImpl.cleanup(rs, st, null);
104 }
105
106 @Test
107 public void testGetProfileCount() throws Exception {
108 FnAppDoaImpl testSubject;
109 String driver = "";
110 String URL = "";
111 String username = "";
112 String password = "";
113 int result;
114
115 // default test
116 testSubject = createTestSubject();
117 result = testSubject.getProfileCount(driver, URL, username, password);
118 }
119}