You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2012/01/17 17:18:08 UTC
svn commit: r1232458 -
/lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/BinaryUpdateRequestHandlerTest.java
Author: yonik
Date: Tue Jan 17 16:18:07 2012
New Revision: 1232458
URL: http://svn.apache.org/viewvc?rev=1232458&view=rev
Log:
SOLR-3037: missed test
Added:
lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/BinaryUpdateRequestHandlerTest.java (with props)
Added: lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/BinaryUpdateRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/BinaryUpdateRequestHandlerTest.java?rev=1232458&view=auto
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/BinaryUpdateRequestHandlerTest.java (added)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/BinaryUpdateRequestHandlerTest.java Tue Jan 17 16:18:07 2012
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler;
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.client.solrj.impl.BinaryRequestWriter;
+import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.params.UpdateParams;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.response.SolrQueryResponse;
+import org.apache.solr.update.AddUpdateCommand;
+import org.apache.solr.update.processor.BufferingRequestProcessor;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class BinaryUpdateRequestHandlerTest extends SolrTestCaseJ4 {
+
+ @BeforeClass
+ public static void beforeTests() throws Exception {
+ initCore("solrconfig.xml", "schema.xml");
+ }
+
+ @Test
+ public void testRequestParams() throws Exception {
+ SolrInputDocument doc = new SolrInputDocument();
+ doc.addField("id", "1");
+ UpdateRequest ureq = new UpdateRequest();
+ ureq.add(doc);
+ ureq.setParam(UpdateParams.COMMIT_WITHIN, "100");
+ ureq.setParam(UpdateParams.OVERWRITE, Boolean.toString(false));
+
+ BinaryRequestWriter brw = new BinaryRequestWriter();
+ BufferingRequestProcessor p = new BufferingRequestProcessor(null);
+ SolrQueryResponse rsp = new SolrQueryResponse();
+ BinaryUpdateRequestHandler handler = new BinaryUpdateRequestHandler();
+ SolrQueryRequest req = req();
+ ContentStreamLoader csl = handler.newLoader(req, p);
+
+ csl.load(req, rsp, brw.getContentStream(ureq));
+
+ AddUpdateCommand add = p.addCommands.get(0);
+ System.out.println(add.solrDoc);
+ assertEquals(false, add.overwrite);
+ assertEquals(100, add.commitWithin);
+
+ req.close();
+ }
+}