lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject lucene-solr:branch_6x: SOLR-10565 Use unique scope and domain names in this test to avoid collisions.
Date Mon, 03 Jul 2017 12:39:03 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 9947a811e -> 3b26b2a64


SOLR-10565 Use unique scope and domain names in this test to avoid collisions.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/3b26b2a6
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/3b26b2a6
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/3b26b2a6

Branch: refs/heads/branch_6x
Commit: 3b26b2a641501502fbbed1f93ddc17ee40ddf277
Parents: 9947a81
Author: Andrzej Bialecki <ab@apache.org>
Authored: Mon Jul 3 14:21:12 2017 +0200
Committer: Andrzej Bialecki <ab@apache.org>
Committed: Mon Jul 3 14:38:51 2017 +0200

----------------------------------------------------------------------
 .../metrics/reporters/SolrJmxReporterTest.java    | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3b26b2a6/solr/core/src/test/org/apache/solr/metrics/reporters/SolrJmxReporterTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/metrics/reporters/SolrJmxReporterTest.java
b/solr/core/src/test/org/apache/solr/metrics/reporters/SolrJmxReporterTest.java
index 42100d2..5bd7dfe 100644
--- a/solr/core/src/test/org/apache/solr/metrics/reporters/SolrJmxReporterTest.java
+++ b/solr/core/src/test/org/apache/solr/metrics/reporters/SolrJmxReporterTest.java
@@ -49,6 +49,7 @@ public class SolrJmxReporterTest extends SolrTestCaseJ4 {
   private static final int MAX_ITERATIONS = 20;
 
   private static int jmxPort;
+  private static String PREFIX;
 
   private String domain;
 
@@ -64,6 +65,7 @@ public class SolrJmxReporterTest extends SolrTestCaseJ4 {
     jmxPort = getNextAvailablePort();
     assertFalse(jmxPort == -1);
     LocateRegistry.createRegistry(jmxPort);
+    PREFIX = getSimpleClassName() + "-";
   }
 
   @Before
@@ -72,7 +74,7 @@ public class SolrJmxReporterTest extends SolrTestCaseJ4 {
 
     final SolrCore core = h.getCore();
     domain = core.getName();
-    rootName = TestUtil.randomSimpleString(random(), 5, 10);
+    rootName = PREFIX + TestUtil.randomSimpleString(random(), 5, 10);
 
     coreMetricManager = core.getCoreMetricManager();
     metricManager = core.getCoreContainer().getMetricManager();
@@ -94,7 +96,7 @@ public class SolrJmxReporterTest extends SolrTestCaseJ4 {
   private PluginInfo createReporterPluginInfo(String rootName, boolean enabled) {
     Random random = random();
     String className = SolrJmxReporter.class.getName();
-    String reporterName = TestUtil.randomSimpleString(random, 5, 10);
+    String reporterName = PREFIX + TestUtil.randomSimpleString(random, 5, 10);
 
     Map<String, Object> attrs = new HashMap<>();
     attrs.put(FieldType.CLASS_NAME, className);
@@ -105,7 +107,7 @@ public class SolrJmxReporterTest extends SolrTestCaseJ4 {
 
     boolean shouldOverrideDomain = random.nextBoolean();
     if (shouldOverrideDomain) {
-      domain = TestUtil.randomSimpleString(random);
+      domain = PREFIX + TestUtil.randomSimpleString(random);
       attrs.put("domain", domain);
     }
 
@@ -128,7 +130,7 @@ public class SolrJmxReporterTest extends SolrTestCaseJ4 {
     Random random = random();
 
     Map<String, Counter> registered = new HashMap<>();
-    String scope = SolrMetricTestUtils.getRandomScope(random, true);
+    String scope = PREFIX + SolrMetricTestUtils.getRandomScope(random, true);
     SolrInfoMBean.Category category = SolrMetricTestUtils.getRandomCategory(random, true);
 
     int iterations = TestUtil.nextInt(random, 0, MAX_ITERATIONS);
@@ -149,7 +151,7 @@ public class SolrJmxReporterTest extends SolrTestCaseJ4 {
   public void testReloadCore() throws Exception {
     Random random = random();
 
-    String scope = SolrMetricTestUtils.getRandomScope(random, true);
+    String scope = PREFIX + SolrMetricTestUtils.getRandomScope(random, true);
     SolrInfoMBean.Category category = SolrMetricTestUtils.getRandomCategory(random, true);
     Map<String, Counter> metrics = SolrMetricTestUtils.getRandomMetrics(random, true);
     SolrMetricProducer producer = SolrMetricTestUtils.getProducerOf(metricManager, category,
scope, metrics);
@@ -173,12 +175,12 @@ public class SolrJmxReporterTest extends SolrTestCaseJ4 {
 
   @Test
   public void testEnabled() throws Exception {
-    String root1 = TestUtil.randomSimpleString(random(), 5, 10);
+    String root1 = PREFIX + TestUtil.randomSimpleString(random(), 5, 10);
     PluginInfo pluginInfo1 = createReporterPluginInfo(root1, true);
     metricManager.loadReporter(coreMetricManager.getRegistryName(), coreMetricManager.getCore().getResourceLoader(),
         pluginInfo1);
 
-    String root2 = TestUtil.randomSimpleString(random(), 5, 10);
+    String root2 = PREFIX + TestUtil.randomSimpleString(random(), 5, 10);
     assertFalse(root2.equals(root1));
     PluginInfo pluginInfo2 = createReporterPluginInfo(root2, false);
     metricManager.loadReporter(coreMetricManager.getRegistryName(), coreMetricManager.getCore().getResourceLoader(),
@@ -188,7 +190,7 @@ public class SolrJmxReporterTest extends SolrTestCaseJ4 {
     assertTrue(reporters.containsKey(pluginInfo1.name));
     assertTrue(reporters.containsKey(pluginInfo2.name));
 
-    String scope = SolrMetricTestUtils.getRandomScope(random(), true);
+    String scope = PREFIX + SolrMetricTestUtils.getRandomScope(random(), true);
     SolrInfoMBean.Category category = SolrMetricTestUtils.getRandomCategory(random(), true);
     Map<String, Counter> metrics = SolrMetricTestUtils.getRandomMetrics(random(), true);
     SolrMetricProducer producer = SolrMetricTestUtils.getProducerOf(metricManager, category,
scope, metrics);


Mime
View raw message