You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dk...@apache.org on 2011/12/02 18:03:50 UTC

svn commit: r1209585 [17/22] - in /camel/trunk: ./ apache-camel/ buildingtools/ camel-core/ camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/api/management/ camel-core/src/main/java/org/apache/camel/builder/ camel-co...

Modified: camel/trunk/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java?rev=1209585&r1=1209584&r2=1209585&view=diff
==============================================================================
--- camel/trunk/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java (original)
+++ camel/trunk/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java Fri Dec  2 17:03:07 2011
@@ -1,223 +1,223 @@
-/**
- * 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.camel.component.solr;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import org.apache.camel.EndpointInject;
-import org.apache.camel.Exchange;
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.common.SolrDocument;
-import org.apache.solr.common.SolrException;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class SolrUpdateTest extends SolrComponentTestSupport {
-
-    @EndpointInject(uri = "solr://localhost:8999/solr")
-    protected SolrEndpoint solrEndpoint;
-
-    @Test
-    public void indexSingleDocumentOnlyWithId() throws Exception {
-        Exchange exchange = createExchangeWithBody(null);
-        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
-        exchange.getIn().setHeader("SolrField.id", "MA147LL/A");
-
-        template.send("direct:start", exchange);
-        solrCommit();
-
-        // Check things were indexed.
-        QueryResponse response = executeSolrQuery("id:MA147LL/A");
-
-        assertEquals(0, response.getStatus());
-        assertEquals(1, response.getResults().getNumFound());
-    }
-
-    @Test
-    public void caughtSolrExceptionIsHandledElegantly() throws Exception {
-        Exchange exchange = createExchangeWithBody(null);
-        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
-        exchange.getIn().setHeader("SolrField.name", "Missing required field throws exception.");
-
-        template.send("direct:start", exchange);
-
-        assertEquals(SolrException.class, exchange.getException().getClass());
-    }
-
-    @Test
-    public void setHeadersAsSolrFields() throws Exception {
-        Exchange exchange = createExchangeWithBody("Body is ignored");
-        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
-        exchange.getIn().setHeader("SolrField.id", "MA147LL/A");
-        exchange.getIn().setHeader("SolrField.name", "Apple 60 GB iPod with Video Playback Black");
-        exchange.getIn().setHeader("SolrField.manu", "Apple Computer Inc.");
-
-        template.send("direct:start", exchange);
-        solrCommit();
-
-        QueryResponse response = executeSolrQuery("id:MA147LL/A");
-
-        assertEquals(0, response.getStatus());
-        assertEquals(1, response.getResults().getNumFound());
-
-        SolrDocument doc = response.getResults().get(0);
-        assertEquals("Apple 60 GB iPod with Video Playback Black", doc.getFieldValue("name"));
-        assertEquals("Apple Computer Inc.", doc.getFieldValue("manu"));
-    }
-
-    @Test
-    public void setMultiValuedFieldInHeader() throws Exception {
-        String[] categories = {"electronics", "apple"};
-        Exchange exchange = createExchangeWithBody("Test body for iPod.");
-        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
-        exchange.getIn().setHeader("SolrField.id", "MA147LL/A");
-        exchange.getIn().setHeader("SolrField.cat", categories);
-
-        template.send("direct:start", exchange);
-        solrCommit();
-
-        // Check things were indexed.
-        QueryResponse response = executeSolrQuery("id:MA147LL/A");
-
-        assertEquals(0, response.getStatus());
-        assertEquals(1, response.getResults().getNumFound());
-
-        SolrDocument doc = response.getResults().get(0);
-        assertArrayEquals(categories, ((List) doc.getFieldValue("cat")).toArray());
-    }
-
-    @Test
-    public void indexDocumentsAndThenCommit() throws Exception {
-        Exchange exchange = createExchangeWithBody(null);
-        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
-        exchange.getIn().setHeader("SolrField.id", "MA147LL/A");
-        exchange.getIn().setHeader("SolrField.name", "Apple 60 GB iPod with Video Playback Black");
-        exchange.getIn().setHeader("SolrField.manu", "Apple Computer Inc.");
-        template.send("direct:start", exchange);
-
-        QueryResponse response = executeSolrQuery("*:*");
-        assertEquals(0, response.getStatus());
-        assertEquals(0, response.getResults().getNumFound());
-
-        solrCommit();
-
-        QueryResponse afterCommitResponse = executeSolrQuery("*:*");
-        assertEquals(0, afterCommitResponse.getStatus());
-        assertEquals(1, afterCommitResponse.getResults().getNumFound());
-    }
-
-    @Test
-    public void invalidSolrParametersAreIgnored() throws Exception {
-        Exchange exchange = createExchangeWithBody(null);
-        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
-        exchange.getIn().setHeader("SolrField.id", "MA147LL/A");
-        exchange.getIn().setHeader("SolrField.name", "Apple 60 GB iPod with Video Playback Black");
-        exchange.getIn().setHeader("SolrParam.invalid-param", "this is ignored");
-
-        template.send("direct:start", exchange);
-        solrCommit();
-
-        QueryResponse response = executeSolrQuery("*:*");
-        assertEquals(0, response.getStatus());
-        assertEquals(1, response.getResults().getNumFound());
-    }
-
-    @Test
-    public void indexDocumentsToCSVUpdateHandlerWithoutParameters() throws Exception {
-        solrEndpoint.setRequestHandler("/update/csv");
-
-        Exchange exchange = createExchangeWithBody(new File("src/test/resources/data/books.csv"));
-        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
-        template.send("direct:start", exchange);
-        solrCommit();
-
-        QueryResponse response = executeSolrQuery("*:*");
-        assertEquals(0, response.getStatus());
-        assertEquals(10, response.getResults().getNumFound());
-
-        response = executeSolrQuery("id:0553573403");
-        SolrDocument doc = response.getResults().get(0);
-        assertEquals("A Game of Thrones", doc.getFieldValue("name"));
-        assertEquals(7.99f, doc.getFieldValue("price"));
-    }
-
-    @Test
-    public void indexDocumentsToCSVUpdateHandlerWithParameters() throws Exception {
-        solrEndpoint.setRequestHandler("/update/csv");
-
-        Exchange exchange = createExchangeWithBody(new File("src/test/resources/data/books.csv"));
-        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
-        exchange.getIn().setHeader("SolrParam.fieldnames", "id,cat,name,price,inStock,author_t,series_t,sequence_i,genre_s");
-        exchange.getIn().setHeader("SolrParam.skip", "cat,sequence_i,genre_s");
-        exchange.getIn().setHeader("SolrParam.skipLines", 1);
-
-        template.send("direct:start", exchange);
-        solrCommit();
-
-        QueryResponse response = executeSolrQuery("*:*");
-        assertEquals(0, response.getStatus());
-        assertEquals(10, response.getResults().getNumFound());
-
-        SolrDocument doc = response.getResults().get(0);
-        assertFalse(doc.getFieldNames().contains("cat"));
-    }
-
-    @Test
-    public void indexPDFDocumentToExtractingRequestHandler() throws Exception {
-        solrEndpoint.setRequestHandler("/update/extract");
-
-        Exchange exchange = createExchangeWithBody(new File("src/test/resources/data/tutorial.pdf"));
-        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
-        exchange.getIn().setHeader("SolrParam.literal.id", "tutorial.pdf");
-
-        template.send("direct:start", exchange);
-        solrCommit();
-
-        QueryResponse response = executeSolrQuery("*:*");
-        assertEquals(0, response.getStatus());
-        assertEquals(1, response.getResults().getNumFound());
-
-        SolrDocument doc = response.getResults().get(0);
-        assertEquals("Solr", doc.getFieldValue("subject"));
-        assertEquals("tutorial.pdf", doc.getFieldValue("id"));
-        assertEquals(Arrays.asList("application/pdf"), doc.getFieldValue("content_type"));
-    }
-
-    @Test
-    @Ignore("No real advantage has yet been discovered to specifying the file in a header.")
-    public void indexPDFDocumentSpecifyingFileInParameters() throws Exception {
-        solrEndpoint.setRequestHandler("/update/extract");
-
-        Exchange exchange = createExchangeWithBody(null);
-        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
-        exchange.getIn().setHeader("SolrParam.stream.file", "src/test/resources/data/tutorial.pdf");
-        exchange.getIn().setHeader("SolrParam.literal.id", "tutorial.pdf");
-
-        template.send("direct:start", exchange);
-        solrCommit();
-
-        QueryResponse response = executeSolrQuery("*:*");
-        assertEquals(0, response.getStatus());
-        assertEquals(1, response.getResults().getNumFound());
-
-        SolrDocument doc = response.getResults().get(0);
-        assertEquals("Solr", doc.getFieldValue("subject"));
-        assertEquals("tutorial.pdf", doc.getFieldValue("id"));
-        assertEquals(Arrays.asList("application/pdf"), doc.getFieldValue("content_type"));
-    }
-}
+/**
+ * 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.camel.component.solr;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrException;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class SolrUpdateTest extends SolrComponentTestSupport {
+
+    @EndpointInject(uri = "solr://localhost:8999/solr")
+    protected SolrEndpoint solrEndpoint;
+
+    @Test
+    public void indexSingleDocumentOnlyWithId() throws Exception {
+        Exchange exchange = createExchangeWithBody(null);
+        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
+        exchange.getIn().setHeader("SolrField.id", "MA147LL/A");
+
+        template.send("direct:start", exchange);
+        solrCommit();
+
+        // Check things were indexed.
+        QueryResponse response = executeSolrQuery("id:MA147LL/A");
+
+        assertEquals(0, response.getStatus());
+        assertEquals(1, response.getResults().getNumFound());
+    }
+
+    @Test
+    public void caughtSolrExceptionIsHandledElegantly() throws Exception {
+        Exchange exchange = createExchangeWithBody(null);
+        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
+        exchange.getIn().setHeader("SolrField.name", "Missing required field throws exception.");
+
+        template.send("direct:start", exchange);
+
+        assertEquals(SolrException.class, exchange.getException().getClass());
+    }
+
+    @Test
+    public void setHeadersAsSolrFields() throws Exception {
+        Exchange exchange = createExchangeWithBody("Body is ignored");
+        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
+        exchange.getIn().setHeader("SolrField.id", "MA147LL/A");
+        exchange.getIn().setHeader("SolrField.name", "Apple 60 GB iPod with Video Playback Black");
+        exchange.getIn().setHeader("SolrField.manu", "Apple Computer Inc.");
+
+        template.send("direct:start", exchange);
+        solrCommit();
+
+        QueryResponse response = executeSolrQuery("id:MA147LL/A");
+
+        assertEquals(0, response.getStatus());
+        assertEquals(1, response.getResults().getNumFound());
+
+        SolrDocument doc = response.getResults().get(0);
+        assertEquals("Apple 60 GB iPod with Video Playback Black", doc.getFieldValue("name"));
+        assertEquals("Apple Computer Inc.", doc.getFieldValue("manu"));
+    }
+
+    @Test
+    public void setMultiValuedFieldInHeader() throws Exception {
+        String[] categories = {"electronics", "apple"};
+        Exchange exchange = createExchangeWithBody("Test body for iPod.");
+        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
+        exchange.getIn().setHeader("SolrField.id", "MA147LL/A");
+        exchange.getIn().setHeader("SolrField.cat", categories);
+
+        template.send("direct:start", exchange);
+        solrCommit();
+
+        // Check things were indexed.
+        QueryResponse response = executeSolrQuery("id:MA147LL/A");
+
+        assertEquals(0, response.getStatus());
+        assertEquals(1, response.getResults().getNumFound());
+
+        SolrDocument doc = response.getResults().get(0);
+        assertArrayEquals(categories, ((List) doc.getFieldValue("cat")).toArray());
+    }
+
+    @Test
+    public void indexDocumentsAndThenCommit() throws Exception {
+        Exchange exchange = createExchangeWithBody(null);
+        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
+        exchange.getIn().setHeader("SolrField.id", "MA147LL/A");
+        exchange.getIn().setHeader("SolrField.name", "Apple 60 GB iPod with Video Playback Black");
+        exchange.getIn().setHeader("SolrField.manu", "Apple Computer Inc.");
+        template.send("direct:start", exchange);
+
+        QueryResponse response = executeSolrQuery("*:*");
+        assertEquals(0, response.getStatus());
+        assertEquals(0, response.getResults().getNumFound());
+
+        solrCommit();
+
+        QueryResponse afterCommitResponse = executeSolrQuery("*:*");
+        assertEquals(0, afterCommitResponse.getStatus());
+        assertEquals(1, afterCommitResponse.getResults().getNumFound());
+    }
+
+    @Test
+    public void invalidSolrParametersAreIgnored() throws Exception {
+        Exchange exchange = createExchangeWithBody(null);
+        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
+        exchange.getIn().setHeader("SolrField.id", "MA147LL/A");
+        exchange.getIn().setHeader("SolrField.name", "Apple 60 GB iPod with Video Playback Black");
+        exchange.getIn().setHeader("SolrParam.invalid-param", "this is ignored");
+
+        template.send("direct:start", exchange);
+        solrCommit();
+
+        QueryResponse response = executeSolrQuery("*:*");
+        assertEquals(0, response.getStatus());
+        assertEquals(1, response.getResults().getNumFound());
+    }
+
+    @Test
+    public void indexDocumentsToCSVUpdateHandlerWithoutParameters() throws Exception {
+        solrEndpoint.setRequestHandler("/update/csv");
+
+        Exchange exchange = createExchangeWithBody(new File("src/test/resources/data/books.csv"));
+        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
+        template.send("direct:start", exchange);
+        solrCommit();
+
+        QueryResponse response = executeSolrQuery("*:*");
+        assertEquals(0, response.getStatus());
+        assertEquals(10, response.getResults().getNumFound());
+
+        response = executeSolrQuery("id:0553573403");
+        SolrDocument doc = response.getResults().get(0);
+        assertEquals("A Game of Thrones", doc.getFieldValue("name"));
+        assertEquals(7.99f, doc.getFieldValue("price"));
+    }
+
+    @Test
+    public void indexDocumentsToCSVUpdateHandlerWithParameters() throws Exception {
+        solrEndpoint.setRequestHandler("/update/csv");
+
+        Exchange exchange = createExchangeWithBody(new File("src/test/resources/data/books.csv"));
+        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
+        exchange.getIn().setHeader("SolrParam.fieldnames", "id,cat,name,price,inStock,author_t,series_t,sequence_i,genre_s");
+        exchange.getIn().setHeader("SolrParam.skip", "cat,sequence_i,genre_s");
+        exchange.getIn().setHeader("SolrParam.skipLines", 1);
+
+        template.send("direct:start", exchange);
+        solrCommit();
+
+        QueryResponse response = executeSolrQuery("*:*");
+        assertEquals(0, response.getStatus());
+        assertEquals(10, response.getResults().getNumFound());
+
+        SolrDocument doc = response.getResults().get(0);
+        assertFalse(doc.getFieldNames().contains("cat"));
+    }
+
+    @Test
+    public void indexPDFDocumentToExtractingRequestHandler() throws Exception {
+        solrEndpoint.setRequestHandler("/update/extract");
+
+        Exchange exchange = createExchangeWithBody(new File("src/test/resources/data/tutorial.pdf"));
+        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
+        exchange.getIn().setHeader("SolrParam.literal.id", "tutorial.pdf");
+
+        template.send("direct:start", exchange);
+        solrCommit();
+
+        QueryResponse response = executeSolrQuery("*:*");
+        assertEquals(0, response.getStatus());
+        assertEquals(1, response.getResults().getNumFound());
+
+        SolrDocument doc = response.getResults().get(0);
+        assertEquals("Solr", doc.getFieldValue("subject"));
+        assertEquals("tutorial.pdf", doc.getFieldValue("id"));
+        assertEquals(Arrays.asList("application/pdf"), doc.getFieldValue("content_type"));
+    }
+
+    @Test
+    @Ignore("No real advantage has yet been discovered to specifying the file in a header.")
+    public void indexPDFDocumentSpecifyingFileInParameters() throws Exception {
+        solrEndpoint.setRequestHandler("/update/extract");
+
+        Exchange exchange = createExchangeWithBody(null);
+        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
+        exchange.getIn().setHeader("SolrParam.stream.file", "src/test/resources/data/tutorial.pdf");
+        exchange.getIn().setHeader("SolrParam.literal.id", "tutorial.pdf");
+
+        template.send("direct:start", exchange);
+        solrCommit();
+
+        QueryResponse response = executeSolrQuery("*:*");
+        assertEquals(0, response.getStatus());
+        assertEquals(1, response.getResults().getNumFound());
+
+        SolrDocument doc = response.getResults().get(0);
+        assertEquals("Solr", doc.getFieldValue("subject"));
+        assertEquals("tutorial.pdf", doc.getFieldValue("id"));
+        assertEquals(Arrays.asList("application/pdf"), doc.getFieldValue("content_type"));
+    }
+}

Propchange: camel/trunk/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: camel/trunk/components/camel-solr/src/test/resources/SolrSpringTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-solr/src/test/resources/SolrSpringTest-context.xml?rev=1209585&r1=1209584&r2=1209585&view=diff
==============================================================================
--- camel/trunk/components/camel-solr/src/test/resources/SolrSpringTest-context.xml (original)
+++ camel/trunk/components/camel-solr/src/test/resources/SolrSpringTest-context.xml Fri Dec  2 17:03:07 2011
@@ -1,52 +1,52 @@
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-            http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
-
-    <camelContext xmlns="http://camel.apache.org/schema/spring">
-        <route id="XMLRoute">
-            <from uri="direct:xml-start" />
-            <split>
-                <xpath>/bookstore/book</xpath>
-                <convertBodyTo type="java.lang.String"/>
-                <setHeader headerName="SolrOperation">
-                    <constant>INSERT</constant>
-                </setHeader>
-                <setHeader headerName="SolrField.id">
-                    <xpath resultType="java.lang.String">//title/text()</xpath>
-                </setHeader>
-                <setHeader headerName="SolrField.title">
-                    <xpath resultType="java.lang.String">//title/text()</xpath>
-                </setHeader>
-                <setHeader headerName="SolrField.cat">
-                    <groovy>
-                        def book = new XmlParser().parseText(request.body)
-                        book.cat.collect{ it.text() } as String[]
-                    </groovy>
-                </setHeader>
-                <to uri="solr://localhost:8899/solr"/>
-            </split>
-            <setHeader headerName="SolrOperation">
-                <constant>COMMIT</constant>
-            </setHeader>
-            <to uri="solr://localhost:8899/solr"/>
-        </route>
-
-        <route id="PDFRoute">
-            <from uri="direct:pdf-start" />
-            <setHeader headerName="SolrOperation">
-                <constant>INSERT</constant>
-            </setHeader>
-            <setHeader headerName="SolrParam.literal.id">
-                <simple>${body.name}</simple>
-            </setHeader>
-            <to uri="solr://localhost:8899/solr?requestHandler=/update/extract" />
-            <setHeader headerName="SolrOperation">
-                <constant>COMMIT</constant>
-            </setHeader>
-            <to uri="solr://localhost:8899/solr"/>
-        </route>
-    </camelContext>
-
-</beans>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+            http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+    <camelContext xmlns="http://camel.apache.org/schema/spring">
+        <route id="XMLRoute">
+            <from uri="direct:xml-start" />
+            <split>
+                <xpath>/bookstore/book</xpath>
+                <convertBodyTo type="java.lang.String"/>
+                <setHeader headerName="SolrOperation">
+                    <constant>INSERT</constant>
+                </setHeader>
+                <setHeader headerName="SolrField.id">
+                    <xpath resultType="java.lang.String">//title/text()</xpath>
+                </setHeader>
+                <setHeader headerName="SolrField.title">
+                    <xpath resultType="java.lang.String">//title/text()</xpath>
+                </setHeader>
+                <setHeader headerName="SolrField.cat">
+                    <groovy>
+                        def book = new XmlParser().parseText(request.body)
+                        book.cat.collect{ it.text() } as String[]
+                    </groovy>
+                </setHeader>
+                <to uri="solr://localhost:8899/solr"/>
+            </split>
+            <setHeader headerName="SolrOperation">
+                <constant>COMMIT</constant>
+            </setHeader>
+            <to uri="solr://localhost:8899/solr"/>
+        </route>
+
+        <route id="PDFRoute">
+            <from uri="direct:pdf-start" />
+            <setHeader headerName="SolrOperation">
+                <constant>INSERT</constant>
+            </setHeader>
+            <setHeader headerName="SolrParam.literal.id">
+                <simple>${body.name}</simple>
+            </setHeader>
+            <to uri="solr://localhost:8899/solr?requestHandler=/update/extract" />
+            <setHeader headerName="SolrOperation">
+                <constant>COMMIT</constant>
+            </setHeader>
+            <to uri="solr://localhost:8899/solr"/>
+        </route>
+    </camelContext>
+
+</beans>

Propchange: camel/trunk/components/camel-solr/src/test/resources/SolrSpringTest-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-solr/src/test/resources/SolrSpringTest-context.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: camel/trunk/components/camel-solr/src/test/resources/data/books.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-solr/src/test/resources/data/books.xml?rev=1209585&r1=1209584&r2=1209585&view=diff
==============================================================================
--- camel/trunk/components/camel-solr/src/test/resources/data/books.xml (original)
+++ camel/trunk/components/camel-solr/src/test/resources/data/books.xml Fri Dec  2 17:03:07 2011
@@ -1,50 +1,50 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Modified from the example XML file w3schools.com provides for its
-    XPath tutorial.
-
-    http://www.w3schools.com/xpath/books.xml
--->
-<bookstore>
-
-    <book>
-        <title lang="en">Everyday Italian</title>
-        <author>Giada De Laurentiis</author>
-        <year>2005</year>
-        <price>30.00</price>
-        <cat>Cooking</cat>
-    </book>
-
-    <book>
-        <title lang="en">Harry Potter</title>
-        <author>J K. Rowling</author>
-        <year>2005</year>
-        <price>29.99</price>
-        <cat>Children</cat>
-    </book>
-
-    <book>
-        <title lang="en">XQuery Kick Start</title>
-        <author>James McGovern</author>
-        <author>Per Bothner</author>
-        <author>Kurt Cagle</author>
-        <author>James Linn</author>
-        <author>Vaidyanathan Nagarajan</author>
-        <year>2003</year>
-        <price>49.99</price>
-        <cat>Web</cat>
-        <cat>Technology</cat>
-        <cat>Computers</cat>
-    </book>
-
-    <book>
-        <title lang="en">Learning XML</title>
-        <author>Erik T. Ray</author>
-        <year>2003</year>
-        <price>39.95</price>
-        <cat>Web</cat>
-        <cat>Technology</cat>
-        <cat>Computers</cat>
-    </book>
-
-</bookstore>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Modified from the example XML file w3schools.com provides for its
+    XPath tutorial.
+
+    http://www.w3schools.com/xpath/books.xml
+-->
+<bookstore>
+
+    <book>
+        <title lang="en">Everyday Italian</title>
+        <author>Giada De Laurentiis</author>
+        <year>2005</year>
+        <price>30.00</price>
+        <cat>Cooking</cat>
+    </book>
+
+    <book>
+        <title lang="en">Harry Potter</title>
+        <author>J K. Rowling</author>
+        <year>2005</year>
+        <price>29.99</price>
+        <cat>Children</cat>
+    </book>
+
+    <book>
+        <title lang="en">XQuery Kick Start</title>
+        <author>James McGovern</author>
+        <author>Per Bothner</author>
+        <author>Kurt Cagle</author>
+        <author>James Linn</author>
+        <author>Vaidyanathan Nagarajan</author>
+        <year>2003</year>
+        <price>49.99</price>
+        <cat>Web</cat>
+        <cat>Technology</cat>
+        <cat>Computers</cat>
+    </book>
+
+    <book>
+        <title lang="en">Learning XML</title>
+        <author>Erik T. Ray</author>
+        <year>2003</year>
+        <price>39.95</price>
+        <cat>Web</cat>
+        <cat>Technology</cat>
+        <cat>Computers</cat>
+    </book>
+
+</bookstore>

Propchange: camel/trunk/components/camel-solr/src/test/resources/data/books.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-solr/src/test/resources/data/books.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: camel/trunk/components/camel-solr/src/test/resources/solr/conf/elevate.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-solr/src/test/resources/solr/conf/elevate.xml?rev=1209585&r1=1209584&r2=1209585&view=diff
==============================================================================
--- camel/trunk/components/camel-solr/src/test/resources/solr/conf/elevate.xml (original)
+++ camel/trunk/components/camel-solr/src/test/resources/solr/conf/elevate.xml Fri Dec  2 17:03:07 2011
@@ -1,36 +1,36 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- 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.
--->
-
-<!-- If this file is found in the config directory, it will only be
-     loaded once at startup.  If it is found in Solr's data
-     directory, it will be re-loaded every commit.
--->
-
-<elevate>
- <query text="foo bar">
-  <doc id="1" />
-  <doc id="2" />
-  <doc id="3" />
- </query>
- 
- <query text="ipod">
-   <doc id="MA147LL/A" />  <!-- put the actual ipod at the top -->
-   <doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
- </query>
- 
-</elevate>
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+-->
+
+<!-- If this file is found in the config directory, it will only be
+     loaded once at startup.  If it is found in Solr's data
+     directory, it will be re-loaded every commit.
+-->
+
+<elevate>
+ <query text="foo bar">
+  <doc id="1" />
+  <doc id="2" />
+  <doc id="3" />
+ </query>
+ 
+ <query text="ipod">
+   <doc id="MA147LL/A" />  <!-- put the actual ipod at the top -->
+   <doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
+ </query>
+ 
+</elevate>

Propchange: camel/trunk/components/camel-solr/src/test/resources/solr/conf/elevate.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-solr/src/test/resources/solr/conf/elevate.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml