use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.
the class TestFunctions method testAlterFunctionAlreadyExists.
@Test(expected = MetaException.class)
public void testAlterFunctionAlreadyExists() throws Exception {
Function originalFunction = testFunctions[0];
Function newFunction = testFunctions[1];
client.alterFunction(originalFunction.getDbName(), originalFunction.getFunctionName(), newFunction);
}
use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.
the class TestFunctions method testCreateFunctionNullFunctionName.
@Test
public void testCreateFunctionNullFunctionName() throws Exception {
Function function = testFunctions[0];
function.setFunctionName(null);
try {
client.createFunction(function);
// TODO: Should have a check on the server side. Embedded metastore throws
// NullPointerException, remote throws TTransportException
Assert.fail("Expected an NullPointerException or TTransportException to be thrown");
} catch (NullPointerException exception) {
// Expected exception - Embedded MetaStore
} catch (TTransportException exception) {
// Expected exception - Remote MetaStore
}
}
use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.
the class TestFunctions method testCreateFunctionEmptyName.
@Test(expected = InvalidObjectException.class)
public void testCreateFunctionEmptyName() throws Exception {
Function function = testFunctions[0];
function.setFunctionName("");
client.createFunction(function);
}
use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.
the class TestFunctions method testAlterFunctionNoSuchDatabase.
@Test(expected = MetaException.class)
public void testAlterFunctionNoSuchDatabase() throws Exception {
// Choosing the 2nd function, since the 1st one is duplicated in the dummy database
Function originalFunction = testFunctions[1];
Function newFunction = getNewFunction();
client.alterFunction("no_such_database", originalFunction.getFunctionName(), newFunction);
}
use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.
the class TestFunctions method testAlterFunctionInvalidNameInNew.
@Test
public void testAlterFunctionInvalidNameInNew() throws Exception {
Function newFunction = getNewFunction();
newFunction.setFunctionName("test_function_2;");
try {
client.alterFunction(DEFAULT_DATABASE, "test_function_to_find_2", newFunction);
// TODO: Should have a check on the server side. Embedded metastore throws
// InvalidObjectException, remote throws TApplicationException
Assert.fail("Expected an InvalidObjectException or TApplicationException to be thrown");
} catch (InvalidObjectException exception) {
// Expected exception - Embedded MetaStore
} catch (TApplicationException exception) {
// Expected exception - Remote MetaStore
}
}
Aggregations