summaryrefslogtreecommitdiffstats
path: root/src/test/java
Commit message (Collapse)AuthorAgeFilesLines
* Zips of recreated hello-world.git and all external repositories for testing.chirontt2019-06-076-46/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This hello-world.git repo is created using the native Git for Windows software. Various test classes in the GitBlitSuite test suite require the presence of the hello-world.git repo in github.com/git/ which has been missing, hence causing many test failures in the suite. This recreation of the hello-world.git repo aims to conform to the many test cases' requirements in the suite, and to be checked in as part of the gitblit repo, thus eliminates the requirement of a remote hello-world.git repo during the test run. The repo is now stored is a zip ball in the new src/test/data folder. The hello-world repo's various commit IDs were hard-coded in various test classes. These commit IDs, which must now have new values in the recreated repo, are now extracted out to the src/test/data/hello-world.properties file. The gitblit's build.xml is modified to generate the HelloworldKeys.java file containing the hello-world.properties file's key strings, in similar fashion as the existing generation of the com.gitblit.Keys.java file. And these key strings in HelloworldKeys.java are now used in the various test classes, thus eliminating the hard-coding of the hello-world repo's commit IDs in the test code. During the test run by GitBlitSuite test suite, some repos from GitHub were cloned and became part of the test data. These repos are now zipped to be part of gitblit repo itself, thus eliminating the network fetch at the start of test run which can be slow, especially with the JGit repo cloning which is huge and time consuming. The cloned JGit repo is now zipped and checked in to gitblit, along with the other 4 repos (hello-world, ambition, gitective and ticgit). They will be unzipped during the test suite run and be available in the local file system, thus avoiding the need for some network fetch. Special note on the zipped JGit repo: this repo is big (and growing all the time on GitHub), and takes up about 32MB of disk space after cloning from GitHub. I've made it smaller by resetting HEAD back to a commit of 5 years ago (with git reset --hard <commitId> command), to put it back to roughly where/when the tests were written for it (which is not quite, because there are tons of commit history since which can't be removed.) The local JGit repo is then garbage-collected (with git gc --prune --aggressive) to reduce its size to about 19MB. Zipped it is still 17MB. This is a lot of MBs for a few tests. So the JGit repo is not included in this commit. Fixes #1275
* Fix for various test failures.chirontt2019-06-079-90/+112
| | | | | | | | | | | | Most of failures were due to temporary test repos, users and/or teams being left behind after the test run, and these left-over stuff in $baseFolder/data/git caused assertion errors in many tests in subsequent test runs. This fix tries to delete those left-over stuff at the end of each test, mainly in their @Afterclass code blocks. PushLogTest.java is deleted as it doesn't work, and has been superseded with better tests in various protocol test suites (GitServletTest, GitDaemonTest, SshDaemonTest, etc.)
* Reindex tickets on server start if no index existsFlorian Zschocke2017-03-054-4/+4
| | | | | | | | | | | | | | Check if tickets need to be reindexed when the server starts. This is the case if no ticket index exists. In that case the ticket index is built. This is done during the start of the `ITicketService`. For this the interface of `ITicketService` needed to change. The `start` method was defined abstract and the specific ticket services had to implement it. None does any real starting stuff in it. The `start` method is now final. It calls a new abstract method `onStart` which the specific ticket services need to implement. In the existing implementations I just changed `start` to `onStart`.
* Use versioned index directories for repository indices.Florian Zschocke2017-03-051-0/+267
| | | | | | | | | | | | | Change from the index version of a repository index being stored in a config file to also using index directories with the version in the name. For that, `LuceneRepoIndexStore` is added, which adds the fixed `lucene` part to the path. It also gives out the location of the `lucene.conf` file, which is now stored in the index directory. This way it is automatically deleted when the directory is deleted. I believe that it should also provide means to store branch aliases and tips, i.e. hide the config file completely. But this isn't implemented with this commit, the `LuceneService` is still aware that a config file is used.
* Introduce an index version for the ticket indexFlorian Zschocke2017-03-051-0/+245
| | | | | | | | | | | | | | | | | In order to be able to update the index definition, the ticket index is assigned a version number, 2. This way the definiton can be updated and compatability with existing index files can be checked. The actual index is stored in a directory of name `indexVersion_codecVersion`. This wayit is veriy easy to check if an index of a certain version exists on the filesystem. It allows to have multiple indexes of different versions present, so that a downgrade of the software is possible without having to reindex again. Of coure, this is only possible if no new tickets were created since these would be missing in the old index. A new class `LuceneIndexStore` is introduced, which abstracts away the versioned index directory. The idea is, that this provides one place to keep the Lucene codec version and to allow to code compatibility rules into this class, so that older indices can still be used if they are compatible.
* Merge pull request #1160 from fzs/sshLdapAuthenticatorFlorian Zschocke2016-12-185-339/+1427
|\ | | | | LDAP SSH key manager
| * Fix SshKeysDispatcher test failing on WindowsFlorian Zschocke2016-12-061-7/+7
| | | | | | | | | | | | | | | | | | The `SshKeysDispatcher` tests that use the keys list command are failing on Windows because they assume a Unix line ending after each key. But the command will use a system line ending. So this fix uses system line endings in the reference string for the assert, too. In addition, two `assertTrue(false)´ are replaced with a proper `fail`.
| * Use dynamic port selection for LDAP listeners in LDAP tests.Florian Zschocke2016-12-061-10/+11
| | | | | | | | | | | | | | Instead of using fixed ports for the listeners of the in-memory LDAP server, let the listeners select ports and then save them in the authentication mode instance. This way we prevent port collisions, which especially showed up under Windows.
| * Retrieve public SSH keys from LDAP.Florian Zschocke2016-11-292-0/+755
| | | | | | | | | | | | | | | | | | | | | | | | Add new class `LdapPublicKeyManager` which retrieves public SSH keys from LDAP. The attribute can be configured with the new configuration option `realm.ldap.sshPublicKey`. The setting can be a simple attribute name, like `sshPublicKey`, or an attribute name and a prefix for the value, like `altSecurityIdentities:SshKey`, in which case attributes are selected that have the name `altSecurityIdentities` and whose values start with `SshKey:`.
| * Extract LdapConnection into new class from LdapAuthProviderFlorian Zschocke2016-11-231-0/+248
| | | | | | | | | | | | | | | | Extract the inner class `LdapConnection` from the `LdapAuthProvider` into a separate class, so that it can be used from multiple classes that have to connect to an LDAP directory. The new class is placed into the new package `com.gitblit.ldap`, since it isn't specific to authentication.
| * Create base unit test class for LDAP tests.Florian Zschocke2016-11-232-332/+416
| | | | | | | | | | | | Extract the creation of the in-memory servers and the interceptor code to a base class that LDAP related unit tests can extend to have the servers available.
* | Merge branch 'rcaa-master' into master.Florian Zschocke2016-12-131-0/+33
|\ \
| * | Introduce SecureRandom wrapper for properly seeded static instancesFlorian Zschocke2016-12-121-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce our own wrapper `SecureRandom` around `java.security.SecureRandom`. This a) makes sure that the PRNG is seeded on creation and not when random bytes are retrieved, and b) uses a static instance in the `UserModel` so that lags do not occur during operation due to potentially seeding getting blocked on Unix when reading from the system's entropy pool. To keep the random data still secure, the static instance will reseed all 24 hours, also a functionality of the wrapper class. This fixes #1063 and extends and closes PR #1116
* | | Merge branch 'fixMentionsInTickets-985'Florian Zschocke2016-12-121-1/+73
|\ \ \ | |_|/ |/| |
| * | Fix user mention regular expression and group replacement.merged--fixMentionsInTickets-985Florian Zschocke2016-12-101-1/+73
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The regular expression used for user mentions used to work only inside sentences. Also, since it tested for whitespace, the whitespace would get replaced, too, which would join lines together. Instead the new regex uses boundary matchers to match against word boundaires. As these are not capturing only the actual user mention can be captured and is then replaced. Also, this way the regex can ignore punctuation like in "@jim, look at this." Since Gibtlit now requires Java 7 we can use named capture groups. This makes the use of a centrally defined regular expression much safer. The (admittedly only) group to capture the user name is named "user" and can be referenced by this name. By using the name instead of a group number, the regex could be changed without the code using it breaking because the group number changed. A simple test is added for user mentions, which unfortunately has to deal with the full markdown replacement, too. Fixes #985
* | Set "can admin" permission on LDAP users and teams correctlymerged--fixAdminRoleLDAPFlorian Zschocke2016-11-181-4/+261
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The canAdmin permission is set on a LDAP user, when the user is listed in `realm.ldap.admins` or is a member of a team listed in `realm.ldap.admins`. This leads to inconsistent and surprising behaviour on the EditUser page when clicking the "can admin" checkbox. Also, the "can admin" checkbox is disabled, but not checked, for teams that are listed as admin teams. The new behaviour implemented in this patch makes users and teams from LDAP match local ones. That means: * LDAP teams that are listed in `realm.ldap.admins` get the canAdmin property set if teams are maintained in LDAP. * LDAP users that are listed in `realm.ldap.admins` get the canAdmin property set if teams are maintained in LDAP. * LDAP users do not get the canAdmin property set, if they are only a member of a team listed in `realm.ldap.admins`. * The `supportsRoleChanges` method for users and teams of the `LdapAuthProvider` unconditially returns false if teams are maintained in LDAP, not only for users and teams listed in `realm.ldap.admins`. * Therefore, for all LDAP users and teams the "can admin" checkbox is always disabled if teams are maintained in LDAP.
* | Extend LDAP tests to use LDAP servers with access restrictions.Florian Zschocke2016-11-091-45/+257
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add access restrictions to the LDAP test server instances. New modes used a test parameters are ANONYMOUS, DS_MANAGER and USR_MANAGER. ANONYMOUS can bind anonymously and access users and groups. In DS_MANAGER the server requires authentication and will only allow the DIRECTORY_MANAGER user to search for users and groups. In USR_MANAGER only the user can search groups, the USER_MANAGER, which is used to bind in this mode, can not. A third server instance is created because I did fear side effects should the tests be run in parallel, had I tried to configure the access restriction in Before.
* | Extend LDAP authentication tests to use different modes.Florian Zschocke2016-11-061-23/+107
|/ | | | | | | Instantiate two LDAP servers, one that allows anonymous access, and one that requires authentication for all operations. The JUnit test is parameterized to run all tests with both instances. It uses different settings for each mode.
* TicketReference Testing #1048Paul Martin2016-06-181-4/+36
| | | | + Multiple commits in a single push
* Ticket Reference handling #1048Paul Martin2016-04-272-1/+940
| | | | | | | | | | | | | | | + Supports referencing: + Tickets from other tickets via comments + Tickets from commits on any branch + Common TicketLink class used for both commits and tickets + TicketLink is temporary and persisted to ticket as a Reference + Support deletion of ticket references + Rebasing patchsets/branches will generate new references + Deleting old patchsets/branches will remove the relevant references + Substantial testing of use cases + With and without patchsets, deleting, amending + BranchTicketService used during testing to allow end-to-end ref testing + Relocated common git helper functions to JGitUtils
* Fix for #976 - Filestore links via browserPaul Martin2015-12-251-3/+3
| | | | | | | | | | | | | + GitLFS client support + FilestoreModel now parses meta file + Read meta heading from cache if available + Authentication based on accept headers for browser view filestore login + PathModel & PathChangeModel now understands filestore items + Zip & Rar downloads contain include filestore items + Filestore servlet returns LFS JSON error only if accepted by client + DiffStat now knows repository to allow identification of filestore items + Filestore items identified and returned via view, raw & blob links on blame, commitDiff, commit and Tree pages
* Log update for Fail2Ban usagePaul Martin2015-10-255-34/+34
| | | | | + Adds standard logging for all authentication providers + Updates help page to use default GitBlit SSH port
* Git-LFS supportPaul Martin2015-10-104-1/+908
| | | | | | | | | | | | | | + Metadata maintained in append-only JSON file providing complete audit history. + Filestore menu item + Lists filestore items + Current size and availability + Link to GitBlit Filestore help page (top right) + Hooks into existing repository permissions + Uses default repository path for out-of-box operation with Git-LFS client + accessRestrictionFilter now has access to http method and auth header + Testing for servlet and manager
* Revert manual specification of ssh user auth factoriesJames Moger2015-10-053-14/+8
|
* Update to SSHD 1.0.0James Moger2015-09-182-8/+8
|
* Revised AvatarGenerator to be injectableJames Moger2015-06-152-52/+50
|
* First draft for a customized avatar imageFabrice Bacchella2015-06-151-0/+77
|
* Invalid kerberos patches, works now and with a test.Fabrice Bacchella2015-05-262-1/+77
|
* Implement configurable tab length support for blob viewsJames Moger2015-05-222-4/+4
|
* Merged #247 "Add Kerberos5/GSS authentication to ssh"James Moger2015-05-212-0/+9
|\
| * Adding Kerberos5/GSS authentication to sshFabrice Bacchella2015-05-042-0/+9
| | | | | | | | Adding the possibility to define authentication method order for ssh
* | A patch that allows to extract a new user informations from the HTTP sessionFabrice Bacchella2015-05-151-17/+658
|/ | | | if the webapp container can fill it.
* Add links to commit diff and blob diff pages to toggle whitespace settingJames Moger2015-03-071-3/+3
|
* Add DiffComparator argument to all DiffUtils calls, default to ignore all ↵James Moger2015-03-071-3/+4
| | | | whitespace
* #230 - Improve empty folder navigation.Milos Cubrilo2015-01-113-7/+82
| | | | Empty folders are automatically skipped when browsing repository tree (similar to github "folder jumping" feature).
* Tickets - Priority, Severity optionsPaul Martin2014-10-203-4/+193
| | | | | | | | | + Severity indicated via new character indicator and color of ticket icon on ticket list + Priority indicated via new priority icon and color on ticket list + Indexed as integers to provide sorting and maintain language neutral index + Colours and indicator text controlled through CSS classes priority-<x> & severity-<x> + UITicketTest created to generate tickets of all types to ease debugging
* Merge release-1.6.1James Moger2014-10-201-1/+1
|\
| * Correct unit test assertionJames Moger2014-10-201-1/+1
| |
| * Fix GitBlitTest.testGitblitSettings()James Moger2014-10-131-1/+5
| |
* | Fix GitBlitTest.testGitblitSettings()James Moger2014-10-131-1/+5
| |
* | Merge branch 'ticket/161' into developJames Moger2014-09-081-4/+4
|\|
| * Expose setting to control Lucene repository indexing frequencyJames Moger2014-09-081-4/+4
| |
* | Merge branch 'ticket/164' into developJames Moger2014-09-079-14/+45
|\|
| * Create infrastructure for XSS sanitizationJames Moger2014-09-079-14/+45
| |
* | Extract services manager into a top-level injectable managerJames Moger2014-07-031-20/+0
| |
* | Use Guice-Servlet rather than custom code and expose the InjectorJames Moger2014-07-031-0/+6
|/ | | | | | | | | | | | | | | This is a fairly functional variation of Gitblit with one notable exception: The security filters are not working properly. This is a design flaw in Guice that I have reported upstream [1]. The general idea is that Guice-Servlet filters are not properly wrapping the ServletRequest. This has historically been a problem for Guice-Servlet servlets but Google has fixed most of those issues. Unfortunately, all the same flaws reported against the servlet delegation also exist in Guice-Servlet filter delegation. :( [1]: https://code.google.com/p/google-guice/issues/detail?id=807
* Add repository and user/team lifecycle listener extension pointsJames Moger2014-06-098-21/+21
|
* Add a basic SSH public key management UIJames Moger2014-06-051-0/+15
|
* Change enum name and unit test RSS tag queriesJames Moger2014-05-081-1/+35
|
* Revise, complete, and fully test the FORK rpcJames Moger2014-05-082-17/+63
|