[DCAEGEN2] Release dcaegen2-services-kpi-computation-ms container
[dcaegen2/services.git] / components / datalake-handler / des / src / test / java / org / onap / datalake / des / domain / DbTypeTest.java
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP : DataLake DES
4  * ================================================================================
5  * Copyright 2020 China Mobile. All rights reserved.
6  * Copyright (C) 2022 Wipro Limited.
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
22 package org.onap.datalake.des.domain;
23
24 import static org.junit.Assert.assertEquals;
25 import static org.junit.Assert.assertNotEquals;
26 import static org.junit.Assert.assertNotNull;
27 import static org.junit.Assert.assertNull;
28 import static org.junit.Assert.assertTrue;
29
30 import org.junit.Test;
31
32 /**
33  * Test Data Type.
34  *
35  * @author Kai Lu
36  */
37 public class DbTypeTest {
38
39     @Test
40     public void test() {
41         DbType dbType = new DbType("ES", "Elasticsearch");
42
43         dbType.setTool(false);
44
45         assertNotNull(dbType.toString());
46         assertEquals(dbType, dbType);
47         assertNotEquals(dbType, null);
48         assertNotEquals(dbType, "ES");
49
50         DbType dbType2 = new DbType();
51         dbType2.setId("MONGO");
52         dbType2.setName("MongoDB");
53         assertNotEquals(dbType, dbType2);
54         assertNotNull(dbType.hashCode());
55
56         assertEquals("MongoDB", dbType2.getName());
57         dbType2.setName(null);
58         dbType2.setDefaultPort(1);
59         assertTrue(1 == dbType2.getDefaultPort());
60
61         dbType2.setDbs(null);
62         assertNull(dbType2.getDbs());
63     }
64
65 }