Java Code Examples for com.klarna.hiverunner.builder.HiveShellBuilder#setHiveServerContainer()

The following examples show how to use com.klarna.hiverunner.builder.HiveShellBuilder#setHiveServerContainer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HiveRunnerCore.java    From HiveRunner with Apache License 2.0 5 votes vote down vote up
private HiveShellContainer buildShell(List<? extends Script> scripts, Object testCase, HiveRunnerConfig config,
    HiveServerContext context) throws IOException {
  HiveServerContainer hiveTestHarness = new HiveServerContainer(context);

  HiveShellBuilder hiveShellBuilder = new HiveShellBuilder();
  hiveShellBuilder.setCommandShellEmulation(config.getCommandShellEmulator());

  HiveShellField shellSetter = loadScriptUnderTest(testCase, hiveShellBuilder);
  if (scripts != null) {
    hiveShellBuilder.overrideScriptsUnderTest(scripts);
  }

  hiveShellBuilder.setHiveServerContainer(hiveTestHarness);

  loadAnnotatedResources(testCase, hiveShellBuilder);

  loadAnnotatedProperties(testCase, hiveShellBuilder);

  loadAnnotatedSetupScripts(testCase, hiveShellBuilder);

  // Build shell
  HiveShellContainer shell = hiveShellBuilder.buildShell();

  // Set shell
  shellSetter.setShell(shell);

  if (shellSetter.isAutoStart()) {
    shell.start();
  }
  return shell;
}
 
Example 2
Source File: FlinkStandaloneHiveRunner.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Traverses the test class annotations. Will inject a HiveShell in the test case that envelopes the HiveServer.
 */
private HiveShellContainer createHiveServerContainer(final Class testClass, HiveServerContext context)
		throws Exception {

	final HiveServerContainer hiveServerContainer = new HiveServerContainer(context);

	HiveShellBuilder hiveShellBuilder = new HiveShellBuilder();
	HiveRunnerShim hiveRunnerShim = HiveRunnerShimLoader.load();
	hiveRunnerShim.setCommandShellEmulation(hiveShellBuilder, config);

	HiveShellField shellSetter = loadScriptsUnderTest(testClass, hiveShellBuilder);

	hiveShellBuilder.setHiveServerContainer(hiveServerContainer);

	loadAnnotatedResources(testClass, hiveShellBuilder);

	loadAnnotatedProperties(testClass, hiveShellBuilder);

	loadAnnotatedSetupScripts(testClass, hiveShellBuilder);

	// Build shell
	final HiveShellContainer shell = hiveShellBuilder.buildShell();

	// Set shell
	shellSetter.setShell(shell);

	if (shellSetter.isAutoStart()) {
		shell.start();
	}

	return shell;
}
 
Example 3
Source File: FlinkStandaloneHiveRunner.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Traverses the test class annotations. Will inject a HiveShell in the test case that envelopes the HiveServer.
 */
private HiveShellContainer createHiveServerContainer(final Class testClass, HiveServerContext context)
		throws Exception {

	final HiveServerContainer hiveServerContainer = new HiveServerContainer(context);

	HiveShellBuilder hiveShellBuilder = new HiveShellBuilder();
	HiveRunnerShim hiveRunnerShim = HiveRunnerShimLoader.load();
	hiveRunnerShim.setCommandShellEmulation(hiveShellBuilder, config);

	HiveShellField shellSetter = loadScriptsUnderTest(testClass, hiveShellBuilder);

	hiveShellBuilder.setHiveServerContainer(hiveServerContainer);

	loadAnnotatedResources(testClass, hiveShellBuilder);

	loadAnnotatedProperties(testClass, hiveShellBuilder);

	loadAnnotatedSetupScripts(testClass, hiveShellBuilder);

	// Build shell
	final HiveShellContainer shell = hiveShellBuilder.buildShell();

	// Set shell
	shellSetter.setShell(shell);

	if (shellSetter.isAutoStart()) {
		shell.start();
	}

	return shell;
}