不能用gradle建立项目Sagan

时间:2016-01-28 03:14:31

标签: java spring gradle spring-boot

我正试图在本地运行Spring的project Sagan。按照项目维基中的说明,我尝试用gradle构建它。但是因为这个测试错误而失败了:

    java.lang.AssertionError: 
Expected: "{\n  \"from\" : 0,\n  \"size\" : 10,\n  \"query\" : {\n    \"filtered\" : {\n      \"query\" : {\n        \"bool\" : {\n          \"must\" : {\n            \"multi_match\" : {\n              \"query\" : \"spring boot\",\n              \"fields\" : [ \"title^3\", \"rawContent\", \"author\" ],\n              \"fuzziness\" : 1,\n              \"minimum_should_match\" : \"30%\"\n            }\n          },\n          \"should\" : [ {\n            \"term\" : {\n              \"current\" : true\n            }\n          }, {\n            \"term\" : {\n              \"_type\" : \"projectpage\"\n            }\n          }, {\n            \"match\" : {\n              \"title\" : {\n                \"query\" : \"spring boot\",\n                \"type\" : \"phrase\",\n                \"boost\" : 3.0,\n                \"slop\" : 1\n              }\n            }\n          } ]\n        }\n      },\n      \"filter\" : {\n        \"or\" : {\n          \"filters\" : [ {\n            \"range\" : {\n              \"publishAt\" : {\n                \"from\" : null,\n                \"to\" : \"now/d\",\n                \"include_lower\" : true,\n                \"include_upper\" : true\n              }\n            }\n          }, {\n            \"not\" : {\n              \"filter\" : {\n                \"type\" : {\n                  \"value\" : \"blogpost\"\n                }\n              }\n            }\n          } ]\n        }\n      }\n    }\n  },\n  \"post_filter\" : {\n    \"or\" : {\n      \"filters\" : [ {\n        \"and\" : {\n          \"filters\" : [ {\n            \"terms\" : {\n              \"facetPaths\" : [ \"Projects/Api\", \"Projects/Reference\" ],\n              \"execution\" : \"or\"\n            }\n          }, {\n            \"terms\" : {\n              \"facetPaths\" : [ \"Projects/Reactor Project/1.1.0.RELEASE\" ],\n              \"execution\" : \"or\"\n            }\n          } ]\n        }\n      }, {\n        \"terms\" : {\n          \"facetPaths\" : [ \"Blog/Engineering\" ],\n          \"execution\" : \"or\"\n        }\n      } ]\n    }\n  },\n  \"sort\" : [ {\n    \"_score\" : { }\n  }, {\n    \"publishAt\" : {\n      \"order\" : \"desc\"\n    }\n  } ],\n  \"facets\" : {\n    \"facet_paths_result\" : {\n      \"terms\" : {\n        \"field\" : \"facetPaths\",\n        \"size\" : 100000,\n        \"order\" : \"term\"\n      }\n    }\n  },\n  \"highlight\" : {\n    \"order\" : \"score\",\n    \"require_field_match\" : false,\n    \"fields\" : {\n      \"rawContent\" : {\n        \"fragment_size\" : 300,\n        \"number_of_fragments\" : 1\n      }\n    }\n  }\n}"
     but: was "{\r\n  \"from\" : 0,\r\n  \"size\" : 10,\r\n  \"query\" : {\r\n    \"filtered\" : {\r\n      \"query\" : {\r\n        \"bool\" : {\r\n          \"must\" : {\r\n            \"multi_match\" : {\r\n              \"query\" : \"spring boot\",\r\n              \"fields\" : [ \"title^3\", \"rawContent\", \"author\" ],\r\n              \"fuzziness\" : 1,\r\n              \"minimum_should_match\" : \"30%\"\r\n            }\r\n          },\r\n          \"should\" : [ {\r\n            \"term\" : {\r\n              \"current\" : true\r\n            }\r\n          }, {\r\n            \"term\" : {\r\n              \"_type\" : \"projectpage\"\r\n            }\r\n          }, {\r\n            \"match\" : {\r\n              \"title\" : {\r\n                \"query\" : \"spring boot\",\r\n                \"type\" : \"phrase\",\r\n                \"boost\" : 3.0,\r\n                \"slop\" : 1\r\n              }\r\n            }\r\n          } ]\r\n        }\r\n      },\r\n      \"filter\" : {\r\n        \"or\" : {\r\n          \"filters\" : [ {\r\n            \"range\" : {\r\n              \"publishAt\" : {\r\n                \"from\" : null,\r\n                \"to\" : \"now/d\",\r\n                \"include_lower\" : true,\r\n                \"include_upper\" : true\r\n              }\r\n            }\r\n          }, {\r\n            \"not\" : {\r\n              \"filter\" : {\r\n                \"type\" : {\r\n                  \"value\" : \"blogpost\"\r\n                }\r\n              }\r\n            }\r\n          } ]\r\n        }\r\n      }\r\n    }\r\n  },\r\n  \"post_filter\" : {\r\n    \"or\" : {\r\n      \"filters\" : [ {\r\n        \"and\" : {\r\n          \"filters\" : [ {\r\n            \"terms\" : {\r\n              \"facetPaths\" : [ \"Projects/Api\", \"Projects/Reference\" ],\r\n              \"execution\" : \"or\"\r\n            }\r\n          }, {\r\n            \"terms\" : {\r\n              \"facetPaths\" : [ \"Projects/Reactor Project/1.1.0.RELEASE\" ],\r\n              \"execution\" : \"or\"\r\n            }\r\n          } ]\r\n        }\r\n      }, {\r\n        \"terms\" : {\r\n          \"facetPaths\" : [ \"Blog/Engineering\" ],\r\n          \"execution\" : \"or\"\r\n        }\r\n      } ]\r\n    }\r\n  },\r\n  \"sort\" : [ {\r\n    \"_score\" : { }\r\n  }, {\r\n    \"publishAt\" : {\r\n      \"order\" : \"desc\"\r\n    }\r\n  } ],\r\n  \"facets\" : {\r\n    \"facet_paths_result\" : {\r\n      \"terms\" : {\r\n        \"field\" : \"facetPaths\",\r\n        \"size\" : 100000,\r\n        \"order\" : \"term\"\r\n      }\r\n    }\r\n  },\r\n  \"highlight\" : {\r\n    \"order\" : \"score\",\r\n    \"require_field_match\" : false,\r\n    \"fields\" : {\r\n      \"rawContent\" : {\r\n        \"fragment_size\" : 300,\r\n        \"number_of_fragments\" : 1\r\n      }\r\n    }\r\n  }\r\n}"
    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)
    at sagan.search.support.SaganQueryBuildersTests.fullTextSearch(SaganQueryBuildersTests.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:105)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:56)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:64)
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:50)
    at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
    at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
    at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:106)
    at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:360)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

我该如何解决这个问题? (我使用的Java版本是1.8.0_65)

1 个答案:

答案 0 :(得分:1)

我刚刚推出了一个修复程序 - 实际上,集成测试依赖于平台:在将字符串与从文件系统读取的内容进行比较时,不会剥离行返回字符。

将来,请毫不犹豫地解决问题against the github project, even for questions