@Test(expected=HttpException.class) public void testServer_auth_bad_password() { BasicCredentialsProvider credsProv = new BasicCredentialsProvider(); credsProv.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(USER, "WRONG")); HttpClient client = HttpClients.custom().setDefaultCredentialsProvider(credsProv).build(); try ( TypedInputStream in = HttpOp.execHttpGet(FusekiTestAuth.urlDataset(), "*/*", client, null) ) {} catch (HttpException ex) { throw assertAuthHttpException(ex); } } }
@Test(expected=HttpException.class) public void testServer_auth_bad_user() { BasicCredentialsProvider credsProvider = new BasicCredentialsProvider(); Credentials credentials = new UsernamePasswordCredentials("USERUSER", PASSWORD); credsProvider.setCredentials(AuthScope.ANY, credentials); HttpClient client = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build(); try ( TypedInputStream in = HttpOp.execHttpGet(FusekiTestAuth.urlDataset(), "*/*", client, null) ) {} catch (HttpException ex) { throw assertAuthHttpException(ex); } }
@Test(expected=HttpException.class) public void testServer_auth_no_auth() { // No Auth try ( TypedInputStream in = HttpOp.execHttpGet(FusekiTestAuth.urlDataset(), "*/*") ) {} catch (HttpException ex) { throw assertAuthHttpException(ex); } }