2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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.sdc.be.dao.es;
23 import org.elasticsearch.client.Client;
24 import org.junit.Test;
25 import org.openecomp.sdc.be.utils.DAOConfDependentTest;
27 public class ElasticSearchClientTest extends DAOConfDependentTest{
29 private ElasticSearchClient createTestSubject() {
30 return new ElasticSearchClient();
34 public void testInitialize() throws Exception {
35 ElasticSearchClient testSubject;
38 testSubject = createTestSubject();
39 testSubject.setTransportClient("true");
40 testSubject.setLocal("true");
41 testSubject.initialize();
42 testSubject.setTransportClient("false");
43 testSubject.setClusterName("false");
44 testSubject.initialize();
48 public void testClose() throws Exception {
49 ElasticSearchClient testSubject;
52 testSubject = createTestSubject();
58 public void testGetClient() throws Exception {
59 ElasticSearchClient testSubject;
63 testSubject = createTestSubject();
64 result = testSubject.getClient();
69 public void testGetServerHost() throws Exception {
70 ElasticSearchClient testSubject;
74 testSubject = createTestSubject();
75 result = testSubject.getServerHost();
80 public void testGetServerPort() throws Exception {
81 ElasticSearchClient testSubject;
85 testSubject = createTestSubject();
86 result = testSubject.getServerPort();
91 public void testSetClusterName() throws Exception {
92 ElasticSearchClient testSubject;
93 String clusterName = "";
96 testSubject = createTestSubject();
97 testSubject.setClusterName(clusterName);
102 public void testSetLocal() throws Exception {
103 ElasticSearchClient testSubject;
104 String strIsLocal = "";
107 testSubject = createTestSubject();
109 testSubject.setLocal(strIsLocal);
112 testSubject = createTestSubject();
114 testSubject.setLocal(strIsLocal);
117 testSubject.setLocal(strIsLocal);
122 public void testIsTransportClient() throws Exception {
123 ElasticSearchClient testSubject;
127 testSubject = createTestSubject();
128 result = testSubject.isTransportClient();
133 public void testSetTransportClient() throws Exception {
134 ElasticSearchClient testSubject;
135 String strIsTransportclient = "";
138 testSubject = createTestSubject();
139 strIsTransportclient = null;
140 testSubject.setTransportClient(strIsTransportclient);
143 testSubject = createTestSubject();
144 strIsTransportclient = "true";
145 testSubject.setTransportClient(strIsTransportclient);