You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2017/03/22 18:51:48 UTC

lucene-solr:jira/solr-9959: SOLR-9959 Fix a failing test and remove irrelevant one.

Repository: lucene-solr
Updated Branches:
  refs/heads/jira/solr-9959 6e8a42b28 -> c769bc621


SOLR-9959 Fix a failing test and remove irrelevant one.


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

Branch: refs/heads/jira/solr-9959
Commit: c769bc621a125f8858c4453f0ea95f03b497db8d
Parents: 6e8a42b
Author: Andrzej Bialecki <ab...@apache.org>
Authored: Wed Mar 22 19:51:14 2017 +0100
Committer: Andrzej Bialecki <ab...@apache.org>
Committed: Wed Mar 22 19:51:14 2017 +0100

----------------------------------------------------------------------
 .../test/org/apache/solr/SolrInfoBeanTest.java  |  4 +-
 .../solr/handler/admin/MBeansHandlerTest.java   | 99 --------------------
 2 files changed, 3 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c769bc62/solr/core/src/test/org/apache/solr/SolrInfoBeanTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/SolrInfoBeanTest.java b/solr/core/src/test/org/apache/solr/SolrInfoBeanTest.java
index f2f35ed..d39c87f 100644
--- a/solr/core/src/test/org/apache/solr/SolrInfoBeanTest.java
+++ b/solr/core/src/test/org/apache/solr/SolrInfoBeanTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.solr;
 
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.core.SolrInfoBean;
 import org.apache.solr.handler.StandardRequestHandler;
 import org.apache.solr.handler.admin.LukeRequestHandler;
@@ -58,12 +59,13 @@ public class SolrInfoBeanTest extends SolrTestCaseJ4
     int checked = 0;
     SolrMetricManager metricManager = h.getCoreContainer().getMetricManager();
     String registry = h.getCore().getCoreMetricManager().getRegistryName();
+    String scope = TestUtil.randomSimpleString(random(), 2, 10);
     for( Class clazz : classes ) {
       if( SolrInfoBean.class.isAssignableFrom( clazz ) ) {
         try {
           SolrInfoBean info = (SolrInfoBean)clazz.newInstance();
           if (info instanceof SolrMetricProducer) {
-            ((SolrMetricProducer)info).initializeMetrics(metricManager, registry, null);
+            ((SolrMetricProducer)info).initializeMetrics(metricManager, registry, scope);
           }
           
           //System.out.println( info.getClass() );

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c769bc62/solr/core/src/test/org/apache/solr/handler/admin/MBeansHandlerTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/admin/MBeansHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/admin/MBeansHandlerTest.java
deleted file mode 100644
index 84e2382..0000000
--- a/solr/core/src/test/org/apache/solr/handler/admin/MBeansHandlerTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.handler.admin;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.common.params.CommonParams;
-import org.apache.solr.common.util.ContentStream;
-import org.apache.solr.common.util.ContentStreamBase;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.request.LocalSolrQueryRequest;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class MBeansHandlerTest extends SolrTestCaseJ4 {
-  
-  @BeforeClass
-  public static void beforeClass() throws Exception {
-    initCore("solrconfig.xml", "schema.xml");
-  }
-
-  @Test
-  public void testDiff() throws Exception {
-    String xml = h.query(req(
-        CommonParams.QT,"/admin/mbeans",
-        "stats","true",
-        CommonParams.WT,"xml"
-     ));
-    List<ContentStream> streams = new ArrayList<>();
-    streams.add(new ContentStreamBase.StringStream(xml));
-    
-    LocalSolrQueryRequest req = lrf.makeRequest(
-        CommonParams.QT,"/admin/mbeans",
-        "stats","true",
-        CommonParams.WT,"xml",
-        "diff","true");
-    req.setContentStreams(streams);
-    
-    xml = h.query(req);
-    NamedList<NamedList<NamedList<Object>>> diff = SolrInfoMBeanHandler.fromXML(xml);
-
-    // The stats bean for SolrInfoMBeanHandler
-    NamedList stats = (NamedList)diff.get("ADMIN").get("/admin/mbeans").get("stats");
-    
-    //System.out.println("stats:"+stats);
-    Pattern p = Pattern.compile("Was: (?<was>[0-9]+), Now: (?<now>[0-9]+), Delta: (?<delta>[0-9]+)");
-    String response = stats.get("requests").toString();
-    Matcher m = p.matcher(response);
-    if (!m.matches()) {
-      fail("Response did not match pattern: " + response);
-    }
-
-    assertEquals(1, Integer.parseInt(m.group("delta")));
-    int was = Integer.parseInt(m.group("was"));
-    int now = Integer.parseInt(m.group("now"));
-    assertEquals(1, now - was);
-
-    xml = h.query(req(
-        CommonParams.QT,"/admin/mbeans",
-        "stats","true",
-        "key","org.apache.solr.handler.admin.CollectionsHandler"
-    ));
-    NamedList<NamedList<NamedList<Object>>> nl = SolrInfoMBeanHandler.fromXML(xml);
-    assertNotNull( nl.get("ADMIN").get("org.apache.solr.handler.admin.CollectionsHandler"));
-  }
-
-  @Test
-  public void testXMLDiffWithExternalEntity() throws Exception {
-    String file = getFile("mailing_lists.pdf").toURI().toASCIIString();
-    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-        "<!DOCTYPE foo [<!ENTITY bar SYSTEM \""+file+"\">]>\n" +
-        "<response>\n" +
-        "&bar;" +
-        "<lst name=\"responseHeader\"><int name=\"status\">0</int><int name=\"QTime\">31</int></lst><lst name=\"solr-mbeans\"></lst>\n" +
-        "</response>";
-
-    NamedList<NamedList<NamedList<Object>>> nl = SolrInfoMBeanHandler.fromXML(xml);
-
-    assertTrue("external entity ignored properly", true);
-  }
-}