Giter Club home page Giter Club logo

inmemdb-maven-plugin's Issues

For Derby (other databases too?), provide ability to specify output directory for derby.log file

Derby creates a semi-annoying derby.log file that remains in one's working directory after running the plugin. Ideally, it would be nice if it we had the option of dumping it under target/ so it would get erased with each mvn clean. Right now, one can accomplish that by adding the rather cumbersome properties-maven-plugin to the pom like so:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<goals>
<goal>set-system-properties</goal>
</goals>
<configuration>
<properties>
<property>
<name>derby.system.home</name>
<value>${basedir}/target/derby-system</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>

(derby.log gets output whereever the derby.system.home is defined.) But if the inmemdb plugin had a parameter like ${basedir}/target/derby-system (or or or whatever) that could avoid the need for the above properties plugin that would be great.

Support for Maven 3.1

inmemdb-maven-plugin 1.4.2 is not compatible with Maven 3.1:

[ERROR] Failed to execute goal com.btmatthews.maven.plugins.inmemdb:inmemdb-maven-plugin:1.4.2:run (run) on project privacy-impl: The plugin com.btmatthews.maven.plugins.inmemdb:inmemdb-maven-plugin:1.4.2 requires Maven version 3.0.5 -> [Help 1]

centos 6.5 java.net.BindException: Cannot assign requested address

Hello,

I am trying to use this plugin on centos 6.5 but I get a java.net.BindException: Cannot assign requested address.

[INFO] --- inmemdb-maven-plugin:1.3.0:run (run) @ roller-webapp ---
[INFO] Configured database port: 4224
[INFO] Configured database username: APP
[INFO] Configured database password: APP
[INFO] Configured database name: rollerdb
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ roller-webapp ---
[ERROR] Error starting or stopping the monitor
java.net.BindException: Cannot assign requested address
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
at java.net.ServerSocket.bind(ServerSocket.java:376)
at java.net.ServerSocket.(ServerSocket.java:237)
at com.btmatthews.utils.monitor.Monitor.runMonitor(Monitor.java:82)
at com.btmatthews.utils.monitor.Monitor$1.run(Monitor.java:108)
at java.lang.Thread.run(Thread.java:722)

I have checked port 4224 and its not in use.

The exception does not give enough information on which port it cannot assign, and I have looked at the source also.

Adding the element made no difference.

Have you any ideas on what port it wants?

        <plugin>
            <groupId>com.btmatthews.maven.plugins.inmemdb</groupId>
            <artifactId>inmemdb-maven-plugin</artifactId>
            <configuration>
                <monitorKey>inmemdb</monitorKey>
                <monitorPort>11527</monitorPort>
            </configuration>
            <executions>
                <execution>
                    <id>run</id>
                    <phase>test-compile</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <daemon>true</daemon>
                        <type>derby</type>
                        <database>rollerdb</database>
                        <username>APP</username>
                        <password>APP</password>
                        <port>4224</port>
                        <sources>
                            <script>
                                <sourceFile>${pom.basedir}/target/dbscripts/derby/createdb.sql</sourceFile>
                            </script>
                        </sources>
                    </configuration>
                </execution>
                <execution>
                    <id>stop</id>
                    <phase>package</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

Cheers Greg

Error: is an unsupported file type

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.

Hsqldb is mandatory even if we're using derby

Even if using derby, a noclassdeffound appears at shutdown:
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: org/hsqldb/DatabaseURL
at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at com.btmatthews.maven.plugins.inmemdb.db.derby.DerbyDatabase.stop(DerbyDatabase.java:207)
at com.btmatthews.utils.monitor.Monitor.executeCommand(Monitor.java:265)
at com.btmatthews.utils.monitor.Monitor.runMonitorInternal(Monitor.java:180)
at com.btmatthews.utils.monitor.Monitor.runMonitor(Monitor.java:128)
at com.btmatthews.utils.monitor.Monitor$1.run(Monitor.java:152)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.hsqldb.DatabaseURL
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
... 10 more

