GitHub user conniey opened a pull request:
https://github.com/apache/lucenenet/pull/177
Limiting uses of static variables and methods in Testcases
This is an improvement from PR #172. The difference is that all the
existing constructors are maintained with some additions.
This PR would allow an easier transition to using xUnit. xUnit by default,
runs its tests in parallel and asynchronously. The current use of mutable
static fields limits in test cases the ability to utilise this.
* Changing existing static variables to static readonly so we are explicit
that these variables are set once and do not change.
* Change OLD_FORMAT_IMPERSONATION_IS_ACTIVE to non-static field since other
tests share and use this variable
* Change ClassEnvRule to non-static since every test class generates its
own rule during test
* Change dependent static methods in LuceneTestCase to non-static because
their state depended on the state of these non-static variables
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/conniey/lucenenet notRemovingCtors
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/lucenenet/pull/177.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #177
----
commit 93acfd936b64d602e3e59d56c9d4b53e2820214b
Author: Connie Yau <[email protected]>
Date: 2016-07-11T23:33:47Z
Changing static variables to static readonly
commit 655fa1a02f325551936c7b0388963b05204d296a
Author: Connie Yau <[email protected]>
Date: 2016-07-12T12:26:26Z
Changing OLD_FORMAT_IMPERSONATION_IS_ACTIVE to non-static property
commit ae41663fd508e45deac3682104f1c8dabf3d6973
Author: Connie Yau <[email protected]>
Date: 2016-07-22T19:17:21Z
Changing ClassEnvRule to non-static
commit 4b52ddfdefed3c7cf91c6d9c7b5aad18014732dd
Author: Connie Yau <[email protected]>
Date: 2016-07-15T16:20:45Z
Fixing test errors with teardown/setup
commit d7e15dc8adcf33f59133243f4b6022ebf6d8d46f
Author: Connie Yau <[email protected]>
Date: 2016-07-20T19:14:08Z
Adding a static LuceneTestCase.NewIndexWriterConfig method
commit ab57fd17da92fdb5469c9495fb6654a9db1dff4c
Author: Connie Yau <[email protected]>
Date: 2016-07-20T19:14:19Z
Modifying RandomIndexWriter ctors to take Similarity and Timezone
commit 6f3e8079447bd9ac4f38119b1bdaebfa7690214a
Author: Connie Yau <[email protected]>
Date: 2016-07-22T16:31:02Z
Fixing build errors from adding extra params to RandomIndexWriter
commit 6614015b207044b13d3a46a77f17c5d89010aedf
Author: Connie Yau <[email protected]>
Date: 2016-07-22T19:29:50Z
Making one LuceneTestCase.NewIndexWriterConfig non-static
commit 8be2a5433039c6daa114a1632ae2056bd8de148e
Author: Connie Yau <[email protected]>
Date: 2016-07-22T19:30:36Z
Adding parameters to static NewSearcher
commit c499981985b086d31699bde5438ff0bc410d7e37
Author: Connie Yau <[email protected]>
Date: 2016-07-22T19:31:18Z
Making LuceneTestCase.NewField/NewTextField non-static
commit ef7f1dd17feda9fbb1a2cc02d5f764268d7e7354
Author: Connie Yau <[email protected]>
Date: 2016-07-22T19:33:30Z
Adding another overload for LuceneTestCase.NewSearcher
commit 9591b70d96a9ee08d23421e70c41c6363967b37a
Author: Connie Yau <[email protected]>
Date: 2016-07-22T22:06:31Z
Fixing RandomIndexWriter build errors in BaseTokenStreamTestCase
commit 72840c6544d310155d7e1849283d9ec38bab79c3
Author: Connie Yau <[email protected]>
Date: 2016-07-22T22:07:12Z
Fixing NewField build errors in ThreadingIndexingAndSearching
commit 9067582a3bf68430a789e641670e3a96fe688d95
Author: Connie Yau <[email protected]>
Date: 2016-07-22T22:07:46Z
Fixing NewSearcher errors in QueryUtils
commit 659d95221eb57e05d47f1292efa47ef2266b6bf3
Author: Connie Yau <[email protected]>
Date: 2016-07-22T22:08:20Z
Fixing RandomIndexWriter ctor error in SearchEquivalentTestBase
commit 95bd05b76fbde14a852e789dc4c445dc93cb7d6e
Author: Connie Yau <[email protected]>
Date: 2016-08-01T05:50:16Z
Fixing non-static calls from private classes using OuterInstance
commit 3930ae4a014c336e73ed4bc24a867e18be4b008f
Author: Connie Yau <[email protected]>
Date: 2016-08-01T05:51:02Z
Exposing external getters for ClassEnvRule.TimeZone and Similarity
commit c15ab48b5d3f4b75672ef06c90c7ae645f9cd3e9
Author: Connie Yau <[email protected]>
Date: 2016-08-01T05:53:24Z
Changing methods that do not have to be static to non-static. (ie.
TestFixture TearDown/Setup)
commit b9bb484d00225721081efc02782ce9191be8a83a
Author: Connie Yau <[email protected]>
Date: 2016-08-01T05:54:23Z
Adding TestWriterMethods so that it does not rely on external static call
commit f772f19daecf8b7b139b38a9662dc19d110c8432
Author: Connie Yau <[email protected]>
Date: 2016-08-01T06:29:27Z
Injecting OLD_FORMAT_IMPERSONATION_IS_ACTIVE into Codecs so that they do
not reference static value
commit c8e1eae628e07b06ae2f31512c9955d66d4b81ca
Author: Connie Yau <[email protected]>
Date: 2016-08-01T06:30:36Z
Passing Similarity and TimeZone into RandomIndexWriter ctors.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---