Closed bbottema closed 4 years ago
Hi, Really thanks for the report and the fix. I'll have a look asap
Hi @bbottema I've tried your fix. It's perhaps fixing your issue on windows but it's breaking it on other OS (on my mac for instance)
2020-01-09 10:11:03,783 [main] DEBUG o.c.u.EmbeddedCassandraServerHelper - Starting cassandra... 2020-01-09 10:11:03,785 [main] DEBUG o.c.u.EmbeddedCassandraServerHelper - Initialization needed
org.apache.cassandra.exceptions.ConfigurationException: Cannot locate file://Users/jsevellec/projet/cassandra-unit/git-repo/cassandra-unit/cassandra-unit/target/embeddedCassandra/cu-cassandra-rndport.yaml. If this is a local file, please confirm you've provided file:/// as a URI prefix.
at org.apache.cassandra.config.YamlConfigurationLoader.getStorageConfigURL(YamlConfigurationLoader.java:85)
at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:100)
at org.apache.cassandra.config.DatabaseDescriptor.loadConfig(DatabaseDescriptor.java:268)
at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:147)
at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:132)
at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:144)
at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:108)
at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:88)
at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:84)
at org.cassandraunit.utils.EmbeddedCassandraServerHelperTest.shouldStartupOnRandomFreePort(EmbeddedCassandraServerHelperTest.java:27)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
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.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
We need to investigate more on this
That's not with my fix it seems, because it still uses file://
and not file:/
Unfortunately, it is.
file.getAbsolutePath return a path starting with a "/" (on a non windows OS)
So "file:/" + file.getAbsolutePath end up with "//"
file.getAbsolutePath return a path starting with a "/" (on a non windows OS)
So "file:/" + file.getAbsolutePath end up with "//"
Ahhh, crap. That's why it worked with file://
in linux, because then it would become file:///
, which is the only other valid form in addition to file:/
for file paths.
I added a small tweak, but don't have time to test it. Should work generically for both OS' though.
Yes that does the trick
…ic file path separators, so the Cassandra library preconditions checks don't fail on Windows
fixes https://github.com/jsevellec/cassandra-unit/issues/302