Upgrade to latest oparent
[dmaap/dbcapi.git] / src / test / java / org / onap / dmaap / dbcapi / aaf / database / DBFieldHandlerTest.java
1
2 /*-
3  * ============LICENSE_START=======================================================
4  * org.onap.dmaap
5  * ================================================================================
6  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  * 
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21 package org.onap.dmaap.dbcapi.aaf.database;
22
23 import org.onap.dmaap.dbcapi.model.*;
24 import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
25
26 import static org.junit.Assert.*;
27
28 import org.junit.After;
29 import org.junit.Before;
30 import org.junit.Test;
31 import java.util.*;
32 import java.sql.*;
33
34 public class DBFieldHandlerTest {
35
36         private static final String  fmt = "%24s: %s%n";
37
38         ReflectionHarness rh = new ReflectionHarness();
39
40    private static class TopicReplicationTypeHandler implements DBFieldHandler.SqlOp {
41         public Object get(ResultSet rs, int index) throws Exception {
42             int val = rs.getInt(index);
43
44             return (ReplicationType.valueOf(val));
45         }
46         public void set(PreparedStatement ps, int index, Object val) throws Exception {
47             if (val == null) {
48                 ps.setInt(index, 0);
49                 return;
50             }
51             @SuppressWarnings("unchecked")
52             ReplicationType rep = (ReplicationType) val;
53             ps.setInt(index, rep.getValue());
54         }
55     }
56
57
58
59         @Before
60         public void setUp() throws Exception {
61         }
62
63         @After
64         public void tearDown() throws Exception {
65         }
66
67
68         @Test
69         public void test1() {
70
71
72                 //rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" );      
73         
74         }
75
76         @Test
77         public void test2() {
78                 String v = "Validate";
79                 //rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "set", v );
80
81         }
82
83         @Test
84         public void test3() {
85
86                 try {
87                         DBFieldHandler fh = new DBFieldHandler( String.class, "aString", 1 );
88                 } catch (Exception e ) {
89                 }
90
91         }
92
93         @Test
94         public void test4() {
95
96                 try {
97                         DBFieldHandler fh = new DBFieldHandler( String.class, "aString", 1, null );
98                 } catch (Exception e ) {
99                 }
100
101         }
102
103
104
105 }
106