twitchob opened a new issue, #24878:
URL: https://github.com/apache/shardingsphere/issues/24878

   ## Question
   
   **For English only**, other languages will not accept.
   
   Before asking a question, make sure you have:
   
   - Googled your question.
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   
   ## Hi!community. When I solve this problem (#24806),another problem arose:
   
   
```-------------------------------------------------------------------------------
   Test set: 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ExportMetaDataExecutorTest
   
-------------------------------------------------------------------------------
   Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.354 s <<< 
FAILURE! - in 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ExportMetaDataExecutorTest
   
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ExportMetaDataExecutorTest.assertExecuteWithEmptyMetaData
  Time elapsed: 0.048 s  <<< FAILURE!
   java.lang.AssertionError: 
   
   Expected: is 
"{\"meta_data\":{\"databases\":{\"empty_metadata\":\"databaseName: 
null\\ndataSources:\\nrules:\\n\"},\"props\":\"\",\"rules\":\"\"}}"
        but: was 
"{\"meta_data\":{\"databases\":{\"empty_metadata\":\"databaseName: 
null\\r\\ndataSources:\\r\\nrules:\\r\\n\"},\"props\":\"\",\"rules\":\"\"}}"
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
        at 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ExportMetaDataExecutorTest.assertExecuteWithEmptyMetaData(ExportMetaDataExecutorTest.java:87)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at 
org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.jar/nva:727)
 
   ```
   
   ## I found that the reason is that the newline character in the window 
environment(/r/n) is inconsistent with that in linux (/r).
   
   I changed this in the unit test:
   
   In class 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ExportMetaDataExecutorTest
 row 107
   `assertThat(row.getCell(3), 
is("{\"meta_data\":{\"databases\":{\"empty_metadata\":\"databaseName: 
null\\ndataSources:\\nrules:\\n\"},\"props\":\"\",\"rules\":\"\"}}"));` 
   is changed to
   `assertThat(row.getCell(3), 
is("{\"meta_data\":{\"databases\":{\"empty_metadata\":\"databaseName: 
null\\r\\ndataSources:\\r\\nrules:\\r\\n\"},\"props\":\"\",\"rules\":\"\"}}"));`
   
   ## add `/r` for json files
   
![image](https://user-images.githubusercontent.com/34822229/228145006-17c21ca0-a200-4f95-97f6-06994eda8490.png)
   
   ##  windows.json replace export-metadata-configuration.json
   
![image](https://user-images.githubusercontent.com/34822229/228146267-b2e7b533-a61b-4056-b914-49488160ba58.png)
   
   ## Build success
   
![image](https://user-images.githubusercontent.com/34822229/228146562-67526407-b533-41be-9a85-253ee535d2b1.png)
   
   ## But I think this is very inelegant. Is there a way to solve this problem 
without modifying the code?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to