Skip to content

Commit

Permalink
IGNITE-45 - Fixing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Goncharuk committed Mar 19, 2015
1 parent 77d7eb8 commit bbcda44
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Expand Up @@ -1778,8 +1778,8 @@ else if (rebalanceOrder < 0)
* @return Validation result or {@code null} in case of success. * @return Validation result or {@code null} in case of success.
*/ */
@Nullable private IgniteSpiNodeValidationResult validateHashIdResolvers(ClusterNode node) { @Nullable private IgniteSpiNodeValidationResult validateHashIdResolvers(ClusterNode node) {
for (GridCacheAdapter cache : ctx.cache().internalCaches()) { for (DynamicCacheDescriptor desc : registeredCaches.values()) {
CacheConfiguration cfg = cache.configuration(); CacheConfiguration cfg = desc.cacheConfiguration();


if (cfg.getAffinity() instanceof CacheRendezvousAffinityFunction) { if (cfg.getAffinity() instanceof CacheRendezvousAffinityFunction) {
CacheRendezvousAffinityFunction aff = (CacheRendezvousAffinityFunction)cfg.getAffinity(); CacheRendezvousAffinityFunction aff = (CacheRendezvousAffinityFunction)cfg.getAffinity();
Expand All @@ -1795,12 +1795,12 @@ else if (rebalanceOrder < 0)


if (nodeHashObj.hashCode() == topNodeHashObj.hashCode()) { if (nodeHashObj.hashCode() == topNodeHashObj.hashCode()) {
String errMsg = "Failed to add node to topology because it has the same hash code for " + String errMsg = "Failed to add node to topology because it has the same hash code for " +
"partitioned affinity as one of existing nodes [cacheName=" + cache.name() + "partitioned affinity as one of existing nodes [cacheName=" + cfg.getName() +
", hashIdResolverClass=" + hashIdRslvr.getClass().getName() + ", hashIdResolverClass=" + hashIdRslvr.getClass().getName() +
", existingNodeId=" + topNode.id() + ']'; ", existingNodeId=" + topNode.id() + ']';


String sndMsg = "Failed to add node to topology because it has the same hash code for " + String sndMsg = "Failed to add node to topology because it has the same hash code for " +
"partitioned affinity as one of existing nodes [cacheName=" + cache.name() + "partitioned affinity as one of existing nodes [cacheName=" + cfg.getName() +
", hashIdResolverClass=" + hashIdRslvr.getClass().getName() + ", existingNodeId=" + ", hashIdResolverClass=" + hashIdRslvr.getClass().getName() + ", existingNodeId=" +
topNode.id() + ']'; topNode.id() + ']';


Expand Down
Expand Up @@ -76,11 +76,7 @@ public class GridCachePartitionedAffinityHashIdResolverSelfTest extends GridComm
* @throws Exception If failed. * @throws Exception If failed.
*/ */
public void testDuplicateId() throws Exception { public void testDuplicateId() throws Exception {
rslvr = new CacheAffinityNodeHashResolver() { rslvr = new BogusHashResolver();
@Override public Object resolve(ClusterNode node) {
return 1;
}
};


startGrid(0); startGrid(0);


Expand All @@ -93,4 +89,14 @@ public void testDuplicateId() throws Exception {
}, IgniteCheckedException.class, "Failed to start manager: GridManagerAdapter [enabled=true, name=" + }, IgniteCheckedException.class, "Failed to start manager: GridManagerAdapter [enabled=true, name=" +
"org.apache.ignite.internal.managers.discovery.GridDiscoveryManager]"); "org.apache.ignite.internal.managers.discovery.GridDiscoveryManager]");
} }

/**
*
*/
private static class BogusHashResolver implements CacheAffinityNodeHashResolver {
/** {@inheritDoc} */
@Override public Object resolve(ClusterNode node) {
return 1;
}
}
} }

0 comments on commit bbcda44

Please sign in to comment.