You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Ron Smits <ro...@gmail.com> on 2014/11/12 15:16:43 UTC

testing with eclipselink.

I have a small application that uses eclipselink and sqlite. This works
perfectly except for the testing. I have no clue how to tell EJBContainer
to use eclipselink as provider. It is setup in persistence.xml:

<persistence-unit name="evedb" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <class>org.ronsmits.eveasset.evedomain.BluePrint</class>
        <class>org.ronsmits.eveasset.evedomain.EveItem</class>
        <jta-data-source>evedb</jta-data-source>
        <properties>
            <property name="eclipselink.ddl-generation" value="create-tables"/>
            <property name="eclipselink.logging.file" value="/tmp/output.log"/>
            <property name="eclipselink.logging.logger" value="JavaLogger"/>
            <property name="eclipselink.logging.level" value="SEVERE"/>
        </properties>
    </persistence-unit>

My resource for the database is:

<resources>
    <Resource id="evedb" type="javax.sql.DataSource">
        jdbcDriver = org.sqlite.JDBC
        jdbcUrl = jdbc:sqlite:${db}
    </Resource>
</resources>

(The ${db} gets filled in by maven)

My test case starts with setting up the EJBContainer:

    @Before
    public void setUp() throws NamingException {
        Properties p = new Properties();
        p.put("evedb", "new://Resource?type=DataSource");
        p.put("evedb.JdbcDriver", "org.sqlite.JDBC");
        p.put("evedb.JdbcUrl",
"jdbc:sqlite:/home/ron/Downloads/sqlite-latest.sqlite");
        container = EJBContainer.createEJBContainer(p);
        container.getContext().bind("inject", this);
    }

The tests are not even run as EJBContainer tries to start the persistence
with openJPA instead of with eclipselink. Now I have seen that there is a
tomee-plume package nowadays but I can imagine this has a solution that I
am completely overlooking.

Any help?

Ron

I Haven’t Lost My Mind - It’s Backed Up On Disk Somewhere
​

Re: testing with eclipselink.

Posted by Romain Manni-Bucau <rm...@tomitribe.com>.
2014-11-12 16:11 GMT+01:00 Howard W. Smith, Jr. <sm...@gmail.com>:
> On Wed, Nov 12, 2014 at 9:20 AM, Romain Manni-Bucau <
> rmannibucau@tomitribe.com> wrote:
>
>> Site note: we have an openejb-core-eclipselink replacing openejb-core
>> which comes with eclipselink out of the box
>>
>
> Was openejb-core-eclipselink added for Plume (mojarra/eclipselink)?

More or less. Since some users use plume then they should be able to
test in embedded mode as well.

>  what version of eclipselink is it?

2.4.2

Re: testing with eclipselink.

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
On Wed, Nov 12, 2014 at 9:20 AM, Romain Manni-Bucau <
rmannibucau@tomitribe.com> wrote:

> Site note: we have an openejb-core-eclipselink replacing openejb-core
> which comes with eclipselink out of the box
>

Was openejb-core-eclipselink added for Plume (mojarra/eclipselink)? what
version of eclipselink is it?

Re: testing with eclipselink.

Posted by Romain Manni-Bucau <rm...@tomitribe.com>.
We all did it ;)
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-11-12 15:59 GMT+01:00 Ron Smits <ro...@gmail.com>:
> ok sorry to have bothered the list. There was a second persistence.xml
> lurking around. After cleaning my shit (and in the meantime cleaning my
> pom) all started working the way I want. Thanks Romain for pointing me to
> the right direction.
>
> Ron
>
> On Wed Nov 12 2014 at 3:21:01 PM Romain Manni-Bucau <
> rmannibucau@tomitribe.com> wrote:
>
>> Hi
>>
>> are you sure you use the persistence.xml you think? setting provider
>> you shouldn't have any issue.
>>
>> Site note: we have an openejb-core-eclipselink replacing openejb-core
>> which comes with eclipselink out of the box
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>>
>> 2014-11-12 15:16 GMT+01:00 Ron Smits <ro...@gmail.com>:
>> > I have a small application that uses eclipselink and sqlite. This works
>> > perfectly except for the testing. I have no clue how to tell EJBContainer
>> > to use eclipselink as provider. It is setup in persistence.xml:
>> >
>> > <persistence-unit name="evedb" transaction-type="JTA">
>> >         <provider>org.eclipse.persistence.jpa.
>> PersistenceProvider</provider>
>> >         <class>org.ronsmits.eveasset.evedomain.BluePrint</class>
>> >         <class>org.ronsmits.eveasset.evedomain.EveItem</class>
>> >         <jta-data-source>evedb</jta-data-source>
>> >         <properties>
>> >             <property name="eclipselink.ddl-generation"
>> value="create-tables"/>
>> >             <property name="eclipselink.logging.file"
>> value="/tmp/output.log"/>
>> >             <property name="eclipselink.logging.logger"
>> value="JavaLogger"/>
>> >             <property name="eclipselink.logging.level" value="SEVERE"/>
>> >         </properties>
>> >     </persistence-unit>
>> >
>> > My resource for the database is:
>> >
>> > <resources>
>> >     <Resource id="evedb" type="javax.sql.DataSource">
>> >         jdbcDriver = org.sqlite.JDBC
>> >         jdbcUrl = jdbc:sqlite:${db}
>> >     </Resource>
>> > </resources>
>> >
>> > (The ${db} gets filled in by maven)
>> >
>> > My test case starts with setting up the EJBContainer:
>> >
>> >     @Before
>> >     public void setUp() throws NamingException {
>> >         Properties p = new Properties();
>> >         p.put("evedb", "new://Resource?type=DataSource");
>> >         p.put("evedb.JdbcDriver", "org.sqlite.JDBC");
>> >         p.put("evedb.JdbcUrl",
>> > "jdbc:sqlite:/home/ron/Downloads/sqlite-latest.sqlite");
>> >         container = EJBContainer.createEJBContainer(p);
>> >         container.getContext().bind("inject", this);
>> >     }
>> >
>> > The tests are not even run as EJBContainer tries to start the persistence
>> > with openJPA instead of with eclipselink. Now I have seen that there is a
>> > tomee-plume package nowadays but I can imagine this has a solution that I
>> > am completely overlooking.
>> >
>> > Any help?
>> >
>> > Ron
>> >
>> > I Haven’t Lost My Mind - It’s Backed Up On Disk Somewhere
>> >
>>

Re: testing with eclipselink.

Posted by Ron Smits <ro...@gmail.com>.
ok sorry to have bothered the list. There was a second persistence.xml
lurking around. After cleaning my shit (and in the meantime cleaning my
pom) all started working the way I want. Thanks Romain for pointing me to
the right direction.

Ron

On Wed Nov 12 2014 at 3:21:01 PM Romain Manni-Bucau <
rmannibucau@tomitribe.com> wrote:

> Hi
>
> are you sure you use the persistence.xml you think? setting provider
> you shouldn't have any issue.
>
> Site note: we have an openejb-core-eclipselink replacing openejb-core
> which comes with eclipselink out of the box
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
>
> 2014-11-12 15:16 GMT+01:00 Ron Smits <ro...@gmail.com>:
> > I have a small application that uses eclipselink and sqlite. This works
> > perfectly except for the testing. I have no clue how to tell EJBContainer
> > to use eclipselink as provider. It is setup in persistence.xml:
> >
> > <persistence-unit name="evedb" transaction-type="JTA">
> >         <provider>org.eclipse.persistence.jpa.
> PersistenceProvider</provider>
> >         <class>org.ronsmits.eveasset.evedomain.BluePrint</class>
> >         <class>org.ronsmits.eveasset.evedomain.EveItem</class>
> >         <jta-data-source>evedb</jta-data-source>
> >         <properties>
> >             <property name="eclipselink.ddl-generation"
> value="create-tables"/>
> >             <property name="eclipselink.logging.file"
> value="/tmp/output.log"/>
> >             <property name="eclipselink.logging.logger"
> value="JavaLogger"/>
> >             <property name="eclipselink.logging.level" value="SEVERE"/>
> >         </properties>
> >     </persistence-unit>
> >
> > My resource for the database is:
> >
> > <resources>
> >     <Resource id="evedb" type="javax.sql.DataSource">
> >         jdbcDriver = org.sqlite.JDBC
> >         jdbcUrl = jdbc:sqlite:${db}
> >     </Resource>
> > </resources>
> >
> > (The ${db} gets filled in by maven)
> >
> > My test case starts with setting up the EJBContainer:
> >
> >     @Before
> >     public void setUp() throws NamingException {
> >         Properties p = new Properties();
> >         p.put("evedb", "new://Resource?type=DataSource");
> >         p.put("evedb.JdbcDriver", "org.sqlite.JDBC");
> >         p.put("evedb.JdbcUrl",
> > "jdbc:sqlite:/home/ron/Downloads/sqlite-latest.sqlite");
> >         container = EJBContainer.createEJBContainer(p);
> >         container.getContext().bind("inject", this);
> >     }
> >
> > The tests are not even run as EJBContainer tries to start the persistence
> > with openJPA instead of with eclipselink. Now I have seen that there is a
> > tomee-plume package nowadays but I can imagine this has a solution that I
> > am completely overlooking.
> >
> > Any help?
> >
> > Ron
> >
> > I Haven’t Lost My Mind - It’s Backed Up On Disk Somewhere
> >
>

Re: testing with eclipselink.

Posted by Romain Manni-Bucau <rm...@tomitribe.com>.
Hi

are you sure you use the persistence.xml you think? setting provider
you shouldn't have any issue.

Site note: we have an openejb-core-eclipselink replacing openejb-core
which comes with eclipselink out of the box
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-11-12 15:16 GMT+01:00 Ron Smits <ro...@gmail.com>:
> I have a small application that uses eclipselink and sqlite. This works
> perfectly except for the testing. I have no clue how to tell EJBContainer
> to use eclipselink as provider. It is setup in persistence.xml:
>
> <persistence-unit name="evedb" transaction-type="JTA">
>         <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>         <class>org.ronsmits.eveasset.evedomain.BluePrint</class>
>         <class>org.ronsmits.eveasset.evedomain.EveItem</class>
>         <jta-data-source>evedb</jta-data-source>
>         <properties>
>             <property name="eclipselink.ddl-generation" value="create-tables"/>
>             <property name="eclipselink.logging.file" value="/tmp/output.log"/>
>             <property name="eclipselink.logging.logger" value="JavaLogger"/>
>             <property name="eclipselink.logging.level" value="SEVERE"/>
>         </properties>
>     </persistence-unit>
>
> My resource for the database is:
>
> <resources>
>     <Resource id="evedb" type="javax.sql.DataSource">
>         jdbcDriver = org.sqlite.JDBC
>         jdbcUrl = jdbc:sqlite:${db}
>     </Resource>
> </resources>
>
> (The ${db} gets filled in by maven)
>
> My test case starts with setting up the EJBContainer:
>
>     @Before
>     public void setUp() throws NamingException {
>         Properties p = new Properties();
>         p.put("evedb", "new://Resource?type=DataSource");
>         p.put("evedb.JdbcDriver", "org.sqlite.JDBC");
>         p.put("evedb.JdbcUrl",
> "jdbc:sqlite:/home/ron/Downloads/sqlite-latest.sqlite");
>         container = EJBContainer.createEJBContainer(p);
>         container.getContext().bind("inject", this);
>     }
>
> The tests are not even run as EJBContainer tries to start the persistence
> with openJPA instead of with eclipselink. Now I have seen that there is a
> tomee-plume package nowadays but I can imagine this has a solution that I
> am completely overlooking.
>
> Any help?
>
> Ron
>
> I Haven’t Lost My Mind - It’s Backed Up On Disk Somewhere
>