-
Notifications
You must be signed in to change notification settings - Fork 4
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
Added unit tests around config and other minor tweaks. #7
Conversation
src/main/java/com/opencredo/connect/venafi/tpp/log/TppLogSourceConfig.java
Outdated
Show resolved
Hide resolved
src/main/java/com/opencredo/connect/venafi/tpp/log/TppLogSourceConnector.java
Outdated
Show resolved
Hide resolved
src/main/java/com/opencredo/connect/venafi/tpp/log/TppLogSourceTask.java
Show resolved
Hide resolved
Map<String, Object> sourceOffset = new HashMap<>(); | ||
sourceOffset.put(LAST_READ, lastRead); | ||
sourceOffset.put(LAST_API_OFFSET, apiOffset); | ||
return sourceOffset; | ||
} | ||
|
||
List<EventLog> getTppLogs(String token, String date, int offset) { | ||
List<EventLog> getTppLogs(String token, String date, long offset) { |
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.
we should probably look at the whole file and figure out where to best auto-box and auto-unbox the Long...
src/test/java/com/opencredo/connect/venafi/tpp/log/TppLogSourceConfigTest.java
Show resolved
Hide resolved
src/test/java/com/opencredo/connect/venafi/tpp/log/TppLogSourceConfigTest.java
Outdated
Show resolved
Hide resolved
Co-Authored-By: rufusfnash <[email protected]>
…ncredo/kafka-connect-venafi-tpp into config_def_test_and_validate
src/test/java/com/opencredo/connect/venafi/tpp/log/TppLogSourceConfigTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/opencredo/connect/venafi/tpp/log/TppLogSourceConfigTest.java
Outdated
Show resolved
Hide resolved
props.put(BASE_URL_CONFIG, "https://localhost:443"); | ||
props.put(USERNAME_CONFIG, "placeholder_username"); | ||
props.put(PASSWORD_CONFIG, "placeholder_password"); | ||
return props; |
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.
If Guava is on the path, we could do return ImmutableMap.of()...;
- looks nicer and ensures nobody messes with our config... 😇
} | ||
|
||
private void given_this_is_overriden_with(String key, Object value, Map<String, Object> props) { | ||
props.put(key, value); |
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.
wrap in assertNotNull()? (I seem to remember put will return an old value, if any?
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.
True but I think you're then testing the test more than the intent which is simply the making sure the key value is set to the new values independent of if they were ever set previously.
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.
the method says "overridden", not "set", though. 😇
} | ||
|
||
private void given_this_is_removed_from(String key, Map<String, Object> props) { | ||
props.remove(key); |
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.
wrap in assertTrue() for the reason detailed below? 😇
src/test/java/com/opencredo/connect/venafi/tpp/log/TppLogSourceConnectorTest.java
Outdated
Show resolved
Hide resolved
…eConfigTest.java Co-Authored-By: rufusfnash <[email protected]>
…eConfigTest.java Co-Authored-By: rufusfnash <[email protected]>
…to config_def_test_and_validate
Removing old comment
I've made the changes in Intellij
@@ -43,7 +43,7 @@ public void start(Map<String, String> props) { | |||
@Override | |||
public List<Map<String, String>> taskConfigs(int maxTasks) { | |||
if (maxTasks != 1) { | |||
throw new IllegalArgumentException("max Tasks should be set to 1."); | |||
log.info("Ignoring maxTasks as there can only be one."); |
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.
we dub thee the Highlander setting... 🤡
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.
One last comment... :)
#7 (comment)
No description provided.