Add support for loading from DBUnit flat XML

Modify DBUnitXMLLoader to determine if the schema is matches the verbose XML format.
Create DBUnitFlatXMLLoader to load the flat XML format files which will have the same .dbunit.xml as the verbose XML format.
Add DBIUnitFlatXMLLoader to the loaders.

Does it work with Datasource from outside

Hello,

I have used your plugin to populate a hsql database but I experiencing some problems,
I'm using openjpa with annotation class.
I have two datasources and when i run IT my tests uses the persistence file that use the Test datasource.
when running IT I got an exception :

Unable to retrieve EntityManager

Introduce dynamic dependency resolution

Eliminate the need to download all implementations and their transitive dependencies and instead use dynamic resolution to just download the implementation for the target database.

Maven 3.0.5 required?

Is there a specific reason why maven 3.0.5 is required? Debian ships with 3.0.4 which renders inmemdb-maven-plugin unusable for now.

Derbynet looks like it changed

Hi,

Here's the stack when I try to shut down derbydb with version 10.10.2:

J102 : [0] org/apache/derby/impl/drda/NetworkServerControlImpl$3
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.derby.iapi.jdbc.DRDAServerStarter.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: org/apache/derby/impl/drda/NetworkServerControlImpl$3
at org.apache.derby.impl.drda.NetworkServerControlImpl.blockingStart(Unknown Source)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.apache.derby.impl.drda.NetworkServerControlImpl$3
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
... 7 more

No message when port is already in use

When using the plugin to launch an hsqldb instance on a port that is already in use (in this case also hsqldb by a different user) the plugin just continues as if nothing is wrong, but the db is not configured correctly.
It would be nice to show this in the output and maybe even break the maven run with an error.

Inserting data on h2 database via script does not work.

Inserting data via script on h2 db does not work.

I have the following maven plugin configuration where i try to clean the database, create the tables, insert some data. When Inserting the data using a sql script it does not work when the db is H2. It does work when the db is hsqldb. Using a dbunit datascriptb on a h2 database does work.

com.btmatthews.maven.plugins.inmemdb inmemdb-maven-plugin 1.4.3 11527 inmemdb h2 testDB <script> ${project.basedir}/src/test/resources/sql/cleanup.sql </script> <script> ${project.basedir}/src/test/resources/sql/schema.sql </script>
                    <dataSet>
            <sourceFile>${project.basedir}/src/test/resources/sql/dataSet.xml</sourceFile>
        </dataSet>
        <!--<script>-->,
                <!--<sourceFile>${project.basedir}/src/test/resources/sql/test-data.sql</sourceFile>-->
                        <!--</script>-->
                    </sources>
                </configuration>
            </plugin>

deamon mode does not execute sql-sources

If <daemon>true</daemon> the scripts declared within <sources> will not be executed.

This is impractical for the use case when you want to start and initialize the database in pre-integration-test

Provide an option for the derby.log file to be generated

For the vast majority of test generations (including all successful ones) the derby.log file is useless and it's nice that the plugin is not cluttering work folders by adding that file in. However, while debugging failed test cases (particularly with JPA/Hibernate) it can sometimes be helpful when one activates SQL statement logging: http://www.jroller.com/gmazza/entry/apache_derby_setup#logging to see the SQL statements that the JPA classes generated to try to figure out what went wrong. Derby presently prints this in the derby.log file.

I would recommend a <showLogFiles/> option, which I would default to FALSE so you don't even need to list it in your plugin if you're not debugging JPA or JDBC or whatever. However, if you need to see the SQL statements, you can add that setting in and configure your derby.properties file as described in the link above to see the SQL output if you wish. It is not necessary for the plugin to configure the location of the derby.log file, as that can be set by defining derby.system.home within the now-required derby.properties file (and it defaults to the directory in which you ran Maven if it is not set.)

This is not a crucial matter presently, as worst-case, one can downgrade to 1.2.0 of the plugin for this debugging functionality if ever needed. I either never or almost never have a need it myself, but I think it's a good-to-have.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.