Search in sources :

Example 6 with ExecutionContext

use of org.apache.hive.ptest.execution.context.ExecutionContext in project hive by apache.

the class TestTestConfiguration method testGettersSetters.

@Test
public void testGettersSetters() throws Exception {
    Context ctx = Context.fromInputStream(Resources.getResource("test-configuration.properties").openStream());
    ExecutionContextConfiguration execConf = ExecutionContextConfiguration.withContext(ctx);
    TestConfiguration conf = TestConfiguration.withContext(ctx, LOG);
    Set<Host> expectedHosts = Sets.newHashSet(new Host("localhost", "hiveptest", new String[] { "/home/hiveptest" }, 2));
    ExecutionContext executionContext = execConf.getExecutionContextProvider().createExecutionContext();
    Assert.assertEquals(expectedHosts, executionContext.getHosts());
    Assert.assertEquals("/tmp/hive-ptest-units/working/dir", execConf.getWorkingDirectory());
    Assert.assertEquals("/etc/hiveptest/conf", execConf.getProfileDirectory());
    Assert.assertEquals("/tmp/hive-ptest-units/working/dir/logs", execConf.getGlobalLogDirectory());
    Assert.assertEquals("/home/brock/.ssh/id_rsa", executionContext.getPrivateKey());
    Assert.assertEquals("git://github.com/apache/hive.git", conf.getRepository());
    Assert.assertEquals("apache-github", conf.getRepositoryName());
    Assert.assertEquals("trunk", conf.getBranch());
    Assert.assertEquals("/tmp/hive-ptest-units/working/dir/working", executionContext.getLocalWorkingDirectory());
    Assert.assertEquals("-Dtest.continue.on.failure=true -Dtest.silent=false", conf.getAntArgs());
    Assert.assertEquals("hadoop-1,hadoop-2", conf.getAdditionalProfiles());
    Assert.assertNotNull(conf.toString());
    Assert.assertEquals("", conf.getPatch());
    conf.setPatch("Patch");
    Assert.assertEquals("Patch", conf.getPatch());
    conf.setRepository("Repository");
    Assert.assertEquals("Repository", conf.getRepository());
    conf.setRepositoryName("RepositoryName");
    Assert.assertEquals("RepositoryName", conf.getRepositoryName());
    conf.setBranch("Branch");
    Assert.assertEquals("Branch", conf.getBranch());
    conf.setAntArgs("AntArgs");
    Assert.assertEquals("AntArgs", conf.getAntArgs());
}
Also used : ExecutionContext(org.apache.hive.ptest.execution.context.ExecutionContext) ExecutionContext(org.apache.hive.ptest.execution.context.ExecutionContext) Test(org.junit.Test) PTest(org.apache.hive.ptest.execution.PTest)

Aggregations

ExecutionContext (org.apache.hive.ptest.execution.context.ExecutionContext)6 File (java.io.File)3 PTest (org.apache.hive.ptest.execution.PTest)3 ExecutionContextConfiguration (org.apache.hive.ptest.execution.conf.ExecutionContextConfiguration)2 Host (org.apache.hive.ptest.execution.conf.Host)2 TestConfiguration (org.apache.hive.ptest.execution.conf.TestConfiguration)2 ExecutionContextProvider (org.apache.hive.ptest.execution.context.ExecutionContextProvider)2 RSyncCommandExecutor (org.apache.hive.ptest.execution.ssh.RSyncCommandExecutor)2 SSHCommandExecutor (org.apache.hive.ptest.execution.ssh.SSHCommandExecutor)2 Test (org.junit.Test)2 FileOutputStream (java.io.FileOutputStream)1 OutputStream (java.io.OutputStream)1 HashSet (java.util.HashSet)1 CommandLine (org.apache.commons.cli.CommandLine)1 CommandLineParser (org.apache.commons.cli.CommandLineParser)1 GnuParser (org.apache.commons.cli.GnuParser)1 Options (org.apache.commons.cli.Options)1 TestStartRequest (org.apache.hive.ptest.api.request.TestStartRequest)1 TestLogger (org.apache.hive.ptest.api.server.TestLogger)1 LocalCommandFactory (org.apache.hive.ptest.execution.LocalCommandFactory)1