Skip to content
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

Merged
merged 7 commits into from Aug 29, 2016
Merged

Conversation

oscargus
Copy link
Contributor

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..."

@oscargus oscargus added status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers architecture labels Aug 27, 2016
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));
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@oscargus
Copy link
Contributor Author

Hardcoded keyword separators in all tests.

@stefan-kolb
Copy link
Member

stefan-kolb commented Aug 29, 2016

@oscargus There are some checkstyle errors.

:checkstyleTest[ant:checkstyle] [ERROR] /home/travis/build/JabRef/jabref/src/test/java/net/sf/jabref/gui/importer/actions/ConvertLegacyExplicitGroupsTest.java:13: 'org.junit.Before' should be separated from previous imports. [ImportOrder]
[ant:checkstyle] [ERROR] /home/travis/build/JabRef/jabref/src/test/java/net/sf/jabref/logic/groups/ExplicitGroupTest.java:7: 'org.junit.Test' should be separated from previous imports. [ImportOrder]
[ant:checkstyle] [ERROR] /home/travis/build/JabRef/jabref/src/test/java/net/sf/jabref/logic/groups/GroupTreeNodeTest.java:12: 'org.junit.Before' should be separated from previous imports. [ImportOrder]
[ant:checkstyle] [ERROR] /home/travis/build/JabRef/jabref/src/test/java/net/sf/jabref/logic/groups/KeywordGroupTest.java:5: 'org.junit.Test' should be separated from previous imports. [ImportOrder]

@oscargus
Copy link
Contributor Author

Yeah, noted that. Will fix soon. (Annoying thing when you remove the last import in a block...)

@matthiasgeiger
Copy link
Member

I'm not sure whether the shared related changes are a good idea... A small change in DBMSSynchronizer bubbles up to BibDatabaseContext where an additional constructor and statements like // As it is set to local, the keywordSeparator is not used are necessary...

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 keyword separator as a parameter)?

@oscargus
Copy link
Contributor Author

oscargus commented Aug 29, 2016 via email

@oscargus
Copy link
Contributor Author

New attempt.

@oscargus
Copy link
Contributor Author

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.)

@matthiasgeiger
Copy link
Member

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.

@oscargus
Copy link
Contributor Author

Well spotted @matthiasgeiger . I'll merge this in to reduce possible (later) merge conflicts regarding the move to model.

@oscargus oscargus merged commit ace1ba1 into JabRef:master Aug 29, 2016
@oscargus oscargus deleted the removeglobalsintest branch August 29, 2016 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants