Re: How to test Solr Integartion - how to get EmbeddedSolrServer?
Thinking more about it, I can solve my immediate problem by just copy-pasting the classes I need into my own project packages (KISS like herehttps://github.com/Filirom1/solr-test-exemple ). I'd however suggest to refactor Solr code structure to be much more defaults-compliant making it easier for external developers to understand, and hopefully easier to maintain for committers (with fewer special-needs configurations). I've done some of those refactorings on my local copy of Solr and would be glad to contribute. For this particular problem the KISS solution would be to create yet one more module for Tests which depend on Solr Core and on the Test Framework. The org burden of that extra module, versus the ease of building configuration, I believe, outweights. On Tue, May 17, 2011 at 7:11 PM, Gabriele Kahlout gabri...@mysimpatico.comwrote: http://stackoverflow.com/questions/6034513/can-i-avoid-a-dependency-cycle-with-one-edge-being-a-test-dependency On Tue, May 17, 2011 at 6:49 PM, Gabriele Kahlout gabri...@mysimpatico.com wrote: On Tue, May 17, 2011 at 3:52 PM, Gabriele Kahlout gabri...@mysimpatico.com wrote: On Tue, May 17, 2011 at 3:44 PM, Steven A Rowe sar...@syr.edu wrote: Hi Gabriele, On 5/17/2011 at 9:34 AM, Gabriele Kahlout wrote: Solr Core should declare a test dependency on Solr Test Framework. I agree: - Solr Core should have a test-scope dependency on Solr Test Framework. - Solr Test Framework should have a compile-scope dependency on Solr Core. But Maven views this as a circular dependency. I've seen, but adding it with scope test /scope works. The logic: the src is compiled first and then re-used (I'm assuming maven does something smart about not including the full jar). Not quite. I've tried a demo and the reactor complains. I'll try to see if maven could become 'smarter', or if the 2-build phase solution will work. The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='com.mysimpatico:TestFramework:1.0-SNAPSHOT'}' and 'Vertex{label='org.apache:DummyCore:1.0-SNAPSHOT'}' introduces to cycle in the graph org.apache:DummyCore:1.0-SNAPSHOT -- com.mysimpatico:TestFramework:1.0-SNAPSHOT -- org.apache:DummyCore:1.0-SNAPSHOT - [Help 1] The workaround: Solr Core includes the source of Solr Test Framework as part of its test source code. It's not pretty, but it works. I'd be happy to entertain other (functional) approaches. In dp4j.com pom.xml I build in 2 phases to compile with the same annotations in the project itself (but i don't think we need that here) Steve -- Regards, K. Gabriele --- unchanged since 20/9/10 --- P.S. If the subject contains [LON] or the addressee acknowledges the receipt within 48 hours then I don't resend the email. subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) Now + 48h) ⇒ ¬resend(I, this). If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with X. ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)). -- Regards, K. Gabriele --- unchanged since 20/9/10 --- P.S. If the subject contains [LON] or the addressee acknowledges the receipt within 48 hours then I don't resend the email. subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) Now + 48h) ⇒ ¬resend(I, this). If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with X. ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)). -- Regards, K. Gabriele --- unchanged since 20/9/10 --- P.S. If the subject contains [LON] or the addressee acknowledges the receipt within 48 hours then I don't resend the email. subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) Now + 48h) ⇒ ¬resend(I, this). If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with X. ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)). -- Regards, K. Gabriele --- unchanged since 20/9/10 --- P.S. If the subject contains [LON] or the addressee acknowledges the receipt within 48 hours then I don't resend the email. subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) Now + 48h) ⇒ ¬resend(I, this). If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with X. ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)).
Re: How to test Solr Integartion - how to get EmbeddedSolrServer?
You've probably seen this page: http://wiki.apache.org/solr/HowToContribute, but here it is for reference Go ahead and open a JIRA at https://issues.apache.org/jira/browse/SOLR (you need to create an account) and attach your changes as a patch. That gets it into the system and folks can start commenting on what they think the implications are. One of the committers needs to pick it up, but you can prompt G... Yonik's law of patches reads: A half-baked patch in Jira, with no documentation, no tests and no backwards compatibility is better than no patch at all. So don't worry about a completely polished patch for the first cut, it's often helpful for people to see the early stages to help steer the effort. Best Erick On Wed, May 18, 2011 at 5:41 AM, Gabriele Kahlout gabri...@mysimpatico.com wrote: Thinking more about it, I can solve my immediate problem by just copy-pasting the classes I need into my own project packages (KISS like herehttps://github.com/Filirom1/solr-test-exemple ). I'd however suggest to refactor Solr code structure to be much more defaults-compliant making it easier for external developers to understand, and hopefully easier to maintain for committers (with fewer special-needs configurations). I've done some of those refactorings on my local copy of Solr and would be glad to contribute. For this particular problem the KISS solution would be to create yet one more module for Tests which depend on Solr Core and on the Test Framework. The org burden of that extra module, versus the ease of building configuration, I believe, outweights. On Tue, May 17, 2011 at 7:11 PM, Gabriele Kahlout gabri...@mysimpatico.comwrote: http://stackoverflow.com/questions/6034513/can-i-avoid-a-dependency-cycle-with-one-edge-being-a-test-dependency On Tue, May 17, 2011 at 6:49 PM, Gabriele Kahlout gabri...@mysimpatico.com wrote: On Tue, May 17, 2011 at 3:52 PM, Gabriele Kahlout gabri...@mysimpatico.com wrote: On Tue, May 17, 2011 at 3:44 PM, Steven A Rowe sar...@syr.edu wrote: Hi Gabriele, On 5/17/2011 at 9:34 AM, Gabriele Kahlout wrote: Solr Core should declare a test dependency on Solr Test Framework. I agree: - Solr Core should have a test-scope dependency on Solr Test Framework. - Solr Test Framework should have a compile-scope dependency on Solr Core. But Maven views this as a circular dependency. I've seen, but adding it with scope test /scope works. The logic: the src is compiled first and then re-used (I'm assuming maven does something smart about not including the full jar). Not quite. I've tried a demo and the reactor complains. I'll try to see if maven could become 'smarter', or if the 2-build phase solution will work. The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='com.mysimpatico:TestFramework:1.0-SNAPSHOT'}' and 'Vertex{label='org.apache:DummyCore:1.0-SNAPSHOT'}' introduces to cycle in the graph org.apache:DummyCore:1.0-SNAPSHOT -- com.mysimpatico:TestFramework:1.0-SNAPSHOT -- org.apache:DummyCore:1.0-SNAPSHOT - [Help 1] The workaround: Solr Core includes the source of Solr Test Framework as part of its test source code. It's not pretty, but it works. I'd be happy to entertain other (functional) approaches. In dp4j.com pom.xml I build in 2 phases to compile with the same annotations in the project itself (but i don't think we need that here) Steve -- Regards, K. Gabriele --- unchanged since 20/9/10 --- P.S. If the subject contains [LON] or the addressee acknowledges the receipt within 48 hours then I don't resend the email. subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) Now + 48h) ⇒ ¬resend(I, this). If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with X. ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)). -- Regards, K. Gabriele --- unchanged since 20/9/10 --- P.S. If the subject contains [LON] or the addressee acknowledges the receipt within 48 hours then I don't resend the email. subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) Now + 48h) ⇒ ¬resend(I, this). If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with X. ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)). -- Regards, K. Gabriele --- unchanged since 20/9/10 --- P.S. If the subject contains [LON] or the addressee acknowledges the receipt within 48 hours then I don't resend the email. subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) Now + 48h) ⇒ ¬resend(I, this). If an email is sent by a sender that is not a trusted contact or the
How to test Solr Integartion - how to get EmbeddedSolrServer?
Hello, I'm starting to write tests of my Solr integration, and have unfortunately spent a lot of time chasing updated documentation. Follows a test I found herehttp://blog.synyx.de/2011/01/integration-tests-for-your-solr-config/which uses anEmbeddedSolrServerto communicate with the server and run some queries. @Test public void testThatNoResultsAreReturned() throws SolrServerException { SolrParams params = new SolrQuery(text that is not found); assertQ(TEST_SEED, null, tests); QueryResponse response = req(params); assertEquals(0L, response.getResults().getNumFound()); } The issue is that I cannot add a dependency on Solr-3.2-SNAPSHOT since it's packaged as a war. I've tried to attach the sources and make the dependency of type classes but it still won't work. plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-war-plugin/artifactId configuration warSourceDirectoryweb/warSourceDirectory webXmlweb/WEB-INF/web.xml/webXml * attachClassestrue/attachClasses* /configuration /plugin How could you use EmbeddedSolrServer outside of Solr Webapp? I've see that org.apache.solr.client.solrj.embedded.TestSolrProperties does that in Solr Core, but not through a dependency on Solr Webapp (and I'm not figuring out where it comes from). -- Regards, K. Gabriele --- unchanged since 20/9/10 --- P.S. If the subject contains [LON] or the addressee acknowledges the receipt within 48 hours then I don't resend the email. subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) Now + 48h) ⇒ ¬resend(I, this). If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with X. ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)).
Re: How to test Solr Integartion - how to get EmbeddedSolrServer?
I use the following: dependency groupIdorg.apache.solr/groupId artifactIdsolr-core/artifactId version3.1.0/version /dependency dependency groupIdorg.apache.solr/groupId artifactIdsolr-solrj/artifactId version3.1.0/version /dependency Hello, I'm starting to write tests of my Solr integration, and have unfortunately spent a lot of time chasing updated documentation. Follows a test I found herehttp://blog.synyx.de/2011/01/integration-tests-for-your-solr-config/which uses anEmbeddedSolrServerto communicate with the server and run some queries. @Test public void testThatNoResultsAreReturned() throws SolrServerException { SolrParams params = new SolrQuery(text that is not found); assertQ(TEST_SEED, null, tests); QueryResponse response = req(params); assertEquals(0L, response.getResults().getNumFound()); } The issue is that I cannot add a dependency on Solr-3.2-SNAPSHOT since it's packaged as a war. I've tried to attach the sources and make the dependency of type classes but it still won't work. plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-war-plugin/artifactId configuration warSourceDirectoryweb/warSourceDirectory webXmlweb/WEB-INF/web.xml/webXml * attachClassestrue/attachClasses* /configuration /plugin How could you use EmbeddedSolrServer outside of Solr Webapp? I've see that org.apache.solr.client.solrj.embedded.TestSolrProperties does that in Solr Core, but not through a dependency on Solr Webapp (and I'm not figuring out where it comes from). -- Regards, K. Gabriele --- unchanged since 20/9/10 --- P.S. If the subject contains [LON] or the addressee acknowledges the receipt within 48 hours then I don't resend the email. subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) Now + 48h) ⇒ ¬resend(I, this). If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with X. ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)). __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ -- Colin Vipurs Server Team Lead Shazam Entertainment Ltd 26-28 Hammersmith Grove, London W6 7HA m: +44 (0) 000 000 t: +44 (0) 20 8742 6820 w:www.shazam.com Please consider the environment before printing this document This e-mail and its contents are strictly private and confidential. It must not be disclosed, distributed or copied without our prior consent. If you have received this transmission in error, please notify Shazam Entertainment immediately on: +44 (0) 020 8742 6820 and then delete it from your system. Please note that the information contained herein shall additionally constitute Confidential Information for the purposes of any NDA between the recipient/s and Shazam Entertainment. Shazam Entertainment Limited is incorporated in England and Wales under company number 3998831 and its registered office is at 26-28 Hammersmith Grove, London W6 7HA. __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __
Re: How to test Solr Integartion - how to get EmbeddedSolrServer?
thank you. I'd like to stick to the same version (i.e. 3.2-SNAPSHOT). It seems things have changed there. To reproduce (should we file this and add my test as a test to avoid this bumping up again?) $ svn co -r 1104120 http://svn.apache.org/repos/asf/lucene/dev/branches/branch_3x/ solr cd solr; ant get-maven-poms; mvn -N -Pbootstrap install; mvn -DskipTests install wget http://dp4j.sf.net/debug/embeddedServerTest.zip unzip embeddedServerTest.zip cd embeddedServerTest; mvn -X test P.S. I realize the example is not SSCCE (but close, and i laready uplaoded it). dependencies dependency groupIdjunit/groupId artifactIdjunit/artifactId version4.8.2/version scopetest/scope typejar/type /dependency dependency groupIdorg.apache.solr/groupId artifactIdsolr-core/artifactId version3.2-SNAPSHOT/version /dependency dependency groupIdorg.apache.solr/groupId artifactIdsolr-test-framework/artifactId version3.2-SNAPSHOT/version /dependency /dependencies import org.junit.Before; import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer; import org.apache.solr.util.AbstractSolrTestCase; public class SolrConfigTest extends AbstractSolrTestCase { public String getSchemaFile() { return /conf/schema.xml; } public String getSolrConfigFile() { return /conf/solrconfig.xml; } @Before @Override public void setUp() throws Exception { super.setUp(); new EmbeddedSolrServer(h.getCoreContainer(), h.getCore().getName()); } } On Tue, May 17, 2011 at 2:38 PM, Colin Vipurs colin.vip...@shazamteam.comwrote: I use the following: dependency groupIdorg.apache.solr/groupId artifactIdsolr-core/artifactId version3.1.0/version /dependency dependency groupIdorg.apache.solr/groupId artifactIdsolr-solrj/artifactId version3.1.0/version /dependency Hello, I'm starting to write tests of my Solr integration, and have unfortunately spent a lot of time chasing updated documentation. Follows a test I found herehttp://blog.synyx.de/2011/01/integration-tests-for-your-solr-config/which uses anEmbeddedSolrServerto communicate with the server and run some queries. @Test public void testThatNoResultsAreReturned() throws SolrServerException { SolrParams params = new SolrQuery(text that is not found); assertQ(TEST_SEED, null, tests); QueryResponse response = req(params); assertEquals(0L, response.getResults().getNumFound()); } The issue is that I cannot add a dependency on Solr-3.2-SNAPSHOT since it's packaged as a war. I've tried to attach the sources and make the dependency of type classes but it still won't work. plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-war-plugin/artifactId configuration warSourceDirectoryweb/warSourceDirectory webXmlweb/WEB-INF/web.xml/webXml * attachClassestrue/attachClasses* /configuration /plugin How could you use EmbeddedSolrServer outside of Solr Webapp? I've see that org.apache.solr.client.solrj.embedded.TestSolrProperties does that in Solr Core, but not through a dependency on Solr Webapp (and I'm not figuring out where it comes from). -- Regards, K. Gabriele --- unchanged since 20/9/10 --- P.S. If the subject contains [LON] or the addressee acknowledges the receipt within 48 hours then I don't resend the email. subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) Now + 48h) ⇒ ¬resend(I, this). If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with X. ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)). __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ -- *Colin Vipurs* *Server Team Lead* *Shazam Entertainment Ltd * *26-28 Hammersmith Grove, London W6 7HA* m: +44 (0) 000 000 t: +44 (0) 20 8742 6820 w:*www.shazam.com* Please consider the environment before printing this document This e-mail and its contents are strictly private and confidential. It must not be disclosed, distributed or copied without our prior consent. If you have received this transmission in error, please notify Shazam Entertainment immediately on: +44 (0) 020 8742 6820 and then delete it from your system. Please note that the information contained herein shall additionally constitute Confidential Information for the purposes of any NDA between the recipient/s and Shazam Entertainment. Shazam
RE: How to test Solr Integartion - how to get EmbeddedSolrServer?
Hi Gabriele, On 5/17/2011 at 9:34 AM, Gabriele Kahlout wrote: Solr Core should declare a test dependency on Solr Test Framework. I agree: - Solr Core should have a test-scope dependency on Solr Test Framework. - Solr Test Framework should have a compile-scope dependency on Solr Core. But Maven views this as a circular dependency. The workaround: Solr Core includes the source of Solr Test Framework as part of its test source code. It's not pretty, but it works. I'd be happy to entertain other (functional) approaches. Steve
Re: How to test Solr Integartion - how to get EmbeddedSolrServer?
On Tue, May 17, 2011 at 3:44 PM, Steven A Rowe sar...@syr.edu wrote: Hi Gabriele, On 5/17/2011 at 9:34 AM, Gabriele Kahlout wrote: Solr Core should declare a test dependency on Solr Test Framework. I agree: - Solr Core should have a test-scope dependency on Solr Test Framework. - Solr Test Framework should have a compile-scope dependency on Solr Core. But Maven views this as a circular dependency. I've seen, but adding it with scope test /scope works. The logic: the src is compiled first and then re-used (I'm assuming maven does something smart about not including the full jar). The workaround: Solr Core includes the source of Solr Test Framework as part of its test source code. It's not pretty, but it works. I'd be happy to entertain other (functional) approaches. In dp4j.com pom.xml I build in 2 phases to compile with the same annotations in the project itself (but i don't think we need that here) Steve -- Regards, K. Gabriele --- unchanged since 20/9/10 --- P.S. If the subject contains [LON] or the addressee acknowledges the receipt within 48 hours then I don't resend the email. subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) Now + 48h) ⇒ ¬resend(I, this). If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with X. ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)).