IGNITE-28731 Create cluster auto activation plugin - #355
Conversation
e1ba8c9 to
426bd4b
Compare
0d6b493 to
115b23d
Compare
chesnokoff
left a comment
There was a problem hiding this comment.
Many tests repeat the same node startup sequence and cluster state checks. Can we extract common helper methods for starting configured nodes and checking the expected state? This would make the individual test scenarios shorter and easier to understand
| @Override public boolean apply(Collection<ClusterNode> nodes) { | ||
| Set<String> missingNodes = new HashSet<>(requiredNodes); | ||
|
|
||
| for (ClusterNode node : nodes) { | ||
| String nodeConsistentId = node.consistentId().toString(); | ||
|
|
||
| missingNodes.remove(nodeConsistentId); | ||
|
|
||
| if (missingNodes.isEmpty()) | ||
| break; | ||
| } | ||
|
|
||
| return missingNodes.isEmpty(); | ||
| } |
There was a problem hiding this comment.
| @Override public boolean apply(Collection<ClusterNode> nodes) { | |
| Set<String> missingNodes = new HashSet<>(requiredNodes); | |
| for (ClusterNode node : nodes) { | |
| String nodeConsistentId = node.consistentId().toString(); | |
| missingNodes.remove(nodeConsistentId); | |
| if (missingNodes.isEmpty()) | |
| break; | |
| } | |
| return missingNodes.isEmpty(); | |
| } | |
| @Override public boolean apply(Collection<ClusterNode> nodes) { | |
| Set<String> missingNodes = new HashSet<>(requiredNodes); | |
| for (ClusterNode node : nodes) { | |
| String nodeConsistentId = node.consistentId().toString(); | |
| missingNodes.remove(nodeConsistentId); | |
| if (missingNodes.isEmpty()) | |
| return true; | |
| } | |
| return false; | |
| } |
| @Override public boolean apply(Collection<ClusterNode> nodes) { | ||
| Set<String> missingNodes = new HashSet<>(requiredValues); | ||
|
|
||
| for (ClusterNode node : nodes) { | ||
| String attrVal = node.attribute(attrName); | ||
|
|
||
| missingNodes.remove(attrVal); | ||
|
|
||
| if (missingNodes.isEmpty()) | ||
| break; | ||
| } | ||
|
|
||
| return missingNodes.isEmpty(); | ||
| } |
There was a problem hiding this comment.
| @Override public boolean apply(Collection<ClusterNode> nodes) { | |
| Set<String> missingNodes = new HashSet<>(requiredValues); | |
| for (ClusterNode node : nodes) { | |
| String attrVal = node.attribute(attrName); | |
| missingNodes.remove(attrVal); | |
| if (missingNodes.isEmpty()) | |
| break; | |
| } | |
| return missingNodes.isEmpty(); | |
| } | |
| @Override public boolean apply(Collection<ClusterNode> nodes) { | |
| Set<String> missingNodes = new HashSet<>(requiredValues); | |
| for (ClusterNode node : nodes) { | |
| String attrVal = node.attribute(attrName); | |
| missingNodes.remove(attrVal); | |
| if (missingNodes.isEmpty()) | |
| return true; | |
| } | |
| return false; | |
| } |
|
|
||
| /** {@inheritDoc} */ | ||
| @Override public void onIgniteStart() { | ||
|
|
| } | ||
|
|
||
| /** @return IgniteConfiguration from XML. */ | ||
| private IgniteConfiguration getConfigurationFromXml(String xmlPath) throws Exception { |
There was a problem hiding this comment.
From IDEA: Exception 'java.lang.Exception' is never thrown in the method
| PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider( | ||
| new ActivateByConsistentID(Set.of(NODE_0, NODE_1)) | ||
| ); | ||
|
|
| PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider( | ||
| new ActivateByConsistentID(Set.of(NODE_2)) | ||
| ); | ||
|
|
| PluginProvider<?> autoActivationProvider = new AutoActivationPluginProvider( | ||
| new ActivateByConsistentID(Set.of(NODE_2)) | ||
| ); | ||
|
|
There was a problem hiding this comment.
same for other methods: remove empty lines as first lines in method bodies
| private CacheConfiguration getCacheConfiguration() { | ||
| return new CacheConfiguration<>() |
There was a problem hiding this comment.
| private CacheConfiguration getCacheConfiguration() { | |
| return new CacheConfiguration<>() | |
| private CacheConfiguration<String, Integer> getCacheConfiguration() { | |
| return new CacheConfiguration<String, Integer>() |
There was a problem hiding this comment.
let's avoid raw usage of type
chesnokoff
left a comment
There was a problem hiding this comment.
Functionally looks good to me. I still have some concerns about the string based test helpers but I do not consider them blocking
No description provided.