com.klarna.hiverunner.HiveServerContainer Java Examples

The following examples show how to use com.klarna.hiverunner.HiveServerContainer. 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: HiveShellBase.java    From HiveRunner with Apache License 2.0 5 votes vote down vote up
HiveShellBase(HiveServerContainer hiveServerContainer, Map<String, String> hiveConf, List<String> setupScripts,
        List<HiveResource> resources, List<Script> scriptsUnderTest, CommandShellEmulator commandShellEmulator) {
    this.hiveServerContainer = hiveServerContainer;
    this.hiveConf = hiveConf;
    this.commandShellEmulator = commandShellEmulator;
    this.setupScripts = new ArrayList<>(setupScripts);
    this.resources = new ArrayList<>(resources);
    this.scriptsUnderTest = new ArrayList<>(scriptsUnderTest);
    hiveVars = new HashMap<>();
    cwd = Paths.get(System.getProperty("user.dir"));
}
 
Example #2
Source File: HiveShellBaseTest.java    From HiveRunner with Apache License 2.0 5 votes vote down vote up
private HiveShell createHiveShell(CommandShellEmulator emulation, String... keyValues) {
    Map<String, String> hiveConf = MapUtils.putAll(new HashMap(), keyValues);
    HiveConf conf = createHiveconf(hiveConf);

    CLIService client = Mockito.mock(CLIService.class);

    container = Mockito.mock(HiveServerContainer.class);

    List<String> setupScripts = Arrays.asList();
    List<HiveResource> hiveResources = Arrays.asList();
    List<Script> scriptsUnderTest = Arrays.asList();

    return new HiveShellBase(container, hiveConf, setupScripts, hiveResources, scriptsUnderTest, emulation);
}
 
Example #3
Source File: HiveShellBuilder.java    From HiveRunner with Apache License 2.0 4 votes vote down vote up
public void setHiveServerContainer(HiveServerContainer hiveServerContainer) {
    this.hiveServerContainer = hiveServerContainer;
}
 
Example #4
Source File: HiveShellTearable.java    From HiveRunner with Apache License 2.0 4 votes vote down vote up
HiveShellTearable(HiveServerContainer hiveServerContainer, Map<String, String> hiveConf,
                  List<String> setupScripts, List<HiveResource> resources,
                  List<Script> scriptsUnderTest, CommandShellEmulator commandShellEmulator) {
    super(hiveServerContainer, hiveConf, setupScripts, resources, scriptsUnderTest, commandShellEmulator);
}
 
Example #5
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 #6
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;
}