use of org.apache.dolphinscheduler.dao.entity.UdfFunc in project dolphinscheduler by apache.
the class UdfFuncServiceTest method getUdfFunc.
/**
* get UdfFunc id
*/
private UdfFunc getUdfFunc() {
UdfFunc udfFunc = new UdfFunc();
udfFunc.setFuncName("UdfFuncServiceTest");
udfFunc.setClassName("org.apache.dolphinscheduler.api.service.UdfFuncServiceTest");
udfFunc.setResourceId(0);
udfFunc.setResourceName("UdfFuncServiceTest");
udfFunc.setCreateTime(new Date());
udfFunc.setDatabase("database");
udfFunc.setUpdateTime(new Date());
udfFunc.setType(UdfType.HIVE);
return udfFunc;
}
use of org.apache.dolphinscheduler.dao.entity.UdfFunc in project dolphinscheduler by apache.
the class UdfFuncServiceTest method testQueryUdfFuncList.
@Test
public void testQueryUdfFuncList() {
User user = getLoginUser();
user.setUserType(UserType.GENERAL_USER);
Mockito.when(udfFuncMapper.getUdfFuncByType(user.getId(), UdfType.HIVE.ordinal())).thenReturn(getList());
Map<String, Object> result = udfFuncService.queryUdfFuncList(user, UdfType.HIVE.ordinal());
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
List<UdfFunc> udfFuncList = (List<UdfFunc>) result.get(Constants.DATA_LIST);
Assert.assertTrue(CollectionUtils.isNotEmpty(udfFuncList));
}
use of org.apache.dolphinscheduler.dao.entity.UdfFunc in project dolphinscheduler by apache.
the class UDFUserMapperTest method testUpdate.
/**
* test update
*/
@Test
public void testUpdate() {
// insertOneUser
User user = insertOneUser();
// insertOneUdfFunc
UdfFunc udfFunc = insertOneUdfFunc();
// insertOne
UDFUser udfUser = insertOne(user, udfFunc);
udfUser.setUserId(2);
udfUser.setUdfId(2);
int update = udfUserMapper.updateById(udfUser);
Assert.assertEquals(update, 1);
}
use of org.apache.dolphinscheduler.dao.entity.UdfFunc in project dolphinscheduler by apache.
the class UDFUserMapperTest method insertOneUdfFunc.
/**
* insert one udf
* @return UdfFunc
*/
private UdfFunc insertOneUdfFunc() {
UdfFunc udfFunc = new UdfFunc();
udfFunc.setFuncName("dolphin_udf_func");
udfFunc.setClassName("org.apache.dolphinscheduler.test.mr");
udfFunc.setType(UdfType.HIVE);
udfFunc.setResourceId(1);
udfFunc.setResourceName("dolphin_resource");
udfFunc.setCreateTime(new Date());
udfFunc.setUpdateTime(new Date());
udfFuncMapper.insert(udfFunc);
return udfFunc;
}
use of org.apache.dolphinscheduler.dao.entity.UdfFunc in project dolphinscheduler by apache.
the class UDFUserMapperTest method testDelete.
/**
* test delete
*/
@Test
public void testDelete() {
// insertOneUser
User user = insertOneUser();
// insertOneUdfFunc
UdfFunc udfFunc = insertOneUdfFunc();
// insertOne
UDFUser udfUser = insertOne(user, udfFunc);
int delete = udfUserMapper.deleteById(udfUser.getId());
Assert.assertEquals(delete, 1);
}
Aggregations