bmatthews68 / inmemdb-maven-plugin

A Maven 3 plug-in that can be used to launch an in-memory database for use in integration tests. Apache Derby and HSQLDB are both supported.
http://inmemdb-maven-plugin.btmatthews.com
Apache License 2.0
15 stars 7 forks source link

Error: is an unsupported file type #20

Closed nadeemanwar closed 10 years ago

nadeemanwar commented 10 years ago

I want to start the in memory database and then run the script to create the schema. Database gets started correctly, but when it try to run the script to create the schema, getting this error. As per the documentation, .sql is a supported file type.

[INFO] Started embedded HSQLDB database [INFO] Server has been started [INFO] Executing initialization scripts and loading data sets [INFO] Loading Script[src/test/resources/TestAppHyperSql.sql] [ERROR] 'src/test/resources/TestAppHyperSql.sql' is an unsupported file type.

Thanks, nadeem.

bmatthews68 commented 10 years ago

What OS are you using? On 14 Jul 2014 17:01, "nadeemanwar" notifications@github.com wrote:

I want to start the in memory database and then run the script to create the schema. Database gets started correctly, but when it try to run the script to create the schema, getting this error. As per the documentation, .sql is a supported file type.

[INFO] Started embedded HSQLDB database [INFO] Server has been started [INFO] Executing initialization scripts and loading data sets [INFO] Loading Script[src/test/resources/TestAppHyperSql.sql] [ERROR] 'src/test/resources/TestAppHyperSql.sql' is an unsupported file type.

Thanks, nadeem.

— Reply to this email directly or view it on GitHub https://github.com/bmatthews68/inmemdb-maven-plugin/issues/20.

nadeemanwar commented 10 years ago

Windows 7, running the test through Jenkins running in windows 7, with JDK 7 and Maven 3.2.1

bmatthews68 commented 10 years ago

Thanks. I think the problem is that the file cannot be found and the error message is inappropriate. I am in the middle of my commute but will look into when I get home. On 14 Jul 2014 17:57, "nadeemanwar" notifications@github.com wrote:

Windows 7, running the test through Jenkins running in windows 7, with JDK 7 and Maven 3.2.1

— Reply to this email directly or view it on GitHub https://github.com/bmatthews68/inmemdb-maven-plugin/issues/20#issuecomment-48926143 .

bmatthews68 commented 10 years ago

Hi Nadeem,

As I originally guessed the problem is that the file cannot be found. This happens when running the build from in CI servers and IDEs when using relative file system paths.

Since TestAppHyperSql.sql is in the src/test/resources it can be loaded as a classpath resource just change the path to classpath:TestAppHyperSql.sql. Can you give that a try and close this issue if it works for you.

Thanks, Brian

nadeemanwar commented 10 years ago

I changed the path to classpath:TestAppHyperSql.sql but get this error. Is that is what you want me to test?

[INFO] Started embedded HSQLDB database [INFO] Server has been started [INFO] Executing initialization scripts and loading data sets [INFO] Loading Script[classpath:TestAppHyperSql.sql] Exception in thread "Thread-1" java.lang.IllegalArgumentException: 'reader' may not be null at org.hsqldb.cmdline.SqlFile.(Unknown Source) at org.hsqldb.cmdline.SqlFile.(Unknown Source) at com.btmatthews.maven.plugins.inmemdb.ldr.sqltool.SQLLoader.load(SQLLoader.java:69) at com.btmatthews.maven.plugins.inmemdb.db.AbstractDatabase.load(AbstractDatabase.java:182) at com.btmatthews.maven.plugins.inmemdb.mojo.RunMojo.started(RunMojo.java:152) at com.btmatthews.utils.monitor.Monitor.runMonitor(Monitor.java:127) at com.btmatthews.utils.monitor.Monitor$1.run(Monitor.java:152) at java.lang.Thread.run(Thread.java:745)

Thanks, nadeem

bmatthews68 commented 10 years ago

Hi Nadeem,

Sorry. I wasn't thinking straight. That classpath: solution would never have worked. I forgot that I added that feature to work with scripts being loaded from other dependency modules. It won't work when the script is in the current module. I'll look into making that a feature in the next release.

In the meantime can you try using ${basedir}. Make the path ${basedir}/src/test/resources/TestAppHyperSql.sql.

Regards, Brian

On 15 July 2014 04:47, nadeemanwar notifications@github.com wrote:

I changed the path to classpath:TestAppHyperSql.sql but get this error. Is that is what you want me to test?

[INFO] Started embedded HSQLDB database [INFO] Server has been started [INFO] Executing initialization scripts and loading data sets [INFO] Loading Script[classpath:TestAppHyperSql.sql] Exception in thread "Thread-1" java.lang.IllegalArgumentException: 'reader' may not be null at org.hsqldb.cmdline.SqlFile.(Unknown Source) at org.hsqldb.cmdline.SqlFile.(Unknown Source) at com.btmatthews.maven.plugins.inmemdb.ldr.sqltool.SQLLoader.load(SQLLoader.java:69) at com.btmatthews.maven.plugins.inmemdb.db.AbstractDatabase.load(AbstractDatabase.java:182) at com.btmatthews.maven.plugins.inmemdb.mojo.RunMojo.started(RunMojo.java:152) at com.btmatthews.utils.monitor.Monitor.runMonitor(Monitor.java:127) at com.btmatthews.utils.monitor.Monitor$1.run(Monitor.java:152) at java.lang.Thread.run(Thread.java:745)

Thanks, nadeem

— Reply to this email directly or view it on GitHub https://github.com/bmatthews68/inmemdb-maven-plugin/issues/20#issuecomment-48987505 .

nadeemanwar commented 10 years ago

Yes that worked. Thanks for the help.