[opencms-dev] Running Unit test cases (was: [PATCH] PostgreSQLSupport for OpenCms 6.x (CVS))

Antonio Core antonio at starsolutions.it
Mon Dec 20 18:10:23 CET 2004


Alex,

you can download the PostgreSQL JDBC driver from here:

http://jdbc.postgresql.org/download/pg74.215.jdbc3.jar

Regarding tests:

You are right, I executed the org.opencms.xml.content.AllTests; Now, I'm
executing the right one (org.opencms.test.AllTests). :-|

For this reason, may you wait to include my patches released yesterday?
I'll send you the right one asap.

Running unittests with the right class, I receive this error:

Testcase: testLegacyInitialization took 2.672 sec
        FAILED
Master tables not created!
junit.framework.AssertionFailedError: Master tables not created!
        at
org.opencms.module.TestModuleLegacy.testLegacyInitialization(TestModuleLegacy.java:143)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at
junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)
        at
junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)


To resolve this problem, I created the file 'postgresql.sql' with
specific PostgreSQL commands, but I don't know how to proceed to insert
it into the "org.opencms.legacy.compatibility" module.

May be, do I have to follow these steps? :

- Create the 'postgresql.sql' directly inside OpenCMS database (using
OpenCms Application);
- Export the module changed;
- change the source code of module in my source tree using the source
code generated by export.

Is it the right way to proceed?
May you support me??


Regards,

Antonio



On Mon, 2004-12-20 at 12:44 +0100, Alexander Kandzior wrote:
> Antonio, 
> 
> I'll include your patch in the CVS later today or tomorrow.
> 
> Please send me the download URL for the ProstgreSQL pg74.215.jdbc3.jar, I'll
> then include this in the distribution as well.
> 
> Regarding yout tests: Did you execute org.opencms.test.AllTests? The output
> you attached was only regarding org.opencms.xml.content.AllTests, so there's
> a lot missing. In fact, if you did execute the right test, you must have
> exactly one test failing, this is the "publish project scenario A", since
> this currently always fails.
> 
> Best Regards,
> Alex.
> 
> Alexander Kandzior
> Alkacon Software - The OpenCms Experts
> http://www.alkacon.com
> 
>  
> 
> > -----Original Message-----
> > From: opencms-dev-bounces at opencms.org 
> > [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Antonio Core
> > Sent: Sunday, December 19, 2004 2:33 AM
> > To: The OpenCms mailing list
> > Subject: Re: [opencms-dev] Running Unit test cases (was: 
> > [PATCH] PostgreSQLSupport for OpenCms 6.x (CVS))
> > 
> > Alex,
> > 
> > I regret for the late response, but I had problems with my Pc...
> > 
> > I prepared the configurations file for unit tests on 
> > PostgreSQL following your instructions.
> > The tests have been executed without errors; please, find 
> > attached at this email the log file 
> > (TEST-org.opencms.xml.content.AllTests.txt).
> > 
> > Attached at this email there is the 
> > "opencms_postgresql_02.patch" file with these changes:
> > 
> >     File changed:
> > 
> >           - opencms/build.xml 
> >                  the postgresql lines have  been added.
> > 
> >           - opencms/test/test.properties  
> >                  the setup for postgresql has been added.
> > 
> >           - opencms/test/data/WEB-INF/config/opencms-vfs.xml
> >                  the unittests failed because the class 
> >                                 
> > 
> > org.opencms.workplace.xmlwidgets.CmsXmlVfsImageWidget
> > 
> >                 doesn't exist anymore in the CVS tree.
> >                 Reading in the CVS log, I thought taht this 
> > class has been replaced by
> >                   
> > 
> > org.opencms.workplace.xmlwidgets.CmsXmlImageGalleryWidget
> > 
> >                  For this reason, I replaced the line:
> > 
> > <widget class="org.opencms.workplace.xmlwidgets.CmsXmlVfsImageWidget"
> > alias="VfsImageWidget"/>
> > 
> >                   whit that one:
> > 
> > <widget
> > class="org.opencms.workplace.xmlwidgets.CmsXmlImageGalleryWidget"
> > alias="ImageWidget" />
> > 
> >                   This is the same value as in the  
> >                        opencms/webapp/WEB-INF/config/opencms-vfs.xml
> > file.
> >                    I hope that it is correct.
> > 
> > 
> >            - opencms/webapp/setup/database/postgresql/create_db.sql
> >            - opencms/webapp/setup/database/postgresql/drop_db.sql
> >            - opencms/webapp/setup/database/postgresql/drop_tables.sql
> >            -
> > opencms/webapp/setup/database/postgresql/step_4_database_setup.jsp
> >                    Changed the PostgreSQL setup file, 
> > according unittests results.
> > 
> >     File Added:
> >           -
> > opencms/test/data/WEB-INF/config.postgresql/opencms-modules.xml
> >           -
> > opencms/test/data/WEB-INF/config.postgresql/opencms.properties
> >                   Configuration files to use in unittests 
> > with PostgreSQL database
> > 
> > Moreover, in the CVS source tree the file pg74.215.jdbc3.jar 
> > is not present yet...
> > 
> > Best Regards,
> > Antonio
> > 
> > 
> > On Mon, 2004-12-06 at 12:36 +0100, Alexander Kandzior wrote:
> > > Antonio,
> > > 
> > > It took me a couple of days, but I actually "repaired" the 
> > "unittests"
> > > target in the build.xml file. Turns out there was a library 
> > missing. 
> > > 
> > > Let's assume you are able to run "ant war" and generate the OpenCms 
> > > war file.
> > > 
> > > Try running "ant unittests". This will run all the Junit tests and 
> > > write the output to a file. The location of the file is ant 
> > specific 
> > > and may depend on your setup. Also, the optional "junit" target 
> > > support for ant is required, this usually comes in a 
> > "ant-junit.jar". 
> > > Please check the ant homepage on how to configure these since.
> > > 
> > > OpenCms configuration for unit tests:
> > > 
> > > The unit tests run with a pre-configured database 
> > configuration. The 
> > > file "/test/test.properties" contains the main test settings. 
> > > Basically you must configure the database you want to test here, as 
> > > well as the local path configuration where the data is located.
> > > 
> > > Each database must come with it's own set of pre-configured 
> > > "opencms.properties". In the folder "/test/data/WEB-INF" 
> > you will find 
> > > one config.xxx folder for each supported database. These files are 
> > > copied automatically to "/test/data/WEB-INF/config" during 
> > test setup.
> > > 
> > > For example, mySQL is configured by default in 
> > "test.propeties" with 
> > > the "db.product=mysql" setting. So the mySQL secific settings are 
> > > taken form the folder  "/test/data/WEB-INF/config.mysql". So in the 
> > > mySQL example, it's assumed that there is a local mysql 
> > installation, the user name is "root"
> > > and the user has no password. All of this is located in 
> > > "opencms.properties". In case the test cases can't connect to the 
> > > database, you must modify these parameters.
> > > 
> > > Best Regards,
> > > Alex.
> > > 
> > > Alexander Kandzior
> > > Alkacon Software - The OpenCms Experts http://www.alkacon.com
> > > 
> > >  
> > > 
> > > > -----Original Message-----
> > > > From: opencms-dev-bounces at opencms.org 
> > > > [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Antonio Core
> > > > Sent: Thursday, December 02, 2004 2:56 PM
> > > > To: The OpenCms mailing list
> > > > Subject: RE: [opencms-dev] [PATCH] PostgreSQL Support for OpenCms 
> > > > 6.x (CVS)
> > > > 
> > > > Alex,
> > > > 
> > > > Normally, I use jEdit as my development tool.
> > > > 
> > > > Anyway, I've already installed Eclipse (ver 3.1M3) and I'm trying 
> > > > it. ;)
> > > > 
> > > > May you send me more informations about how proceed to setup and 
> > > > perform JUnit tests with Eclipse?
> > > > 
> > > > Best Regards,
> > > > 
> > > > Antonio
> > > > 
> > > > 
> > > > 
> > > > On Thu, 2004-12-02 at 10:36, Alexander Kandzior wrote:
> > > > > Are you using Eclipse for development?
> > > > > If so, I can yout tell how we do it, since we are using Eclipse.
> > > > > If not, there's also an ant task, but this may 
> > currently be broken.
> > > > > 
> > > > > Best Regards,
> > > > > Alex.
> > > > > 
> > > > > Alexander Kandzior
> > > > > Alkacon Software - The OpenCms Experts http://www.alkacon.com
> > > > > 
> > > > >  
> > > > > 
> > > > > > -----Original Message-----
> > > > > > From: opencms-dev-bounces at opencms.org 
> > > > > > [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Antonio 
> > > > > > Core
> > > > > > Sent: Thursday, December 02, 2004 10:19 AM
> > > > > > To: The OpenCms mailing list
> > > > > > Subject: RE: [opencms-dev] [PATCH] PostgreSQL Support for 
> > > > > > OpenCms 6.x (CVS)
> > > > > > 
> > > > > > Alex,
> > > > > > 
> > > > > > No, i didn't, sorry.
> > > > > > 
> > > > > > I think that it will be necessary too.
> > > > > > 
> > > > > > Thank you very much if you support me with that.
> > > > > > 
> > > > > > Best Regards,
> > > > > > 
> > > > > > Antonio
> > > > > > 
> > > > > > 
> > > > > > On Thu, 2004-12-02 at 09:51, Alexander Kandzior wrote:
> > > > > > > I applied these fixes to the CVS version.
> > > > > > > 
> > > > > > > Antonio, did you run the Junit tests for Postgessql? These
> > > > > > are really
> > > > > > > helpful since they have quite a broad range of daabase
> > > > operation
> > > > > > > covered already. If not I can support you in getting these
> > > > > > up and running.
> > > > > > > 
> > > > > > > Best Regards,
> > > > > > > Alex.
> > > > > > > 
> > > > > > > Alexander Kandzior
> > > > > > > Alkacon Software - The OpenCms Experts 
> > http://www.alkacon.com
> > > > > > > 
> > > > > > >  
> > > > > > > 
> > > > > > > > -----Original Message-----
> > > > > > > > From: opencms-dev-bounces at opencms.org 
> > > > > > > > [mailto:opencms-dev-bounces at opencms.org] On Behalf Of 
> > > > > > > > Antonio Core
> > > > > > > > Sent: Wednesday, December 01, 2004 10:14 PM
> > > > > > > > To: OpenCms
> > > > > > > > Subject: [opencms-dev] [PATCH] PostgreSQL Support for 
> > > > > > > > OpenCms 6.x
> > > > > > > > (CVS)
> > > > > > > > 
> > > > > > > > Dear all,
> > > > > > > > 
> > > > > > > > here is a patch for postgreSQL database support.
> > > > > > > > 
> > > > > > > > The files changed:
> > > > > > > > 
> > > > > > > > 
> > opencms/src/org/opencms/db/postgresql/CmsBackupDriver.java 
> > > > > > > >         (specialized method deleteBackups of class   
> > > > > > > >          
> > opencms.src.org.opencms.db.generic.CmsBackupDriver)
> > > > > > > > 
> > > > > > > > opencms/src/org/opencms/db/postgresql/query.properties
> > > > > > > >         (added queries:
> > > > > > > >                 C_POSTGRESQL_BACKUP_DELETE_CONTENT
> > > > > > > >                 C_POSTGRESQL_BACKUP_DELETE_RESOURCES
> > > > > > > >                 C_POSTGRESQL_BACKUP_DELETE_STRUCTURE
> > > > > > > >          removed query:
> > > > > > > >                 C_BACKUP_DELETE_RESOURCE
> > > > > > > >         )
> > > > > > > > 
> > > > > > > > 
> > > > > > > > Having a CVS checkout of the opencms source, go into
> > > > the opencms
> > > > > > > > directory and launch the following command:
> > > > > > > > 
> > > > > > > > patch -p0 < ....path.../opencms_postgresql_01.patch
> > > > > > > > 
> > > > > > > > 
> > > > > > > > Best Regards,
> > > > > > > > 
> > > > > > > > Antonio
> > > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > _______________________________________________
> > > > > > > This mail is send to you from the opencms-dev mailing list
> > > > > > To change
> > > > > > > your list options, or to unsubscribe from the list,
> > > > please visit
> > > > > > > http://mail.opencms.org/mailman/listinfo/opencms-dev
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > _______________________________________________
> > > > > > This mail is send to you from the opencms-dev mailing
> > > > list To change
> > > > > > your list options, or to unsubscribe from the list, 
> > please visit 
> > > > > > http://mail.opencms.org/mailman/listinfo/opencms-dev
> > > > > > 
> > > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > _______________________________________________
> > > > > This mail is send to you from the opencms-dev mailing list
> > > > To change
> > > > > your list options, or to unsubscribe from the list, 
> > please visit 
> > > > > http://mail.opencms.org/mailman/listinfo/opencms-dev
> > > > 
> > > > 
> > > > 
> > > > _______________________________________________
> > > > This mail is send to you from the opencms-dev mailing 
> > list To change 
> > > > your list options, or to unsubscribe from the list, please visit 
> > > > http://mail.opencms.org/mailman/listinfo/opencms-dev
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > This mail is send to you from the opencms-dev mailing list 
> > To change 
> > > your list options, or to unsubscribe from the list, please visit 
> > > http://mail.opencms.org/mailman/listinfo/opencms-dev
> > 
> 
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev




More information about the opencms-dev mailing list