Skip to content

No-op stores does nothing hence test class is not needed. #90

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

Merged
merged 1 commit into from
Dec 12, 2016

Conversation

guidomedina
Copy link

@guidomedina guidomedina commented Dec 12, 2016

NoopStore does nothing hence all tests will fail as it will not store messages, it will simply return true to any action.

@guidomedina
Copy link
Author

guidomedina commented Dec 12, 2016

@chrjohn I figured what it was, NoopStore instance created from NoopStoreFactory passes the session ID and when refreshing, the session corresponding to that session ID is not found.

We can just remove the session ID from that class and that test will pass, but the others won't, that's because the other tests will expect the messages to be present.

The only tests that will pass are the ones related to message sequences.

@guidomedina
Copy link
Author

Don't merge yet, I will add another modification to make it even cleaner.

@chrjohn
Copy link
Member

chrjohn commented Dec 12, 2016

Okeydokey.

…ore messages, it will simply return true to any action or do nothing.
@guidomedina
Copy link
Author

Done, check now.

@chrjohn chrjohn merged commit 9fbce5a into quickfix-j:master Dec 12, 2016
chrjohn added a commit that referenced this pull request Dec 12, 2016
No-op stores does nothing hence test class is not needed.
(cherry picked from commit 9fbce5a)
@guidomedina
Copy link
Author

guidomedina commented Dec 12, 2016

Is the following example fragment with the NoopStore OK?

final MessageStoreFactory messageStoreFactory;
if (needMessageStore) {
  messageStoreFactory = new MemoryStore.MemoryStoreFactory();
} else {
  settings.setString(sessionId, SETTING_PERSIST_MESSAGES, "N");
  messageStoreFactory = new NoopStoreFactory();
}

That MemoryStore that you see there is similar to the one from QFJ but the HashMap is based on FastUtil:

  ...
  private final Map<Integer, String> messages = new Int2ObjectOpenHashMap<>(10000, 0.7f);
  ...

@chrjohn
Copy link
Member

chrjohn commented Dec 12, 2016

Sorry, I do not quite understand the question. Where is that piece of code from?

@guidomedina
Copy link
Author

guidomedina commented Dec 12, 2016

That's just an example, not part of QFJ, the question is in regard the use of NoopStore combined with the PersistMessages option set at the session settings programmatically.

I see my question was missing the last statement, the question should had been:
Is the following example with NoopStore and PersistMessages setting OK?

@chrjohn
Copy link
Member

chrjohn commented Dec 13, 2016

Yes, that should work IMHO.

@chrjohn chrjohn added this to the QFJ 1.6.3 milestone Dec 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants