2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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.onap.dmaap.mr.tools;
23 import static org.junit.Assert.assertTrue;
25 import java.io.FileNotFoundException;
26 import java.io.PrintStream;
27 import java.util.Arrays;
29 import org.junit.After;
30 import org.junit.Before;
31 import org.junit.Test;
32 import org.junit.runner.RunWith;
33 import org.mockito.InjectMocks;
34 import org.mockito.Mock;
35 import org.mockito.MockitoAnnotations;
36 import org.powermock.api.mockito.PowerMockito;
37 import org.powermock.modules.junit4.PowerMockRunner;
39 import com.att.nsa.cmdtool.CommandNotReadyException;
41 @RunWith(PowerMockRunner.class)
42 public class ClusterCommandTest {
44 private ClusterCommand command;
46 private MRCommandContext context;
48 private PrintStream printStream;
51 public void setUp() throws Exception {
52 MockitoAnnotations.initMocks(this);
53 PowerMockito.when(context.getCluster()).thenReturn(Arrays.asList("localhost"));
57 public void tearDown() throws Exception {
62 public void testGetMatches() {
70 public void testCheckReady() {
73 command.checkReady(context);
74 } catch (CommandNotReadyException e) {
75 // TODO Auto-generated catch block
83 public void testExecute() throws FileNotFoundException, CommandNotReadyException {
84 String[] parts = { "create", "testtopic", "1", "1" };
85 command.execute(parts, context, printStream);
91 public void testExecute1() throws FileNotFoundException, CommandNotReadyException {
93 command.execute(parts, context, printStream);
99 public void testDisplayHelp() {
101 command.displayHelp(printStream);