SOLR-4114: tests: make happy with git - source attrib counts on svn substitution

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1426329 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-12-27 21:08:54 +00:00
parent ba52cd4e03
commit 7e51f75561
1 changed files with 23 additions and 13 deletions

View File

@ -609,26 +609,36 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
Object value; Object value;
Object indexDir; Object indexDir;
Object name; Object name;
try { try {
if (((value = server.getAttribute(mbean, "category")) != null && value.toString().equals(Category.CORE.toString())) && if (((value = server.getAttribute(mbean, "category")) != null && value
((value = server.getAttribute(mbean, "source")) != null && value.toString().contains(SolrCore.class.getSimpleName())) && .toString().equals(Category.CORE.toString()))
((indexDir = server.getAttribute(mbean, "indexDir")) != null) && && ((indexDir = server.getAttribute(mbean, "coreName")) != null)
((name = server.getAttribute(mbean, "name")) != null)) { && ((indexDir = server.getAttribute(mbean, "indexDir")) != null)
if (!indexDirToShardNamesMap.containsKey(indexDir.toString())) { && ((name = server.getAttribute(mbean, "name")) != null)) {
indexDirToShardNamesMap.put(indexDir.toString(), new HashSet<String>()); if (!indexDirToShardNamesMap.containsKey(indexDir.toString())) {
} indexDirToShardNamesMap.put(indexDir.toString(),
indexDirToShardNamesMap.get(indexDir.toString()).add(name.toString()); new HashSet<String>());
}
indexDirToShardNamesMap.get(indexDir.toString()).add(
name.toString());
} }
} catch (Exception e) { } catch (Exception e) {
// ignore, just continue - probably a "category" or "source" attribute not found // ignore, just continue - probably a "category" or "source" attribute
// not found
} }
} }
} }
assertTrue("Something is broken in the assert for no shards using the same indexDir - probably something was changed in the attributes published in the MBean of " + SolrCore.class.getSimpleName(), indexDirToShardNamesMap.size() > 0); assertTrue(
for (Entry<String, Set<String>> entry : indexDirToShardNamesMap.entrySet()) { "Something is broken in the assert for no shards using the same indexDir - probably something was changed in the attributes published in the MBean of "
+ SolrCore.class.getSimpleName() + " : " + indexDirToShardNamesMap,
indexDirToShardNamesMap.size() > 0);
for (Entry<String,Set<String>> entry : indexDirToShardNamesMap.entrySet()) {
if (entry.getValue().size() > 1) { if (entry.getValue().size() > 1) {
fail("We have shards using the same indexDir. E.g. shards " + entry.getValue().toString() + " all use indexDir " + entry.getKey()); fail("We have shards using the same indexDir. E.g. shards "
+ entry.getValue().toString() + " all use indexDir "
+ entry.getKey());
} }
} }