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.core.classloader.annotations.PowerMockIgnore;
38 import org.powermock.modules.junit4.PowerMockRunner;
40 import com.att.nsa.cmdtool.CommandNotReadyException;
42 @RunWith(PowerMockRunner.class)
43 @PowerMockIgnore("jdk.internal.reflect.*")
44 public class ClusterCommandTest {
46 private ClusterCommand command;
48 private MRCommandContext context;
50 private PrintStream printStream;
53 public void setUp() throws Exception {
54 MockitoAnnotations.initMocks(this);
55 PowerMockito.when(context.getCluster()).thenReturn(Arrays.asList("localhost"));
59 public void tearDown() throws Exception {
64 public void testGetMatches() {
72 public void testCheckReady() {
75 command.checkReady(context);
76 } catch (CommandNotReadyException e) {
77 // TODO Auto-generated catch block
85 public void testExecute() throws FileNotFoundException, CommandNotReadyException {
86 String[] parts = { "create", "testtopic", "1", "1" };
87 command.execute(parts, context, printStream);
93 public void testExecute1() throws FileNotFoundException, CommandNotReadyException {
95 command.execute(parts, context, printStream);
101 public void testDisplayHelp() {
103 command.displayHelp(printStream);