@Test @LocalTachyonClusterResource.Config( tachyonConfParams = { Constants.SECURITY_AUTHENTICATION_TYPE, "CUSTOM", Constants.SECURITY_AUTHENTICATION_CUSTOM_PROVIDER, NameMatchAuthenticationProvider.FULL_CLASS_NAME }, startCluster = false) public void customAuthenticationDenyConnectTest() throws Exception { /** * Using tachyon as loginUser for unit testing, only tachyon user is allowed to connect to * Tachyon Master. */ System.setProperty(Constants.SECURITY_LOGIN_USERNAME, "tachyon"); mLocalTachyonClusterResource.start(); // Using no-tachyon as loginUser to connect to Master, the IOException will be thrown clearLoginUser(); mThrown.expect(ConnectionFailedException.class); System.setProperty(Constants.SECURITY_LOGIN_USERNAME, "no-tachyon"); FileSystemMasterClient masterClient = new FileSystemMasterClient( mLocalTachyonClusterResource.get().getMaster().getAddress(), mLocalTachyonClusterResource.get().getMasterTachyonConf()); try { Assert.assertFalse(masterClient.isConnected()); masterClient.connect(); } finally { masterClient.close(); } }
@Test @LocalTachyonClusterResource.Config( tachyonConfParams = { Constants.SECURITY_AUTHENTICATION_TYPE, "CUSTOM", Constants.SECURITY_AUTHENTICATION_CUSTOM_PROVIDER, NameMatchAuthenticationProvider.FULL_CLASS_NAME }, startCluster = false) public void customAuthenticationOpenCloseTest() throws Exception { /** * Using tachyon as loginUser for unit testing, only tachyon user is allowed to connect to * Tachyon Master. */ System.setProperty(Constants.SECURITY_LOGIN_USERNAME, "tachyon"); mLocalTachyonClusterResource.start(); authenticationOperationTest("/file-custom"); }