1 /*******************************************************************************
2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (c) 2019 AT&T Intellectual Property
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.
19 * ============LICENSE_END=============================================
20 * ====================================================================
21 *******************************************************************************/
23 package org.onap.music.eelf.healthcheck;
25 import static org.junit.Assert.assertEquals;
26 import static org.mockito.Mockito.doNothing;
27 import static org.mockito.Mockito.doReturn;
28 import org.junit.Before;
29 import org.junit.Test;
30 import org.mockito.Mockito;
31 import org.onap.music.datastore.MusicDataStore;
32 import org.onap.music.datastore.MusicDataStoreHandle;
33 import org.onap.music.exceptions.MusicQueryException;
34 import org.onap.music.exceptions.MusicServiceException;
35 import org.onap.music.main.MusicCore;
36 import org.onap.music.main.ResultType;
38 public class MusicHealthCheckTest {
40 MusicHealthCheck musicHealthCheck;
44 musicHealthCheck = new MusicHealthCheck();
48 public void testSetCassandrHost() {
49 musicHealthCheck.setCassandrHost("127.0.0.1");
50 assertEquals("127.0.0.1", musicHealthCheck.getCassandrHost());
54 public void testGetCassandraStatus() throws MusicServiceException, MusicQueryException {
55 MusicHealthCheck mHealthCheck = Mockito.spy(MusicHealthCheck.class);
56 doReturn(ResultType.SUCCESS).when(mHealthCheck).nonKeyRelatedPut(Mockito.any(), Mockito.anyString());
57 doNothing().when(mHealthCheck).executeEventualPut(Mockito.any());
58 assertEquals("ACTIVE", mHealthCheck.getCassandraStatus("consistency"));