You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/02/09 02:04:13 UTC
svn commit: r1068718 [20/21] - in /lucene/dev/branches/bulkpostings: ./
dev-tools/eclipse/ dev-tools/idea/.idea/ dev-tools/idea/lucene/
dev-tools/maven/ dev-tools/maven/lucene/ dev-tools/maven/lucene/contrib/ant/
dev-tools/maven/lucene/contrib/db/bdb-j...
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/cloud/ZkTestServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/cloud/ZkTestServer.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/cloud/ZkTestServer.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/cloud/ZkTestServer.java Wed Feb 9 01:03:49 2011
@@ -1,319 +1,319 @@
-package org.apache.solr.cloud;
-
-/**
- * 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 java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.management.JMException;
-
-import org.apache.solr.SolrTestCaseJ4;
-import org.apache.zookeeper.jmx.ManagedUtil;
-import org.apache.zookeeper.server.NIOServerCnxn;
-import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperServer;
-import org.apache.zookeeper.server.SessionTracker.Session;
-import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig.ConfigException;
-
-public class ZkTestServer {
-
- protected final ZKServerMain zkServer = new ZKServerMain();
-
- private String zkDir;
-
- private int clientPort;
-
- private Thread zooThread;
-
- class ZKServerMain {
-
- private NIOServerCnxn.Factory cnxnFactory;
- private ZooKeeperServer zooKeeperServer;
-
- protected void initializeAndRun(String[] args) throws ConfigException,
- IOException {
- try {
- ManagedUtil.registerLog4jMBeans();
- } catch (JMException e) {
-
- }
-
- ServerConfig config = new ServerConfig();
- if (args.length == 1) {
- config.parse(args[0]);
- } else {
- config.parse(args);
- }
-
- runFromConfig(config);
- }
-
- /**
- * Run from a ServerConfig.
- *
- * @param config ServerConfig to use.
- * @throws IOException
- */
- public void runFromConfig(ServerConfig config) throws IOException {
- try {
- // Note that this thread isn't going to be doing anything else,
- // so rather than spawning another thread, we will just call
- // run() in this thread.
- // create a file logger url from the command line args
- zooKeeperServer = new ZooKeeperServer();
-
- FileTxnSnapLog ftxn = new FileTxnSnapLog(new File(config
- .getDataLogDir()), new File(config.getDataDir()));
- zooKeeperServer.setTxnLogFactory(ftxn);
- zooKeeperServer.setTickTime(config.getTickTime());
- cnxnFactory = new NIOServerCnxn.Factory(config.getClientPortAddress(), config
- .getMaxClientCnxns());
- cnxnFactory.startup(zooKeeperServer);
- cnxnFactory.join();
- if (zooKeeperServer.isRunning()) {
- zooKeeperServer.shutdown();
- }
- } catch (InterruptedException e) {
- }
- }
-
- /**
- * Shutdown the serving instance
- * @throws IOException
- */
- protected void shutdown() throws IOException {
- zooKeeperServer.shutdown();
- zooKeeperServer.getZKDatabase().close();
- waitForServerDown(getZkHost() + ":" + getPort(), 5000);
- cnxnFactory.shutdown();
- }
-
- public int getLocalPort() {
- if (cnxnFactory == null) {
- throw new IllegalStateException("A port has not yet been selected");
- }
- int port = cnxnFactory.getLocalPort();
- if (port == 0) {
- throw new IllegalStateException("A port has not yet been selected");
- }
- return port;
- }
- }
-
- public ZkTestServer(String zkDir) {
- this.zkDir = zkDir;
- }
-
- public ZkTestServer(String zkDir, int port) {
- this.zkDir = zkDir;
- this.clientPort = port;
- }
-
- public String getZkHost() {
- return "127.0.0.1:" + zkServer.getLocalPort();
- }
-
- public String getZkAddress() {
- return "127.0.0.1:" + zkServer.getLocalPort() + "/solr";
- }
-
- public int getPort() {
- return zkServer.getLocalPort();
- }
-
- public void expire(final long sessionId) {
- zkServer.zooKeeperServer.expire(new Session() {
- @Override
- public long getSessionId() {
- return sessionId;
- }
- @Override
- public int getTimeout() {
- return 4000;
- }});
- }
-
- public void run() throws InterruptedException {
- // we don't call super.setUp
- zooThread = new Thread() {
-
- @Override
- public void run() {
- ServerConfig config = new ServerConfig() {
-
- {
- setClientPort(ZkTestServer.this.clientPort);
- this.dataDir = zkDir;
- this.dataLogDir = zkDir;
- this.tickTime = 1500;
- }
-
- public void setClientPort(int clientPort) {
- if (clientPortAddress != null) {
- try {
- this.clientPortAddress = new InetSocketAddress(
- InetAddress.getByName(clientPortAddress.getHostName()), clientPort);
- } catch (UnknownHostException e) {
- throw new RuntimeException(e);
- }
- } else {
- this.clientPortAddress = new InetSocketAddress(clientPort);
- }
- }
- };
-
- try {
- zkServer.runFromConfig(config);
- } catch (Throwable e) {
- throw new RuntimeException(e);
- }
- }
- };
-
- zooThread.setDaemon(true);
- zooThread.start();
-
- int cnt = 0;
- int port = -1;
- try {
- port = getPort();
- } catch(IllegalStateException e) {
-
- }
- while (port < 1) {
- Thread.sleep(100);
- try {
- port = getPort();
- } catch(IllegalStateException e) {
-
- }
- if (cnt == 40) {
- throw new RuntimeException("Could not get the port for ZooKeeper server");
- }
- cnt++;
- }
- }
-
- @SuppressWarnings("deprecation")
- public void shutdown() throws IOException {
- SolrTestCaseJ4.ignoreException("java.nio.channels.ClosedChannelException");
- // TODO: this can log an exception while trying to unregister a JMX MBean
- try {
- zkServer.shutdown();
- } finally {
- SolrTestCaseJ4.resetExceptionIgnores();
- }
- }
-
-
- public static boolean waitForServerDown(String hp, long timeout) {
- long start = System.currentTimeMillis();
- while (true) {
- try {
- HostPort hpobj = parseHostPortList(hp).get(0);
- send4LetterWord(hpobj.host, hpobj.port, "stat");
- } catch (IOException e) {
- return true;
- }
-
- if (System.currentTimeMillis() > start + timeout) {
- break;
- }
- try {
- Thread.sleep(250);
- } catch (InterruptedException e) {
- // ignore
- }
- }
- return false;
- }
-
- public static class HostPort {
- String host;
- int port;
-
- HostPort(String host, int port) {
- this.host = host;
- this.port = port;
- }
- }
-
- /**
- * Send the 4letterword
- * @param host the destination host
- * @param port the destination port
- * @param cmd the 4letterword
- * @return
- * @throws IOException
- */
- public static String send4LetterWord(String host, int port, String cmd)
- throws IOException
- {
-
- Socket sock = new Socket(host, port);
- BufferedReader reader = null;
- try {
- OutputStream outstream = sock.getOutputStream();
- outstream.write(cmd.getBytes());
- outstream.flush();
- // this replicates NC - close the output stream before reading
- sock.shutdownOutput();
-
- reader =
- new BufferedReader(
- new InputStreamReader(sock.getInputStream()));
- StringBuilder sb = new StringBuilder();
- String line;
- while((line = reader.readLine()) != null) {
- sb.append(line + "\n");
- }
- return sb.toString();
- } finally {
- sock.close();
- if (reader != null) {
- reader.close();
- }
- }
- }
-
- public static List<HostPort> parseHostPortList(String hplist) {
- ArrayList<HostPort> alist = new ArrayList<HostPort>();
- for (String hp : hplist.split(",")) {
- int idx = hp.lastIndexOf(':');
- String host = hp.substring(0, idx);
- int port;
- try {
- port = Integer.parseInt(hp.substring(idx + 1));
- } catch (RuntimeException e) {
- throw new RuntimeException("Problem parsing " + hp + e.toString());
- }
- alist.add(new HostPort(host, port));
- }
- return alist;
- }
-}
+package org.apache.solr.cloud;
+
+/**
+ * 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 java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.management.JMException;
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.zookeeper.jmx.ManagedUtil;
+import org.apache.zookeeper.server.NIOServerCnxn;
+import org.apache.zookeeper.server.ServerConfig;
+import org.apache.zookeeper.server.ZooKeeperServer;
+import org.apache.zookeeper.server.SessionTracker.Session;
+import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig.ConfigException;
+
+public class ZkTestServer {
+
+ protected final ZKServerMain zkServer = new ZKServerMain();
+
+ private String zkDir;
+
+ private int clientPort;
+
+ private Thread zooThread;
+
+ class ZKServerMain {
+
+ private NIOServerCnxn.Factory cnxnFactory;
+ private ZooKeeperServer zooKeeperServer;
+
+ protected void initializeAndRun(String[] args) throws ConfigException,
+ IOException {
+ try {
+ ManagedUtil.registerLog4jMBeans();
+ } catch (JMException e) {
+
+ }
+
+ ServerConfig config = new ServerConfig();
+ if (args.length == 1) {
+ config.parse(args[0]);
+ } else {
+ config.parse(args);
+ }
+
+ runFromConfig(config);
+ }
+
+ /**
+ * Run from a ServerConfig.
+ *
+ * @param config ServerConfig to use.
+ * @throws IOException
+ */
+ public void runFromConfig(ServerConfig config) throws IOException {
+ try {
+ // Note that this thread isn't going to be doing anything else,
+ // so rather than spawning another thread, we will just call
+ // run() in this thread.
+ // create a file logger url from the command line args
+ zooKeeperServer = new ZooKeeperServer();
+
+ FileTxnSnapLog ftxn = new FileTxnSnapLog(new File(config
+ .getDataLogDir()), new File(config.getDataDir()));
+ zooKeeperServer.setTxnLogFactory(ftxn);
+ zooKeeperServer.setTickTime(config.getTickTime());
+ cnxnFactory = new NIOServerCnxn.Factory(config.getClientPortAddress(), config
+ .getMaxClientCnxns());
+ cnxnFactory.startup(zooKeeperServer);
+ cnxnFactory.join();
+ if (zooKeeperServer.isRunning()) {
+ zooKeeperServer.shutdown();
+ }
+ } catch (InterruptedException e) {
+ }
+ }
+
+ /**
+ * Shutdown the serving instance
+ * @throws IOException
+ */
+ protected void shutdown() throws IOException {
+ zooKeeperServer.shutdown();
+ zooKeeperServer.getZKDatabase().close();
+ waitForServerDown(getZkHost() + ":" + getPort(), 5000);
+ cnxnFactory.shutdown();
+ }
+
+ public int getLocalPort() {
+ if (cnxnFactory == null) {
+ throw new IllegalStateException("A port has not yet been selected");
+ }
+ int port = cnxnFactory.getLocalPort();
+ if (port == 0) {
+ throw new IllegalStateException("A port has not yet been selected");
+ }
+ return port;
+ }
+ }
+
+ public ZkTestServer(String zkDir) {
+ this.zkDir = zkDir;
+ }
+
+ public ZkTestServer(String zkDir, int port) {
+ this.zkDir = zkDir;
+ this.clientPort = port;
+ }
+
+ public String getZkHost() {
+ return "127.0.0.1:" + zkServer.getLocalPort();
+ }
+
+ public String getZkAddress() {
+ return "127.0.0.1:" + zkServer.getLocalPort() + "/solr";
+ }
+
+ public int getPort() {
+ return zkServer.getLocalPort();
+ }
+
+ public void expire(final long sessionId) {
+ zkServer.zooKeeperServer.expire(new Session() {
+ @Override
+ public long getSessionId() {
+ return sessionId;
+ }
+ @Override
+ public int getTimeout() {
+ return 4000;
+ }});
+ }
+
+ public void run() throws InterruptedException {
+ // we don't call super.setUp
+ zooThread = new Thread() {
+
+ @Override
+ public void run() {
+ ServerConfig config = new ServerConfig() {
+
+ {
+ setClientPort(ZkTestServer.this.clientPort);
+ this.dataDir = zkDir;
+ this.dataLogDir = zkDir;
+ this.tickTime = 1500;
+ }
+
+ public void setClientPort(int clientPort) {
+ if (clientPortAddress != null) {
+ try {
+ this.clientPortAddress = new InetSocketAddress(
+ InetAddress.getByName(clientPortAddress.getHostName()), clientPort);
+ } catch (UnknownHostException e) {
+ throw new RuntimeException(e);
+ }
+ } else {
+ this.clientPortAddress = new InetSocketAddress(clientPort);
+ }
+ }
+ };
+
+ try {
+ zkServer.runFromConfig(config);
+ } catch (Throwable e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+
+ zooThread.setDaemon(true);
+ zooThread.start();
+
+ int cnt = 0;
+ int port = -1;
+ try {
+ port = getPort();
+ } catch(IllegalStateException e) {
+
+ }
+ while (port < 1) {
+ Thread.sleep(100);
+ try {
+ port = getPort();
+ } catch(IllegalStateException e) {
+
+ }
+ if (cnt == 40) {
+ throw new RuntimeException("Could not get the port for ZooKeeper server");
+ }
+ cnt++;
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public void shutdown() throws IOException {
+ SolrTestCaseJ4.ignoreException("java.nio.channels.ClosedChannelException");
+ // TODO: this can log an exception while trying to unregister a JMX MBean
+ try {
+ zkServer.shutdown();
+ } finally {
+ SolrTestCaseJ4.resetExceptionIgnores();
+ }
+ }
+
+
+ public static boolean waitForServerDown(String hp, long timeout) {
+ long start = System.currentTimeMillis();
+ while (true) {
+ try {
+ HostPort hpobj = parseHostPortList(hp).get(0);
+ send4LetterWord(hpobj.host, hpobj.port, "stat");
+ } catch (IOException e) {
+ return true;
+ }
+
+ if (System.currentTimeMillis() > start + timeout) {
+ break;
+ }
+ try {
+ Thread.sleep(250);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+ return false;
+ }
+
+ public static class HostPort {
+ String host;
+ int port;
+
+ HostPort(String host, int port) {
+ this.host = host;
+ this.port = port;
+ }
+ }
+
+ /**
+ * Send the 4letterword
+ * @param host the destination host
+ * @param port the destination port
+ * @param cmd the 4letterword
+ * @return
+ * @throws IOException
+ */
+ public static String send4LetterWord(String host, int port, String cmd)
+ throws IOException
+ {
+
+ Socket sock = new Socket(host, port);
+ BufferedReader reader = null;
+ try {
+ OutputStream outstream = sock.getOutputStream();
+ outstream.write(cmd.getBytes("US-ASCII"));
+ outstream.flush();
+ // this replicates NC - close the output stream before reading
+ sock.shutdownOutput();
+
+ reader =
+ new BufferedReader(
+ new InputStreamReader(sock.getInputStream()));
+ StringBuilder sb = new StringBuilder();
+ String line;
+ while((line = reader.readLine()) != null) {
+ sb.append(line + "\n");
+ }
+ return sb.toString();
+ } finally {
+ sock.close();
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ }
+
+ public static List<HostPort> parseHostPortList(String hplist) {
+ ArrayList<HostPort> alist = new ArrayList<HostPort>();
+ for (String hp : hplist.split(",")) {
+ int idx = hp.lastIndexOf(':');
+ String host = hp.substring(0, idx);
+ int port;
+ try {
+ port = Integer.parseInt(hp.substring(idx + 1));
+ } catch (RuntimeException e) {
+ throw new RuntimeException("Problem parsing " + hp + e.toString());
+ }
+ alist.add(new HostPort(host, port));
+ }
+ return alist;
+ }
+}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/common/util/ContentStreamTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/common/util/ContentStreamTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/common/util/ContentStreamTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/common/util/ContentStreamTest.java Wed Feb 9 01:03:49 2011
@@ -27,6 +27,7 @@ import java.io.InputStream;
import java.io.StringReader;
import java.net.ConnectException;
import java.net.URL;
+import java.net.URLConnection;
import org.apache.commons.io.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
@@ -42,7 +43,7 @@ public class ContentStreamTest extends L
String input = "aads ghaskdgasgldj asl sadg ajdsg &jag # @ hjsakg hsakdg hjkas s";
ContentStreamBase stream = new ContentStreamBase.StringStream( input );
assertEquals( input.length(), stream.getSize().intValue() );
- assertEquals( input, IOUtils.toString( stream.getStream() ) );
+ assertEquals( input, IOUtils.toString( stream.getStream(), "UTF-8" ) );
assertEquals( input, IOUtils.toString( stream.getReader() ) );
}
@@ -64,12 +65,15 @@ public class ContentStreamTest extends L
public void testURLStream() throws IOException
{
- String content = null;
+ byte[] content = null;
+ String contentType = null;
URL url = new URL( "http://svn.apache.org/repos/asf/lucene/dev/trunk/" );
InputStream in = null;
try {
- in = url.openStream();
- content = IOUtils.toString( in );
+ URLConnection conn = url.openConnection();
+ in = conn.getInputStream();
+ contentType = conn.getContentType();
+ content = IOUtils.toByteArray(in);
} catch (ConnectException ex) {
assumeNoException("Unable to connect to " + url + " to run the test.", ex);
}finally {
@@ -78,23 +82,26 @@ public class ContentStreamTest extends L
}
}
- assertTrue( content.length() > 10 ); // found something...
+ assertTrue( content.length > 10 ); // found something...
ContentStreamBase stream = new ContentStreamBase.URLStream( url );
- assertEquals( content.length(), stream.getSize().intValue() );
+ assertEquals( content.length, stream.getSize().intValue() );
// Test the stream
in = stream.getStream();
try {
assertTrue( IOUtils.contentEquals(
- new ByteArrayInputStream( content.getBytes() ), in ) );
+ new ByteArrayInputStream(content), in ) );
}
finally {
IOUtils.closeQuietly(in);
}
+ String charset = ContentStreamBase.getCharsetFromContentType(contentType);
+ if (charset == null)
+ charset = ContentStreamBase.DEFAULT_CHARSET;
// Re-open the stream and this time use a reader
stream = new ContentStreamBase.URLStream( url );
- assertTrue( IOUtils.contentEquals( new StringReader( content ), stream.getReader() ) );
+ assertTrue( IOUtils.contentEquals( new StringReader(new String(content, charset)), stream.getReader() ) );
}
}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/common/util/DOMUtilTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/common/util/DOMUtilTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/common/util/DOMUtilTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/common/util/DOMUtilTest.java Wed Feb 9 01:03:49 2011
@@ -17,7 +17,7 @@
package org.apache.solr.common.util;
-import java.io.ByteArrayInputStream;
+import java.io.StringReader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -27,6 +27,7 @@ import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
import org.apache.lucene.util.LuceneTestCase;
@@ -85,6 +86,6 @@ public class DOMUtilTest extends LuceneT
}
public Document getDocument( String xml ) throws Exception {
- return builder.parse( new ByteArrayInputStream( xml.getBytes() ) );
+ return builder.parse(new InputSource(new StringReader(xml)));
}
}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/AlternateDirectoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/AlternateDirectoryTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/AlternateDirectoryTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/AlternateDirectoryTest.java Wed Feb 9 01:03:49 2011
@@ -48,6 +48,7 @@ public class AlternateDirectoryTest exte
public static volatile boolean openCalled = false;
public static volatile Directory dir;
+ @Override
public Directory open(String path) throws IOException {
openCalled = true;
// need to close the directory, or otherwise the test fails.
@@ -63,6 +64,7 @@ public class AlternateDirectoryTest exte
static public class TestIndexReaderFactory extends IndexReaderFactory {
static volatile boolean newReaderCalled = false;
+ @Override
public IndexReader newReader(Directory indexDir, boolean readOnly)
throws IOException {
TestIndexReaderFactory.newReaderCalled = true;
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/DummyValueSourceParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/DummyValueSourceParser.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/DummyValueSourceParser.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/DummyValueSourceParser.java Wed Feb 9 01:03:49 2011
@@ -32,17 +32,21 @@ import org.apache.solr.search.function.V
public class DummyValueSourceParser extends ValueSourceParser {
private NamedList args;
+ @Override
public void init(NamedList args) {
this.args = args;
}
+ @Override
public ValueSource parse(FunctionQParser fp) throws ParseException {
ValueSource source = fp.parseValueSource();
ValueSource result = new SimpleFloatFunction(source) {
+ @Override
protected String name() {
return "foo";
}
+ @Override
protected float func(int doc, DocValues vals) {
float result = 0;
return result;
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/IndexReaderFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/IndexReaderFactoryTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/IndexReaderFactoryTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/IndexReaderFactoryTest.java Wed Feb 9 01:03:49 2011
@@ -20,10 +20,12 @@ import org.apache.solr.util.AbstractSolr
public class IndexReaderFactoryTest extends AbstractSolrTestCase {
+ @Override
public String getSchemaFile() {
return "schema.xml";
}
+ @Override
public String getSolrConfigFile() {
return "solrconfig-termindex.xml";
}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/MockQuerySenderListenerReqHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/MockQuerySenderListenerReqHandler.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/MockQuerySenderListenerReqHandler.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/MockQuerySenderListenerReqHandler.java Wed Feb 9 01:03:49 2011
@@ -34,36 +34,43 @@ public class MockQuerySenderListenerReqH
AtomicInteger initCounter = new AtomicInteger(0);
+ @Override
public void init(NamedList args) {
initCounter.incrementAndGet();
super.init(args);
}
+ @Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
this.req = req;
this.rsp = rsp;
}
+ @Override
public String getDescription() {
String result = null;
return result;
}
+ @Override
public String getSourceId() {
String result = null;
return result;
}
+ @Override
public String getSource() {
String result = null;
return result;
}
+ @Override
public String getVersion() {
String result = null;
return result;
}
+ @Override
public NamedList<Object> getStatistics() {
NamedList<Object> lst = super.getStatistics();
lst.add("initCount", initCounter.intValue());
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java Wed Feb 9 01:03:49 2011
@@ -42,6 +42,7 @@ import org.xml.sax.SAXException;
*/
public class TestArbitraryIndexDir extends AbstractSolrTestCase{
+ @Override
public void setUp() throws Exception {
super.setUp();
@@ -58,6 +59,7 @@ public class TestArbitraryIndexDir exten
("standard",0,20,"version","2.2");
}
+ @Override
public void tearDown() throws Exception {
super.tearDown();
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestBadConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestBadConfig.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestBadConfig.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestBadConfig.java Wed Feb 9 01:03:49 2011
@@ -21,9 +21,12 @@ import org.apache.solr.util.AbstractSolr
public class TestBadConfig extends AbstractSolrTestCase {
+ @Override
public String getSchemaFile() { return "schema.xml"; }
+ @Override
public String getSolrConfigFile() { return "bad_solrconfig.xml"; }
+ @Override
public void setUp() throws Exception {
ignoreException("unset.sys.property");
try {
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestJmxIntegration.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestJmxIntegration.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestJmxIntegration.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestJmxIntegration.java Wed Feb 9 01:03:49 2011
@@ -46,6 +46,7 @@ public class TestJmxIntegration extends
return "solrconfig.xml";
}
+ @Override
@Before
public void setUp() throws Exception {
// Make sure that at least one MBeanServer is available
@@ -53,6 +54,7 @@ public class TestJmxIntegration extends
super.setUp();
}
+ @Override
@After
public void tearDown() throws Exception {
super.tearDown();
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestJmxMonitoredMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestJmxMonitoredMap.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestJmxMonitoredMap.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestJmxMonitoredMap.java Wed Feb 9 01:03:49 2011
@@ -51,6 +51,7 @@ public class TestJmxMonitoredMap extends
private JmxMonitoredMap<String, SolrInfoMBean> monitoredMap;
+ @Override
@Before
public void setUp() throws Exception {
super.setUp();
@@ -84,6 +85,7 @@ public class TestJmxMonitoredMap extends
}
}
+ @Override
@After
public void tearDown() throws Exception {
try {
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestLegacyMergeSchedulerPolicyConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestLegacyMergeSchedulerPolicyConfig.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestLegacyMergeSchedulerPolicyConfig.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestLegacyMergeSchedulerPolicyConfig.java Wed Feb 9 01:03:49 2011
@@ -1,5 +1,22 @@
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 java.io.IOException;
import org.apache.lucene.index.IndexWriter;
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestPropInject.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestPropInject.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestPropInject.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestPropInject.java Wed Feb 9 01:03:49 2011
@@ -1,5 +1,22 @@
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 java.io.IOException;
import org.apache.lucene.index.ConcurrentMergeScheduler;
@@ -9,10 +26,12 @@ import org.apache.solr.update.DirectUpda
import org.apache.solr.util.AbstractSolrTestCase;
public class TestPropInject extends AbstractSolrTestCase {
+ @Override
public String getSchemaFile() {
return "schema.xml";
}
+ @Override
public String getSolrConfigFile() {
return "solrconfig-propinject.xml";
}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestSolrDeletionPolicy1.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestSolrDeletionPolicy1.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestSolrDeletionPolicy1.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestSolrDeletionPolicy1.java Wed Feb 9 01:03:49 2011
@@ -34,6 +34,7 @@ public class TestSolrDeletionPolicy1 ext
initCore("solrconfig-delpolicy1.xml","schema.xml");
}
+ @Override
@Before
public void setUp() throws Exception {
super.setUp();
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java Wed Feb 9 01:03:49 2011
@@ -1,5 +1,22 @@
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 java.io.File;
import org.apache.commons.io.FileUtils;
@@ -16,11 +33,13 @@ import javax.xml.parsers.DocumentBuilder
public class TestXIncludeConfig extends AbstractSolrTestCase {
protected boolean supports;
+ @Override
public String getSchemaFile() {
return "schema.xml";
}
//public String getSolrConfigFile() { return "solrconfig.xml"; }
+ @Override
public String getSolrConfigFile() {
return "solrconfig-xinclude.xml";
}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/DocumentAnalysisRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/DocumentAnalysisRequestHandlerTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/DocumentAnalysisRequestHandlerTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/DocumentAnalysisRequestHandlerTest.java Wed Feb 9 01:03:49 2011
@@ -30,8 +30,12 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.Reader;
/**
* A test for {@link DocumentAnalysisRequestHandler}.
@@ -71,15 +75,14 @@ public class DocumentAnalysisRequestHand
"</doc>" +
"</docs>";
- final List<ContentStream> contentStreams = new ArrayList<ContentStream>(1);
- contentStreams.add(new ContentStreamBase.StringStream(docsInput));
+ final ContentStream cs = new ContentStreamBase.StringStream(docsInput);
ModifiableSolrParams params = new ModifiableSolrParams();
params.add("analysis.query", "The Query String");
params.add("analysis.showmatch", "true");
SolrQueryRequest req = new SolrQueryRequestBase(h.getCore(), params) {
@Override
public Iterable<ContentStream> getContentStreams() {
- return contentStreams;
+ return Collections.singleton(cs);
}
};
@@ -106,6 +109,94 @@ public class DocumentAnalysisRequestHand
req.close();
}
+ /** A binary-only ContentStream */
+ static class ByteStream extends ContentStreamBase {
+ private final byte[] bytes;
+
+ public ByteStream(byte[] bytes, String contentType) {
+ this.bytes = bytes;
+ this.contentType = contentType;
+ name = null;
+ size = Long.valueOf(bytes.length);
+ sourceInfo = "rawBytes";
+ }
+
+ public InputStream getStream() throws IOException {
+ return new ByteArrayInputStream(bytes);
+ }
+
+ @Override
+ public Reader getReader() throws IOException {
+ throw new IOException("This is a byte stream, Readers are not supported.");
+ }
+ }
+
+
+ // This test should also test charset detection in UpdateRequestHandler,
+ // but the DocumentAnalysisRequestHandler is simplier to use/check.
+ @Test
+ public void testCharsetInDocument() throws Exception {
+ final byte[] xmlBytes = (
+ "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n" +
+ "<docs>\r\n" +
+ " <doc>\r\n" +
+ " <field name=\"id\">Müller</field>\r\n" +
+ " </doc>" +
+ "</docs>"
+ ).getBytes("ISO-8859-1");
+
+ // we declare a content stream without charset:
+ final ContentStream cs = new ByteStream(xmlBytes, "application/xml");
+
+ ModifiableSolrParams params = new ModifiableSolrParams();
+ SolrQueryRequest req = new SolrQueryRequestBase(h.getCore(), params) {
+ @Override
+ public Iterable<ContentStream> getContentStreams() {
+ return Collections.singleton(cs);
+ }
+ };
+
+ DocumentAnalysisRequest request = handler.resolveAnalysisRequest(req);
+ assertNotNull(request);
+ final List<SolrInputDocument> documents = request.getDocuments();
+ assertNotNull(documents);
+ assertEquals(1, documents.size());
+ SolrInputDocument doc = documents.get(0);
+ assertEquals("Müller", doc.getField("id").getValue());
+ }
+
+ // This test should also test charset detection in UpdateRequestHandler,
+ // but the DocumentAnalysisRequestHandler is simplier to use/check.
+ @Test
+ public void testCharsetOutsideDocument() throws Exception {
+ final byte[] xmlBytes = (
+ "<docs>\r\n" +
+ " <doc>\r\n" +
+ " <field name=\"id\">Müller</field>\r\n" +
+ " </doc>" +
+ "</docs>"
+ ).getBytes("ISO-8859-1");
+
+ // we declare a content stream with charset:
+ final ContentStream cs = new ByteStream(xmlBytes, "application/xml; charset=ISO-8859-1");
+
+ ModifiableSolrParams params = new ModifiableSolrParams();
+ SolrQueryRequest req = new SolrQueryRequestBase(h.getCore(), params) {
+ @Override
+ public Iterable<ContentStream> getContentStreams() {
+ return Collections.singleton(cs);
+ }
+ };
+
+ DocumentAnalysisRequest request = handler.resolveAnalysisRequest(req);
+ assertNotNull(request);
+ final List<SolrInputDocument> documents = request.getDocuments();
+ assertNotNull(documents);
+ assertEquals(1, documents.size());
+ SolrInputDocument doc = documents.get(0);
+ assertEquals("Müller", doc.getField("id").getValue());
+ }
+
/**
* Tests the {@link DocumentAnalysisRequestHandler#handleAnalysisRequest(org.apache.solr.client.solrj.request.DocumentAnalysisRequest,
* org.apache.solr.schema.IndexSchema)}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/JsonLoaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/JsonLoaderTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/JsonLoaderTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/JsonLoaderTest.java Wed Feb 9 01:03:49 2011
@@ -146,23 +146,28 @@ class BufferingRequestProcessor extends
super(next);
}
+ @Override
public void processAdd(AddUpdateCommand cmd) throws IOException {
addCommands.add( cmd );
}
+ @Override
public void processDelete(DeleteUpdateCommand cmd) throws IOException {
deleteCommands.add( cmd );
}
+ @Override
public void processCommit(CommitUpdateCommand cmd) throws IOException {
commitCommands.add( cmd );
}
+ @Override
public void processRollback(RollbackUpdateCommand cmd) throws IOException
{
rollbackCommands.add( cmd );
}
+ @Override
public void finish() throws IOException {
// nothing?
}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java Wed Feb 9 01:03:49 2011
@@ -94,7 +94,17 @@ public class MoreLikeThisHandlerTest ext
assertQ("morelike this - harrison ford",mltreq
,"//result/doc[1]/int[@name='id'][.='45']");
+ // test MoreLikeThis debug
+ params.set(CommonParams.DEBUG_QUERY, "true");
+ assertQ("morelike this - harrison ford",mltreq
+ ,"//lst[@name='debug']/lst[@name='moreLikeThis']/lst[@name='44']/str[@name='rawMLTQuery']"
+ ,"//lst[@name='debug']/lst[@name='moreLikeThis']/lst[@name='44']/str[@name='boostedMLTQuery']"
+ ,"//lst[@name='debug']/lst[@name='moreLikeThis']/lst[@name='44']/str[@name='realMLTQuery']"
+ ,"//lst[@name='debug']/lst[@name='moreLikeThis']/lst[@name='44']/lst[@name='explain']/str[@name='45']"
+ );
+
// test that qparser plugins work
+ params.remove(CommonParams.DEBUG_QUERY);
params.set(CommonParams.Q, "{!field f=id}44");
assertQ(mltreq
,"//result/doc[1]/int[@name='id'][.='45']");
@@ -112,9 +122,9 @@ public class MoreLikeThisHandlerTest ext
assertQ(mltreq
,"//result/doc[1]/int[@name='id'][.='45']");
- // test that debugging works
+ // test that debugging works (test for MoreLikeThis*Handler*)
params.set(CommonParams.QT, "/mlt");
- params.set("debugQuery", "true");
+ params.set(CommonParams.DEBUG_QUERY, "true");
assertQ(mltreq
,"//result/doc[1]/int[@name='id'][.='45']"
,"//lst[@name='debug']/lst[@name='explain']"
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/StandardRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/StandardRequestHandlerTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/StandardRequestHandlerTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/StandardRequestHandlerTest.java Wed Feb 9 01:03:49 2011
@@ -43,9 +43,9 @@ public class StandardRequestHandlerTest
public void testSorting() throws Exception {
SolrCore core = h.getCore();
- assertU(adoc("id", "10", "title", "test", "val_s", "aaa"));
- assertU(adoc("id", "11", "title", "test", "val_s", "bbb"));
- assertU(adoc("id", "12", "title", "test", "val_s", "ccc"));
+ assertU(adoc("id", "10", "title", "test", "val_s1", "aaa"));
+ assertU(adoc("id", "11", "title", "test", "val_s1", "bbb"));
+ assertU(adoc("id", "12", "title", "test", "val_s1", "ccc"));
assertU(commit());
Map<String,String> args = new HashMap<String, String>();
@@ -58,7 +58,7 @@ public class StandardRequestHandlerTest
,"//*[@numFound='3']"
);
- args.put( CommonParams.SORT, "val_s asc" );
+ args.put( CommonParams.SORT, "val_s1 asc" );
assertQ("with sort param [asc]", req
,"//*[@numFound='3']"
,"//result/doc[1]/int[@name='id'][.='10']"
@@ -66,7 +66,7 @@ public class StandardRequestHandlerTest
,"//result/doc[3]/int[@name='id'][.='12']"
);
- args.put( CommonParams.SORT, "val_s desc" );
+ args.put( CommonParams.SORT, "val_s1 desc" );
assertQ("with sort param [desc]", req
,"//*[@numFound='3']"
,"//result/doc[1]/int[@name='id'][.='12']"
@@ -84,7 +84,7 @@ public class StandardRequestHandlerTest
// Using legacy ';' param
args.remove( CommonParams.SORT );
args.put( QueryParsing.DEFTYPE, "lucenePlusSort" );
- args.put( CommonParams.Q, "title:test; val_s desc" );
+ args.put( CommonParams.Q, "title:test; val_s1 desc" );
assertQ("with sort param [desc]", req
,"//*[@numFound='3']"
,"//result/doc[1]/int[@name='id'][.='12']"
@@ -92,8 +92,8 @@ public class StandardRequestHandlerTest
,"//result/doc[3]/int[@name='id'][.='10']"
);
- args.put( CommonParams.Q, "title:test; val_s asc" );
- assertQ("with sort param [desc]", req
+ args.put( CommonParams.Q, "title:test; val_s1 asc" );
+ assertQ("with sort param [asc]", req
,"//*[@numFound='3']"
,"//result/doc[1]/int[@name='id'][.='10']"
,"//result/doc[2]/int[@name='id'][.='11']"
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/TestCSVLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/TestCSVLoader.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/TestCSVLoader.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/TestCSVLoader.java Wed Feb 9 01:03:49 2011
@@ -41,6 +41,7 @@ public class TestCSVLoader extends SolrT
String def_charset = "UTF-8";
File file = new File(filename);
+ @Override
@Before
public void setUp() throws Exception {
// if you override setUp or tearDown, you better call
@@ -49,6 +50,7 @@ public class TestCSVLoader extends SolrT
cleanup();
}
+ @Override
@After
public void tearDown() throws Exception {
// if you override setUp or tearDown, you better call
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java Wed Feb 9 01:03:49 2011
@@ -25,9 +25,11 @@ import org.apache.lucene.store.SimpleFSD
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.TestDistributedSearch;
import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
+import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
@@ -42,6 +44,8 @@ import org.junit.Test;
import java.io.*;
import java.net.URL;
+import java.util.Map;
+import java.util.HashMap;
/**
* Test for ReplicationHandler
@@ -53,7 +57,6 @@ public class TestReplicationHandler exte
private static final String CONF_DIR = "." + File.separator + "solr" + File.separator + "conf" + File.separator;
- private static final String SLAVE_CONFIG = CONF_DIR + "solrconfig-slave.xml";
static JettySolrRunner masterJetty, slaveJetty;
static SolrServer masterClient, slaveClient;
@@ -157,6 +160,80 @@ public class TestReplicationHandler exte
return res;
}
+ private NamedList<Object> getDetails(SolrServer s) throws Exception {
+
+
+ ModifiableSolrParams params = new ModifiableSolrParams();
+ params.set("command","details");
+ params.set("qt","/replication");
+ QueryRequest req = new QueryRequest(params);
+
+ NamedList<Object> res = s.request(req);
+
+ assertNotNull("null response from server", res);
+
+ @SuppressWarnings("unchecked") NamedList<Object> details
+ = (NamedList<Object>) res.get("details");
+
+ assertNotNull("null details", details);
+
+ return details;
+ }
+
+ @Test
+ public void testDetails() throws Exception {
+ {
+ NamedList<Object> details = getDetails(masterClient);
+
+ assertEquals("master isMaster?",
+ "true", details.get("isMaster"));
+ assertEquals("master isSlave?",
+ "false", details.get("isSlave"));
+ assertNotNull("master has master section",
+ details.get("master"));
+ }
+ {
+ NamedList<Object> details = getDetails(slaveClient);
+
+ assertEquals("slave isMaster?",
+ "false", details.get("isMaster"));
+ assertEquals("slave isSlave?",
+ "true", details.get("isSlave"));
+ assertNotNull("slave has slave section",
+ details.get("slave"));
+ }
+
+ SolrInstance repeater = null;
+ JettySolrRunner repeaterJetty = null;
+ SolrServer repeaterClient = null;
+ try {
+ repeater = new SolrInstance("repeater", masterJetty.getLocalPort());
+ repeater.setUp();
+ repeaterJetty = createJetty(repeater);
+ repeaterClient = createNewSolrServer(repeaterJetty.getLocalPort());
+
+
+ NamedList<Object> details = getDetails(repeaterClient);
+
+ assertEquals("repeater isMaster?",
+ "true", details.get("isMaster"));
+ assertEquals("repeater isSlave?",
+ "true", details.get("isSlave"));
+ assertNotNull("repeater has master section",
+ details.get("master"));
+ assertNotNull("repeater has slave section",
+ details.get("slave"));
+
+ } finally {
+ try {
+ if (repeaterJetty != null) repeaterJetty.stop();
+ } catch (Exception e) { /* :NOOP: */ }
+ try {
+ if (repeater != null) repeater.tearDown();
+ } catch (Exception e) { /* :NOOP: */ }
+ }
+ }
+
@Test
public void testReplicateAfterWrite2Slave() throws Exception {
clearIndexWithReplication();
@@ -250,14 +327,15 @@ public class TestReplicationHandler exte
masterClient.commit();
//change the schema on master
- copyFile(getFile(CONF_DIR + "schema-replication2.xml"), new File(master.getConfDir(), "schema.xml"));
+ master.copyConfigFile(CONF_DIR + "schema-replication2.xml", "schema.xml");
masterJetty.stop();
masterJetty = createJetty(master);
masterClient = createNewSolrServer(masterJetty.getLocalPort());
- copyFile(getFile(SLAVE_CONFIG), new File(slave.getConfDir(), "solrconfig.xml"), masterJetty.getLocalPort());
+ slave.setTestPort(masterJetty.getLocalPort());
+ slave.copyConfigFile(slave.getSolrConfigFile(), "solrconfig.xml");
slaveJetty.stop();
slaveJetty = createJetty(slave);
@@ -349,7 +427,7 @@ public class TestReplicationHandler exte
public void testSnapPullWithMasterUrl() throws Exception {
//change solrconfig on slave
//this has no entry for pollinginterval
- copyFile(getFile(CONF_DIR + "solrconfig-slave1.xml"), new File(slave.getConfDir(), "solrconfig.xml"), masterJetty.getLocalPort());
+ slave.copyConfigFile(CONF_DIR + "solrconfig-slave1.xml", "solrconfig.xml");
slaveJetty.stop();
slaveJetty = createJetty(slave);
slaveClient = createNewSolrServer(slaveJetty.getLocalPort());
@@ -386,7 +464,7 @@ public class TestReplicationHandler exte
// NOTE: at this point, the slave is not polling any more
// restore it.
- copyFile(getFile(CONF_DIR + "solrconfig-slave.xml"), new File(slave.getConfDir(), "solrconfig.xml"), masterJetty.getLocalPort());
+ slave.copyConfigFile(CONF_DIR + "solrconfig-slave.xml", "solrconfig.xml");
slaveJetty.stop();
slaveJetty = createJetty(slave);
slaveClient = createNewSolrServer(slaveJetty.getLocalPort());
@@ -410,15 +488,16 @@ public class TestReplicationHandler exte
assertEquals(nDocs, masterQueryResult.getNumFound());
//change solrconfig having 'replicateAfter startup' option on master
- copyFile(getFile(CONF_DIR + "solrconfig-master2.xml"),
- new File(master.getConfDir(), "solrconfig.xml"));
+ master.copyConfigFile(CONF_DIR + "solrconfig-master2.xml",
+ "solrconfig.xml");
masterJetty.stop();
masterJetty = createJetty(master);
masterClient = createNewSolrServer(masterJetty.getLocalPort());
- copyFile(getFile(SLAVE_CONFIG), new File(slave.getConfDir(), "solrconfig.xml"), masterJetty.getLocalPort());
+ slave.setTestPort(masterJetty.getLocalPort());
+ slave.copyConfigFile(slave.getSolrConfigFile(), "solrconfig.xml");
//start slave
slaveJetty = createJetty(slave);
@@ -435,11 +514,14 @@ public class TestReplicationHandler exte
// NOTE: the master only replicates after startup now!
// revert that change.
- copyFile(getFile(CONF_DIR + "solrconfig-master.xml"), new File(master.getConfDir(), "solrconfig.xml"));
+ master.copyConfigFile(CONF_DIR + "solrconfig-master.xml", "solrconfig.xml");
masterJetty.stop();
masterJetty = createJetty(master);
masterClient = createNewSolrServer(masterJetty.getLocalPort());
- copyFile(getFile(SLAVE_CONFIG), new File(slave.getConfDir(), "solrconfig.xml"), masterJetty.getLocalPort());
+
+ slave.setTestPort(masterJetty.getLocalPort());
+ slave.copyConfigFile(slave.getSolrConfigFile(), "solrconfig.xml");
+
//start slave
slaveJetty.stop();
slaveJetty = createJetty(slave);
@@ -477,20 +559,24 @@ public class TestReplicationHandler exte
masterClient.commit();
//change solrconfig on master
- copyFile(getFile(CONF_DIR + "solrconfig-master1.xml"), new File(master.getConfDir(), "solrconfig.xml"));
+ master.copyConfigFile(CONF_DIR + "solrconfig-master1.xml",
+ "solrconfig.xml");
//change schema on master
- copyFile(getFile(CONF_DIR + "schema-replication2.xml"), new File(master.getConfDir(), "schema.xml"));
+ master.copyConfigFile(CONF_DIR + "schema-replication2.xml",
+ "schema.xml");
//keep a copy of the new schema
- copyFile(getFile(CONF_DIR + "schema-replication2.xml"), new File(master.getConfDir(), "schema-replication2.xml"));
+ master.copyConfigFile(CONF_DIR + "schema-replication2.xml",
+ "schema-replication2.xml");
masterJetty.stop();
masterJetty = createJetty(master);
masterClient = createNewSolrServer(masterJetty.getLocalPort());
- copyFile(getFile(SLAVE_CONFIG), new File(slave.getConfDir(), "solrconfig.xml"), masterJetty.getLocalPort());
+ slave.setTestPort(masterJetty.getLocalPort());
+ slave.copyConfigFile(slave.getSolrConfigFile(), "solrconfig.xml");
slaveJetty.stop();
slaveJetty = createJetty(slave);
@@ -521,12 +607,12 @@ public class TestReplicationHandler exte
@Test
public void testBackup() throws Exception {
masterJetty.stop();
- copyFile(getFile(CONF_DIR + "solrconfig-master1.xml"), new File(master.getConfDir(), "solrconfig.xml"));
+ master.copyConfigFile(CONF_DIR + "solrconfig-master1.xml",
+ "solrconfig.xml");
masterJetty = createJetty(master);
masterClient = createNewSolrServer(masterJetty.getLocalPort());
-
nDocs--;
masterClient.deleteByQuery("*:*");
for (int i = 0; i < nDocs; i++)
@@ -536,6 +622,7 @@ public class TestReplicationHandler exte
class BackupThread extends Thread {
volatile String fail = null;
+ @Override
public void run() {
String masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=" + ReplicationHandler.CMD_BACKUP;
URL url;
@@ -560,6 +647,7 @@ public class TestReplicationHandler exte
volatile String fail = null;
volatile String response = null;
volatile boolean success = false;
+ @Override
public void run() {
String masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=" + ReplicationHandler.CMD_DETAILS;
URL url;
@@ -567,7 +655,7 @@ public class TestReplicationHandler exte
try {
url = new URL(masterUrl);
stream = url.openStream();
- response = IOUtils.toString(stream);
+ response = IOUtils.toString(stream, "UTF-8");
if(response.contains("<str name=\"status\">success</str>")) {
success = true;
}
@@ -646,19 +734,22 @@ public class TestReplicationHandler exte
private static class SolrInstance {
- String name;
- Integer masterPort;
- File homeDir;
- File confDir;
- File dataDir;
+ private String name;
+ private Integer testPort;
+ private File homeDir;
+ private File confDir;
+ private File dataDir;
/**
- * if masterPort is null, this instance is a master -- otherwise this instance is a slave, and assumes the master is
- * on localhost at the specified port.
+ * @param name used to pick new solr home dir, as well as which
+ * "solrconfig-${name}.xml" file gets copied
+ * to solrconfig.xml in new conf dir.
+ * @param testPort if not null, used as a replacement for
+ * TEST_PORT in the cloned config files.
*/
- public SolrInstance(String name, Integer port) {
+ public SolrInstance(String name, Integer testPort) {
this.name = name;
- this.masterPort = port;
+ this.testPort = testPort;
}
public String getHomeDir() {
@@ -678,43 +769,47 @@ public class TestReplicationHandler exte
}
public String getSolrConfigFile() {
- String fname = "";
- if (null == masterPort)
- fname = CONF_DIR + "solrconfig-master.xml";
- else
- fname = SLAVE_CONFIG;
- return fname;
+ return CONF_DIR + "solrconfig-"+name+".xml";
+ }
+
+ /** If it needs to change */
+ public void setTestPort(Integer testPort) {
+ this.testPort = testPort;
}
public void setUp() throws Exception {
System.setProperty("solr.test.sys.prop1", "propone");
System.setProperty("solr.test.sys.prop2", "proptwo");
- File home = new File(TEMP_DIR,
- getClass().getName() + "-" + System.currentTimeMillis());
-
- if (null == masterPort) {
- homeDir = new File(home, "master");
- dataDir = new File(homeDir, "data");
- confDir = new File(homeDir, "conf");
- } else {
- homeDir = new File(home, "slave");
- dataDir = new File(homeDir, "data");
- confDir = new File(homeDir, "conf");
- }
+ File home = new File(TEMP_DIR,
+ getClass().getName() + "-" +
+ System.currentTimeMillis());
+
+
+ homeDir = new File(home, name);
+ dataDir = new File(homeDir, "data");
+ confDir = new File(homeDir, "conf");
homeDir.mkdirs();
dataDir.mkdirs();
confDir.mkdirs();
File f = new File(confDir, "solrconfig.xml");
- copyFile(getFile(getSolrConfigFile()), f, masterPort);
- f = new File(confDir, "schema.xml");
- copyFile(getFile(getSchemaFile()), f);
+ copyConfigFile(getSolrConfigFile(), "solrconfig.xml");
+ copyConfigFile(getSchemaFile(), "schema.xml");
}
public void tearDown() throws Exception {
AbstractSolrTestCase.recurseDelete(homeDir);
}
+
+ public void copyConfigFile(String srcFile, String destFile)
+ throws IOException {
+
+ copyFile(getFile(srcFile),
+ new File(confDir, destFile),
+ testPort);
+ }
+
}
}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java Wed Feb 9 01:03:49 2011
@@ -1,5 +1,22 @@
package org.apache.solr.handler.component;
+/**
+ * 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.solr.BaseDistributedSearchTestCase;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.common.params.ModifiableSolrParams;
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/DistributedTermsComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/DistributedTermsComponentTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/DistributedTermsComponentTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/DistributedTermsComponentTest.java Wed Feb 9 01:03:49 2011
@@ -1,5 +1,22 @@
package org.apache.solr.handler.component;
+/**
+ * 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.solr.BaseDistributedSearchTestCase;
/**
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java Wed Feb 9 01:03:49 2011
@@ -120,13 +120,13 @@ public class QueryElevationComponentTest
@Test
public void testSorting() throws IOException
{
- assertU(adoc("id", "a", "title", "ipod", "str_s", "a" ));
- assertU(adoc("id", "b", "title", "ipod ipod", "str_s", "b" ));
- assertU(adoc("id", "c", "title", "ipod ipod ipod", "str_s", "c" ));
-
- assertU(adoc("id", "x", "title", "boosted", "str_s", "x" ));
- assertU(adoc("id", "y", "title", "boosted boosted", "str_s", "y" ));
- assertU(adoc("id", "z", "title", "boosted boosted boosted", "str_s", "z" ));
+ assertU(adoc("id", "a", "title", "ipod", "str_s1", "a" ));
+ assertU(adoc("id", "b", "title", "ipod ipod", "str_s1", "b" ));
+ assertU(adoc("id", "c", "title", "ipod ipod ipod", "str_s1", "c" ));
+
+ assertU(adoc("id", "x", "title", "boosted", "str_s1", "x" ));
+ assertU(adoc("id", "y", "title", "boosted boosted", "str_s1", "y" ));
+ assertU(adoc("id", "z", "title", "boosted boosted boosted", "str_s1", "z" ));
assertU(commit());
String query = "title:ipod";
@@ -188,7 +188,7 @@ public class QueryElevationComponentTest
// Try normal sort by 'id'
// default 'forceBoost' should be false
assertEquals( false, booster.forceElevation );
- args.put( CommonParams.SORT, "str_s asc" );
+ args.put( CommonParams.SORT, "str_s1 asc" );
assertQ( null, req
,"//*[@numFound='4']"
,"//result/doc[1]/str[@name='id'][.='a']"
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java Wed Feb 9 01:03:49 2011
@@ -42,6 +42,7 @@ public class SpellCheckComponentTest ext
initCore("solrconfig-spellcheckcomponent.xml","schema.xml");
}
+ @Override
public void setUp() throws Exception {
super.setUp();
assertU(adoc("id", "0", "lowerfilt", "This is a title"));
@@ -59,6 +60,7 @@ public class SpellCheckComponentTest ext
assertU((commit()));
}
+ @Override
public void tearDown() throws Exception {
super.tearDown();
assertU(delQ("*:*"));
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/highlight/HighlighterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/highlight/HighlighterTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/highlight/HighlighterTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/highlight/HighlighterTest.java Wed Feb 9 01:03:49 2011
@@ -769,4 +769,30 @@ public class HighlighterTest extends Sol
);
}
+
+ public void testSubwordWildcardHighlight() {
+ assertU(adoc("subword", "lorem PowerShot.com ipsum", "id", "1"));
+ assertU(commit());
+ assertQ("subword wildcard highlighting",
+ req("q", "subword:pow*", "hl", "true", "hl.fl", "subword"),
+ "//lst[@name='highlighting']/lst[@name='1']" +
+ "/arr[@name='subword']/str='lorem <em>PowerShot.com</em> ipsum'");
+ }
+
+ public void testSubwordWildcardHighlightWithTermOffsets() {
+ assertU(adoc("subword_offsets", "lorem PowerShot.com ipsum", "id", "1"));
+ assertU(commit());
+ assertQ("subword wildcard highlighting",
+ req("q", "subword_offsets:pow*", "hl", "true", "hl.fl", "subword_offsets"),
+ "//lst[@name='highlighting']/lst[@name='1']" +
+ "/arr[@name='subword_offsets']/str='lorem <em>PowerShot.com</em> ipsum'");
+ }
+ public void testSubwordWildcardHighlightWithTermOffsets2() {
+ assertU(adoc("subword_offsets", "lorem PowerShot ipsum", "id", "1"));
+ assertU(commit());
+ assertQ("subword wildcard highlighting",
+ req("q", "subword_offsets:pow*", "hl", "true", "hl.fl", "subword_offsets"),
+ "//lst[@name='highlighting']/lst[@name='1']" +
+ "/arr[@name='subword_offsets']/str='lorem <em>PowerShot</em> ipsum'");
+ }
}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/request/TestBinaryResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/request/TestBinaryResponseWriter.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/request/TestBinaryResponseWriter.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/request/TestBinaryResponseWriter.java Wed Feb 9 01:03:49 2011
@@ -38,10 +38,12 @@ import java.util.UUID;
*/
public class TestBinaryResponseWriter extends AbstractSolrTestCase {
+ @Override
public String getSchemaFile() {
return "schema12.xml";
}
+ @Override
public String getSolrConfigFile() {
return "solrconfig.xml";
}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/request/TestWriterPerf.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/request/TestWriterPerf.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/request/TestWriterPerf.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/request/TestWriterPerf.java Wed Feb 9 01:03:49 2011
@@ -37,15 +37,19 @@ public class TestWriterPerf extends Abst
public static final Logger log
= LoggerFactory.getLogger(TestWriterPerf.class);
+ @Override
public String getSchemaFile() { return "schema11.xml"; }
+ @Override
public String getSolrConfigFile() { return "solrconfig-functionquery.xml"; }
public String getCoreName() { return "basic"; }
+ @Override
public void setUp() throws Exception {
// if you override setUp or tearDown, you better call
// the super classes version
super.setUp();
}
+ @Override
public void tearDown() throws Exception {
// if you override setUp or tearDown, you better call
// the super classes version
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/schema/CustomSimilarityFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/schema/CustomSimilarityFactory.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/schema/CustomSimilarityFactory.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/schema/CustomSimilarityFactory.java Wed Feb 9 01:03:49 2011
@@ -19,6 +19,7 @@ package org.apache.solr.schema;
import org.apache.lucene.search.SimilarityProvider;
public class CustomSimilarityFactory extends SimilarityFactory {
+ @Override
public SimilarityProvider getSimilarityProvider() {
return new MockConfigurableSimilarity(params.get("echo"));
}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/schema/DateFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/schema/DateFieldTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/schema/DateFieldTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/schema/DateFieldTest.java Wed Feb 9 01:03:49 2011
@@ -29,6 +29,7 @@ public class DateFieldTest extends Lucen
protected DateField f = null;
protected DateMathParser p = new DateMathParser(UTC, Locale.US);
+ @Override
public void setUp() throws Exception {
super.setUp();
f = new DateField();
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/schema/TestBinaryField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/schema/TestBinaryField.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/schema/TestBinaryField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/schema/TestBinaryField.java Wed Feb 9 01:03:49 2011
@@ -174,6 +174,7 @@ public class TestBinaryField extends Luc
}
+ @Override
public void tearDown() throws Exception {
jetty.stop();
super.tearDown();
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/FooQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/FooQParserPlugin.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/FooQParserPlugin.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/FooQParserPlugin.java Wed Feb 9 01:03:49 2011
@@ -27,6 +27,7 @@ import org.apache.lucene.index.Term;
public class FooQParserPlugin extends QParserPlugin {
+ @Override
public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) {
return new FooQParser(qstr, localParams, params, req);
}
@@ -40,6 +41,7 @@ class FooQParser extends QParser {
super(qstr, localParams, params, req);
}
+ @Override
public Query parse() throws ParseException {
return new TermQuery(new Term(localParams.get(QueryParsing.F), localParams.get(QueryParsing.V)));
}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestExtendedDismaxParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestExtendedDismaxParser.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestExtendedDismaxParser.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestExtendedDismaxParser.java Wed Feb 9 01:03:49 2011
@@ -20,15 +20,19 @@ package org.apache.solr.search;
import org.apache.solr.util.AbstractSolrTestCase;
public class TestExtendedDismaxParser extends AbstractSolrTestCase {
+ @Override
public String getSchemaFile() { return "schema12.xml"; }
+ @Override
public String getSolrConfigFile() { return "solrconfig.xml"; }
// public String getCoreName() { return "collection1"; }
+ @Override
public void setUp() throws Exception {
// if you override setUp or tearDown, you better call
// the super classes version
super.setUp();
}
+ @Override
public void tearDown() throws Exception {
// if you override setUp or tearDown, you better call
// the super classes version
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestFastLRUCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestFastLRUCache.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestFastLRUCache.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestFastLRUCache.java Wed Feb 9 01:03:49 2011
@@ -334,6 +334,7 @@ public class TestFastLRUCache extends Lu
for (int i=0; i<threads.length; i++) {
final int seed=random.nextInt();
threads[i] = new Thread() {
+ @Override
public void run() {
int ret = useCache(sc, numGets/nThreads, maxKey, seed);
puts.addAndGet(ret);
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestIndexSearcher.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestIndexSearcher.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestIndexSearcher.java Wed Feb 9 01:03:49 2011
@@ -36,6 +36,7 @@ public class TestIndexSearcher extends S
initCore("solrconfig.xml","schema.xml");
}
+ @Override
public void tearDown() throws Exception {
super.tearDown();
assertU(delQ("*:*"));
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestLRUCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestLRUCache.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestLRUCache.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestLRUCache.java Wed Feb 9 01:03:49 2011
@@ -1,5 +1,22 @@
package org.apache.solr.search;
+/**
+ * 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 java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestQueryTypes.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestQueryTypes.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestQueryTypes.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestQueryTypes.java Wed Feb 9 01:03:49 2011
@@ -21,16 +21,20 @@ import org.apache.solr.util.AbstractSolr
public class TestQueryTypes extends AbstractSolrTestCase {
+ @Override
public String getSchemaFile() { return "schema11.xml"; }
+ @Override
public String getSolrConfigFile() { return "solrconfig.xml"; }
public String getCoreName() { return "basic"; }
+ @Override
public void setUp() throws Exception {
// if you override setUp or tearDown, you better call
// the super classes version
super.setUp();
}
+ @Override
public void tearDown() throws Exception {
// if you override setUp or tearDown, you better call
// the super classes version
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestQueryUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestQueryUtils.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestQueryUtils.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestQueryUtils.java Wed Feb 9 01:03:49 2011
@@ -31,12 +31,16 @@ import java.util.List;
*/
public class TestQueryUtils extends AbstractSolrTestCase {
+ @Override
public String getSchemaFile() { return "schema.xml"; }
+ @Override
public String getSolrConfigFile() { return "solrconfig.xml"; }
+ @Override
public void setUp() throws Exception {
super.setUp();
}
+ @Override
public void tearDown() throws Exception {
super.tearDown();
}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestRangeQuery.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestRangeQuery.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestRangeQuery.java Wed Feb 9 01:03:49 2011
@@ -33,6 +33,7 @@ public class TestRangeQuery extends Solr
initCore("solrconfig.xml", "schema11.xml");
}
+ @Override
@Before
public void setUp() throws Exception {
// if you override setUp or tearDown, you better call
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestSearchPerf.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestSearchPerf.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestSearchPerf.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestSearchPerf.java Wed Feb 9 01:03:49 2011
@@ -35,12 +35,16 @@ import java.io.IOException;
*/
public class TestSearchPerf extends AbstractSolrTestCase {
+ @Override
public String getSchemaFile() { return "schema11.xml"; }
+ @Override
public String getSolrConfigFile() { return "solrconfig.xml"; }
+ @Override
public void setUp() throws Exception {
super.setUp();
}
+ @Override
public void tearDown() throws Exception {
super.tearDown();
}
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestSort.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestSort.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/TestSort.java Wed Feb 9 01:03:49 2011
@@ -33,7 +33,9 @@ import java.io.IOException;
import java.util.*;
public class TestSort extends AbstractSolrTestCase {
+ @Override
public String getSchemaFile() { return null; }
+ @Override
public String getSolrConfigFile() { return null; }
Random r = random;
@@ -49,6 +51,7 @@ public class TestSort extends AbstractSo
String val;
String val2;
+ @Override
public String toString() {
return "{id=" +doc + " val1="+val + " val2="+val2 + "}";
}