public void testValidateUser() throws Exception { TaskRepository repository = BugzillaFixture.current().repository(); TaskRepositoryLocation location = new TaskRepositoryLocation(repository); client = new BugzillaClient(location, repository, BugzillaFixture.current().connector()); client.validate(new NullProgressMonitor()); }
public void testValidateAnonymous() throws Exception { TaskRepository repository = BugzillaFixture.current().repository(); AuthenticationCredentials anonymousCreds = new AuthenticationCredentials("", ""); repository.setCredentials(AuthenticationType.REPOSITORY, anonymousCreds, false); TaskRepositoryLocation location = new TaskRepositoryLocation(repository); client = new BugzillaClient(location, repository, BugzillaFixture.current().connector()); client.validate(new NullProgressMonitor()); }
public void testValidateInvalidProxy() throws Exception { TaskRepository repository = BugzillaFixture.current().repository(); AbstractWebLocation location = BugzillaFixture.current() .location( PrivilegeLevel.USER, new Proxy(Proxy.Type.HTTP, new InetSocketAddress("localhost", 12356))); client = new BugzillaClient(location, repository, BugzillaFixture.current().connector()); try { client.validate(new NullProgressMonitor()); fail("invalid proxy did not cause connection error"); } catch (Exception e) { // ignore } }
public void testValidateUserPlusHTTP() throws Exception { TaskRepository repository = BugzillaFixture.current().repository(); repository.setCredentials( AuthenticationType.HTTP, new AuthenticationCredentials("YYYYYYYY", "XXXXXXXX"), false); TaskRepositoryLocation location = new TaskRepositoryLocation(repository); client = new BugzillaClient(location, repository, BugzillaFixture.current().connector()); try { client.validate(new NullProgressMonitor()); } catch (Exception e) { assertEquals( "Unable to login to " + repository.getUrl() + ".\n\n\n The username or password you entered is not valid.\n\n" + "Please validate credentials via Task Repositories view.", e.getMessage()); } }
public void testValidateAnonymousPlusHTTP() throws Exception { TaskRepository repository = BugzillaFixture.current().repository(); AuthenticationCredentials anonymousCreds = new AuthenticationCredentials("", ""); repository.setCredentials(AuthenticationType.REPOSITORY, anonymousCreds, false); repository.setCredentials( AuthenticationType.HTTP, new AuthenticationCredentials("YYYYYYYY", "XXXXXXXX"), false); TaskRepositoryLocation location = new TaskRepositoryLocation(repository); client = new BugzillaClient(location, repository, BugzillaFixture.current().connector()); try { client.validate(new NullProgressMonitor()); } catch (CoreException e) { assertEquals( "Expected login error, got: " + e.getMessage(), RepositoryStatus.ERROR_REPOSITORY_LOGIN, e.getStatus().getCode()); } }