Skip to content

Commit

Permalink
Remove method testValidateFunctionsConfigs which was abandoned (apach…
Browse files Browse the repository at this point in the history
  • Loading branch information
liketic authored and sijie committed Sep 11, 2019
1 parent 7ef1b31 commit a02dba3
Showing 1 changed file with 0 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.apache.bookkeeper.clients.StorageClientBuilder;
Expand Down Expand Up @@ -577,55 +576,6 @@ public void testStateGetterWithoutKey() throws Exception {
private static final String inputTopicName = TEST_NAME + "-input-topic";
private static final String outputTopicName = TEST_NAME + "-output-topic";

private void testValidateFunctionsConfigs(String[] correctArgs, String[] incorrectArgs,
String errMessageCheck) throws Exception {

String[] cmds = {"create", "update", "localrun"};

for (String type : cmds) {
List<String> correctArgList = new LinkedList<>();
List<String> incorrectArgList = new LinkedList<>();
correctArgList.add(type);
incorrectArgList.add(type);

correctArgList.addAll(Arrays.asList(correctArgs));
incorrectArgList.addAll(Arrays.asList(incorrectArgs));
cmd.run(correctArgList.toArray(new String[correctArgList.size()]));

if (type.equals("create")) {
CreateFunction creater = cmd.getCreater();
assertEquals(fnName, creater.getFunctionName());
assertEquals(inputTopicName, creater.getInputs());
assertEquals(outputTopicName, creater.getOutput());
} else if (type.equals("update")){
UpdateFunction updater = cmd.getUpdater();
assertEquals(fnName, updater.getFunctionName());
assertEquals(inputTopicName, updater.getInputs());
assertEquals(outputTopicName, updater.getOutput());
} else {
CmdFunctions.LocalRunner localRunner = cmd.getLocalRunner();
assertEquals(fnName, localRunner.getFunctionName());
assertEquals(inputTopicName, localRunner.getInputs());
assertEquals(outputTopicName, localRunner.getOutput());
}

if (type.equals("create")) {
verify(functions, times(1)).createFunction(any(FunctionConfig.class), anyString());
} else if (type.equals("update")) {
verify(functions, times(1)).updateFunction(any(FunctionConfig.class), anyString());
}

setup();
ConsoleOutputCapturer consoleOutputCapturer = new ConsoleOutputCapturer();
consoleOutputCapturer.start();
cmd.run(incorrectArgList.toArray(new String[incorrectArgList.size()]));

consoleOutputCapturer.stop();
String output = consoleOutputCapturer.getStderr();
assertTrue(output.replace("\n", "").contains(errMessageCheck));
}
}

@Test
public void testCreateFunctionWithCpu() throws Exception {
String fnName = TEST_NAME + "-function";
Expand Down

0 comments on commit a02dba3

Please sign in to comment.