use of com.thinkbiganalytics.UsernameCaseStrategyUtil in project kylo by Teradata.
the class RefreshableDataSourceTest method init.
@Before
public void init() {
env = Mockito.mock(Environment.class);
securityContext = Mockito.mock(SecurityContext.class);
authentication = Mockito.mock(Authentication.class);
contextHolder = Mockito.mock(SecurityContextHolder.class);
kerberosTicketConfiguration = Mockito.mock(KerberosTicketConfiguration.class);
kerberosUtil = Mockito.mock(KerberosUtil.class);
usernameCaseStrategyUtil = new UsernameCaseStrategyUtil();
usernameCaseStrategyUtil.setEnvironment(env);
Mockito.when(env.getProperty("hive.userImpersonation.enabled")).thenReturn("true");
Mockito.when(env.getProperty("hive.datasource.driverClassName")).thenReturn("org.apache.hive.jdbc.HiveDriver");
Mockito.when(env.getProperty("hive.datasource.url")).thenReturn("jdbc:hive2://localhost:10000/default");
Mockito.when(env.getProperty("hive.datasource.username")).thenReturn(principal + "");
Mockito.when(env.getProperty("hive.datasource.password")).thenReturn("password1234");
Mockito.when(securityContext.getAuthentication()).thenReturn(authentication);
SecurityContextHolder.setContext(securityContext);
Mockito.when(authentication.getName()).thenReturn(principal);
Mockito.when(kerberosTicketConfiguration.isKerberosEnabled()).thenReturn(false);
hiveDs = new RefreshableDataSource(kerberosTicketConfiguration, usernameCaseStrategyUtil, env, "hive.datasource");
}
Aggregations