lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven A Rowe <sar...@syr.edu>
Subject RE: svn commit: r1137092 - in /lucene/dev/trunk/solr/src: java/org/apache/solr/core/QuerySenderListener.java test-files/solr/conf/solrconfig-querysender-noquery.xml test/org/apache/solr/core/TestQuerySenderNoQuery.java
Date Sat, 18 Jun 2011 02:26:14 GMT
Hi Erick,

When you include the JIRA issue ID in your Subversion commit log message, the log message
and links to each of your changes are automatically appended to the JIRA issue (you can see
these from the "All" tab).  But this apparently only happens if you use all caps, e.g. "SOLR-2598".
 This commit didn't make it onto the issue, since you put "Solr-2598" in your commit log message.

It's possible to change log messages after a commit, but I'm pretty sure that you can't retroactively
attach a commit's changes to a JIRA issue.  Recently when I forgot to put the issue ID in
a commit log message, I added a comment with a link to the ViewVC view of the revision - here's
where I did that: <https://issues.apache.org/jira/browse/SOLR-2452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049430#comment-13049430>

Steve

> -----Original Message-----
> From: erick@apache.org [mailto:erick@apache.org]
> Sent: Friday, June 17, 2011 8:10 PM
> To: commits@lucene.apache.org
> Subject: svn commit: r1137092 - in /lucene/dev/trunk/solr/src:
> java/org/apache/solr/core/QuerySenderListener.java test-
> files/solr/conf/solrconfig-querysender-noquery.xml
> test/org/apache/solr/core/TestQuerySenderNoQuery.java
> 
> Author: erick
> Date: Sat Jun 18 00:10:21 2011
> New Revision: 1137092
> 
> URL: http://svn.apache.org/viewvc?rev=1137092&view=rev
> Log:
> Solr-2598 (Commenting out the <arr name="queries"> section in
> firstSearcher generates an NPE)
> 
> Added:
>     lucene/dev/trunk/solr/src/test-files/solr/conf/solrconfig-
> querysender-noquery.xml
> 
> lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestQuerySenderNoQuer
> y.java
> Modified:
> 
> lucene/dev/trunk/solr/src/java/org/apache/solr/core/QuerySenderListener.j
> ava
> 
> Modified:
> lucene/dev/trunk/solr/src/java/org/apache/solr/core/QuerySenderListener.j
> ava
> URL:
> http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/so
> lr/core/QuerySenderListener.java?rev=1137092&r1=1137091&r2=1137092&view=d
> iff
> =========================================================================
> =====
> ---
> lucene/dev/trunk/solr/src/java/org/apache/solr/core/QuerySenderListener.j
> ava (original)
> +++
> lucene/dev/trunk/solr/src/java/org/apache/solr/core/QuerySenderListener.j
> ava Sat Jun 18 00:10:21 2011
> @@ -41,7 +41,9 @@ public class QuerySenderListener extends
>    public void newSearcher(SolrIndexSearcher newSearcher,
> SolrIndexSearcher currentSearcher) {
>      final SolrIndexSearcher searcher = newSearcher;
>      log.info("QuerySenderListener sending requests to " + newSearcher);
> -    for (NamedList nlst : (List<NamedList>)args.get("queries")) {
> +    List<NamedList> allLists = (List<NamedList>)args.get("queries");
> +    if (allLists == null) return;
> +    for (NamedList nlst : allLists) {
>        SolrQueryRequest req = null;
> 
>        try {
> 
> Added: lucene/dev/trunk/solr/src/test-files/solr/conf/solrconfig-
> querysender-noquery.xml
> URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test-
> files/solr/conf/solrconfig-querysender-noquery.xml?rev=1137092&view=auto
> =========================================================================
> =====
> --- lucene/dev/trunk/solr/src/test-files/solr/conf/solrconfig-
> querysender-noquery.xml (added)
> +++ lucene/dev/trunk/solr/src/test-files/solr/conf/solrconfig-
> querysender-noquery.xml Sat Jun 18 00:10:21 2011
> @@ -0,0 +1,79 @@
> +<?xml version="1.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.
> +-->
> +
> +<!-- $Id: solrconfig-querysender.xml 1048886 2010-12-14 01:10:52Z
> hossman $
> +     $Source$
> +     $Name$
> +  -->
> +
> +<config>
> +
> <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMat
> chVersion>
> +    <!--  The DirectoryFactory to use for indexes.
> +        solr.StandardDirectoryFactory, the default, is filesystem based.
> +        solr.RAMDirectoryFactory is memory based and not persistent. -->
> +  <directoryFactory name="DirectoryFactory"
> class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
> +
> +  <updateHandler class="solr.DirectUpdateHandler2">
> +    <listener event="postCommit"
> +              class="org.apache.solr.core.MockEventListener" />
> +    <listener event="postOptimize"
> +              class="org.apache.solr.core.MockEventListener" />
> +  </updateHandler>
> +
> +  <query>
> +
> +
> +    <!-- a newSearcher event is fired whenever a new searcher is being
> prepared
> +         and there is a current searcher handling requests (aka
> registered). -->
> +    <!-- QuerySenderListener takes an array of NamedList and executes a
> +         local query request for each NamedList in sequence. -->
> +    <listener event="newSearcher" class="solr.QuerySenderListener">
> +      <!--
> +      <arr name="queries">
> +        <lst> <str name="q">solr</str> <str name="start">0</str>
<str
> name="rows">10</str> <str name="qt">mock</str></lst>
> +        <lst> <str name="q">rocks</str> <str name="start">0</str>
<str
> name="rows">10</str> <str name="qt">mock</str></lst>
> +      </arr>
> +      -->
> +    </listener>
> +    <listener event="newSearcher"
> +              class="org.apache.solr.core.MockEventListener" />
> +
> +
> +    <!-- a firstSearcher event is fired whenever a new searcher is being
> +         prepared but there is no current registered searcher to handle
> +         requests or to gain prewarming data from. -->
> +    <listener event="firstSearcher" class="solr.QuerySenderListener">
> +      <!--
> +      <arr name="queries">
> +        <lst> <str name="q">fast_warm</str> <str name="start">0</str>
> <str name="rows">10</str>
> +          <str name="qt">mock</str>
> +        </lst>
> +      </arr>
> +      -->
> +    </listener>
> +    <listener event="firstSearcher"
> +              class="org.apache.solr.core.MockEventListener" />
> +
> +
> +  </query>
> +  <requestHandler name="mock"
> class="org.apache.solr.core.MockQuerySenderListenerReqHandler"
> default="true">
> +    <!-- default values for query parameters -->
> +
> +  </requestHandler>
> +</config>
> 
> Added:
> lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestQuerySenderNoQuer
> y.java
> URL:
> http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/so
> lr/core/TestQuerySenderNoQuery.java?rev=1137092&view=auto
> =========================================================================
> =====
> ---
> lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestQuerySenderNoQuer
> y.java (added)
> +++
> lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestQuerySenderNoQuer
> y.java Sat Jun 18 00:10:21 2011
> @@ -0,0 +1,90 @@
> +package org.apache.solr.core;
> +
> +/**
> + * 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.
> + */
> +
> +import org.apache.lucene.store.Directory;
> +import org.apache.solr.SolrTestCaseJ4;
> +import org.apache.solr.common.params.EventParams;
> +import org.apache.solr.search.SolrIndexSearcher;
> +import org.apache.solr.search.TestExtendedDismaxParser;
> +import org.apache.solr.util.RefCounted;
> +import org.junit.BeforeClass;
> +import org.junit.Test;
> +
> +public class TestQuerySenderNoQuery extends SolrTestCaseJ4 {
> +
> +  // number of instances configured in the solrconfig.xml
> +  private static final int EXPECTED_MOCK_LISTENER_INSTANCES = 4;
> +
> +  private static int preInitMockListenerCount = 0;
> +
> +  @BeforeClass
> +  public static void beforeClass() throws Exception {
> +    // record current value prior to core initialization
> +    // so we can verify the correct number of instances later
> +    // NOTE: this won't work properly if concurrent tests run
> +    // in the same VM
> +    preInitMockListenerCount = MockEventListener.getCreateCount();
> +
> +    initCore("solrconfig-querysender-noquery.xml","schema.xml");
> +  }
> +
> +  public void testListenerCreationCounts() {
> +    SolrCore core = h.getCore();
> +
> +    assertEquals("Unexpected number of listeners created",
> +                 EXPECTED_MOCK_LISTENER_INSTANCES,
> +                 MockEventListener.getCreateCount() -
> preInitMockListenerCount);
> +  }
> +
> +  @Test
> +  public void testRequestHandlerRegistry() {
> +    // property values defined in build.xml
> +    SolrCore core = h.getCore();
> +
> +    assertEquals( 2, core.firstSearcherListeners.size() );
> +    assertEquals( 2, core.newSearcherListeners.size() );
> +  }
> +
> +  // Determine that when the query lists are commented out of both new
> and
> +  // first searchers in the config, we don't throw an NPE
> +  @Test
> +  public void testSearcherEvents() throws Exception {
> +    SolrCore core = h.getCore();
> +    SolrEventListener newSearcherListener =
> core.newSearcherListeners.get(0);
> +    assertTrue("Not an instance of QuerySenderListener",
> newSearcherListener instanceof QuerySenderListener);
> +    QuerySenderListener qsl = (QuerySenderListener) newSearcherListener;
> +
> +    RefCounted<SolrIndexSearcher> currentSearcherRef =
> core.getSearcher();
> +    SolrIndexSearcher currentSearcher = currentSearcherRef.get();
> +    SolrIndexSearcher dummy = null;
> +    qsl.newSearcher(currentSearcher, dummy);//test first Searcher (since
> param is null)
> +    MockQuerySenderListenerReqHandler mock =
> (MockQuerySenderListenerReqHandler) core.getRequestHandler("mock");
> +    assertNotNull("Mock is null", mock);
> +    assertNull("Req (firstsearcher) is not null", mock.req);
> +
> +    Directory dir = currentSearcher.getIndexReader().directory();
> +    SolrIndexSearcher newSearcher = new SolrIndexSearcher(core,
> core.getSchema(), "testQuerySenderNoQuery", dir, true, false);
> +
> +    qsl.newSearcher(newSearcher, currentSearcher); // get newSearcher.
> +    assertNull("Req (newsearcher) is not null", mock.req);
> +    newSearcher.close();
> +    currentSearcherRef.decref();
> +  }
> +
> +}
> 

Mime
View raw message