New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed some Globals in tests #1872
Conversation
connection = TestConnector.getTestConnection(dbmsType); | ||
|
||
bibDatabase = new BibDatabase(); | ||
BibDatabaseContext context = new BibDatabaseContext(bibDatabase); | ||
|
||
|
||
dbmsSynchronizer = new DBMSSynchronizer(context); | ||
dbmsSynchronizer = new DBMSSynchronizer(context, | ||
JabRefPreferences.getInstance().get(JabRefPreferences.KEYWORD_SEPARATOR)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer a hard-coded keyword separator (instead of taking the one from the preferences) here and in the next tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was thinking of that as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow it doesn't matter since the keyword groups totally ignores the given keyword separator... #1877
Hardcoded keyword separators in all tests. |
@oscargus There are some checkstyle errors.
|
Yeah, noted that. Will fix soon. (Annoying thing when you remove the last import in a block...) |
9c20690
to
2752dce
Compare
I'm not sure whether the Well, the dependency to Globals is gone in DBMSSynchronizer but I don't think the overall quality of the code has improved with this... Perhaps its a better idea to always create a "local" BibDatabaseContext which than can be changed to a "shared" one using a method call (which requires the |
In general, I agree that the code quality not necessarily increases with
architecture constraints. ;-)
Yes, I think it is a better idea to do as you say. I just noted that it
wasn't an issue creating a local database without the keyword separator
(that annoying keyword separator that is ignored to such a large
extent...), so I thought that this was at least a better solution compared
to adding it as a required argument...
I'll see what I can do.
|
New attempt. |
Btw, the idea about the change was to be able to move DBMSSynchronizer to its correct place more easily by getting rid of the Globals (which probably should be logic, but looks like model if we should be able to move BibDatabaseContext to model). However, it is one of these things which will be very hard to solve architecture wise, as there is a quite tight connection to DMBSProcessor which is connected to other things and so on. I do not really like the non-gui/logic packages: collab (easy to move to gui though), external (impossible to move ExternalFileType as it is used in MetaData(?)), pdfimporter (hard to move as some logic methods call gui through it), shared (connections to BibDatabaseContext), and specialfields (connections from model straight into gui). (cli and preferences are OK.) |
Minor, but quite important from me 😉 Perhaps instead of 'setDatabaseLocation....' use 'convertToLocal/SharedDatabase'? But this is not that crucial and I would accept the other naming as Well... Apart from that this looks better to me and can be merged now. |
Well spotted @matthiasgeiger . I'll merge this in to reduce possible (later) merge conflicts regarding the move to model. |
And in parts of shared (to possibly allow easier refactoring to gui/logic later).
(Not sure if the database tests will actually pass, so better wait until everything is green..."