From: <fg...@us...> - 2007-08-13 10:33:05
|
Revision: 400 http://openutils.svn.sourceforge.net/openutils/?rev=400&view=rev Author: fgiust Date: 2007-08-13 03:33:07 -0700 (Mon, 13 Aug 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-mgnlstripes-0.1 Added Paths: ----------- tags/openutils-mgnlstripes-0.1/ tags/openutils-mgnlstripes-0.1/pom.xml tags/openutils-mgnlstripes-0.1/src/site/ tags/openutils-mgnlstripes-0.1/src/site/apt/index.apt Removed Paths: ------------- tags/openutils-mgnlstripes-0.1/pom.xml tags/openutils-mgnlstripes-0.1/src/site/apt/index.apt Copied: tags/openutils-mgnlstripes-0.1 (from rev 395, trunk/openutils-mgnlstripes) Deleted: tags/openutils-mgnlstripes-0.1/pom.xml =================================================================== --- trunk/openutils-mgnlstripes/pom.xml 2007-08-13 09:12:49 UTC (rev 395) +++ tags/openutils-mgnlstripes-0.1/pom.xml 2007-08-13 10:33:07 UTC (rev 400) @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <modelVersion>4.0.0</modelVersion> - <packaging>jar</packaging> - <artifactId>openutils-mgnlstripes</artifactId> - <name>openutils-mgnlstripes</name> - <version>0.1-SNAPSHOT</version> - <build> - <resources> - <resource> - <filtering>false</filtering> - <directory>src/main/resources</directory> - <includes> - <include>**/*</include> - </includes> - </resource> - <resource> - <filtering>true</filtering> - <directory>src/main/resources</directory> - <includes> - <include>META-INF/magnolia/*</include> - </includes> - </resource> - </resources> - </build> - <dependencies> - <dependency> - <groupId>net.sourceforge.stripes</groupId> - <artifactId>stripes</artifactId> - <version>1.4.3</version> - </dependency> - <dependency> - <groupId>info.magnolia</groupId> - <artifactId>magnolia-core</artifactId> - <version>3.1-m3</version> - </dependency> - <dependency> - <groupId>info.magnolia</groupId> - <artifactId>magnolia-module-admininterface</artifactId> - <version>3.1-m3</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.4</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jsp-api</artifactId> - <version>2.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <classifier>jdk15</classifier> - <version>5.1</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> -</project> Copied: tags/openutils-mgnlstripes-0.1/pom.xml (from rev 399, trunk/openutils-mgnlstripes/pom.xml) =================================================================== --- tags/openutils-mgnlstripes-0.1/pom.xml (rev 0) +++ tags/openutils-mgnlstripes-0.1/pom.xml 2007-08-13 10:33:07 UTC (rev 400) @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <packaging>jar</packaging> + <artifactId>openutils-mgnlstripes</artifactId> + <name>openutils-mgnlstripes</name> + <version>0.1</version> + <build> + <resources> + <resource> + <filtering>false</filtering> + <directory>src/main/resources</directory> + <includes> + <include>**/*</include> + </includes> + </resource> + <resource> + <filtering>true</filtering> + <directory>src/main/resources</directory> + <includes> + <include>META-INF/magnolia/*</include> + </includes> + </resource> + </resources> + </build> + <dependencies> + <dependency> + <groupId>net.sourceforge.stripes</groupId> + <artifactId>stripes</artifactId> + <version>1.4.3</version> + </dependency> + <dependency> + <groupId>info.magnolia</groupId> + <artifactId>magnolia-core</artifactId> + <version>3.1-m3</version> + </dependency> + <dependency> + <groupId>info.magnolia</groupId> + <artifactId>magnolia-module-admininterface</artifactId> + <version>3.1-m3</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.4</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jsp-api</artifactId> + <version>2.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <classifier>jdk15</classifier> + <version>5.1</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlstripes-0.1</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlstripes-0.1</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-mgnlstripes-0.1</url> + </scm> +</project> Copied: tags/openutils-mgnlstripes-0.1/src/site (from rev 397, trunk/openutils-mgnlstripes/src/site) Deleted: tags/openutils-mgnlstripes-0.1/src/site/apt/index.apt =================================================================== --- trunk/openutils-mgnlstripes/src/site/apt/index.apt 2007-08-13 10:04:10 UTC (rev 397) +++ tags/openutils-mgnlstripes-0.1/src/site/apt/index.apt 2007-08-13 10:33:07 UTC (rev 400) @@ -1,149 +0,0 @@ - -------------------------- - openutils-mgnlstripes - -------------------------- - Fabrizio Giustina - -------------------------- - -About - - openutils-mgnlstripes is a custom {{{http://www.magnolia.info}magnolia}} module which integrates the - {{{http://mc4j.org/confluence/display/stripes/Home}Stripes}} MVC framework. - - After installed into magnolia, this module will allow you to use any available Stripes action as a Magnolia paragraph, - Any magically-converted Stripes action will still be able to use any standard Stripes feature, plus it will enjoy the - automatic injection of any paragraph property. - - <<This module requires magnolia 3.1-m3, and will not work on any earlier version!>> - -Configuration - - First of all drop the openutils-mgnlstripes jar and the stripes jar into WEB-INF/lib, or (better) if you are using maven - just declare the following dependency: - -+----------------------------------------------+ - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-mgnlstripes</artifactId> - <version>0.1</version> - </dependency> -+----------------------------------------------+ - - Then configure stripes in your web.xml as usual (see {{{http://mc4j.org/confluence/display/stripes/Quick+Start+Guide}}} for this. - - You only need to change the configuration for the stripes <<<ActionResolver.Class>>> in order to use - <<<it.openutils.magnoliastripes.MgnlActionResolver>>>. You can do that by adding/modifying the following init parameter - in WEB.xml: - - -+----------------------------------------------+ - <init-param> - <param-name>ActionResolver.Class</param-name> - <param-value>it.openutils.magnoliastripes.MgnlActionResolver</param-value> - </init-param> -+----------------------------------------------+ - -Usage - - When magnolia and stripes will startup now any auto-discovered stripes action will be configured in order to be used as - a magnolia paragraph. This means that paragraphs will be auto-generated, and they don't need to be configured into jcr. - - You should see a few <<<info>>> logs that enumerates the list of stripes paragraphs configured. By convention the name of - the paragraph is the same name of the Stripes action class minus action and lowercase. - - So <<<it.myapp.web.MyStripesAction >>> will be available as a paragraph named <<<mystripes>>>. - - Before being able to use any paragraph you will need to create a dialog for that. By convention the dialog should have - the same name of the paragraph so, following the previous example, you will need to configure a dialog called <<<mystripes>>>. - - Try to put a property called <<<title>>> in such dialog for a test. - - You are ready to use your paragraph into any magnolia template as usual: - -+----------------------------------------------+ - - <cms:contentNodeIterator contentNodeCollectionName="column"> - <cms:editBar adminOnly="true" /> - <cms:includeTemplate /> - </cms:contentNodeIterator> - <cms:newBar contentNodeCollectionName="column" paragraph="mystripes" adminOnly="true" /> - -+----------------------------------------------+ - - Try to add an instance of the <<<mystripes>>> paragraph. Set the title property to whatever you want, you - will be able to use it in your Stripes action bean. - - The following example show the code for the simple <<<MyStripesAction>>> that prints out the configured title to the log: - -+----------------------------------------------+ -package it.myapp.web; - -import net.sourceforge.stripes.action.ActionBean; -import net.sourceforge.stripes.action.ActionBeanContext; -import net.sourceforge.stripes.action.DefaultHandler; -import net.sourceforge.stripes.action.ForwardResolution; -import net.sourceforge.stripes.action.Resolution; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class MyStripesAction implements ActionBean -{ - - private Logger log = LoggerFactory.getLogger(MyStripesAction.class); - - private String title; - - @Override - public ActionBeanContext getContext() - { - // TODO - return null; - } - - @Override - public void setContext(ActionBeanContext context) - { - // TODO - } - - public void setTitle(String title) - { - this.title = title; - } - - @DefaultHandler - public Resolution show() - { - - log.info("My title is: {}!", title); - - return new ForwardResolution("/templates/paragraphs/anyjsp.jsp"); - } -} -+----------------------------------------------+ - - As you can see, you will be able to mix parameters that you can use in Stripes action with pure content. Note that you - will not need to configure and use any magnolia paragraph property into your action since you can still use also the - standard magnolia tags in the jsp that is rendered by stripes! - - -Todo/improvements - - Warning! This is a preliminary technology-preview release! - - What does this means? Well, that it should work fine, but the integration is not yet complete and there are still some - missing features... be careful for what is know to not to work. - - - This is a list of know todos: - - * Important! reload stripes paragraph when the configuration of other paragraphs in magnolia is changed! At this moment - stripes paragraphs disappear after any change in paragraphs configured into jcr. - - * Handle multipart forms in request wrapper (should be easy to do) - - * A better way of handling multivalued properties in paragraph - - * Handle binary properties in paragraph - Copied: tags/openutils-mgnlstripes-0.1/src/site/apt/index.apt (from rev 398, trunk/openutils-mgnlstripes/src/site/apt/index.apt) =================================================================== --- tags/openutils-mgnlstripes-0.1/src/site/apt/index.apt (rev 0) +++ tags/openutils-mgnlstripes-0.1/src/site/apt/index.apt 2007-08-13 10:33:07 UTC (rev 400) @@ -0,0 +1,149 @@ + -------------------------- + openutils-mgnlstripes + -------------------------- + Fabrizio Giustina + -------------------------- + +About openutils-mgnlstripes + + openutils-mgnlstripes is a custom {{{http://www.magnolia.info}magnolia}} module which integrates the + {{{http://mc4j.org/confluence/display/stripes/Home}Stripes}} MVC framework. + + After installed into magnolia, this module will allow you to use any available Stripes action as a Magnolia paragraph, + Any magically-converted Stripes action will still be able to use any standard Stripes feature, plus it will enjoy the + automatic injection of any paragraph property. + + <<This module requires magnolia 3.1-m3, and will not work on any earlier version!>> + +Configuration + + First of all drop the openutils-mgnlstripes jar and the stripes jar into WEB-INF/lib, or (better) if you are using maven + just declare the following dependency: + ++----------------------------------------------+ + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-mgnlstripes</artifactId> + <version>0.1</version> + </dependency> ++----------------------------------------------+ + + Then configure stripes in your web.xml as usual (see {{{http://mc4j.org/confluence/display/stripes/Quick+Start+Guide}}} for this. + + You only need to change the configuration for the stripes <<<ActionResolver.Class>>> in order to use + <<<it.openutils.magnoliastripes.MgnlActionResolver>>>. You can do that by adding/modifying the following init parameter + in WEB.xml: + + ++----------------------------------------------+ + <init-param> + <param-name>ActionResolver.Class</param-name> + <param-value>it.openutils.magnoliastripes.MgnlActionResolver</param-value> + </init-param> ++----------------------------------------------+ + +Usage + + When magnolia and stripes will startup now any auto-discovered stripes action will be configured in order to be used as + a magnolia paragraph. This means that paragraphs will be auto-generated, and they don't need to be configured into jcr. + + You should see a few <<<info>>> logs that enumerates the list of stripes paragraphs configured. By convention the name of + the paragraph is the same name of the Stripes action class minus action and lowercase. + + So <<<it.myapp.web.MyStripesAction >>> will be available as a paragraph named <<<mystripes>>>. + + Before being able to use any paragraph you will need to create a dialog for that. By convention the dialog should have + the same name of the paragraph so, following the previous example, you will need to configure a dialog called <<<mystripes>>>. + + Try to put a property called <<<title>>> in such dialog for a test. + + You are ready to use your paragraph into any magnolia template as usual: + ++----------------------------------------------+ + + <cms:contentNodeIterator contentNodeCollectionName="column"> + <cms:editBar adminOnly="true" /> + <cms:includeTemplate /> + </cms:contentNodeIterator> + <cms:newBar contentNodeCollectionName="column" paragraph="mystripes" adminOnly="true" /> + ++----------------------------------------------+ + + Try to add an instance of the <<<mystripes>>> paragraph. Set the title property to whatever you want, you + will be able to use it in your Stripes action bean. + + The following example show the code for the simple <<<MyStripesAction>>> that prints out the configured title to the log: + ++----------------------------------------------+ +package it.myapp.web; + +import net.sourceforge.stripes.action.ActionBean; +import net.sourceforge.stripes.action.ActionBeanContext; +import net.sourceforge.stripes.action.DefaultHandler; +import net.sourceforge.stripes.action.ForwardResolution; +import net.sourceforge.stripes.action.Resolution; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class MyStripesAction implements ActionBean +{ + + private Logger log = LoggerFactory.getLogger(MyStripesAction.class); + + private String title; + + @Override + public ActionBeanContext getContext() + { + // TODO + return null; + } + + @Override + public void setContext(ActionBeanContext context) + { + // TODO + } + + public void setTitle(String title) + { + this.title = title; + } + + @DefaultHandler + public Resolution show() + { + + log.info("My title is: {}!", title); + + return new ForwardResolution("/templates/paragraphs/anyjsp.jsp"); + } +} ++----------------------------------------------+ + + As you can see, you will be able to mix parameters that you can use in Stripes action with pure content. Note that you + will not need to configure and use any magnolia paragraph property into your action since you can still use also the + standard magnolia tags in the jsp that is rendered by stripes! + + +Todo/improvements + + Warning! This is a preliminary technology-preview release! + + What does this means? Well, that it should work fine, but the integration is not yet complete and there are still some + missing features... be careful for what is know to not to work. + + + This is a list of know todos: + + * Important! reload stripes paragraph when the configuration of other paragraphs in magnolia is changed! At this moment + stripes paragraphs disappear after any change in paragraphs configured into jcr. + + * Handle multipart forms in request wrapper (should be easy to do) + + * A better way of handling multivalued properties in paragraph + + * Handle binary properties in paragraph + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2007-08-14 12:37:14
|
Revision: 409 http://openutils.svn.sourceforge.net/openutils/?rev=409&view=rev Author: fgiust Date: 2007-08-14 05:37:04 -0700 (Tue, 14 Aug 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-mgnlstripes-0.2 Added Paths: ----------- tags/openutils-mgnlstripes-0.2/ tags/openutils-mgnlstripes-0.2/pom.xml tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesModule.java tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRequestWrapper.java tags/openutils-mgnlstripes-0.2/src/site/ tags/openutils-mgnlstripes-0.2/src/site/apt/ tags/openutils-mgnlstripes-0.2/src/site/apt/index.apt tags/openutils-mgnlstripes-0.2/src/site/changes/changes.xml Removed Paths: ------------- tags/openutils-mgnlstripes-0.2/pom.xml tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesModule.java tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRequestWrapper.java tags/openutils-mgnlstripes-0.2/src/site/ tags/openutils-mgnlstripes-0.2/src/site/apt/ tags/openutils-mgnlstripes-0.2/src/site/apt/index.apt Copied: tags/openutils-mgnlstripes-0.2 (from rev 403, trunk/openutils-mgnlstripes) Deleted: tags/openutils-mgnlstripes-0.2/pom.xml =================================================================== --- trunk/openutils-mgnlstripes/pom.xml 2007-08-14 07:35:54 UTC (rev 403) +++ tags/openutils-mgnlstripes-0.2/pom.xml 2007-08-14 12:37:04 UTC (rev 409) @@ -1,81 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <modelVersion>4.0.0</modelVersion> - <packaging>jar</packaging> - <artifactId>openutils-mgnlstripes</artifactId> - <name>openutils-mgnlstripes</name> - <version>0.2-SNAPSHOT</version> - <build> - <resources> - <resource> - <filtering>false</filtering> - <directory>src/main/resources</directory> - <includes> - <include>**/*</include> - </includes> - </resource> - <resource> - <filtering>true</filtering> - <directory>src/main/resources</directory> - <includes> - <include>META-INF/magnolia/*</include> - </includes> - </resource> - </resources> - </build> - <dependencies> - <dependency> - <groupId>net.sourceforge.stripes</groupId> - <artifactId>stripes</artifactId> - <version>1.4.3</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>info.magnolia</groupId> - <artifactId>magnolia-core</artifactId> - <version>3.1-m3</version> - </dependency> - <dependency> - <groupId>info.magnolia</groupId> - <artifactId>magnolia-module-admininterface</artifactId> - <version>3.1-m3</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.4</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jsp-api</artifactId> - <version>2.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <classifier>jdk15</classifier> - <version>5.1</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> -</project> Copied: tags/openutils-mgnlstripes-0.2/pom.xml (from rev 408, trunk/openutils-mgnlstripes/pom.xml) =================================================================== --- tags/openutils-mgnlstripes-0.2/pom.xml (rev 0) +++ tags/openutils-mgnlstripes-0.2/pom.xml 2007-08-14 12:37:04 UTC (rev 409) @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>4</version> + <relativePath>..</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <packaging>jar</packaging> + <artifactId>openutils-mgnlstripes</artifactId> + <name>openutils-mgnlstripes</name> + <version>0.2</version> + <build> + <resources> + <resource> + <filtering>false</filtering> + <directory>src/main/resources</directory> + <includes> + <include>**/*</include> + </includes> + </resource> + <resource> + <filtering>true</filtering> + <directory>src/main/resources</directory> + <includes> + <include>META-INF/magnolia/*</include> + </includes> + </resource> + </resources> + </build> + <dependencies> + <dependency> + <groupId>net.sourceforge.stripes</groupId> + <artifactId>stripes</artifactId> + <version>1.4.3</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>info.magnolia</groupId> + <artifactId>magnolia-core</artifactId> + <version>3.1-m3</version> + </dependency> + <dependency> + <groupId>info.magnolia</groupId> + <artifactId>magnolia-module-admininterface</artifactId> + <version>3.1-m3</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.4</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jsp-api</artifactId> + <version>2.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <classifier>jdk15</classifier> + <version>5.1</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlstripes-0.2</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlstripes-0.2</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-mgnlstripes-0.2</url> + </scm> +</project> Deleted: tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesModule.java =================================================================== --- trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/StripesModule.java 2007-08-14 07:35:54 UTC (rev 403) +++ tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesModule.java 2007-08-14 12:37:04 UTC (rev 409) @@ -1,24 +0,0 @@ -package it.openutils.magnoliastripes; - -import info.magnolia.module.ModuleLifecycle; -import info.magnolia.module.ModuleLifecycleContext; - - -/** - * Stripes module. - * @author fgiust - * @version $Id: $ - */ -public class StripesModule implements ModuleLifecycle -{ - - /** - * {@inheritDoc} - */ - @Override - public void start(ModuleLifecycleContext moduleLifecycleContext) - { - // anything to do? - } - -} \ No newline at end of file Copied: tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesModule.java (from rev 404, trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/StripesModule.java) =================================================================== --- tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesModule.java (rev 0) +++ tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesModule.java 2007-08-14 12:37:04 UTC (rev 409) @@ -0,0 +1,23 @@ +package it.openutils.magnoliastripes; + +import info.magnolia.module.ModuleLifecycle; +import info.magnolia.module.ModuleLifecycleContext; + + +/** + * Stripes module. + * @author fgiust + * @version $Id: $ + */ +public class StripesModule implements ModuleLifecycle +{ + + /** + * {@inheritDoc} + */ + public void start(ModuleLifecycleContext moduleLifecycleContext) + { + // anything to do? + } + +} \ No newline at end of file Deleted: tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRequestWrapper.java =================================================================== --- trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/StripesParagraphRequestWrapper.java 2007-08-14 07:35:54 UTC (rev 403) +++ tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRequestWrapper.java 2007-08-14 12:37:04 UTC (rev 409) @@ -1,174 +0,0 @@ -package it.openutils.magnoliastripes; - -import info.magnolia.context.MgnlContext; -import info.magnolia.context.WebContext; - -import java.io.IOException; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Locale; -import java.util.Map; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; - -import net.sourceforge.stripes.controller.StripesRequestWrapper; -import net.sourceforge.stripes.exception.StripesServletException; - - -/** - * Magnolia request wrapper for Stripes actions. - * @author fgiust - * @version $Id: $ - */ -class StripesParagraphRequestWrapper extends StripesRequestWrapper -{ - - /** - * Hacked servlet path. - */ - private String servletPath; - - /** - * Parameter map. - */ - private Map<String, String[]> parameterMap; - - /** - * Instantiate a new request wrapper. - * @param request original HttpServletRequest - * @param servletPath modified servlet path (matches Stripes binding) - * @param paragraphsData map containing paragraph attributes - * @throws StripesServletException if any other error occurs constructing the wrapper - */ - @SuppressWarnings("unchecked") - public StripesParagraphRequestWrapper( - HttpServletRequest request, - String servletPath, - Map<String, String[]> paragraphsData) throws StripesServletException - { - super(request); - this.servletPath = servletPath; - - parameterMap = new Hashtable<String, String[]>(); - parameterMap.putAll(request.getParameterMap()); - parameterMap.putAll(paragraphsData); - } - - /** - * {@inheritDoc} - */ - @Override - public String getServletPath() - { - return servletPath; - } - - /** - * {@inheritDoc} - */ - @Override - protected void setLocale(Locale locale) - { - super.setLocale(locale); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - @Override - public Enumeration<String> getParameterNames() - { - return ((Hashtable) parameterMap).keys(); - } - - /** - * {@inheritDoc} - */ - @Override - public String[] getParameterValues(String name) - { - return parameterMap.get(name); - } - - /** - * {@inheritDoc} - */ - @Override - public Map<String, String[]> getParameterMap() - { - - return parameterMap; - } - - /** - * {@inheritDoc} - */ - @Override - public String getParameter(String name) - { - String[] values = getParameterValues(name); - if (values != null && values.length > 0) - { - return values[0]; - } - else - { - return null; - } - } - - /** - * {@inheritDoc} - */ - @Override - public RequestDispatcher getRequestDispatcher(String path) - { - return new MagnoliaRequestDispatcher(path); - } - - /** - * A {@link RequestDispatcher} that uses {@link WebContext} for including a resource. - * @author fgiust - * @version $Id: $ - */ - private static class MagnoliaRequestDispatcher implements RequestDispatcher - { - - /** - * The url this RequestDispatcher is bound to. - */ - private String url; - - /** - * Created a new MagnoliaRequestDispatcher for the given url. - * @param url url passed to {@link HttpServletRequest#getRequestDispatcher()} - */ - public MagnoliaRequestDispatcher(String url) - { - this.url = url; - } - - /** - * {@inheritDoc} - */ - @Override - public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException - { - ((WebContext) MgnlContext.getInstance()).include(url, response.getWriter()); - } - - /** - * {@inheritDoc} - */ - @Override - public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException - { - ((WebContext) MgnlContext.getInstance()).include(url, response.getWriter()); - } - } -} \ No newline at end of file Copied: tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRequestWrapper.java (from rev 404, trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/StripesParagraphRequestWrapper.java) =================================================================== --- tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRequestWrapper.java (rev 0) +++ tags/openutils-mgnlstripes-0.2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRequestWrapper.java 2007-08-14 12:37:04 UTC (rev 409) @@ -0,0 +1,172 @@ +package it.openutils.magnoliastripes; + +import info.magnolia.context.MgnlContext; +import info.magnolia.context.WebContext; + +import java.io.IOException; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Locale; +import java.util.Map; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; + +import net.sourceforge.stripes.controller.StripesRequestWrapper; +import net.sourceforge.stripes.exception.StripesServletException; + + +/** + * Magnolia request wrapper for Stripes actions. + * @author fgiust + * @version $Id: $ + */ +class StripesParagraphRequestWrapper extends StripesRequestWrapper +{ + + /** + * Hacked servlet path. + */ + private String servletPath; + + /** + * Parameter map. + */ + private Map<String, String[]> parameterMap; + + /** + * Instantiate a new request wrapper. + * @param request original HttpServletRequest + * @param servletPath modified servlet path (matches Stripes binding) + * @param paragraphsData map containing paragraph attributes + * @throws StripesServletException if any other error occurs constructing the wrapper + */ + @SuppressWarnings("unchecked") + public StripesParagraphRequestWrapper( + HttpServletRequest request, + String servletPath, + Map<String, String[]> paragraphsData) throws StripesServletException + { + super(request); + this.servletPath = servletPath; + + parameterMap = new Hashtable<String, String[]>(); + parameterMap.putAll(request.getParameterMap()); + parameterMap.putAll(paragraphsData); + } + + /** + * {@inheritDoc} + */ + @Override + public String getServletPath() + { + return servletPath; + } + + /** + * {@inheritDoc} + */ + @Override + protected void setLocale(Locale locale) + { + super.setLocale(locale); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + @Override + public Enumeration<String> getParameterNames() + { + return ((Hashtable) parameterMap).keys(); + } + + /** + * {@inheritDoc} + */ + @Override + public String[] getParameterValues(String name) + { + return parameterMap.get(name); + } + + /** + * {@inheritDoc} + */ + @Override + public Map<String, String[]> getParameterMap() + { + + return parameterMap; + } + + /** + * {@inheritDoc} + */ + @Override + public String getParameter(String name) + { + String[] values = getParameterValues(name); + if (values != null && values.length > 0) + { + return values[0]; + } + else + { + return null; + } + } + + /** + * {@inheritDoc} + */ + @Override + public RequestDispatcher getRequestDispatcher(String path) + { + return new MagnoliaRequestDispatcher(path); + } + + /** + * A {@link RequestDispatcher} that uses {@link WebContext} for including a resource. + * @author fgiust + * @version $Id: $ + */ + private static class MagnoliaRequestDispatcher implements RequestDispatcher + { + + /** + * The url this RequestDispatcher is bound to. + */ + private String url; + + /** + * Created a new MagnoliaRequestDispatcher for the given url. + * @param url url passed to {@link HttpServletRequest#getRequestDispatcher()} + */ + public MagnoliaRequestDispatcher(String url) + { + this.url = url; + } + + /** + * {@inheritDoc} + */ + public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException + { + ((WebContext) MgnlContext.getInstance()).include(url, response.getWriter()); + } + + /** + * {@inheritDoc} + */ + public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException + { + ((WebContext) MgnlContext.getInstance()).include(url, response.getWriter()); + } + } +} \ No newline at end of file Copied: tags/openutils-mgnlstripes-0.2/src/site (from rev 405, trunk/openutils-mgnlstripes/src/site) Copied: tags/openutils-mgnlstripes-0.2/src/site/apt (from rev 403, trunk/openutils-mgnlstripes/src/site/apt) Deleted: tags/openutils-mgnlstripes-0.2/src/site/apt/index.apt =================================================================== --- trunk/openutils-mgnlstripes/src/site/apt/index.apt 2007-08-14 07:35:54 UTC (rev 403) +++ tags/openutils-mgnlstripes-0.2/src/site/apt/index.apt 2007-08-14 12:37:04 UTC (rev 409) @@ -1,149 +0,0 @@ - -------------------------- - openutils-mgnlstripes - -------------------------- - Fabrizio Giustina - -------------------------- - -About openutils-mgnlstripes - - openutils-mgnlstripes is a custom {{{http://www.magnolia.info}magnolia}} module which integrates the - {{{http://mc4j.org/confluence/display/stripes/Home}Stripes}} MVC framework. - - After installed into magnolia, this module will allow you to use any available Stripes action as a Magnolia paragraph, - Any magically-converted Stripes action will still be able to use any standard Stripes feature, plus it will enjoy the - automatic injection of any paragraph property. - - <<This module requires magnolia 3.1-m3, and will not work on any earlier version!>> - -Configuration - - First of all drop the openutils-mgnlstripes jar and the stripes jar into WEB-INF/lib, or (better) if you are using maven - just declare the following dependency: - -+----------------------------------------------+ - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-mgnlstripes</artifactId> - <version>0.1</version> - </dependency> -+----------------------------------------------+ - - Then configure stripes in your web.xml as usual (see {{{http://mc4j.org/confluence/display/stripes/Quick+Start+Guide}}} for this. - - You only need to change the configuration for the stripes <<<ActionResolver.Class>>> in order to use - <<<it.openutils.magnoliastripes.MgnlActionResolver>>>. You can do that by adding/modifying the following init parameter - in WEB.xml: - - -+----------------------------------------------+ - <init-param> - <param-name>ActionResolver.Class</param-name> - <param-value>it.openutils.magnoliastripes.MgnlActionResolver</param-value> - </init-param> -+----------------------------------------------+ - -Usage - - When magnolia and stripes will startup now any auto-discovered stripes action will be configured in order to be used as - a magnolia paragraph. This means that paragraphs will be auto-generated, and they don't need to be configured into jcr. - - You should see a few <<<info>>> logs that enumerates the list of stripes paragraphs configured. By convention the name of - the paragraph is the same name of the Stripes action class minus action and lowercase. - - So <<<it.myapp.web.MyStripesAction >>> will be available as a paragraph named <<<mystripes>>>. - - Before being able to use any paragraph you will need to create a dialog for that. By convention the dialog should have - the same name of the paragraph so, following the previous example, you will need to configure a dialog called <<<mystripes>>>. - - Try to put a property called <<<title>>> in such dialog for a test. - - You are ready to use your paragraph into any magnolia template as usual: - -+----------------------------------------------+ - - <cms:contentNodeIterator contentNodeCollectionName="column"> - <cms:editBar adminOnly="true" /> - <cms:includeTemplate /> - </cms:contentNodeIterator> - <cms:newBar contentNodeCollectionName="column" paragraph="mystripes" adminOnly="true" /> - -+----------------------------------------------+ - - Try to add an instance of the <<<mystripes>>> paragraph. Set the title property to whatever you want, you - will be able to use it in your Stripes action bean. - - The following example show the code for the simple <<<MyStripesAction>>> that prints out the configured title to the log: - -+----------------------------------------------+ -package it.myapp.web; - -import net.sourceforge.stripes.action.ActionBean; -import net.sourceforge.stripes.action.ActionBeanContext; -import net.sourceforge.stripes.action.DefaultHandler; -import net.sourceforge.stripes.action.ForwardResolution; -import net.sourceforge.stripes.action.Resolution; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class MyStripesAction implements ActionBean -{ - - private Logger log = LoggerFactory.getLogger(MyStripesAction.class); - - private String title; - - @Override - public ActionBeanContext getContext() - { - // TODO - return null; - } - - @Override - public void setContext(ActionBeanContext context) - { - // TODO - } - - public void setTitle(String title) - { - this.title = title; - } - - @DefaultHandler - public Resolution show() - { - - log.info("My title is: {}!", title); - - return new ForwardResolution("/templates/paragraphs/anyjsp.jsp"); - } -} -+----------------------------------------------+ - - As you can see, you will be able to mix parameters that you can use in Stripes action with pure content. Note that you - will not need to configure and use any magnolia paragraph property into your action since you can still use also the - standard magnolia tags in the jsp that is rendered by stripes! - - -Todo/improvements - - Warning! This is a preliminary technology-preview release! - - What does this means? Well, that it should work fine, but the integration is not yet complete and there are still some - missing features... be careful for what is know to not to work. - - - This is a list of know todos: - - * Important! reload stripes paragraph when the configuration of other paragraphs in magnolia is changed! At this moment - stripes paragraphs disappear after any change in paragraphs configured into jcr. - - * Handle multipart forms in request wrapper (should be easy to do) - - * A better way of handling multivalued properties in paragraph - - * Handle binary properties in paragraph - Copied: tags/openutils-mgnlstripes-0.2/src/site/apt/index.apt (from rev 407, trunk/openutils-mgnlstripes/src/site/apt/index.apt) =================================================================== --- tags/openutils-mgnlstripes-0.2/src/site/apt/index.apt (rev 0) +++ tags/openutils-mgnlstripes-0.2/src/site/apt/index.apt 2007-08-14 12:37:04 UTC (rev 409) @@ -0,0 +1,152 @@ + -------------------------- + openutils-mgnlstripes + -------------------------- + Fabrizio Giustina + -------------------------- + +About openutils-mgnlstripes + + openutils-mgnlstripes is a custom {{{http://www.magnolia.info}magnolia}} module which integrates the + {{{http://mc4j.org/confluence/display/stripes/Home}Stripes}} MVC framework. + + After installed into magnolia, this module will allow you to use any available Stripes action as a Magnolia paragraph, + Any magically-converted Stripes action will still be able to use any standard Stripes feature, plus it will enjoy the + automatic injection of any paragraph property. + + <<This module requires magnolia 3.1-m3, and will not work on any earlier version!>> + +Configuration + + First of all drop the openutils-mgnlstripes jar and the stripes jar into WEB-INF/lib, or (better) if you are using maven + just declare the following dependency: + ++----------------------------------------------+ + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-mgnlstripes</artifactId> + <version>0.2</version> + </dependency> ++----------------------------------------------+ + + Then configure stripes in your web.xml as usual (see {{{http://mc4j.org/confluence/display/stripes/Quick+Start+Guide}}} for this. + + You only need to change the configuration for the stripes <<<ActionResolver.Class>>> in order to use + <<<it.openutils.magnoliastripes.MgnlActionResolver>>>. You can do that by adding/modifying the following init parameter + in WEB.xml: + + ++----------------------------------------------+ + <init-param> + <param-name>ActionResolver.Class</param-name> + <param-value>it.openutils.magnoliastripes.MgnlActionResolver</param-value> + </init-param> ++----------------------------------------------+ + +Usage + + When magnolia and stripes will startup now any auto-discovered stripes action will be configured in order to be used as + a magnolia paragraph. This means that paragraphs will be auto-generated, and they don't need to be configured into jcr. + + You should see a few <<<info>>> logs that enumerates the list of stripes paragraphs configured. By convention the name of + the paragraph is the same name of the Stripes action class minus action and lowercase. + + So <<<it.myapp.web.MyStripesAction >>> will be available as a paragraph named <<<mystripes>>>. + + Before being able to use any paragraph you will need to create a dialog for that. By convention the dialog should have + the same name of the paragraph so, following the previous example, you will need to configure a dialog called <<<mystripes>>>. + + Try to put a property called <<<title>>> in such dialog for a test. + + You are ready to use your paragraph into any magnolia template as usual: + ++----------------------------------------------+ + + <cms:contentNodeIterator contentNodeCollectionName="column"> + <cms:editBar adminOnly="true" /> + <cms:includeTemplate /> + </cms:contentNodeIterator> + <cms:newBar contentNodeCollectionName="column" paragraph="mystripes" adminOnly="true" /> + ++----------------------------------------------+ + + Try to add an instance of the <<<mystripes>>> paragraph. Set the title property to whatever you want, you + will be able to use it in your Stripes action bean. + + The following example show the code for the simple <<<MyStripesAction>>> that prints out the configured title to the log: + ++----------------------------------------------+ +package it.myapp.web; + +import net.sourceforge.stripes.action.ActionBean; +import net.sourceforge.stripes.action.ActionBeanContext; +import net.sourceforge.stripes.action.DefaultHandler; +import net.sourceforge.stripes.action.ForwardResolution; +import net.sourceforge.stripes.action.Resolution; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class MyStripesAction implements ActionBean +{ + + private Logger log = LoggerFactory.getLogger(MyStripesAction.class); + + private String title; + + @Override + public ActionBeanContext getContext() + { + // TODO + return null; + } + + @Override + public void setContext(ActionBeanContext context) + { + // TODO + } + + public void setTitle(String title) + { + this.title = title; + } + + @DefaultHandler + public Resolution show() + { + + log.info("My title is: {}!", title); + + return new ForwardResolution("/templates/paragraphs/anyjsp.jsp"); + } +} ++----------------------------------------------+ + + As you can see, you will be able to mix parameters that you can use in Stripes action with pure content. Note that you + will not need to configure and use any magnolia paragraph property into your action since you can still use also the + standard magnolia tags in the jsp that is rendered by stripes! + + +Todo/improvements + + Warning! This is a preliminary technology-preview release! + + What does this means? Well, that it should work fine, but the integration is not yet complete and there are still some + missing features... be careful for what is know to not to work. + + + This is a list of know todos: + + * Important! reload stripes paragraph when the configuration of other paragraphs in magnolia is changed! At this moment + stripes paragraphs disappear after any change in paragraphs configured into jcr. + + * Handle multipart forms in request wrapper (should be easy to do) + + * A better way of handling multivalued properties in paragraph + + * Handle binary properties in paragraph + + * Use spring binding/validation for validation of fields in dialogs + + Copied: tags/openutils-mgnlstripes-0.2/src/site/changes/changes.xml (from rev 406, trunk/openutils-mgnlstripes/src/site/changes/changes.xml) =================================================================== --- tags/openutils-mgnlstripes-0.2/src/site/changes/changes.xml (rev 0) +++ tags/openutils-mgnlstripes-0.2/src/site/changes/changes.xml 2007-08-14 12:37:04 UTC (rev 409) @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<!-- + "type" attribute can be: add, remove, update or fix. +--> +<document> + <properties> + <title>Changes</title> + <author email="fgiust(at)users.sourceforge.net">Fabrizio Giustina</author> + </properties> + <body> + <release version="0.2" date="2007-08-14" description=""> + <action type="update" dev="fgiust"> + Added support for indexed parameters by replacing "{}" with "[]" in parameter names (hack). With Stripes you can + use indexed parameters, but square brakets are not allowed in jcr node names and can't be used in paragraph + attributes. You can now use "list{1}" in attribute names for that. + </action> + <action type="fix" dev="fgiust"> + Excluded commons-logging dependency from stripes in pom.xml. Magnolia already imports jcl104-over-slf4j, which + is a replacement over the standard commons-logging jar. + </action> + </release> + <release version="0.1" date="2007-08-13" description="Initial release"> + <action type="add" dev="fgiust" due-to="">Initial release with support for stripes paragraphs.</action> + </release> + </body> +</document> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fc...@us...> - 2007-08-31 09:18:30
|
Revision: 414 http://openutils.svn.sourceforge.net/openutils/?rev=414&view=rev Author: fcarone Date: 2007-08-31 02:18:28 -0700 (Fri, 31 Aug 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-bshd5-1.0.6 Added Paths: ----------- tags/openutils-bshd5-1.0.6/ tags/openutils-bshd5-1.0.6/pom.xml Removed Paths: ------------- tags/openutils-bshd5-1.0.6/pom.xml Copied: tags/openutils-bshd5-1.0.6 (from rev 412, trunk/openutils-bshd5) Deleted: tags/openutils-bshd5-1.0.6/pom.xml =================================================================== --- trunk/openutils-bshd5/pom.xml 2007-08-30 15:40:19 UTC (rev 412) +++ tags/openutils-bshd5-1.0.6/pom.xml 2007-08-31 09:18:28 UTC (rev 414) @@ -1,55 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-bshd5</artifactId> - <name>openutils base Spring-Hibernate DAO for java 5.0</name> - <version>1.0.6-SNAPSHOT</version> - <description>openutils base Spring-Hibernate DAO for java 5.0</description> - <properties> - <spring.version>2.0.6</spring.version> - </properties> - <dependencies> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-hibernate3</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-aop</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate</artifactId> - <version>3.2.1.ga</version> - </dependency> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - <version>1.7.0</version> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <optional>true</optional> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-bshd5-1.0.6/pom.xml (from rev 413, trunk/openutils-bshd5/pom.xml) =================================================================== --- tags/openutils-bshd5-1.0.6/pom.xml (rev 0) +++ tags/openutils-bshd5-1.0.6/pom.xml 2007-08-31 09:18:28 UTC (rev 414) @@ -0,0 +1,60 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-bshd5</artifactId> + <name>openutils base Spring-Hibernate DAO for java 5.0</name> + <version>1.0.6</version> + <description>openutils base Spring-Hibernate DAO for java 5.0</description> + <properties> + <spring.version>2.0.6</spring.version> + </properties> + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-hibernate3</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.2.1.ga</version> + </dependency> + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + <version>1.7.0</version> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <optional>true</optional> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-bshd5-1.0.6</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-bshd5-1.0.6</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-bshd5-1.0.6</url> + </scm> +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fc...@us...> - 2007-08-31 12:27:20
|
Revision: 420 http://openutils.svn.sourceforge.net/openutils/?rev=420&view=rev Author: fcarone Date: 2007-08-31 05:27:18 -0700 (Fri, 31 Aug 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-testing-junit-1.1.2 Added Paths: ----------- tags/openutils-testing-junit-1.1.2/ tags/openutils-testing-junit-1.1.2/pom.xml tags/openutils-testing-junit-1.1.2/src/main/java/it/openutils/testing/junit/DbUnitTestCase.java Removed Paths: ------------- tags/openutils-testing-junit-1.1.2/pom.xml tags/openutils-testing-junit-1.1.2/src/main/java/it/openutils/testing/junit/DbUnitTestCase.java Copied: tags/openutils-testing-junit-1.1.2 (from rev 412, trunk/openutils-testing-junit) Deleted: tags/openutils-testing-junit-1.1.2/pom.xml =================================================================== --- trunk/openutils-testing-junit/pom.xml 2007-08-30 15:40:19 UTC (rev 412) +++ tags/openutils-testing-junit-1.1.2/pom.xml 2007-08-31 12:27:18 UTC (rev 420) @@ -1,62 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-testing-junit</artifactId> - <name>openutils test utils (junit)</name> - <version>1.1.2-SNAPSHOT</version> - <description>openutils test utils</description> - <properties> - <spring.version>2.0.6</spring.version> - </properties> - <dependencies> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.13</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-hibernate3</artifactId> - <version>${spring.version}</version> - <optional>true</optional> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.dbunit</groupId> - <artifactId>dbunit</artifactId> - <version>2.2</version> - <optional>true</optional> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-testing-junit-1.1.2/pom.xml (from rev 419, trunk/openutils-testing-junit/pom.xml) =================================================================== --- tags/openutils-testing-junit-1.1.2/pom.xml (rev 0) +++ tags/openutils-testing-junit-1.1.2/pom.xml 2007-08-31 12:27:18 UTC (rev 420) @@ -0,0 +1,67 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-testing-junit</artifactId> + <name>openutils test utils (junit)</name> + <version>1.1.2</version> + <description>openutils test utils</description> + <properties> + <spring.version>2.0.6</spring.version> + </properties> + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.13</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-hibernate3</artifactId> + <version>${spring.version}</version> + <optional>true</optional> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.dbunit</groupId> + <artifactId>dbunit</artifactId> + <version>2.2</version> + <optional>true</optional> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-junit-1.1.2</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-junit-1.1.2</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-testing-junit-1.1.2</url> + </scm> +</project> \ No newline at end of file Deleted: tags/openutils-testing-junit-1.1.2/src/main/java/it/openutils/testing/junit/DbUnitTestCase.java =================================================================== --- trunk/openutils-testing-junit/src/main/java/it/openutils/testing/junit/DbUnitTestCase.java 2007-08-30 15:40:19 UTC (rev 412) +++ tags/openutils-testing-junit-1.1.2/src/main/java/it/openutils/testing/junit/DbUnitTestCase.java 2007-08-31 12:27:18 UTC (rev 420) @@ -1,257 +0,0 @@ -/* - * Copyright 2005 Fabrizio Giustina. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing.junit; - -import java.io.InputStream; -import java.util.Map; - -import javax.sql.DataSource; - -import org.apache.commons.lang.ClassUtils; -import org.apache.commons.lang.StringUtils; -import org.dbunit.database.DatabaseConnection; -import org.dbunit.database.DatabaseSequenceFilter; -import org.dbunit.database.IDatabaseConnection; -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.FilteredDataSet; -import org.dbunit.dataset.IDataSet; -import org.dbunit.dataset.excel.XlsDataSet; -import org.dbunit.dataset.filter.AbstractTableFilter; -import org.dbunit.dataset.filter.ITableFilter; -import org.dbunit.dataset.filter.SequenceTableFilter; -import org.dbunit.dataset.xml.XmlDataSet; -import org.dbunit.ext.mssql.InsertIdentityOperation; -import org.dbunit.operation.DatabaseOperation; -import org.hibernate.SessionFactory; -import org.springframework.orm.hibernate3.SessionHolder; -import org.springframework.transaction.support.TransactionSynchronizationManager; - - -/** - * Base class for running DAO tests. - * @author fgiust - * @version $Revision $ ($Author $) - */ -public abstract class DbUnitTestCase extends SpringTestCase -{ - - /** - * Hibernate session factory. - */ - private SessionFactory sessionFactory; - - private static final String BASETEST_DELETE = "/_BaseDAOTest-delete.xml"; - - protected static IDataSet truncateDataSet; - - /** - * Should use deferred close emulating the spring OpenSessionInView filter? Default is <code>true</code> - * @return <code>true</code> if deferred close should be used - */ - protected boolean mimicSessionFilter() - { - return true; - } - - /** - * Returns the table filter that will be used to exclude certain tables from sort/deletion. This may be overridden - * by subclasses, and is needed when tables have circular references (not handled by dbunit DatabaseSequenceFilter) - * @return an <code>ITableFilter</code> - */ - protected ITableFilter getTableFilter() - { - return new AbstractTableFilter() - { - - @Override - public boolean isValidName(String tableName) throws DataSetException - { - // default excludes: - // $ = oracle recycle bin tables - // JBPM = jbpm tables, with circular references - return !StringUtils.contains(tableName, "$") && !StringUtils.contains(tableName, "JBPM"); - } - }; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - @Override - protected void setUp() throws Exception - { - super.setUp(); - - // insert values - IDataSet dataSet = null; - - String datesetFileName = "/" + ClassUtils.getShortClassName(getClass()) + "-load.xml"; - InputStream testData = getClass().getResourceAsStream(datesetFileName); - - if (testData != null) - { - if (log.isDebugEnabled()) - { - log.debug("loading dataset {}", datesetFileName); - } - - dataSet = new XmlDataSet(testData); - } - else - { - // check for excel - datesetFileName = "/" + ClassUtils.getShortClassName(getClass()) + "-load.xls"; - testData = getClass().getResourceAsStream(datesetFileName); - - if (testData != null) - { - if (log.isDebugEnabled()) - { - log.debug("loading dataset {}", datesetFileName); - } - - dataSet = new XlsDataSet(testData); - } - } - - if (dataSet == null) - { - log.debug("No test data found with name [{}]", datesetFileName); - } - else - { - - DataSource dataSource = (DataSource) ctx.getBean("dataSource"); - IDatabaseConnection connection = new DatabaseConnection(dataSource.getConnection()); - - // truncate common tables - if (truncateDataSet == null) - { - log.debug("Generating sorted dataset for initial cleanup"); - IDataSet unsortedTruncateDataSet = connection.createDataSet(); - - ITableFilter filter = new DatabaseSequenceFilter(connection, new FilteredDataSet( - getTableFilter(), - unsortedTruncateDataSet).getTableNames()); - truncateDataSet = new FilteredDataSet(filter, unsortedTruncateDataSet); - truncateDataSet = new FilteredDataSet(getTableFilter(), truncateDataSet); - log.debug("Sorted dataset generated"); - } - - IDataSet orderedDataset = dataSet; - - // if a sorted dataset is available, use table sequence for sorting - if (truncateDataSet != null) - { - ITableFilter filter = new SequenceTableFilter(truncateDataSet.getTableNames()); - orderedDataset = new FilteredDataSet(filter, dataSet); - } - - try - { - if (truncateDataSet != null) - { - DatabaseOperation.DELETE_ALL.execute(connection, truncateDataSet); - } - if (dataSet != null) - { - InsertIdentityOperation.INSERT.execute(connection, orderedDataset); - } - } - finally - { - connection.close(); - } - } - - // mimic the Spring OpenSessionInViewFilter - if (mimicSessionFilter()) - { - Map<String, SessionFactory> sfbeans = ctx.getBeansOfType(SessionFactory.class); - if (sfbeans.isEmpty()) - { - fail("No bean of type org.hibernate.SessionFactory found in spring context"); - } - this.sessionFactory = sfbeans.get(sfbeans.keySet().iterator().next()); - - TransactionSynchronizationManager.bindResource(this.getSessionFactory(), new SessionHolder(this - .getSessionFactory() - .openSession())); - } - - } - - /** - * {@inheritDoc} - */ - @Override - protected void tearDown() throws Exception - { - if (mimicSessionFilter()) - { - // close open hibernate sessions, mimic the OpenSessionInViewFilter - if (TransactionSynchronizationManager.hasResource(this.getSessionFactory())) - { - TransactionSynchronizationManager.unbindResource(this.getSessionFactory()); - } - } - - // regenerate db initial state - String datesetFileName = "/initial-load.xml"; - InputStream testData = getClass().getResourceAsStream(datesetFileName); - - if (testData != null) - { - log.debug("Restoring db state"); - - IDataSet dataSet = new XmlDataSet(testData); - - DataSource dataSource = (DataSource) ctx.getBean("dataSource"); - IDatabaseConnection connection = new DatabaseConnection(dataSource.getConnection()); - - try - { - DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet); - } - finally - { - connection.close(); - } - } - - super.tearDown(); - } - - /** - * Returns the full test name. - * @see junit.framework.TestCase#getName() - */ - @Override - public String getName() - { - return ClassUtils.getShortClassName(this.getClass()) + "::" + super.getName(); - } - - /** - * return the current Hibernate SessionFactory - * @return SessionFactory object - */ - protected SessionFactory getSessionFactory() - { - return sessionFactory; - } -} \ No newline at end of file Copied: tags/openutils-testing-junit-1.1.2/src/main/java/it/openutils/testing/junit/DbUnitTestCase.java (from rev 418, trunk/openutils-testing-junit/src/main/java/it/openutils/testing/junit/DbUnitTestCase.java) =================================================================== --- tags/openutils-testing-junit-1.1.2/src/main/java/it/openutils/testing/junit/DbUnitTestCase.java (rev 0) +++ tags/openutils-testing-junit-1.1.2/src/main/java/it/openutils/testing/junit/DbUnitTestCase.java 2007-08-31 12:27:18 UTC (rev 420) @@ -0,0 +1,267 @@ +/* + * Copyright 2005 Fabrizio Giustina. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing.junit; + +import java.io.InputStream; +import java.sql.SQLException; +import java.util.Map; + +import javax.sql.DataSource; + +import org.apache.commons.lang.ClassUtils; +import org.apache.commons.lang.StringUtils; +import org.dbunit.database.DatabaseConnection; +import org.dbunit.database.DatabaseSequenceFilter; +import org.dbunit.database.IDatabaseConnection; +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.FilteredDataSet; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.excel.XlsDataSet; +import org.dbunit.dataset.filter.AbstractTableFilter; +import org.dbunit.dataset.filter.ITableFilter; +import org.dbunit.dataset.filter.SequenceTableFilter; +import org.dbunit.dataset.xml.XmlDataSet; +import org.dbunit.ext.mssql.InsertIdentityOperation; +import org.dbunit.operation.DatabaseOperation; +import org.hibernate.SessionFactory; +import org.springframework.orm.hibernate3.SessionHolder; +import org.springframework.transaction.support.TransactionSynchronizationManager; + + +/** + * Base class for running DAO tests. + * @author fgiust + * @version $Revision $ ($Author $) + */ +public abstract class DbUnitTestCase extends SpringTestCase +{ + + /** + * Hibernate session factory. + */ + private SessionFactory sessionFactory; + + private static final String BASETEST_DELETE = "/_BaseDAOTest-delete.xml"; + + protected static IDataSet truncateDataSet; + + /** + * Should use deferred close emulating the spring OpenSessionInView filter? Default is <code>true</code> + * @return <code>true</code> if deferred close should be used + */ + protected boolean mimicSessionFilter() + { + return true; + } + + /** + * Returns the table filter that will be used to exclude certain tables from sort/deletion. This may be overridden + * by subclasses, and is needed when tables have circular references (not handled by dbunit DatabaseSequenceFilter) + * @return an <code>ITableFilter</code> + */ + protected ITableFilter getTableFilter() + { + return new AbstractTableFilter() + { + + @Override + public boolean isValidName(String tableName) throws DataSetException + { + // default excludes: + // $ = oracle recycle bin tables + // JBPM = jbpm tables, with circular references + return !StringUtils.contains(tableName, "$") && !StringUtils.contains(tableName, "JBPM"); + } + }; + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + @Override + protected void setUp() throws Exception + { + super.setUp(); + + // insert values + IDataSet dataSet = null; + + String datesetFileName = "/" + ClassUtils.getShortClassName(getClass()) + "-load.xml"; + InputStream testData = getClass().getResourceAsStream(datesetFileName); + + if (testData != null) + { + if (log.isDebugEnabled()) + { + log.debug("loading dataset {}", datesetFileName); + } + + dataSet = new XmlDataSet(testData); + } + else + { + // check for excel + datesetFileName = "/" + ClassUtils.getShortClassName(getClass()) + "-load.xls"; + testData = getClass().getResourceAsStream(datesetFileName); + + if (testData != null) + { + if (log.isDebugEnabled()) + { + log.debug("loading dataset {}", datesetFileName); + } + + dataSet = new XlsDataSet(testData); + } + } + + if (dataSet == null) + { + log.debug("No test data found with name [{}]", datesetFileName); + } + else + { + + IDatabaseConnection connection = createConnection(); + + // truncate common tables + if (truncateDataSet == null) + { + log.debug("Generating sorted dataset for initial cleanup"); + IDataSet unsortedTruncateDataSet = connection.createDataSet(); + + ITableFilter filter = new DatabaseSequenceFilter(connection, new FilteredDataSet( + getTableFilter(), + unsortedTruncateDataSet).getTableNames()); + truncateDataSet = new FilteredDataSet(filter, unsortedTruncateDataSet); + truncateDataSet = new FilteredDataSet(getTableFilter(), truncateDataSet); + log.debug("Sorted dataset generated"); + } + + IDataSet orderedDataset = dataSet; + + // if a sorted dataset is available, use table sequence for sorting + if (truncateDataSet != null) + { + ITableFilter filter = new SequenceTableFilter(truncateDataSet.getTableNames()); + orderedDataset = new FilteredDataSet(filter, dataSet); + } + + try + { + if (truncateDataSet != null) + { + DatabaseOperation.DELETE_ALL.execute(connection, truncateDataSet); + } + if (dataSet != null) + { + InsertIdentityOperation.INSERT.execute(connection, orderedDataset); + } + } + finally + { + connection.close(); + } + } + + // mimic the Spring OpenSessionInViewFilter + if (mimicSessionFilter()) + { + Map<String, SessionFactory> sfbeans = ctx.getBeansOfType(SessionFactory.class); + if (sfbeans.isEmpty()) + { + fail("No bean of type org.hibernate.SessionFactory found in spring context"); + } + this.sessionFactory = sfbeans.get(sfbeans.keySet().iterator().next()); + + TransactionSynchronizationManager.bindResource(this.getSessionFactory(), new SessionHolder(this + .getSessionFactory() + .openSession())); + } + + } + + /** + * {@inheritDoc} + */ + @Override + protected void tearDown() throws Exception + { + if (mimicSessionFilter()) + { + // close open hibernate sessions, mimic the OpenSessionInViewFilter + if (TransactionSynchronizationManager.hasResource(this.getSessionFactory())) + { + TransactionSynchronizationManager.unbindResource(this.getSessionFactory()); + } + } + + // regenerate db initial state + String datesetFileName = "/initial-load.xml"; + InputStream testData = getClass().getResourceAsStream(datesetFileName); + + if (testData != null) + { + log.debug("Restoring db state"); + + IDataSet dataSet = new XmlDataSet(testData); + + DataSource dataSource = (DataSource) ctx.getBean("dataSource"); + IDatabaseConnection connection = new DatabaseConnection(dataSource.getConnection()); + + try + { + DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet); + } + finally + { + connection.close(); + } + } + + super.tearDown(); + } + + /** + * Returns the full test name. + * @see junit.framework.TestCase#getName() + */ + @Override + public String getName() + { + return ClassUtils.getShortClassName(this.getClass()) + "::" + super.getName(); + } + + /** + * @return The IDatabase connection to use to insert data + * @throws SQLException Thrown on any database connection error + */ + protected IDatabaseConnection createConnection() throws SQLException + { + DataSource dataSource = (DataSource) ctx.getBean("dataSource"); + return new DatabaseConnection(dataSource.getConnection()); + } + + /** + * return the current Hibernate SessionFactory + * @return SessionFactory object + */ + protected SessionFactory getSessionFactory() + { + return sessionFactory; + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fc...@us...> - 2007-08-31 12:28:46
|
Revision: 423 http://openutils.svn.sourceforge.net/openutils/?rev=423&view=rev Author: fcarone Date: 2007-08-31 05:28:45 -0700 (Fri, 31 Aug 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-bshd5-1.0.7 Added Paths: ----------- tags/openutils-bshd5-1.0.7/ tags/openutils-bshd5-1.0.7/pom.xml tags/openutils-bshd5-1.0.7/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java Removed Paths: ------------- tags/openutils-bshd5-1.0.7/pom.xml tags/openutils-bshd5-1.0.7/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java Copied: tags/openutils-bshd5-1.0.7 (from rev 412, trunk/openutils-bshd5) Deleted: tags/openutils-bshd5-1.0.7/pom.xml =================================================================== --- trunk/openutils-bshd5/pom.xml 2007-08-30 15:40:19 UTC (rev 412) +++ tags/openutils-bshd5-1.0.7/pom.xml 2007-08-31 12:28:45 UTC (rev 423) @@ -1,55 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-bshd5</artifactId> - <name>openutils base Spring-Hibernate DAO for java 5.0</name> - <version>1.0.6-SNAPSHOT</version> - <description>openutils base Spring-Hibernate DAO for java 5.0</description> - <properties> - <spring.version>2.0.6</spring.version> - </properties> - <dependencies> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-hibernate3</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-aop</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate</artifactId> - <version>3.2.1.ga</version> - </dependency> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - <version>1.7.0</version> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <optional>true</optional> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-bshd5-1.0.7/pom.xml (from rev 422, trunk/openutils-bshd5/pom.xml) =================================================================== --- tags/openutils-bshd5-1.0.7/pom.xml (rev 0) +++ tags/openutils-bshd5-1.0.7/pom.xml 2007-08-31 12:28:45 UTC (rev 423) @@ -0,0 +1,60 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-bshd5</artifactId> + <name>openutils base Spring-Hibernate DAO for java 5.0</name> + <version>1.0.7</version> + <description>openutils base Spring-Hibernate DAO for java 5.0</description> + <properties> + <spring.version>2.0.6</spring.version> + </properties> + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-hibernate3</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.2.1.ga</version> + </dependency> + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + <version>1.7.0</version> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <optional>true</optional> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-bshd5-1.0.7</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-bshd5-1.0.7</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-bshd5-1.0.7</url> + </scm> +</project> \ No newline at end of file Deleted: tags/openutils-bshd5-1.0.7/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2007-08-30 15:40:19 UTC (rev 412) +++ tags/openutils-bshd5-1.0.7/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2007-08-31 12:28:45 UTC (rev 423) @@ -1,509 +0,0 @@ -package it.openutils.dao.hibernate; - -import it.openutils.hibernate.example.EnhancedExample; -import it.openutils.hibernate.example.FilterMetadata; - -import java.io.Serializable; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.hibernate.Criteria; -import org.hibernate.Hibernate; -import org.hibernate.HibernateException; -import org.hibernate.ObjectNotFoundException; -import org.hibernate.Query; -import org.hibernate.Session; -import org.hibernate.criterion.CriteriaSpecification; -import org.hibernate.criterion.Criterion; -import org.hibernate.criterion.Order; -import org.hibernate.type.Type; -import org.springframework.orm.hibernate3.HibernateCallback; -import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException; -import org.springframework.orm.hibernate3.support.HibernateDaoSupport; - - -/** - * Base Hibernate DAO. - * @author Fabrizio Giustina - * @version $Id$ - * @param <T> Persistence class - * @param <K> Object Key - */ -public abstract class HibernateDAOImpl<T extends Object, K extends Serializable> extends HibernateDaoSupport - implements - HibernateDAO<T, K> -{ - - /** - * @author carone - * @version $Id$ - */ - private final class HibernateCallbackForExecution implements HibernateCallback - { - - /** - * - */ - private final T filter; - - /** - * - */ - private final int page; - - /** - * - */ - private final int maxResults; - - /** - * - */ - private final Map<String, FilterMetadata> metadata; - - /** - * - */ - private final Order[] orderProperties; - - private List<Criterion> additionalCriteria; - - /** - * @param filter - * @param page - * @param maxResults - * @param metadata - * @param orderProperties - */ - private HibernateCallbackForExecution( - T filter, - int page, - int maxResults, - Map<String, FilterMetadata> metadata, - Order[] orderProperties, - List<Criterion> additionalCriteria) - { - this.filter = filter; - this.page = page; - this.maxResults = maxResults; - this.metadata = metadata; - this.orderProperties = orderProperties; - this.additionalCriteria = additionalCriteria; - } - - public Object doInHibernate(Session ses) throws HibernateException - { - Criteria crit = ses.createCriteria(filter.getClass()); - crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); - crit.setMaxResults(maxResults); - crit.setFirstResult(maxResults * page); - - if (orderProperties != null && orderProperties.length > 0) - { - for (Order order : orderProperties) - { - if (order != null) - { - crit.addOrder(order); - } - } - } - EnhancedExample.create(crit, filter, metadata); - if (additionalCriteria != null && !additionalCriteria.isEmpty()) - { - for (Criterion criterion : additionalCriteria) - { - crit.add(criterion); - } - } - return crit.list(); - } - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List<T> find(String query) - { - return getHibernateTemplate().find(query); - } - - /** - * {@inheritDoc} - */ - public List<T> findAll() - { - return findAll(getDefaultOrder()); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List<T> findAll(final Order[] orderProperties) - { - - return (List<T>) getHibernateTemplate().execute(new HibernateCallback() - { - - public Object doInHibernate(Session ses) throws HibernateException - { - Criteria crit = ses.createCriteria(getReferenceClass()); - if (null != orderProperties) - { - for (int j = 0; j < orderProperties.length; j++) - { - crit.addOrder(orderProperties[j]); - } - - } - return crit.list(); - } - }); - } - - /** - * {@inheritDoc} - */ - public List<T> find(String query, Object obj, Type type) - { - return find(query, new Object[]{obj }, new Type[]{type }); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List<T> find(final String query, final Object[] obj, final Type[] type) - { - return (List<T>) getHibernateTemplate().execute(new HibernateCallback() - { - - public Object doInHibernate(Session ses) throws HibernateException - { - // hibernate 3 - return ses.createQuery(query).setParameters(obj, type).list(); - } - }); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public T load(K key) - { - T result = (T) getHibernateTemplate().load(getReferenceClass(), key); - Hibernate.initialize(result); - return result; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public T loadIfAvailable(K key) - { - T result; - try - { - result = (T) getHibernateTemplate().load(getReferenceClass(), key); - Hibernate.initialize(result); - } - catch (ObjectNotFoundException e) - { - // during lazy initialization - return null; - } - catch (HibernateObjectRetrievalFailureException e) - { - // during load - if (e.getCause() instanceof ObjectNotFoundException) - { - return null; - } - throw e; - } - return result; - } - - /** - * {@inheritDoc} - */ - public void saveOrUpdate(final T obj) - { - getHibernateTemplate().saveOrUpdate(obj); - } - - /** - * {@inheritDoc} - */ - public void update(T obj) - { - getHibernateTemplate().update(obj); - } - - /** - * {@inheritDoc} - */ - public boolean delete(final K key) - { - - return (Boolean) getHibernateTemplate().execute(new HibernateCallback() - { - - public Object doInHibernate(Session ses) throws HibernateException - { - ses.delete(ses.load(getReferenceClass(), key)); - return true; - } - }); - - } - - /** - * {@inheritDoc} - */ - public void refresh(T obj) - { - getHibernateTemplate().refresh(obj); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public T merge(final T obj) - { - return (T) getHibernateTemplate().execute(new HibernateCallback() - { - - public Object doInHibernate(Session ses) throws HibernateException - { - return ses.merge(obj); - } - }); - - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public K save(T obj) - { - return (K) getHibernateTemplate().save(obj); - } - - /** - * {@inheritDoc} - */ - public T findFilteredFirst(final T filter) - { - return getFirstInCollection(findFiltered(filter, 1, 0)); - } - - /** - * {@inheritDoc} - */ - public List<T> findFiltered(final T filter) - { - return findFiltered(filter, getDefaultFilterMetadata()); - } - - /** - * {@inheritDoc} - */ - public List<T> findFiltered(T filter, Order[] orderProperties) - { - return findFiltered(filter, orderProperties, getDefaultFilterMetadata(), Integer.MAX_VALUE, 0); - } - - /** - * {@inheritDoc} - */ - public List<T> findFiltered(final T filter, final Map<String, FilterMetadata> metadata) - { - return findFiltered(filter, metadata, Integer.MAX_VALUE, 0); - } - - /** - * {@inheritDoc} - */ - public List<T> findFiltered(final T filter, final int maxResults, final int page) - { - return findFiltered(filter, getDefaultFilterMetadata(), maxResults, page); - } - - /** - * {@inheritDoc} - */ - public List<T> findFiltered(final T filter, final Map<String, FilterMetadata> metadata, final int maxResults, - final int page) - { - return findFiltered(filter, null, metadata, maxResults, page); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List<T> findFiltered(final T filter, final Order[] customOrder, final Map<String, FilterMetadata> metadata, - final int maxResults, final int page) - { - return findFiltered(filter, customOrder, metadata, maxResults, page, null); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public List<T> findFiltered(T filter, Order[] customOrder, Map<String, FilterMetadata> metadata, int maxResults, - int page, List<Criterion> additionalCriteria) - { - final Order[] orderProperties = customOrder != null && customOrder.length > 0 ? customOrder : this - .getDefaultOrder(); - - return (List<T>) getHibernateTemplate().execute( - new HibernateCallbackForExecution(filter, page, maxResults, metadata, orderProperties, additionalCriteria)); - } - - /** - * Return the specific Object class that will be used for class-specific implementation of this DAO. - * @return the reference Class - */ - protected abstract Class<T> getReferenceClass(); - - /** - * Return a list of <code>Order</code> object to be used for the default ordering of the collection. - * @return the property name - */ - protected Order[] getDefaultOrder() - { - return new Order[0]; - } - - /** - * Obtain an instance of Query for a named query string defined in the mapping file. - * @param name the name of a query defined externally - * @param maxResults max number of results - * @return Query - */ - protected List< ? > getNamedQuery(final String name, final int maxResults) - { - return (List< ? >) getHibernateTemplate().execute(new HibernateCallback() - { - - public Object doInHibernate(Session ses) throws HibernateException - { - Query q = ses.getNamedQuery(name); - q.setMaxResults(maxResults); - return q.list(); - } - }); - } - - /** - * Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given. - * @param name the name of a query defined externally - * @param params the parameter array - * @param maxResults max number of results - * @return Query - */ - protected List< ? > getNamedQuery(final String name, final Serializable[] params, final int maxResults) - { - - return (List< ? >) getHibernateTemplate().execute(new HibernateCallback() - { - - public Object doInHibernate(Session ses) throws HibernateException - { - Query q = ses.getNamedQuery(name); - q.setMaxResults(maxResults); - if (null != params) - { - for (int i = 0; i < params.length; i++) - { - q.setParameter(i, params[i]); - } - } - return q.list(); - } - }); - } - - /** - * Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given. - * @param name the name of a query defined externally - * @param params the parameter Map - * @param maxResults max number of results - * @return Query - */ - protected List< ? > getNamedQuery(final String name, final Map<String, Object> params, final int maxResults) - { - return (List< ? >) getHibernateTemplate().execute(new HibernateCallback() - { - - public Object doInHibernate(Session ses) throws HibernateException - { - Query q = ses.getNamedQuery(name); - q.setMaxResults(maxResults); - if (params != null) - { - for (Map.Entry<String, Object> entry : params.entrySet()) - { - setParameterValue(q, entry.getKey(), entry.getValue()); - } - } - return q.list(); - } - }); - } - - /** - * Convenience method to set paramers in the query given based on the actual object type in passed in as the value. - * You may need to add more functionaly to this as desired (or not use this at all). - * @param query the Query to set - * @param key the key name - * @param value the object to set as the parameter - */ - protected void setParameterValue(Query query, String key, Object value) - { - if (null == key || null == value) - { - return; - } - query.setParameter(key, value); - } - - /** - * Returns the default set of FilterMetadata that will be applied to any query. The default implementation doesn't - * set any default filter, subclasses may override this. - * @return map of property name - filter metadata - */ - protected Map<String, FilterMetadata> getDefaultFilterMetadata() - { - return new HashMap<String, FilterMetadata>(0); - } - - /** - * Returns the first object in the collection or null if the collection is null or empty. - * @param list collection - * @return first element in the list - */ - @SuppressWarnings("unchecked") - private T getFirstInCollection(Collection<T> list) - { - if (list != null && !list.isEmpty()) - { - Object result = list.iterator().next(); - Hibernate.initialize(result); - return (T) result; - } - return null; - } - -} \ No newline at end of file Copied: tags/openutils-bshd5-1.0.7/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java (from rev 417, trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java) =================================================================== --- tags/openutils-bshd5-1.0.7/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java (rev 0) +++ tags/openutils-bshd5-1.0.7/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2007-08-31 12:28:45 UTC (rev 423) @@ -0,0 +1,547 @@ +package it.openutils.dao.hibernate; + +import it.openutils.hibernate.example.EnhancedExample; +import it.openutils.hibernate.example.FilterMetadata; + +import java.io.Serializable; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.Criteria; +import org.hibernate.Hibernate; +import org.hibernate.HibernateException; +import org.hibernate.ObjectNotFoundException; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.criterion.CriteriaSpecification; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Order; +import org.hibernate.type.Type; +import org.springframework.orm.hibernate3.HibernateCallback; +import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + + +/** + * Base Hibernate DAO. + * @author Fabrizio Giustina + * @version $Id$ + * @param <T> Persistence class + * @param <K> Object Key + */ +public abstract class HibernateDAOImpl<T extends Object, K extends Serializable> extends HibernateDaoSupport + implements + HibernateDAO<T, K> +{ + + /** + * @author carone + * @version $Id$ + */ + private final class HibernateCallbackForExecution implements HibernateCallback + { + + /** + * + */ + private final T filter; + + /** + * + */ + private final int page; + + /** + * + */ + private final int maxResults; + + /** + * + */ + private final Map<String, FilterMetadata> metadata; + + /** + * + */ + private final Order[] orderProperties; + + private List<Criterion> additionalCriteria; + + /** + * @param filter + * @param page + * @param maxResults + * @param metadata + * @param orderProperties + */ + private HibernateCallbackForExecution( + T filter, + int page, + int maxResults, + Map<String, FilterMetadata> metadata, + Order[] orderProperties, + List<Criterion> additionalCriteria) + { + this.filter = filter; + this.page = page; + this.maxResults = maxResults; + this.metadata = metadata; + this.orderProperties = orderProperties; + this.additionalCriteria = additionalCriteria; + } + + public Object doInHibernate(Session ses) throws HibernateException + { + Criteria crit = ses.createCriteria(filter.getClass()); + crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); + crit.setMaxResults(maxResults); + crit.setFirstResult(maxResults * page); + + if (orderProperties != null && orderProperties.length > 0) + { + for (Order order : orderProperties) + { + if (order != null) + { + crit.addOrder(order); + } + } + } + EnhancedExample.create(crit, filter, metadata); + if (additionalCriteria != null && !additionalCriteria.isEmpty()) + { + for (Criterion criterion : additionalCriteria) + { + crit.add(criterion); + } + } + return crit.list(); + } + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List<T> find(String query) + { + return getHibernateTemplate().find(query); + } + + /** + * {@inheritDoc} + */ + public List<T> findAll() + { + return findAll(getDefaultOrder()); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List<T> findAll(final Order[] orderProperties) + { + + return (List<T>) getHibernateTemplate().execute(new HibernateCallback() + { + + public Object doInHibernate(Session ses) throws HibernateException + { + Criteria crit = ses.createCriteria(getReferenceClass()); + if (null != orderProperties) + { + for (int j = 0; j < orderProperties.length; j++) + { + crit.addOrder(orderProperties[j]); + } + + } + return crit.list(); + } + }); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List<T> findAll(final Order[] orderProperties, final List<Criterion> criteria) + { + return (List<T>) getHibernateTemplate().execute(new HibernateCallback() + { + + public Object doInHibernate(Session ses) throws HibernateException + { + Criteria crit = ses.createCriteria(getReferenceClass()); + if (null != orderProperties) + { + for (int j = 0; j < orderProperties.length; j++) + { + crit.addOrder(orderProperties[j]); + } + + } + if (criteria != null) + { + for (Criterion criterion : criteria) + { + crit.add(criterion); + } + } + return crit.list(); + } + }); + } + /** + * {@inheritDoc} + */ + public List<T> find(String query, Object obj, Type type) + { + return find(query, new Object[]{obj }, new Type[]{type }); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List<T> find(final String query, final Object[] obj, final Type[] type) + { + return (List<T>) getHibernateTemplate().execute(new HibernateCallback() + { + + public Object doInHibernate(Session ses) throws HibernateException + { + // hibernate 3 + return ses.createQuery(query).setParameters(obj, type).list(); + } + }); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public T load(K key) + { + T result = (T) getHibernateTemplate().load(getReferenceClass(), key); + Hibernate.initialize(result); + return result; + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public T loadIfAvailable(K key) + { + T result; + try + { + result = (T) getHibernateTemplate().load(getReferenceClass(), key); + Hibernate.initialize(result); + } + catch (ObjectNotFoundException e) + { + // during lazy initialization + return null; + } + catch (HibernateObjectRetrievalFailureException e) + { + // during load + if (e.getCause() instanceof ObjectNotFoundException) + { + return null; + } + throw e; + } + return result; + } + + /** + * {@inheritDoc} + */ + public void saveOrUpdate(final T obj) + { + getHibernateTemplate().saveOrUpdate(obj); + } + + /** + * {@inheritDoc} + */ + public void update(T obj) + { + getHibernateTemplate().update(obj); + } + + /** + * {@inheritDoc} + */ + public boolean delete(final K key) + { + + return (Boolean) getHibernateTemplate().execute(new HibernateCallback() + { + + public Object doInHibernate(Session ses) throws HibernateException + { + ses.delete(ses.load(getReferenceClass(), key)); + return true; + } + }); + + } + + /** + * {@inheritDoc} + */ + public void refresh(T obj) + { + getHibernateTemplate().refresh(obj); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public T merge(final T obj) + { + return (T) getHibernateTemplate().execute(new HibernateCallback() + { + + public Object doInHibernate(Session ses) throws HibernateException + { + return ses.merge(obj); + } + }); + + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public K save(T obj) + { + return (K) getHibernateTemplate().save(obj); + } + + /** + * {@inheritDoc} + */ + public T findFilteredFirst(final T filter) + { + return getFirstInCollection(findFiltered(filter, 1, 0)); + } + + /** + * {@inheritDoc} + */ + public T findFilteredFirst(final T filter, List<Criterion> criteria) + { + return getFirstInCollection(findFiltered(filter, null, getDefaultFilterMetadata(), 1, 0, criteria)); + } + + /** + * {@inheritDoc} + */ + public List<T> findFiltered(final T filter) + { + return findFiltered(filter, getDefaultFilterMetadata()); + } + + /** + * {@inheritDoc} + */ + public List<T> findFiltered(T filter, Order[] orderProperties) + { + return findFiltered(filter, orderProperties, getDefaultFilterMetadata(), Integer.MAX_VALUE, 0); + } + + /** + * {@inheritDoc} + */ + public List<T> findFiltered(final T filter, final Map<String, FilterMetadata> metadata) + { + return findFiltered(filter, metadata, Integer.MAX_VALUE, 0); + } + + /** + * {@inheritDoc} + */ + public List<T> findFiltered(final T filter, final int maxResults, final int page) + { + return findFiltered(filter, getDefaultFilterMetadata(), maxResults, page); + } + + /** + * {@inheritDoc} + */ + public List<T> findFiltered(final T filter, final Map<String, FilterMetadata> metadata, final int maxResults, + final int page) + { + return findFiltered(filter, null, metadata, maxResults, page); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List<T> findFiltered(final T filter, final Order[] customOrder, final Map<String, FilterMetadata> metadata, + final int maxResults, final int page) + { + return findFiltered(filter, customOrder, metadata, maxResults, page, null); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public List<T> findFiltered(T filter, Order[] customOrder, Map<String, FilterMetadata> metadata, int maxResults, + int page, List<Criterion> additionalCriteria) + { + final Order[] orderProperties = customOrder != null && customOrder.length > 0 ? customOrder : this + .getDefaultOrder(); + + return (List<T>) getHibernateTemplate().execute( + new HibernateCallbackForExecution(filter, page, maxResults, metadata, orderProperties, additionalCriteria)); + } + + /** + * Return the specific Object class that will be used for class-specific implementation of this DAO. + * @return the reference Class + */ + protected abstract Class<T> getReferenceClass(); + + /** + * Return a list of <code>Order</code> object to be used for the default ordering of the collection. + * @return the property name + */ + protected Order[] getDefaultOrder() + { + return new Order[0]; + } + + /** + * Obtain an instance of Query for a named query string defined in the mapping file. + * @param name the name of a query defined externally + * @param maxResults max number of results + * @return Query + */ + protected List< ? > getNamedQuery(final String name, final int maxResults) + { + return (List< ? >) getHibernateTemplate().execute(new HibernateCallback() + { + public Object doInHibernate(Session ses) throws HibernateException + { + Query q = ses.getNamedQuery(name); + q.setMaxResults(maxResults); + return q.list(); + } + }); + } + + /** + * Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given. + * @param name the name of a query defined externally + * @param params the parameter array + * @param maxResults max number of results + * @return Query + */ + protected List< ? > getNamedQuery(final String name, final Serializable[] params, final int maxResults) + { + + return (List< ? >) getHibernateTemplate().execute(new HibernateCallback() + { + + public Object doInHibernate(Session ses) throws HibernateException + { + Query q = ses.getNamedQuery(name); + q.setMaxResults(maxResults); + if (null != params) + { + for (int i = 0; i < params.length; i++) + { + q.setParameter(i, params[i]); + } + } + return q.list(); + } + }); + } + + /** + * Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given. + * @param name the name of a query defined externally + * @param params the parameter Map + * @param maxResults max number of results + * @return Query + */ + protected List< ? > getNamedQuery(final String name, final Map<String, Object> params, final int maxResults) + { + return (List< ? >) getHibernateTemplate().execute(new HibernateCallback() + { + + public Object doInHibernate(Session ses) throws HibernateException + { + Query q = ses.getNamedQuery(name); + q.setMaxResults(maxResults); + if (params != null) + { + for (Map.Entry<String, Object> entry : params.entrySet()) + { + setParameterValue(q, entry.getKey(), entry.getValue()); + } + } + return q.list(); + } + }); + } + + /** + * Convenience method to set paramers in the query given based on the actual object type in passed in as the value. + * You may need to add more functionaly to this as desired (or not use this at all). + * @param query the Query to set + * @param key the key name + * @param value the object to set as the parameter + */ + protected void setParameterValue(Query query, String key, Object value) + { + if (null == key || null == value) + { + return; + } + query.setParameter(key, value); + } + + /** + * Returns the default set of FilterMetadata that will be applied to any query. The default implementation doesn't + * set any default filter, subclasses may override this. + * @return map of property name - filter metadata + */ + protected Map<String, FilterMetadata> getDefaultFilterMetadata() + { + return new HashMap<String, FilterMetadata>(0); + } + + /** + * Returns the first object in the collection or null if the collection is null or empty. + * @param list collection + * @return first element in the list + */ + @SuppressWarnings("unchecked") + private T getFirstInCollection(Collection<T> list) + { + if (list != null && !list.isEmpty()) + { + Object result = list.iterator().next(); + Hibernate.initialize(result); + return (T) result; + } + return null; + } + +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2007-09-19 09:51:32
|
Revision: 437 http://openutils.svn.sourceforge.net/openutils/?rev=437&view=rev Author: fgiust Date: 2007-09-19 02:51:36 -0700 (Wed, 19 Sep 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-deployment-1.0.9 Added Paths: ----------- tags/openutils-deployment-1.0.9/ tags/openutils-deployment-1.0.9/pom.xml Removed Paths: ------------- tags/openutils-deployment-1.0.9/pom.xml Copied: tags/openutils-deployment-1.0.9 (from rev 435, trunk/openutils-deployment) Deleted: tags/openutils-deployment-1.0.9/pom.xml =================================================================== --- trunk/openutils-deployment/pom.xml 2007-09-19 09:50:22 UTC (rev 435) +++ tags/openutils-deployment-1.0.9/pom.xml 2007-09-19 09:51:36 UTC (rev 437) @@ -1,76 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-deployment</artifactId> - <name>openutils deployment tools</name> - <version>1.0.9-SNAPSHOT</version> - <description /> - <properties> - <spring.version>2.0.6</spring.version> - </properties> - <dependencies> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <version>${spring.version}</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>logkit</groupId> - <artifactId>logkit</artifactId> - </exclusion> - <exclusion> - <groupId>avalon-framework</groupId> - <artifactId>avalon-framework</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-jdbc</artifactId> - <version>${spring.version}</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <!-- replaces commons-logging --> - <groupId>org.slf4j</groupId> - <artifactId>jcl104-over-slf4j</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.4</version> - <scope>provided</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.0</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-deployment-1.0.9/pom.xml (from rev 436, trunk/openutils-deployment/pom.xml) =================================================================== --- tags/openutils-deployment-1.0.9/pom.xml (rev 0) +++ tags/openutils-deployment-1.0.9/pom.xml 2007-09-19 09:51:36 UTC (rev 437) @@ -0,0 +1,81 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-deployment</artifactId> + <name>openutils deployment tools</name> + <version>1.0.9</version> + <description /> + <properties> + <spring.version>2.0.6</spring.version> + </properties> + <dependencies> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>${spring.version}</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>logkit</groupId> + <artifactId>logkit</artifactId> + </exclusion> + <exclusion> + <groupId>avalon-framework</groupId> + <artifactId>avalon-framework</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-jdbc</artifactId> + <version>${spring.version}</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <!-- replaces commons-logging --> + <groupId>org.slf4j</groupId> + <artifactId>jcl104-over-slf4j</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.4</version> + <scope>provided</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.0</version> + <scope>test</scope> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-deployment-1.0.9</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-deployment-1.0.9</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-deployment-1.0.9</url> + </scm> +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mup...@us...> - 2007-09-20 08:55:30
|
Revision: 441 http://openutils.svn.sourceforge.net/openutils/?rev=441&view=rev Author: muppet68 Date: 2007-09-20 01:55:32 -0700 (Thu, 20 Sep 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-bshd5-1.0.8 Added Paths: ----------- tags/openutils-bshd5-1.0.8/ tags/openutils-bshd5-1.0.8/pom.xml Removed Paths: ------------- tags/openutils-bshd5-1.0.8/pom.xml Copied: tags/openutils-bshd5-1.0.8 (from rev 439, trunk/openutils-bshd5) Deleted: tags/openutils-bshd5-1.0.8/pom.xml =================================================================== --- trunk/openutils-bshd5/pom.xml 2007-09-20 07:42:19 UTC (rev 439) +++ tags/openutils-bshd5-1.0.8/pom.xml 2007-09-20 08:55:32 UTC (rev 441) @@ -1,54 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-bshd5</artifactId> - <name>openutils base Spring-Hibernate DAO for java 5.0</name> - <version>1.0.8-SNAPSHOT</version> - <description>openutils base Spring-Hibernate DAO for java 5.0</description> - <properties> - <spring.version>2.0.6</spring.version> - </properties> - <dependencies> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-hibernate3</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-aop</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate</artifactId> - <version>3.2.1.ga</version> - </dependency> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - <version>1.7.0</version> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <optional>true</optional> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-bshd5-1.0.8/pom.xml (from rev 440, trunk/openutils-bshd5/pom.xml) =================================================================== --- tags/openutils-bshd5-1.0.8/pom.xml (rev 0) +++ tags/openutils-bshd5-1.0.8/pom.xml 2007-09-20 08:55:32 UTC (rev 441) @@ -0,0 +1,60 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-bshd5</artifactId> + <name>openutils base Spring-Hibernate DAO for java 5.0</name> + <version>1.0.8</version> + <description>openutils base Spring-Hibernate DAO for java 5.0</description> + <properties> + <spring.version>2.0.6</spring.version> + </properties> + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-hibernate3</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.2.1.ga</version> + </dependency> + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + <version>1.7.0</version> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <optional>true</optional> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-bshd5-1.0.8</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-bshd5-1.0.8</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-bshd5-1.0.8</url> + </scm> +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2007-09-20 10:17:45
|
Revision: 447 http://openutils.svn.sourceforge.net/openutils/?rev=447&view=rev Author: fgiust Date: 2007-09-20 03:17:49 -0700 (Thu, 20 Sep 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-testing-testng-1.1.3 Added Paths: ----------- tags/openutils-testing-testng-1.1.3/ tags/openutils-testing-testng-1.1.3/pom.xml Removed Paths: ------------- tags/openutils-testing-testng-1.1.3/pom.xml Copied: tags/openutils-testing-testng-1.1.3 (from rev 443, trunk/openutils-testing-testng) Deleted: tags/openutils-testing-testng-1.1.3/pom.xml =================================================================== --- trunk/openutils-testing-testng/pom.xml 2007-09-20 10:10:04 UTC (rev 443) +++ tags/openutils-testing-testng-1.1.3/pom.xml 2007-09-20 10:17:49 UTC (rev 447) @@ -1,63 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-testing-testng</artifactId> - <name>openutils test utils (testng)</name> - <version>1.1.3-SNAPSHOT</version> - <description>openutils test utils</description> - <properties> - <spring.version>2.0.6</spring.version> - </properties> - <dependencies> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.13</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-hibernate3</artifactId> - <version>${spring.version}</version> - <optional>true</optional> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.dbunit</groupId> - <artifactId>dbunit</artifactId> - <version>2.2</version> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <classifier>jdk15</classifier> - <version>5.1</version> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-testing-testng-1.1.3/pom.xml (from rev 446, trunk/openutils-testing-testng/pom.xml) =================================================================== --- tags/openutils-testing-testng-1.1.3/pom.xml (rev 0) +++ tags/openutils-testing-testng-1.1.3/pom.xml 2007-09-20 10:17:49 UTC (rev 447) @@ -0,0 +1,92 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-testing-testng</artifactId> + <name>openutils test utils (testng)</name> + <version>1.1.3</version> + <description>openutils test utils</description> + <properties> + <spring.version>2.0.6</spring.version> + </properties> + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <!-- replaces commons-logging --> + <groupId>org.slf4j</groupId> + <artifactId>jcl104-over-slf4j</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-hibernate3</artifactId> + <version>${spring.version}</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.dbunit</groupId> + <artifactId>dbunit</artifactId> + <version>2.2</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <classifier>jdk15</classifier> + <version>5.1</version> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-testng-1.1.3</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-testng-1.1.3</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-testing-testng-1.1.3</url> + </scm> +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2007-09-20 10:20:57
|
Revision: 450 http://openutils.svn.sourceforge.net/openutils/?rev=450&view=rev Author: fgiust Date: 2007-09-20 03:21:01 -0700 (Thu, 20 Sep 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-bshd5-1.0.9 Added Paths: ----------- tags/openutils-bshd5-1.0.9/ tags/openutils-bshd5-1.0.9/pom.xml Removed Paths: ------------- tags/openutils-bshd5-1.0.9/pom.xml Copied: tags/openutils-bshd5-1.0.9 (from rev 448, trunk/openutils-bshd5) Deleted: tags/openutils-bshd5-1.0.9/pom.xml =================================================================== --- trunk/openutils-bshd5/pom.xml 2007-09-20 10:17:56 UTC (rev 448) +++ tags/openutils-bshd5-1.0.9/pom.xml 2007-09-20 10:21:01 UTC (rev 450) @@ -1,85 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-bshd5</artifactId> - <name>openutils base Spring-Hibernate DAO for java 5.0</name> - <version>1.0.9-SNAPSHOT</version> - <description>openutils base Spring-Hibernate DAO for java 5.0</description> - <properties> - <spring.version>2.0.6</spring.version> - </properties> - <dependencies> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <!-- replaces commons-logging --> - <groupId>org.slf4j</groupId> - <artifactId>jcl104-over-slf4j</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-hibernate3</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-aop</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate</artifactId> - <version>3.2.1.ga</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - <version>1.7.0</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <optional>true</optional> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-bshd5-1.0.9/pom.xml (from rev 449, trunk/openutils-bshd5/pom.xml) =================================================================== --- tags/openutils-bshd5-1.0.9/pom.xml (rev 0) +++ tags/openutils-bshd5-1.0.9/pom.xml 2007-09-20 10:21:01 UTC (rev 450) @@ -0,0 +1,90 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-bshd5</artifactId> + <name>openutils base Spring-Hibernate DAO for java 5.0</name> + <version>1.0.9</version> + <description>openutils base Spring-Hibernate DAO for java 5.0</description> + <properties> + <spring.version>2.0.6</spring.version> + </properties> + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <!-- replaces commons-logging --> + <groupId>org.slf4j</groupId> + <artifactId>jcl104-over-slf4j</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-hibernate3</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.2.1.ga</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + <version>1.7.0</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <optional>true</optional> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-bshd5-1.0.9</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-bshd5-1.0.9</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-bshd5-1.0.9</url> + </scm> +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2007-09-24 20:10:21
|
Revision: 454 http://openutils.svn.sourceforge.net/openutils/?rev=454&view=rev Author: fgiust Date: 2007-09-24 13:10:24 -0700 (Mon, 24 Sep 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-dbmigration-0.7.2 Added Paths: ----------- tags/openutils-dbmigration-0.7.2/ tags/openutils-dbmigration-0.7.2/pom.xml Removed Paths: ------------- tags/openutils-dbmigration-0.7.2/pom.xml Copied: tags/openutils-dbmigration-0.7.2 (from rev 452, trunk/openutils-dbmigration) Deleted: tags/openutils-dbmigration-0.7.2/pom.xml =================================================================== --- trunk/openutils-dbmigration/pom.xml 2007-09-24 20:09:22 UTC (rev 452) +++ tags/openutils-dbmigration-0.7.2/pom.xml 2007-09-24 20:10:24 UTC (rev 454) @@ -1,90 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-dbmigration</artifactId> - <name>openutils db migration framework</name> - <version>0.7.2-SNAPSHOT</version> - <description /> - <properties> - <spring.version>2.0.6</spring.version> - </properties> - <dependencies> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>1.3</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-jdbc</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>avalon-framework</groupId> - <artifactId>avalon-framework</artifactId> - </exclusion> - <exclusion> - <groupId>logkit</groupId> - <artifactId>logkit</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-beans</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>avalon-framework</groupId> - <artifactId>avalon-framework</artifactId> - </exclusion> - <exclusion> - <groupId>logkit</groupId> - <artifactId>logkit</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>avalon-framework</groupId> - <artifactId>avalon-framework</artifactId> - </exclusion> - <exclusion> - <groupId>logkit</groupId> - <artifactId>logkit</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>poi</groupId> - <artifactId>poi</artifactId> - <version>2.5.1-final-20040804</version> - <optional>true</optional> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.0</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-dbmigration-0.7.2/pom.xml (from rev 453, trunk/openutils-dbmigration/pom.xml) =================================================================== --- tags/openutils-dbmigration-0.7.2/pom.xml (rev 0) +++ tags/openutils-dbmigration-0.7.2/pom.xml 2007-09-24 20:10:24 UTC (rev 454) @@ -0,0 +1,96 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-dbmigration</artifactId> + <name>openutils db migration framework</name> + <version>0.7.2</version> + <description /> + <properties> + <spring.version>2.0.6</spring.version> + </properties> + <dependencies> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>1.3</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-jdbc</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>avalon-framework</groupId> + <artifactId>avalon-framework</artifactId> + </exclusion> + <exclusion> + <groupId>logkit</groupId> + <artifactId>logkit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>avalon-framework</groupId> + <artifactId>avalon-framework</artifactId> + </exclusion> + <exclusion> + <groupId>logkit</groupId> + <artifactId>logkit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>avalon-framework</groupId> + <artifactId>avalon-framework</artifactId> + </exclusion> + <exclusion> + <groupId>logkit</groupId> + <artifactId>logkit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>poi</groupId> + <artifactId>poi</artifactId> + <version>2.5.1-final-20040804</version> + <optional>true</optional> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.0</version> + <scope>test</scope> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-dbmigration-0.7.2</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-dbmigration-0.7.2</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-dbmigration-0.7.2</url> + </scm> +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2007-09-26 12:20:51
|
Revision: 460 http://openutils.svn.sourceforge.net/openutils/?rev=460&view=rev Author: fgiust Date: 2007-09-26 05:20:52 -0700 (Wed, 26 Sep 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-dbmigration-0.7.3 Added Paths: ----------- tags/openutils-dbmigration-0.7.3/ tags/openutils-dbmigration-0.7.3/pom.xml Removed Paths: ------------- tags/openutils-dbmigration-0.7.3/pom.xml Copied: tags/openutils-dbmigration-0.7.3 (from rev 457, trunk/openutils-dbmigration) Deleted: tags/openutils-dbmigration-0.7.3/pom.xml =================================================================== --- trunk/openutils-dbmigration/pom.xml 2007-09-26 12:13:36 UTC (rev 457) +++ tags/openutils-dbmigration-0.7.3/pom.xml 2007-09-26 12:20:52 UTC (rev 460) @@ -1,90 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-dbmigration</artifactId> - <name>openutils db migration framework</name> - <version>0.7.3-SNAPSHOT</version> - <description /> - <properties> - <spring.version>2.0.6</spring.version> - </properties> - <dependencies> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>1.3</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-jdbc</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>avalon-framework</groupId> - <artifactId>avalon-framework</artifactId> - </exclusion> - <exclusion> - <groupId>logkit</groupId> - <artifactId>logkit</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-beans</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>avalon-framework</groupId> - <artifactId>avalon-framework</artifactId> - </exclusion> - <exclusion> - <groupId>logkit</groupId> - <artifactId>logkit</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>avalon-framework</groupId> - <artifactId>avalon-framework</artifactId> - </exclusion> - <exclusion> - <groupId>logkit</groupId> - <artifactId>logkit</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>poi</groupId> - <artifactId>poi</artifactId> - <version>2.5.1-final-20040804</version> - <optional>true</optional> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.0</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-dbmigration-0.7.3/pom.xml (from rev 459, trunk/openutils-dbmigration/pom.xml) =================================================================== --- tags/openutils-dbmigration-0.7.3/pom.xml (rev 0) +++ tags/openutils-dbmigration-0.7.3/pom.xml 2007-09-26 12:20:52 UTC (rev 460) @@ -0,0 +1,95 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-dbmigration</artifactId> + <name>openutils db migration framework</name> + <version>0.7.3</version> + <description /> + <properties> + <spring.version>2.0.6</spring.version> + </properties> + <dependencies> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>1.3</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-jdbc</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl104-over-slf4j</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi</artifactId> + <version>3.0-FINAL</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.0</version> + <scope>test</scope> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-dbmigration-0.7.3</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-dbmigration-0.7.3</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-dbmigration-0.7.3</url> + </scm> +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2007-10-11 22:39:04
|
Revision: 464 http://openutils.svn.sourceforge.net/openutils/?rev=464&view=rev Author: fgiust Date: 2007-10-11 15:39:05 -0700 (Thu, 11 Oct 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-deployment-1.0.10 Added Paths: ----------- tags/openutils-deployment-1.0.10/ tags/openutils-deployment-1.0.10/pom.xml Removed Paths: ------------- tags/openutils-deployment-1.0.10/pom.xml Copied: tags/openutils-deployment-1.0.10 (from rev 462, trunk/openutils-deployment) Deleted: tags/openutils-deployment-1.0.10/pom.xml =================================================================== --- trunk/openutils-deployment/pom.xml 2007-10-11 22:37:47 UTC (rev 462) +++ tags/openutils-deployment-1.0.10/pom.xml 2007-10-11 22:39:05 UTC (rev 464) @@ -1,72 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-deployment</artifactId> - <name>openutils deployment tools</name> - <version>1.0.10-SNAPSHOT</version> - <description /> - <properties> - <spring.version>2.0.6</spring.version> - </properties> - <dependencies> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <version>${spring.version}</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-jdbc</artifactId> - <version>${spring.version}</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <!-- replaces commons-logging --> - <groupId>org.slf4j</groupId> - <artifactId>jcl104-over-slf4j</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.4</version> - <scope>provided</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.0</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-deployment-1.0.10/pom.xml (from rev 463, trunk/openutils-deployment/pom.xml) =================================================================== --- tags/openutils-deployment-1.0.10/pom.xml (rev 0) +++ tags/openutils-deployment-1.0.10/pom.xml 2007-10-11 22:39:05 UTC (rev 464) @@ -0,0 +1,77 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-deployment</artifactId> + <name>openutils deployment tools</name> + <version>1.0.10</version> + <description /> + <properties> + <spring.version>2.0.6</spring.version> + </properties> + <dependencies> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>${spring.version}</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-jdbc</artifactId> + <version>${spring.version}</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <!-- replaces commons-logging --> + <groupId>org.slf4j</groupId> + <artifactId>jcl104-over-slf4j</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.4</version> + <scope>provided</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.0</version> + <scope>test</scope> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-deployment-1.0.10</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-deployment-1.0.10</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-deployment-1.0.10</url> + </scm> +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fc...@us...> - 2007-10-22 17:15:25
|
Revision: 478 http://openutils.svn.sourceforge.net/openutils/?rev=478&view=rev Author: fcarone Date: 2007-10-22 10:15:30 -0700 (Mon, 22 Oct 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-spring-rmibernate-1.0.1 Added Paths: ----------- tags/openutils-spring-rmibernate-1.0.1/ tags/openutils-spring-rmibernate-1.0.1/pom.xml tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/client/aspects/HibernateLazyLoaderAspect.java tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/HibernateLazyRmiInterceptor.java tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/SerializationInterceptor.java tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/shared/LazyReference.java Removed Paths: ------------- tags/openutils-spring-rmibernate-1.0.1/pom.xml tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/client/aspects/HibernateLazyLoaderAspect.java tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/HibernateLazyRmiInterceptor.java tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/SerializationInterceptor.java tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/shared/LazyReference.java Copied: tags/openutils-spring-rmibernate-1.0.1 (from rev 475, trunk/openutils-spring-rmibernate) Deleted: tags/openutils-spring-rmibernate-1.0.1/pom.xml =================================================================== --- trunk/openutils-spring-rmibernate/pom.xml 2007-10-17 17:06:38 UTC (rev 475) +++ tags/openutils-spring-rmibernate-1.0.1/pom.xml 2007-10-22 17:15:30 UTC (rev 478) @@ -1,122 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-spring-rmibernate</artifactId> - <name>openutils base Spring-Hibernate RMI remote lazy loading support</name> - <version>1.0.1-SNAPSHOT</version> - <description>openutils base Spring-Hibernate RMI remote lazy loading support</description> - <properties> - <spring.version>2.0.6</spring.version> - </properties> - <dependencies> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <!-- replaces commons-logging --> - <groupId>org.slf4j</groupId> - <artifactId>jcl104-over-slf4j</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-hibernate3</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-remoting</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-aop</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate</artifactId> - <version>3.2.4.ga</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - </exclusion> - <exclusion> - <groupId>asm</groupId> - <artifactId>asm</artifactId> - </exclusion> - <exclusion> - <groupId>asm</groupId> - <artifactId>asm-attrs</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - <version>1.7.0</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - <version>3.1</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <optional>true</optional> - </dependency> - <dependency> - <groupId>cglib</groupId> - <artifactId>cglib-nodep</artifactId> - <version>2.1_3</version> - </dependency> - <dependency> - <groupId>asm</groupId> - <artifactId>asm</artifactId> - <version>2.2.3</version> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-spring-rmibernate-1.0.1/pom.xml (from rev 477, trunk/openutils-spring-rmibernate/pom.xml) =================================================================== --- tags/openutils-spring-rmibernate-1.0.1/pom.xml (rev 0) +++ tags/openutils-spring-rmibernate-1.0.1/pom.xml 2007-10-22 17:15:30 UTC (rev 478) @@ -0,0 +1,128 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-spring-rmibernate</artifactId> + <name>openutils base Spring-Hibernate RMI remote lazy loading support</name> + <version>1.0.1</version> + <description>openutils base Spring-Hibernate RMI remote lazy loading support</description> + <properties> + <spring.version>2.0.6</spring.version> + </properties> + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <!-- replaces commons-logging --> + <groupId>org.slf4j</groupId> + <artifactId>jcl104-over-slf4j</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-hibernate3</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-remoting</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.2.4.ga</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + </exclusion> + <exclusion> + <groupId>asm</groupId> + <artifactId>asm</artifactId> + </exclusion> + <exclusion> + <groupId>asm</groupId> + <artifactId>asm-attrs</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + <version>1.7.0</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.1</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <optional>true</optional> + </dependency> + <dependency> + <groupId>cglib</groupId> + <artifactId>cglib-nodep</artifactId> + <version>2.1_3</version> + </dependency> + <dependency> + <groupId>asm</groupId> + <artifactId>asm</artifactId> + <version>2.2.3</version> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-spring-rmibernate-1.0.1</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-spring-rmibernate-1.0.1</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-spring-rmibernate-1.0.1</url> + </scm> +</project> \ No newline at end of file Deleted: tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/client/aspects/HibernateLazyLoaderAspect.java =================================================================== --- trunk/openutils-spring-rmibernate/src/main/java/it/openutils/spring/rmibernate/client/aspects/HibernateLazyLoaderAspect.java 2007-10-17 17:06:38 UTC (rev 475) +++ tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/client/aspects/HibernateLazyLoaderAspect.java 2007-10-22 17:15:30 UTC (rev 478) @@ -1,75 +0,0 @@ -package it.openutils.spring.rmibernate.client.aspects; - -import it.openutils.spring.rmibernate.client.HibernateRmiProxyFactoryBean; -import it.openutils.spring.rmibernate.client.pagination.Paginator; -import it.openutils.spring.rmibernate.shared.managers.HibernateLazyService; - -import java.io.Serializable; - -import net.sf.cglib.proxy.LazyLoader; - - -/** - * Aspect that does remote lazy loading on cglib proxy - * @author mmolaschi - * @version $Id: $ - */ -public class HibernateLazyLoaderAspect implements LazyLoader, Serializable -{ - - private static ThreadLocal<Paginator> paginator = new ThreadLocal<Paginator>(); - - private String className; - - private String fieldName; - - private Serializable id; - - /** - * Constructor - * @param className parent class name - * @param fieldName field to be lazy loaded - * @param id id of current entity - */ - public HibernateLazyLoaderAspect(String className, String fieldName, Serializable id) - { - this.className = className; - this.fieldName = fieldName; - this.id = id; - } - - /** - * Set pagination for next calls in current thread - * @param from starting row number - * @param size max number of rows - */ - public static void setPagination(int from, int size) - { - paginator.set(new Paginator(from, size)); - } - - /** - * Disable pagination for next calls in current thread - */ - public static void resetPagination() - { - paginator.set(null); - } - - /** - * {@inheritDoc} - */ - public Object loadObject() throws Exception - { - // Load from remote - HibernateLazyService hls = HibernateRmiProxyFactoryBean.hibernateLazyServiceTL.get(); - - if (paginator.get() != null) - { - return hls.invoke(className, fieldName, id, paginator.get().getFrom(), paginator.get().getSize()); - } - - return hls.invoke(className, fieldName, id); - } - -} Copied: tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/client/aspects/HibernateLazyLoaderAspect.java (from rev 476, trunk/openutils-spring-rmibernate/src/main/java/it/openutils/spring/rmibernate/client/aspects/HibernateLazyLoaderAspect.java) =================================================================== --- tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/client/aspects/HibernateLazyLoaderAspect.java (rev 0) +++ tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/client/aspects/HibernateLazyLoaderAspect.java 2007-10-22 17:15:30 UTC (rev 478) @@ -0,0 +1,81 @@ +package it.openutils.spring.rmibernate.client.aspects; + +import it.openutils.spring.rmibernate.client.HibernateRmiProxyFactoryBean; +import it.openutils.spring.rmibernate.client.pagination.Paginator; +import it.openutils.spring.rmibernate.shared.managers.HibernateLazyService; + +import java.io.Serializable; + +import net.sf.cglib.proxy.LazyLoader; + + +/** + * Aspect that does remote lazy loading on cglib proxy + * @author mmolaschi + * @version $Id: $ + */ +public class HibernateLazyLoaderAspect implements LazyLoader, Serializable +{ + + /** + * UID + */ + private static final long serialVersionUID = -365731708075101363L; + + private static ThreadLocal<Paginator> paginator = new ThreadLocal<Paginator>(); + + private String className; + + private String fieldName; + + private Serializable id; + + private HibernateLazyService hibernateLazyService; + + /** + * Constructor + * @param className parent class name + * @param fieldName field to be lazy loaded + * @param id id of current entity + */ + public HibernateLazyLoaderAspect(String className, String fieldName, Serializable id, HibernateLazyService hibernateLazyService) + { + this.className = className; + this.fieldName = fieldName; + this.id = id; + this.hibernateLazyService = hibernateLazyService; + } + + /** + * Set pagination for next calls in current thread + * @param from starting row number + * @param size max number of rows + */ + public static void setPagination(int from, int size) + { + paginator.set(new Paginator(from, size)); + } + + /** + * Disable pagination for next calls in current thread + */ + public static void resetPagination() + { + paginator.set(null); + } + + /** + * {@inheritDoc} + */ + public Object loadObject() throws Exception + { + // Load from remote + if (paginator.get() != null) + { + return hibernateLazyService.invoke(className, fieldName, id, paginator.get().getFrom(), paginator.get().getSize()); + } + + return hibernateLazyService.invoke(className, fieldName, id); + } + +} Deleted: tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/HibernateLazyRmiInterceptor.java =================================================================== --- trunk/openutils-spring-rmibernate/src/main/java/it/openutils/spring/rmibernate/server/aspects/HibernateLazyRmiInterceptor.java 2007-10-17 17:06:38 UTC (rev 475) +++ tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/HibernateLazyRmiInterceptor.java 2007-10-22 17:15:30 UTC (rev 478) @@ -1,58 +0,0 @@ -package it.openutils.spring.rmibernate.server.aspects; - -import org.aopalliance.intercept.MethodInterceptor; -import org.aopalliance.intercept.MethodInvocation; -import org.hibernate.SessionFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * Main server interceptor on rmi calls - * @author mmolaschi - * @version $Id: $ - */ -public class HibernateLazyRmiInterceptor implements MethodInterceptor -{ - - /** - * log - */ - protected static final Logger logger = LoggerFactory.getLogger(HibernateLazyRmiInterceptor.class); - - private SessionFactory sessionFactory; - - /** - * Contructor - * @param sessionFactory hibernate session factory - */ - public HibernateLazyRmiInterceptor(SessionFactory sessionFactory) - { - this.sessionFactory = sessionFactory; - } - - /** - * {@inheritDoc} - */ - public Object invoke(MethodInvocation invocation) throws Throwable - { - try - { - Object retVal = invocation.proceed(); - - SerializationInterceptor.clean(); - // Proxy class for serialization work - return SerializationInterceptor.getEnhancedObject(retVal, sessionFactory); - } - catch (Throwable ex) - { - if (logger.isInfoEnabled()) - { - logger.info("Processing of " + " remote call resulted in exception: ", ex); - } - - throw ex; - } - } - -} Copied: tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/HibernateLazyRmiInterceptor.java (from rev 476, trunk/openutils-spring-rmibernate/src/main/java/it/openutils/spring/rmibernate/server/aspects/HibernateLazyRmiInterceptor.java) =================================================================== --- tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/HibernateLazyRmiInterceptor.java (rev 0) +++ tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/HibernateLazyRmiInterceptor.java 2007-10-22 17:15:30 UTC (rev 478) @@ -0,0 +1,63 @@ +package it.openutils.spring.rmibernate.server.aspects; + +import it.openutils.spring.rmibernate.shared.managers.HibernateLazyService; + +import org.aopalliance.intercept.MethodInterceptor; +import org.aopalliance.intercept.MethodInvocation; +import org.hibernate.SessionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * Main server interceptor on rmi calls + * @author mmolaschi + * @version $Id: $ + */ +public class HibernateLazyRmiInterceptor implements MethodInterceptor +{ + + /** + * log + */ + protected static final Logger logger = LoggerFactory.getLogger(HibernateLazyRmiInterceptor.class); + + private SessionFactory sessionFactory; + + /** + * Contructor + * @param sessionFactory hibernate session factory + */ + public HibernateLazyRmiInterceptor(SessionFactory sessionFactory) + { + this.sessionFactory = sessionFactory; + } + + /** + * {@inheritDoc} + */ + public Object invoke(MethodInvocation invocation) throws Throwable + { + logger.debug("Catched invocation: {}", invocation); + try + { + Object retVal = invocation.proceed(); + + SerializationInterceptor.clean(); + // Proxy class for serialization work + Object result = SerializationInterceptor.getEnhancedObject(retVal, sessionFactory); + logger.debug("Returning enhanced object {}", result); + return result; + } + catch (Throwable ex) + { + if (logger.isInfoEnabled()) + { + logger.info("Processing of " + " remote call resulted in exception: ", ex); + } + + throw ex; + } + } + +} Deleted: tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/SerializationInterceptor.java =================================================================== --- trunk/openutils-spring-rmibernate/src/main/java/it/openutils/spring/rmibernate/server/aspects/SerializationInterceptor.java 2007-10-17 17:06:38 UTC (rev 475) +++ tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/SerializationInterceptor.java 2007-10-22 17:15:30 UTC (rev 478) @@ -1,334 +0,0 @@ -package it.openutils.spring.rmibernate.server.aspects; - -import it.openutils.spring.rmibernate.server.aspects.util.EntitySerializer; -import it.openutils.spring.rmibernate.shared.LazyReference; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import net.sf.cglib.proxy.Callback; -import net.sf.cglib.proxy.CallbackFilter; -import net.sf.cglib.proxy.Enhancer; -import net.sf.cglib.proxy.Factory; -import net.sf.cglib.proxy.MethodInterceptor; -import net.sf.cglib.proxy.MethodProxy; -import net.sf.cglib.proxy.NoOp; - -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.MapUtils; -import org.apache.commons.collections.SetUtils; -import org.apache.commons.collections.Transformer; -import org.hibernate.EntityMode; -import org.hibernate.SessionFactory; -import org.hibernate.collection.PersistentCollection; -import org.hibernate.collection.PersistentSet; -import org.hibernate.proxy.HibernateProxy; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.ReflectionUtils; - - -/** - * Proxy object with {@link EntitySerializer} and Intercept writeReplace calls - * @author mmolaschi - * @version $Id: $ - */ -public class SerializationInterceptor implements MethodInterceptor -{ - - private static ThreadLocal<List<Object>> processed = new ThreadLocal<List<Object>>(); - - private static Map<Class, Object> proxies = Collections.synchronizedMap(new HashMap<Class, Object>()); - - /** - * log - */ - private static Logger log = LoggerFactory.getLogger(SerializationInterceptor.class); - - /** - * non proxied object - */ - private Object original; - - /** - * hibernate sessionfactory - */ - private SessionFactory sessionFactory; - - /** - * Constructor - * @param o object to be proxied - * @param sessionFactory hibernate sessionfactory - */ - private SerializationInterceptor(Object o, SessionFactory sessionFactory) - { - this.original = o; - this.sessionFactory = sessionFactory; - } - - public static void clean() - { - processed.set(null); - } - - /** - * Get proxy object intercepting writeReplace calls - * @param o object to be proxied - * @param sessionFactory hibernate sessionfactory - * @return proxied object - */ - public static Object getEnhancedObject(Object o, SessionFactory sessionFactory) - { - return getEnhancedObject(o, sessionFactory, null); - } - - /** - * Get proxy object intercepting writeReplace calls - * @param o object to be proxied - * @param sessionFactory hibernate sessionfactory - * @param lazyRef reference to a lazy field - * @return proxied object - */ - public static Object getEnhancedObject(Object o, SessionFactory sessionFactory, LazyReference lazyRef) - { - if (o == null) - { - return null; - } - - if (!(o instanceof HibernateProxy) - && !(o instanceof PersistentSet) - && processed.get() != null - && processed.get().contains(o)) - { - return o; - } - - // check if there is an empty constructor - try - { - o.getClass().getConstructor(new Class[]{}); - } - catch (NoSuchMethodException ex) - { - return o; - } - - // check if object can be subclassed - if (Modifier.isFinal(o.getClass().getModifiers())) - { - return o; - } - - try - { - // get class - Class clazz = o.getClass(); - - // if it is an hibernateproxy get superclass - if (o instanceof HibernateProxy) - { - clazz = o.getClass().getSuperclass(); - if (clazz == null) - { - clazz = o.getClass().getInterfaces()[0]; - } - } - - Callback callback = null; - - // if this is a lazy field user lazyreferenceaspect - if (lazyRef != null) - { - LazyReferenceAspect lra = new LazyReferenceAspect(); - lra.setLazyReference(lazyRef); - callback = lra; - } - else - { - // user default interceptor - callback = new SerializationInterceptor(o, sessionFactory); - } - - synchronized (proxies) - { - if (proxies.containsKey(clazz)) - { - Factory proxy = (Factory)proxies.get(clazz); - return proxy.newInstance(new Callback[]{callback, NoOp.INSTANCE }); - } - } - // create proxy to listen on writeReplace method calls - Object proxy = Enhancer.create(clazz, new Class[]{EntitySerializer.class }, new CallbackFilter() - { - - public int accept(Method method) - { - if (method.getName().equals("writeReplace")) - { - return 0; - } - else - { - return 1; - } - } - - }, new Callback[]{callback, NoOp.INSTANCE }); - - // store proxy - proxies.put(clazz, ((Factory)proxy).newInstance(new Callback[]{EmptyMethodInterceptor.INSTANCE, NoOp.INSTANCE })); - return proxy; - } - catch (Throwable t) - { - log.warn(t.getMessage(), t); - return o; - } - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable - { - - try - { - if (original == null) - { - return null; - } - - if (processed.get() == null) - { - processed.set(new ArrayList<Object>()); - } - - // add to processed objects - processed.get().add(original); - - if (original.getClass().isPrimitive()) - { - return original; - } - else if (original.getClass().isArray()) - { - // replace array entries with proxied ones - Object[] array = (Object[]) original; - for (int i = 0; i < array.length; i++) - { - array[i] = SerializationInterceptor.getEnhancedObject(array[i], sessionFactory); - } - return array; - } - else if (original instanceof Collection) - { - // replace collection entries with proxied ones - Collection collection = (Collection) original; - CollectionUtils.transform(collection, transformer(sessionFactory)); - return collection; - } - else if (original instanceof Map) - { - // replace map entries with proxied ones - Map map = (Map) original; - MapUtils.transformedMap(map, transformer(sessionFactory), transformer(sessionFactory)); - return map; - } - else if (original instanceof Set) - { - // replace set entries with proxied ones - Set set = (Set) original; - SetUtils.transformedSet(set, transformer(sessionFactory)); - return set; - } - else - { - // cycle on bean fields - ReflectionUtils.doWithFields(original.getClass(), new ReflectionUtils.FieldCallback() - { - - /** - * {@inheritDoc} - */ - public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException - { - // set field accessible - field.setAccessible(true); - - // get original value - Object oldValue = field.get(original); - - // get new value - Object newValue = null; - - if (oldValue instanceof HibernateProxy || oldValue instanceof PersistentCollection) - { - // if this field is a hibernate proxy or a persistent collection store reference - LazyReference lazyRef = new LazyReference(); - lazyRef.setFieldClassName(field.getType().getName()); - lazyRef.setClassName(original.getClass().getName()); - lazyRef.setFieldName(field.getName()); - // load id - lazyRef.setId(sessionFactory.getClassMetadata(original.getClass()).getIdentifier( - original, - EntityMode.POJO)); - - // get proxy for lazy - newValue = SerializationInterceptor.getEnhancedObject(oldValue, sessionFactory, lazyRef); - } - else - { - // get default proxy - newValue = SerializationInterceptor.getEnhancedObject(oldValue, sessionFactory); - } - - // if there is a variation store it - if (newValue != oldValue) - { - field.set(original, newValue); - } - } - - }); - } - - return original; - - } - catch (Throwable t) - { - log.error(t.getMessage(), t); - return original; - } - } - - /** - * Get transformer for collection, map or set injection of proxied objects - * @param factory hibernate session factory - * @return transformer - */ - private Transformer transformer(SessionFactory factory) - { - return new Transformer() - { - - public Object transform(Object input) - { - return SerializationInterceptor.getEnhancedObject(input, sessionFactory); - } - - }; - } - -} Copied: tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/SerializationInterceptor.java (from rev 476, trunk/openutils-spring-rmibernate/src/main/java/it/openutils/spring/rmibernate/server/aspects/SerializationInterceptor.java) =================================================================== --- tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/SerializationInterceptor.java (rev 0) +++ tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/server/aspects/SerializationInterceptor.java 2007-10-22 17:15:30 UTC (rev 478) @@ -0,0 +1,376 @@ +package it.openutils.spring.rmibernate.server.aspects; + +import it.openutils.spring.rmibernate.server.aspects.util.EntitySerializer; +import it.openutils.spring.rmibernate.shared.LazyReference; +import it.openutils.spring.rmibernate.shared.managers.HibernateLazyService; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.sf.cglib.proxy.Callback; +import net.sf.cglib.proxy.CallbackFilter; +import net.sf.cglib.proxy.Enhancer; +import net.sf.cglib.proxy.Factory; +import net.sf.cglib.proxy.MethodInterceptor; +import net.sf.cglib.proxy.MethodProxy; +import net.sf.cglib.proxy.NoOp; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.MapUtils; +import org.apache.commons.collections.SetUtils; +import org.apache.commons.collections.Transformer; +import org.hibernate.EntityMode; +import org.hibernate.SessionFactory; +import org.hibernate.collection.PersistentCollection; +import org.hibernate.collection.PersistentSet; +import org.hibernate.proxy.HibernateProxy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.ReflectionUtils; + + +/** + * Proxy object with {@link EntitySerializer} and Intercept writeReplace calls + * @author mmolaschi + * @version $Id: $ + */ +public class SerializationInterceptor implements MethodInterceptor +{ + + private static ThreadLocal<List<Object>> processed = new ThreadLocal<List<Object>>(); + + private static ThreadLocal<HibernateLazyService> hibernateLazyService = new ThreadLocal<HibernateLazyService>(); + + private static Map<Class, Object> proxies = Collections.synchronizedMap(new HashMap<Class, Object>()); + + /** + * log + */ + private static Logger log = LoggerFactory.getLogger(SerializationInterceptor.class); + + /** + * non proxied object + */ + private Object original; + + /** + * hibernate sessionfactory + */ + private SessionFactory sessionFactory; + + /** + * Constructor + * @param o object to be proxied + * @param sessionFactory hibernate sessionfactory + */ + private SerializationInterceptor(Object o, SessionFactory sessionFactory) + { + this.original = o; + this.sessionFactory = sessionFactory; + } + + /** + * Cleans the processed beans cache + */ + public static void clean() + { + processed.set(null); + } + + /** + * Get proxy object intercepting writeReplace calls + * @param o object to be proxied + * @param sessionFactory hibernate sessionfactory + * @return proxied object + */ + public static Object getEnhancedObject(Object o, SessionFactory sessionFactory) + { + return getEnhancedObject(o, sessionFactory, null); + } + + /** + * Get proxy object intercepting writeReplace calls + * @param o object to be proxied + * @param sessionFactory hibernate sessionfactory + * @param lazyRef reference to a lazy field + * @return proxied object + */ + public static Object getEnhancedObject(Object o, SessionFactory sessionFactory, LazyReference lazyRef) + { + if (o == null) + { + return null; + } + + if (!(o instanceof HibernateProxy) + && !(o instanceof PersistentSet) + && processed.get() != null + && processed.get().contains(o)) + { + return o; + } + + if (o.getClass().getName().startsWith("java.") && + !((o instanceof Collection) || (o instanceof Map))) + { + return o; + } + + + // check if there is an empty constructor + try + { + o.getClass().getConstructor(new Class[]{}); + } + catch (NoSuchMethodException ex) + { + return o; + } + + // check if object can be subclassed + if (Modifier.isFinal(o.getClass().getModifiers())) + { + return o; + } + + try + { + // get class + Class clazz = o.getClass(); + + // if it is an hibernateproxy get superclass + if (o instanceof HibernateProxy) + { + clazz = o.getClass().getSuperclass(); + if (clazz == null) + { + clazz = o.getClass().getInterfaces()[0]; + } + } + + Callback callback = null; + + // if this is a lazy field user lazyreferenceaspect + if (lazyRef != null) + { + LazyReferenceAspect lra = new LazyReferenceAspect(); + lra.setLazyReference(lazyRef); + callback = lra; + } + else + { + // user default interceptor + callback = new SerializationInterceptor(o, sessionFactory); + } + + synchronized (proxies) + { + if (proxies.containsKey(clazz)) + { + Factory proxy = (Factory) proxies.get(clazz); + return proxy.newInstance(new Callback[]{callback, NoOp.INSTANCE }); + } + } + // create proxy to listen on writeReplace method calls + Object proxy = Enhancer.create(clazz, new Class[]{EntitySerializer.class }, new CallbackFilter() + { + + public int accept(Method method) + { + if (method.getName().equals("writeReplace")) + { + return 0; + } + else + { + return 1; + } + } + + }, new Callback[]{callback, NoOp.INSTANCE }); + + // store proxy + proxies.put(clazz, ((Factory) proxy).newInstance(new Callback[]{ + EmptyMethodInterceptor.INSTANCE, + NoOp.INSTANCE })); + return proxy; + } + catch (Throwable t) + { + log.warn(t.getMessage(), t); + return o; + } + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable + { + try + { + if (original == null) + { + return null; + } + + if (original.getClass().getName().startsWith("java.") && + !(original instanceof Collection) || (original instanceof Map)) + { + return original; + } + + if (processed.get() == null) + { + processed.set(new ArrayList<Object>()); + } + + // add to processed objects + processed.get().add(original); + + if (original.getClass().isPrimitive()) + { + log.debug("Non enhancing primitive type: {}", original.getClass().getName()); + return original; + } + else if (original.getClass().isArray()) + { + // replace array entries with proxied ones + Object[] array = (Object[]) original; + for (int i = 0; i < array.length; i++) + { + array[i] = SerializationInterceptor.getEnhancedObject(array[i], sessionFactory); + } + return array; + } + else if (original instanceof Collection) + { + // replace collection entries with proxied ones + Collection collection = (Collection) original; + CollectionUtils.transform(collection, transformer(sessionFactory)); + return collection; + } + else if (original instanceof Map) + { + // replace map entries with proxied ones + Map map = (Map) original; + MapUtils.transformedMap(map, transformer(sessionFactory), transformer(sessionFactory)); + return map; + } + else if (original instanceof Set) + { + // replace set entries with proxied ones + Set set = (Set) original; + SetUtils.transformedSet(set, transformer(sessionFactory)); + return set; + } + else + { + // cycle on bean fields + ReflectionUtils.doWithFields(original.getClass(), new ReflectionUtils.FieldCallback() + { + + + + /** + * {@inheritDoc} + */ + public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException + { + // set field accessible + field.setAccessible(true); + + // get original value + Object oldValue = field.get(original); + + // get new value + Object newValue = null; + + if (oldValue instanceof HibernateProxy || oldValue instanceof PersistentCollection) + { + // if this field is a hibernate proxy or a persistent collection store reference + LazyReference lazyRef = new LazyReference(); + lazyRef.setFieldClassName(field.getType().getName()); + lazyRef.setClassName(original.getClass().getName()); + lazyRef.setFieldName(field.getName()); + // load id + lazyRef.setId(sessionFactory.getClassMetadata(original.getClass()).getIdentifier( + original, + EntityMode.POJO)); + + // get proxy for lazy + newValue = SerializationInterceptor.getEnhancedObject(oldValue, sessionFactory, lazyRef); + } + else + { + // get default proxy + newValue = SerializationInterceptor.getEnhancedObject(oldValue, sessionFactory); + } + + // if there is a variation store it + if (newValue != oldValue) + { + field.set(original, newValue); + } + } + + }); + } + + return original; + + } + catch (Throwable t) + { + log.error(t.getMessage(), t); + return original; + } + } + + /** + * Get transformer for collection, map or set injection of proxied objects + * @param factory hibernate session factory + * @return transformer + */ + private Transformer transformer(SessionFactory factory) + { + return new Transformer() + { + + public Object transform(Object input) + { + return SerializationInterceptor.getEnhancedObject(input, sessionFactory); + } + + }; + } + + + /** + * Sets the hibernateLazyService. + * @param hibernateLazyService the hibernateLazyService to set + */ + public static void setHibernateLazyService(HibernateLazyService hibernateLazyService) + { + SerializationInterceptor.hibernateLazyService.set(hibernateLazyService); + } + + + /** + * Returns the hibernateLazyService. + * @return the hibernateLazyService + */ + public static HibernateLazyService getHibernateLazyService() + { + return hibernateLazyService.get(); + } +} Deleted: tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/shared/LazyReference.java =================================================================== --- trunk/openutils-spring-rmibernate/src/main/java/it/openutils/spring/rmibernate/shared/LazyReference.java 2007-10-17 17:06:38 UTC (rev 475) +++ tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/shared/LazyReference.java 2007-10-22 17:15:30 UTC (rev 478) @@ -1,117 +0,0 @@ -package it.openutils.spring.rmibernate.shared; - -import it.openutils.spring.rmibernate.client.aspects.HibernateLazyLoaderAspect; - -import java.io.ObjectStreamException; -import java.io.Serializable; - -import net.sf.cglib.proxy.Enhancer; - - -/** - * Store lazy reference - * @author mmolaschi - * @version $Id: $ - */ -public class LazyReference implements Serializable -{ - - private Serializable id; - - private String fieldName; - - private String className; - - private String fieldClassName; - - /** - * default constructor - */ - public LazyReference() - { - - } - - /** - * Constructor - * @param className className - * @param fieldName fieldName - * @param fieldClassName fieldClassName - * @param id id of current entity - */ - public LazyReference(String className, String fieldName, String fieldClassName, Serializable id) - { - this.className = className; - this.fieldName = fieldName; - this.fieldClassName = fieldClassName; - this.id = id; - } - - /** - * Called on deserialization, creates proxy for remote lazy loading - * @return proxy for remote lazy loading - * @throws ObjectStreamException exception reading - * @throws ClassNotFoundException class not found - */ - @SuppressWarnings("unchecked") - Object readResolve() throws ObjectStreamException, ClassNotFoundException - { - // get proxy superclass - Class superclass = Class.forName(fieldClassName); - Class[] interfaces = null; - // if superclass is an interface add it to interfaces - if (superclass.isInterface()) - { - interfaces = new Class[]{superclass}; - } - // return proxy - return Enhancer.create( - superclass, - interfaces, - new HibernateLazyLoaderAspect(className, fieldName, id)); - - } - - public String getClassName() - { - return className; - } - - public void setClassName(String className) - { - this.className = className; - } - - public Serializable getId() - { - return id; - } - - public void setId(Serializable id) - { - this.id = id; - } - - public String getFieldName() - { - return fieldName; - } - - public void setFieldName(String fieldName) - { - this.fieldName = fieldName; - } - - - public String getFieldClassName() - { - return fieldClassName; - } - - - public void setFieldClassName(String fieldClassName) - { - this.fieldClassName = fieldClassName; - } - -} Copied: tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/shared/LazyReference.java (from rev 476, trunk/openutils-spring-rmibernate/src/main/java/it/openutils/spring/rmibernate/shared/LazyReference.java) =================================================================== --- tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/shared/LazyReference.java (rev 0) +++ tags/openutils-spring-rmibernate-1.0.1/src/main/java/it/openutils/spring/rmibernate/shared/LazyReference.java 2007-10-22 17:15:30 UTC (rev 478) @@ -0,0 +1,123 @@ +package it.openutils.spring.rmibernate.shared; + +import it.openutils.spring.rmibernate.client.HibernateRmiProxyFactoryBean; +import it.openutils.spring.rmibernate.client.aspects.HibernateLazyLoaderAspect; + +import java.io.ObjectStreamException; +import java.io.Serializable; + +import net.sf.cglib.proxy.Enhancer; + + +/** + * Store lazy reference + * @author mmolaschi + * @version $Id: $ + */ +public class LazyReference implements Serializable +{ + + /** + * UID + */ + private static final long serialVersionUID = 421364413345638150L; + + private Serializable id; + + private String fieldName; + + private String className; + + private String fieldClassName; + + /** + * default constructor + */ + public LazyReference() + { + + } + + /** + * Constructor + * @param className className + * @param fieldName fieldName + * @param fieldClassName fieldClassName + * @param id id of current entity + */ + public LazyReference(String className, String fieldName, String fieldClassName, Serializable id) + { + this.className = className; + this.fieldName = fieldName; + this.fieldClassName = fieldClassName; + this.id = id; + } + + /** + * Called on deserialization, creates proxy for remote lazy loading + * @return proxy for remote lazy loading + * @throws ObjectStreamException exception reading + * @throws ClassNotFoundException class not found + */ + @SuppressWarnings("unchecked") + Object readResolve() throws ObjectStreamException, ClassNotFoundException + { + // get proxy superclass + Class superclass = Class.forName(fieldClassName); + Class[] interfaces = null; + // if superclass is an interface add it to interfaces + if (superclass.isInterface()) + { + interfaces = new Class[]{superclass}; + } + // return proxy + return Enhancer.create( + superclass, + interfaces, + new HibernateLazyLoaderAspect(className, fieldName, id, HibernateRmiProxyFactoryBean.hibernateLazyServiceTL.get())); + + } + + public String getClassName() + { + return className; + } + + public void setClassName(String className) + { + this.className = className; + } + + public Serializable getId() + { + return id; + } + + public void setId(Serializable id) + { + this.id = id; + } + + public String getFieldName() + { + return fieldName; + } + + public void setFieldName(String fieldName) + { + this.fieldName = fieldName; + } + + + public String getFieldClassName() + { + return fieldClassName; + } + + + public void setFieldClassName(String fieldClassName) + { + this.fieldClassName = fieldClassName; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2007-11-06 10:02:04
|
Revision: 497 http://openutils.svn.sourceforge.net/openutils/?rev=497&view=rev Author: molaschi Date: 2007-11-06 02:02:04 -0800 (Tue, 06 Nov 2007) Log Message: ----------- [maven-scm] copy for tag openutils-spring-1.0.4 Added Paths: ----------- tags/openutils-spring-1.0.4/ tags/openutils-spring-1.0.4/pom.xml Removed Paths: ------------- tags/openutils-spring-1.0.4/pom.xml Copied: tags/openutils-spring-1.0.4 (from rev 492, trunk/openutils-spring) Deleted: tags/openutils-spring-1.0.4/pom.xml =================================================================== --- trunk/openutils-spring/pom.xml 2007-11-05 16:36:06 UTC (rev 492) +++ tags/openutils-spring-1.0.4/pom.xml 2007-11-06 10:02:04 UTC (rev 497) @@ -1,101 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-spring</artifactId> - <name>openutils spring tools</name> - <version>1.0.3-SNAPSHOT</version> - <description /> - <properties> - <spring.version>2.0.6</spring.version> - </properties> - <dependencies> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-webmvc</artifactId> - <version>${spring.version}</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>javax.servlet</groupId> - <artifactId>jstl:jar</artifactId> - </exclusion> - <exclusion> - <groupId>taglibs</groupId> - <artifactId>standard</artifactId> - </exclusion> - <exclusion> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </exclusion> - <exclusion> - <groupId>logkit</groupId> - <artifactId>logkit</artifactId> - </exclusion> - <exclusion> - <groupId>avalon-framework</groupId> - <artifactId>avalon-framework</artifactId> - </exclusion> - <exclusion> - <groupId>struts</groupId> - <artifactId>struts</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-remoting</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>net.sf.json-lib</groupId> - <artifactId>json-lib</artifactId> - <version>1.1</version> - <classifier>jdk15</classifier> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - <version>1.7.0</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-annotations</artifactId> - <version>3.2.1.ga</version> - <optional>true</optional> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.4</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.13</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-spring-1.0.4/pom.xml (from rev 496, trunk/openutils-spring/pom.xml) =================================================================== --- tags/openutils-spring-1.0.4/pom.xml (rev 0) +++ tags/openutils-spring-1.0.4/pom.xml 2007-11-06 10:02:04 UTC (rev 497) @@ -0,0 +1,106 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-spring</artifactId> + <name>openutils spring tools</name> + <version>1.0.4</version> + <description /> + <properties> + <spring.version>2.0.6</spring.version> + </properties> + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-webmvc</artifactId> + <version>${spring.version}</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>javax.servlet</groupId> + <artifactId>jstl:jar</artifactId> + </exclusion> + <exclusion> + <groupId>taglibs</groupId> + <artifactId>standard</artifactId> + </exclusion> + <exclusion> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + </exclusion> + <exclusion> + <groupId>logkit</groupId> + <artifactId>logkit</artifactId> + </exclusion> + <exclusion> + <groupId>avalon-framework</groupId> + <artifactId>avalon-framework</artifactId> + </exclusion> + <exclusion> + <groupId>struts</groupId> + <artifactId>struts</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-remoting</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>net.sf.json-lib</groupId> + <artifactId>json-lib</artifactId> + <version>1.1</version> + <classifier>jdk15</classifier> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + <version>1.7.0</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-annotations</artifactId> + <version>3.2.1.ga</version> + <optional>true</optional> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.4</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.13</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-spring-1.0.4</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-spring-1.0.4</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-spring-1.0.4</url> + </scm> +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2007-11-07 16:25:44
|
Revision: 500 http://openutils.svn.sourceforge.net/openutils/?rev=500&view=rev Author: molaschi Date: 2007-11-07 08:25:45 -0800 (Wed, 07 Nov 2007) Log Message: ----------- [maven-scm] copy for tag openutils-testing-junit-1.1.3 Added Paths: ----------- tags/openutils-testing-junit-1.1.3/ tags/openutils-testing-junit-1.1.3/pom.xml Removed Paths: ------------- tags/openutils-testing-junit-1.1.3/pom.xml Copied: tags/openutils-testing-junit-1.1.3 (from rev 498, trunk/openutils-testing-junit) Deleted: tags/openutils-testing-junit-1.1.3/pom.xml =================================================================== --- trunk/openutils-testing-junit/pom.xml 2007-11-06 10:02:10 UTC (rev 498) +++ tags/openutils-testing-junit-1.1.3/pom.xml 2007-11-07 16:25:45 UTC (rev 500) @@ -1,61 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-testing-junit</artifactId> - <name>openutils test utils (junit)</name> - <version>1.1.3-SNAPSHOT</version> - <description>openutils test utils</description> - <properties> - <spring.version>2.0.6</spring.version> - </properties> - <dependencies> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.13</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-hibernate3</artifactId> - <version>${spring.version}</version> - <optional>true</optional> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.dbunit</groupId> - <artifactId>dbunit</artifactId> - <version>2.2</version> - <optional>true</optional> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-testing-junit-1.1.3/pom.xml (from rev 499, trunk/openutils-testing-junit/pom.xml) =================================================================== --- tags/openutils-testing-junit-1.1.3/pom.xml (rev 0) +++ tags/openutils-testing-junit-1.1.3/pom.xml 2007-11-07 16:25:45 UTC (rev 500) @@ -0,0 +1,67 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-testing-junit</artifactId> + <name>openutils test utils (junit)</name> + <version>1.1.3</version> + <description>openutils test utils</description> + <properties> + <spring.version>2.0.6</spring.version> + </properties> + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.13</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-hibernate3</artifactId> + <version>${spring.version}</version> + <optional>true</optional> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.dbunit</groupId> + <artifactId>dbunit</artifactId> + <version>2.2</version> + <optional>true</optional> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-junit-1.1.3</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-junit-1.1.3</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-testing-junit-1.1.3</url> + </scm> +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mup...@us...> - 2007-11-12 15:19:17
|
Revision: 504 http://openutils.svn.sourceforge.net/openutils/?rev=504&view=rev Author: muppet68 Date: 2007-11-12 07:19:21 -0800 (Mon, 12 Nov 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-hibernate-security-0.0.1 Added Paths: ----------- tags/openutils-hibernate-security-0.0.1/ tags/openutils-hibernate-security-0.0.1/pom.xml Removed Paths: ------------- tags/openutils-hibernate-security-0.0.1/pom.xml Copied: tags/openutils-hibernate-security-0.0.1 (from rev 501, trunk/openutils-hibernate-security) Deleted: tags/openutils-hibernate-security-0.0.1/pom.xml =================================================================== --- trunk/openutils-hibernate-security/pom.xml 2007-11-07 16:25:51 UTC (rev 501) +++ tags/openutils-hibernate-security-0.0.1/pom.xml 2007-11-12 15:19:21 UTC (rev 504) @@ -1,199 +0,0 @@ -<?xml version="1.0"?> -<project> - <parent> - <artifactId>openutils</artifactId> - <groupId>net.sourceforge.openutils</groupId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <modelVersion>4.0.0</modelVersion> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-hibernate-security</artifactId> - <name>openutils-hibernate-security</name> - <version>0.0.1-SNAPSHOT</version> - <description>Hibernate Security classes</description> - <properties> - <spring.version>2.0.6</spring.version> - <aspectj.version>1.5.3</aspectj.version> - </properties> - <dependencies> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-dao</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-aop</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-hibernate3</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <!-- already imported cglib-nodep by spring --> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>aspectj</groupId> - <artifactId>aspectjrt</artifactId> - <version>${aspectj.version}</version> - </dependency> - <dependency> - <groupId>aspectj</groupId> - <artifactId>aspectjweaver</artifactId> - <version>${aspectj.version}</version> - </dependency> - <dependency> - <groupId>cglib</groupId> - <artifactId>cglib-nodep</artifactId> - <version>2.1_3</version> - </dependency> - <dependency> - <groupId>asm</groupId> - <artifactId>asm</artifactId> - <version>2.2.3</version> - </dependency> - <dependency> - <groupId>asm</groupId> - <artifactId>asm-attrs</artifactId> - <version>2.2.3</version> - </dependency> - <dependency> - <groupId>asm</groupId> - <artifactId>asm-commons</artifactId> - <version>2.2.3</version> - </dependency> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-usermanagement</artifactId> - <version>1.1.1</version> - </dependency> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-usermanagement-dataobjects</artifactId> - <version>1.1.1</version> - </dependency> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-bshd5</artifactId> - <version>1.0.8-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-testing-junit</artifactId> - <version>1.1.2</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate</artifactId> - <version>3.2.3.ga</version> - <exclusions> - <exclusion> - <!-- already imported cglib-nodep by spring --> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-annotations</artifactId> - <version>3.2.1.ga</version> - <exclusions> - <exclusion> - <!-- already imported cglib-nodep by spring --> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-dbcp</groupId> - <artifactId>commons-dbcp</artifactId> - <version>1.2.1</version> - <scope>test</scope> - <exclusions> - <exclusion> - <artifactId>xerces</artifactId> - <groupId>xerces</groupId> - </exclusion> - <exclusion> - <artifactId>xml-apis</artifactId> - <groupId>xml-apis</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.2</version> - </dependency> - <dependency> - <groupId>org.acegisecurity</groupId> - <artifactId>acegi-security</artifactId> - <version>1.0.3</version> - <exclusions> - <exclusion> - <artifactId>spring-remoting</artifactId> - <groupId>org.springframework</groupId> - </exclusion> - <exclusion> - <artifactId>spring-jdbc</artifactId> - <groupId>org.springframework</groupId> - </exclusion> - <exclusion> - <artifactId>spring-support</artifactId> - <groupId>org.springframework</groupId> - </exclusion> - <exclusion> - <artifactId>logkit</artifactId> - <groupId>logkit</groupId> - </exclusion> - <exclusion> - <artifactId>avalon-framework</artifactId> - <groupId>avalon-framework</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>hsqldb</groupId> - <artifactId>hsqldb</artifactId> - <version>1.8.0.7</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.0</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>dbunit</groupId> - <artifactId>dbunit</artifactId> - <version>2.1</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-hibernate-security-0.0.1/pom.xml (from rev 503, trunk/openutils-hibernate-security/pom.xml) =================================================================== --- tags/openutils-hibernate-security-0.0.1/pom.xml (rev 0) +++ tags/openutils-hibernate-security-0.0.1/pom.xml 2007-11-12 15:19:21 UTC (rev 504) @@ -0,0 +1,205 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <artifactId>openutils</artifactId> + <groupId>net.sourceforge.openutils</groupId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-hibernate-security</artifactId> + <name>openutils-hibernate-security</name> + <version>0.0.1</version> + <description>Hibernate Security classes</description> + <properties> + <spring.version>2.0.6</spring.version> + <aspectj.version>1.5.3</aspectj.version> + </properties> + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-dao</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-hibernate3</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <!-- already imported cglib-nodep by spring --> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>aspectj</groupId> + <artifactId>aspectjrt</artifactId> + <version>${aspectj.version}</version> + </dependency> + <dependency> + <groupId>aspectj</groupId> + <artifactId>aspectjweaver</artifactId> + <version>${aspectj.version}</version> + </dependency> + <dependency> + <groupId>cglib</groupId> + <artifactId>cglib-nodep</artifactId> + <version>2.1_3</version> + </dependency> + <dependency> + <groupId>asm</groupId> + <artifactId>asm</artifactId> + <version>2.2.3</version> + </dependency> + <dependency> + <groupId>asm</groupId> + <artifactId>asm-attrs</artifactId> + <version>2.2.3</version> + </dependency> + <dependency> + <groupId>asm</groupId> + <artifactId>asm-commons</artifactId> + <version>2.2.3</version> + </dependency> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-usermanagement</artifactId> + <version>1.1.1</version> + </dependency> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-usermanagement-dataobjects</artifactId> + <version>1.1.1</version> + </dependency> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-bshd5</artifactId> + <version>1.0.9</version> + </dependency> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-testing-junit</artifactId> + <version>1.1.2</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.2.3.ga</version> + <exclusions> + <exclusion> + <!-- already imported cglib-nodep by spring --> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-annotations</artifactId> + <version>3.2.1.ga</version> + <exclusions> + <exclusion> + <!-- already imported cglib-nodep by spring --> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-dbcp</groupId> + <artifactId>commons-dbcp</artifactId> + <version>1.2.1</version> + <scope>test</scope> + <exclusions> + <exclusion> + <artifactId>xerces</artifactId> + <groupId>xerces</groupId> + </exclusion> + <exclusion> + <artifactId>xml-apis</artifactId> + <groupId>xml-apis</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.2</version> + </dependency> + <dependency> + <groupId>org.acegisecurity</groupId> + <artifactId>acegi-security</artifactId> + <version>1.0.3</version> + <exclusions> + <exclusion> + <artifactId>spring-remoting</artifactId> + <groupId>org.springframework</groupId> + </exclusion> + <exclusion> + <artifactId>spring-jdbc</artifactId> + <groupId>org.springframework</groupId> + </exclusion> + <exclusion> + <artifactId>spring-support</artifactId> + <groupId>org.springframework</groupId> + </exclusion> + <exclusion> + <artifactId>logkit</artifactId> + <groupId>logkit</groupId> + </exclusion> + <exclusion> + <artifactId>avalon-framework</artifactId> + <groupId>avalon-framework</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>hsqldb</groupId> + <artifactId>hsqldb</artifactId> + <version>1.8.0.7</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>dbunit</groupId> + <artifactId>dbunit</artifactId> + <version>2.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-hibernate-security-0.0.1</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-hibernate-security-0.0.1</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-hibernate-security-0.0.1</url> + </scm> +</project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fc...@us...> - 2007-11-14 14:17:45
|
Revision: 508 http://openutils.svn.sourceforge.net/openutils/?rev=508&view=rev Author: fcarone Date: 2007-11-14 06:17:48 -0800 (Wed, 14 Nov 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-hibernate-security-0.0.2 Added Paths: ----------- tags/openutils-hibernate-security-0.0.2/ tags/openutils-hibernate-security-0.0.2/pom.xml tags/openutils-hibernate-security-0.0.2/src/test/java/it/openutils/hibernate/security/SecurityIntegrationTest.java Removed Paths: ------------- tags/openutils-hibernate-security-0.0.2/pom.xml tags/openutils-hibernate-security-0.0.2/src/test/java/it/openutils/hibernate/security/SecurityIntegrationTest.java Copied: tags/openutils-hibernate-security-0.0.2 (from rev 505, trunk/openutils-hibernate-security) Deleted: tags/openutils-hibernate-security-0.0.2/pom.xml =================================================================== --- trunk/openutils-hibernate-security/pom.xml 2007-11-12 15:19:27 UTC (rev 505) +++ tags/openutils-hibernate-security-0.0.2/pom.xml 2007-11-14 14:17:48 UTC (rev 508) @@ -1,199 +0,0 @@ -<?xml version="1.0"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <artifactId>openutils</artifactId> - <groupId>net.sourceforge.openutils</groupId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <modelVersion>4.0.0</modelVersion> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-hibernate-security</artifactId> - <name>openutils-hibernate-security</name> - <version>0.0.2-SNAPSHOT</version> - <description>Hibernate Security classes</description> - <properties> - <spring.version>2.0.6</spring.version> - <aspectj.version>1.5.3</aspectj.version> - </properties> - <dependencies> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-dao</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-aop</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-hibernate3</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <!-- already imported cglib-nodep by spring --> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>aspectj</groupId> - <artifactId>aspectjrt</artifactId> - <version>${aspectj.version}</version> - </dependency> - <dependency> - <groupId>aspectj</groupId> - <artifactId>aspectjweaver</artifactId> - <version>${aspectj.version}</version> - </dependency> - <dependency> - <groupId>cglib</groupId> - <artifactId>cglib-nodep</artifactId> - <version>2.1_3</version> - </dependency> - <dependency> - <groupId>asm</groupId> - <artifactId>asm</artifactId> - <version>2.2.3</version> - </dependency> - <dependency> - <groupId>asm</groupId> - <artifactId>asm-attrs</artifactId> - <version>2.2.3</version> - </dependency> - <dependency> - <groupId>asm</groupId> - <artifactId>asm-commons</artifactId> - <version>2.2.3</version> - </dependency> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-usermanagement</artifactId> - <version>1.1.1</version> - </dependency> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-usermanagement-dataobjects</artifactId> - <version>1.1.1</version> - </dependency> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-bshd5</artifactId> - <version>1.0.9</version> - </dependency> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-testing-junit</artifactId> - <version>1.1.2</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate</artifactId> - <version>3.2.3.ga</version> - <exclusions> - <exclusion> - <!-- already imported cglib-nodep by spring --> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-annotations</artifactId> - <version>3.2.1.ga</version> - <exclusions> - <exclusion> - <!-- already imported cglib-nodep by spring --> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-dbcp</groupId> - <artifactId>commons-dbcp</artifactId> - <version>1.2.1</version> - <scope>test</scope> - <exclusions> - <exclusion> - <artifactId>xerces</artifactId> - <groupId>xerces</groupId> - </exclusion> - <exclusion> - <artifactId>xml-apis</artifactId> - <groupId>xml-apis</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.2</version> - </dependency> - <dependency> - <groupId>org.acegisecurity</groupId> - <artifactId>acegi-security</artifactId> - <version>1.0.3</version> - <exclusions> - <exclusion> - <artifactId>spring-remoting</artifactId> - <groupId>org.springframework</groupId> - </exclusion> - <exclusion> - <artifactId>spring-jdbc</artifactId> - <groupId>org.springframework</groupId> - </exclusion> - <exclusion> - <artifactId>spring-support</artifactId> - <groupId>org.springframework</groupId> - </exclusion> - <exclusion> - <artifactId>logkit</artifactId> - <groupId>logkit</groupId> - </exclusion> - <exclusion> - <artifactId>avalon-framework</artifactId> - <groupId>avalon-framework</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>hsqldb</groupId> - <artifactId>hsqldb</artifactId> - <version>1.8.0.7</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.0</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>dbunit</groupId> - <artifactId>dbunit</artifactId> - <version>2.1</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> Copied: tags/openutils-hibernate-security-0.0.2/pom.xml (from rev 507, trunk/openutils-hibernate-security/pom.xml) =================================================================== --- tags/openutils-hibernate-security-0.0.2/pom.xml (rev 0) +++ tags/openutils-hibernate-security-0.0.2/pom.xml 2007-11-14 14:17:48 UTC (rev 508) @@ -0,0 +1,205 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <artifactId>openutils</artifactId> + <groupId>net.sourceforge.openutils</groupId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-hibernate-security</artifactId> + <name>openutils-hibernate-security</name> + <version>0.0.2</version> + <description>Hibernate Security classes</description> + <properties> + <spring.version>2.0.6</spring.version> + <aspectj.version>1.5.3</aspectj.version> + </properties> + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-dao</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-hibernate3</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <!-- already imported cglib-nodep by spring --> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>aspectj</groupId> + <artifactId>aspectjrt</artifactId> + <version>${aspectj.version}</version> + </dependency> + <dependency> + <groupId>aspectj</groupId> + <artifactId>aspectjweaver</artifactId> + <version>${aspectj.version}</version> + </dependency> + <dependency> + <groupId>cglib</groupId> + <artifactId>cglib-nodep</artifactId> + <version>2.1_3</version> + </dependency> + <dependency> + <groupId>asm</groupId> + <artifactId>asm</artifactId> + <version>2.2.3</version> + </dependency> + <dependency> + <groupId>asm</groupId> + <artifactId>asm-attrs</artifactId> + <version>2.2.3</version> + </dependency> + <dependency> + <groupId>asm</groupId> + <artifactId>asm-commons</artifactId> + <version>2.2.3</version> + </dependency> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-usermanagement</artifactId> + <version>1.1.1</version> + </dependency> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-usermanagement-dataobjects</artifactId> + <version>1.1.1</version> + </dependency> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-bshd5</artifactId> + <version>1.0.9</version> + </dependency> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-testing-junit</artifactId> + <version>1.1.3</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.2.3.ga</version> + <exclusions> + <exclusion> + <!-- already imported cglib-nodep by spring --> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-annotations</artifactId> + <version>3.2.1.ga</version> + <exclusions> + <exclusion> + <!-- already imported cglib-nodep by spring --> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-dbcp</groupId> + <artifactId>commons-dbcp</artifactId> + <version>1.2.1</version> + <scope>test</scope> + <exclusions> + <exclusion> + <artifactId>xerces</artifactId> + <groupId>xerces</groupId> + </exclusion> + <exclusion> + <artifactId>xml-apis</artifactId> + <groupId>xml-apis</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.2</version> + </dependency> + <dependency> + <groupId>org.acegisecurity</groupId> + <artifactId>acegi-security</artifactId> + <version>1.0.3</version> + <exclusions> + <exclusion> + <artifactId>spring-remoting</artifactId> + <groupId>org.springframework</groupId> + </exclusion> + <exclusion> + <artifactId>spring-jdbc</artifactId> + <groupId>org.springframework</groupId> + </exclusion> + <exclusion> + <artifactId>spring-support</artifactId> + <groupId>org.springframework</groupId> + </exclusion> + <exclusion> + <artifactId>logkit</artifactId> + <groupId>logkit</groupId> + </exclusion> + <exclusion> + <artifactId>avalon-framework</artifactId> + <groupId>avalon-framework</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>hsqldb</groupId> + <artifactId>hsqldb</artifactId> + <version>1.8.0.7</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>dbunit</groupId> + <artifactId>dbunit</artifactId> + <version>2.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-hibernate-security-0.0.2</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-hibernate-security-0.0.2</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-hibernate-security-0.0.2</url> + </scm> +</project> Deleted: tags/openutils-hibernate-security-0.0.2/src/test/java/it/openutils/hibernate/security/SecurityIntegrationTest.java =================================================================== --- trunk/openutils-hibernate-security/src/test/java/it/openutils/hibernate/security/SecurityIntegrationTest.java 2007-11-12 15:19:27 UTC (rev 505) +++ tags/openutils-hibernate-security-0.0.2/src/test/java/it/openutils/hibernate/security/SecurityIntegrationTest.java 2007-11-14 14:17:48 UTC (rev 508) @@ -1,91 +0,0 @@ -package it.openutils.hibernate.security; - -import it.openutils.hibernate.example.FilterMetadata; -import it.openutils.hibernate.security.apptest.DummyDAO; -import it.openutils.hibernate.security.apptest.DummyDataobject; -import it.openutils.testing.junit.DbUnitTestCase; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.acegisecurity.Authentication; -import org.acegisecurity.context.SecurityContextHolder; -import org.acegisecurity.context.SecurityContextImpl; -import org.acegisecurity.providers.AuthenticationProvider; -import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; -import org.dbunit.database.DatabaseConfig; -import org.dbunit.database.IDatabaseConnection; -import org.hibernate.criterion.Criterion; -import org.hibernate.criterion.Order; -import org.junit.Assert; -import org.junit.Test; - - -/* - * Copyright (c) Openmind. All rights reserved. http://www.openmindonline.it - */ - -/** - * @author fcarone - * @version $Id: $ - */ -public class SecurityIntegrationTest extends DbUnitTestCase -{ - - private DummyDAO securedObject; - - - - /** - * {@inheritDoc} - */ - @Override - protected IDatabaseConnection createConnection() throws SQLException - { - IDatabaseConnection connection = super.createConnection(); - DatabaseConfig config = connection.getConfig(); - config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqlDatatypeFactory()); - return connection; - } - - private void authenticate(String username, String password) - { - AuthenticationProvider authenticationProvider = (AuthenticationProvider) ctx.getBean("authenticationProvider"); - Authentication authentication = new UsernamePasswordAuthenticationToken(username, password); - authentication = authenticationProvider.authenticate(authentication); - SecurityContextImpl sci = new SecurityContextImpl(); - sci.setAuthentication(authentication); - SecurityContextHolder.setContext(sci); - } - - /** - * @throws Exception Any exception - */ - @Test - public void testFindFiltered() throws Exception - { - // emulate authentication - authenticate("UserUno", "password"); - - // test - securedObject = (DummyDAO) ctx.getBean("dummyDAO"); - DummyDataobject filter = new DummyDataobject(); - List<DummyDataobject> dummyObjects = securedObject.findFiltered( - filter, - new Order[0], - new HashMap<String, FilterMetadata>(), - 500, - 0, - new ArrayList<Criterion>()); - Assert.assertNotNull(dummyObjects); - Assert.assertEquals(1, dummyObjects.size()); - - dummyObjects = securedObject.findFiltered(filter); - Assert.assertNotNull(dummyObjects); - Assert.assertEquals(1, dummyObjects.size()); - - } - -} Copied: tags/openutils-hibernate-security-0.0.2/src/test/java/it/openutils/hibernate/security/SecurityIntegrationTest.java (from rev 506, trunk/openutils-hibernate-security/src/test/java/it/openutils/hibernate/security/SecurityIntegrationTest.java) =================================================================== --- tags/openutils-hibernate-security-0.0.2/src/test/java/it/openutils/hibernate/security/SecurityIntegrationTest.java (rev 0) +++ tags/openutils-hibernate-security-0.0.2/src/test/java/it/openutils/hibernate/security/SecurityIntegrationTest.java 2007-11-14 14:17:48 UTC (rev 508) @@ -0,0 +1,91 @@ +package it.openutils.hibernate.security; + +import it.openutils.hibernate.example.FilterMetadata; +import it.openutils.hibernate.security.apptest.DummyDAO; +import it.openutils.hibernate.security.apptest.DummyDataobject; +import it.openutils.testing.junit.DbUnitTestCase; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.acegisecurity.Authentication; +import org.acegisecurity.context.SecurityContextHolder; +import org.acegisecurity.context.SecurityContextImpl; +import org.acegisecurity.providers.AuthenticationProvider; +import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; +import org.dbunit.database.DatabaseConfig; +import org.dbunit.database.IDatabaseConnection; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Order; +import org.junit.Assert; +import org.junit.Test; + + +/* + * Copyright (c) Openmind. All rights reserved. http://www.openmindonline.it + */ + +/** + * @author fcarone + * @version $Id: $ + */ +public class SecurityIntegrationTest extends DbUnitTestCase +{ + + private DummyDAO securedObject; + + + + /** + * {@inheritDoc} + */ + @Override + protected IDatabaseConnection createConnection() throws SQLException + { + IDatabaseConnection connection = super.createConnection(); + DatabaseConfig config = connection.getConfig(); + config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqlDatatypeFactory()); + return connection; + } + + private void authenticate(String username, String password) + { + AuthenticationProvider authenticationProvider = (AuthenticationProvider) ctx.getBean("authenticationProvider"); + Authentication authentication = new UsernamePasswordAuthenticationToken(username, password); + authentication = authenticationProvider.authenticate(authentication); + SecurityContextImpl sci = new SecurityContextImpl(); + sci.setAuthentication(authentication); + SecurityContextHolder.setContext(sci); + } + + /** + * @throws Exception Any exception + */ + @Test + public void testFindFiltered() throws Exception + { + // emulate authentication + authenticate("UserUno", "password"); + + // test + securedObject = (DummyDAO) ctx.getBean("dummyDAO"); + DummyDataobject filter = new DummyDataobject(); + List<DummyDataobject> dummyObjects = securedObject.findFiltered( + filter, + new Order[0], + new HashMap<String, FilterMetadata>(), + 500, + 0, + new ArrayList<Criterion>()); + Assert.assertNotNull(dummyObjects); +// Assert.assertEquals(1, dummyObjects.size()); + + dummyObjects = securedObject.findFiltered(filter); + Assert.assertNotNull(dummyObjects); + Assert.assertEquals(1, dummyObjects.size()); + + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2007-12-02 16:48:49
|
Revision: 512 http://openutils.svn.sourceforge.net/openutils/?rev=512&view=rev Author: fgiust Date: 2007-12-02 08:48:54 -0800 (Sun, 02 Dec 2007) Log Message: ----------- [maven-release-plugin] copy for tag openutils-mgnlstripes-3.5-rc2 Added Paths: ----------- tags/openutils-mgnlstripes-3.5-rc2/ tags/openutils-mgnlstripes-3.5-rc2/pom.xml tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MagnoliaMultipartWrapper.java tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesMagnoliaFilter.java tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java tags/openutils-mgnlstripes-3.5-rc2/src/main/resources/mgnl-bootstrap/stripes/config.server.filters.stripes.xml Removed Paths: ------------- tags/openutils-mgnlstripes-3.5-rc2/pom.xml tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesModule.java tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/AddMimeMappingTask.java tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java Copied: tags/openutils-mgnlstripes-3.5-rc2 (from rev 509, trunk/openutils-mgnlstripes) Deleted: tags/openutils-mgnlstripes-3.5-rc2/pom.xml =================================================================== --- trunk/openutils-mgnlstripes/pom.xml 2007-11-14 14:17:57 UTC (rev 509) +++ tags/openutils-mgnlstripes-3.5-rc2/pom.xml 2007-12-02 16:48:54 UTC (rev 512) @@ -1,80 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>4</version> - <relativePath>..</relativePath> - </parent> - <modelVersion>4.0.0</modelVersion> - <packaging>jar</packaging> - <artifactId>openutils-mgnlstripes</artifactId> - <name>openutils-mgnlstripes</name> - <version>0.3-SNAPSHOT</version> - <build> - <resources> - <resource> - <filtering>false</filtering> - <directory>src/main/resources</directory> - <includes> - <include>**/*</include> - </includes> - </resource> - <resource> - <filtering>true</filtering> - <directory>src/main/resources</directory> - <includes> - <include>META-INF/magnolia/*</include> - </includes> - </resource> - </resources> - </build> - <dependencies> - <dependency> - <groupId>net.sourceforge.stripes</groupId> - <artifactId>stripes</artifactId> - <version>1.4.3</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>info.magnolia</groupId> - <artifactId>magnolia-core</artifactId> - <version>3.1-m3</version> - </dependency> - <dependency> - <groupId>info.magnolia</groupId> - <artifactId>magnolia-module-admininterface</artifactId> - <version>3.1-m3</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.4</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jsp-api</artifactId> - <version>2.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <classifier>jdk15</classifier> - <version>5.1</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> -</project> Copied: tags/openutils-mgnlstripes-3.5-rc2/pom.xml (from rev 511, trunk/openutils-mgnlstripes/pom.xml) =================================================================== --- tags/openutils-mgnlstripes-3.5-rc2/pom.xml (rev 0) +++ tags/openutils-mgnlstripes-3.5-rc2/pom.xml 2007-12-02 16:48:54 UTC (rev 512) @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>4</version> + <relativePath>..</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <packaging>jar</packaging> + <artifactId>openutils-mgnlstripes</artifactId> + <name>openutils-mgnlstripes</name> + <version>3.5-rc2</version> + <licenses> + <license> + <name>GPLv3</name> + <url>http://www.gnu.org/licenses/gpl-3.0.txt</url> + </license> + </licenses> + <build> + <resources> + <resource> + <filtering>false</filtering> + <directory>src/main/resources</directory> + <includes> + <include>**/*</include> + </includes> + </resource> + <resource> + <filtering>true</filtering> + <directory>src/main/resources</directory> + <includes> + <include>META-INF/magnolia/*</include> + </includes> + </resource> + </resources> + </build> + <dependencies> + <dependency> + <groupId>net.sourceforge.stripes</groupId> + <artifactId>stripes</artifactId> + <version>1.4.3</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>info.magnolia</groupId> + <artifactId>magnolia-core</artifactId> + <version>3.5-rc2</version> + </dependency> + <dependency> + <groupId>info.magnolia</groupId> + <artifactId>magnolia-module-admininterface</artifactId> + <version>3.5-rc2</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.4</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jsp-api</artifactId> + <version>2.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <classifier>jdk15</classifier> + <version>5.1</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + <repositories> + <repository> + <id>repository.magnolia.info</id> + <name>magnolia repository</name> + <url>http://svn.magnolia.info/maven/m2</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlstripes-3.5-rc2</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlstripes-3.5-rc2</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-mgnlstripes-3.5-rc2</url> + </scm> +</project> Copied: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MagnoliaMultipartWrapper.java (from rev 510, trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/MagnoliaMultipartWrapper.java) =================================================================== --- tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MagnoliaMultipartWrapper.java (rev 0) +++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MagnoliaMultipartWrapper.java 2007-12-02 16:48:54 UTC (rev 512) @@ -0,0 +1,179 @@ +package it.openutils.magnoliastripes; + +import info.magnolia.cms.beans.runtime.Document; +import info.magnolia.cms.beans.runtime.MultipartForm; +import info.magnolia.context.Context; +import info.magnolia.context.MgnlContext; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Enumeration; +import java.util.Iterator; + +import javax.servlet.http.HttpServletRequest; + +import net.sourceforge.stripes.action.FileBean; +import net.sourceforge.stripes.controller.FileUploadLimitExceededException; +import net.sourceforge.stripes.controller.multipart.MultipartWrapper; + +import org.apache.commons.io.IOUtils; + + +/** + * An implementation of MultipartWrapper that delegates to the standard magnolia multipart form handling. + * @author fgiust + * @version $Id: $ + */ +public class MagnoliaMultipartWrapper implements MultipartWrapper +{ + + /** + * Nothing to do here {@inheritDoc} + */ + public void build(HttpServletRequest request, File tempDir, long maxPostSize) throws IOException, + FileUploadLimitExceededException + { + // nothing to do, already provided by magnolia + + } + + private MultipartForm getForm() + { + return (MultipartForm) MgnlContext.getAttribute(MultipartForm.REQUEST_ATTRIBUTE_NAME, Context.LOCAL_SCOPE); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public Enumeration<String> getParameterNames() + { + return getForm().getParameterNames(); + } + + /** + * {@inheritDoc} + */ + public String[] getParameterValues(String name) + { + return getForm().getParameterValues(name); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public Enumeration<String> getFileParameterNames() + { + return new IteratorEnumeration(getForm().getDocuments().keySet().iterator()); + } + + /** + * {@inheritDoc} + */ + public FileBean getFileParameterValue(String name) + { + final Document item = getForm().getDocument(name); + if (item == null) + { + return null; + } + else + { + // Use an anonymous inner subclass of FileBean that overrides all the + // methods that rely on having a File present, to use the FileItem + // created by commons upload instead. + return new FileBean(null, item.getType(), item.getFileNameWithExtension()) + { + + @Override + public long getSize() + { + return item.getLength(); + } + + @Override + public InputStream getInputStream() throws IOException + { + return item.getStream(); + } + + @Override + public void save(File toFile) throws IOException + { + OutputStream os = null; + InputStream is = null; + try + { + os = new BufferedOutputStream(new FileOutputStream(toFile)); + is = item.getStream(); + IOUtils.copyLarge(is, os); + + delete(); + } + catch (Exception e) + { + if (e instanceof IOException) + { + throw (IOException) e; + } + else + { + IOException ioe = new IOException("Problem saving uploaded file."); + ioe.initCause(e); + throw ioe; + } + } + finally + { + IOUtils.closeQuietly(is); + IOUtils.closeQuietly(os); + } + } + + @Override + public void delete() throws IOException + { + item.delete(); + } + }; + } + } + + /** + * Little helper class to create an enumeration as per the interface. + */ + private static class IteratorEnumeration implements Enumeration<String> + { + + Iterator<String> iterator; + + /** + * Constructs an enumeration that consumes from the underlying iterator. + */ + IteratorEnumeration(Iterator<String> iterator) + { + this.iterator = iterator; + } + + /** + * Returns true if more elements can be consumed, false otherwise. + */ + public boolean hasMoreElements() + { + return this.iterator.hasNext(); + } + + /** + * Gets the next element out of the iterator. + */ + public String nextElement() + { + return this.iterator.next(); + } + } +} Deleted: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java =================================================================== --- trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java 2007-11-14 14:17:57 UTC (rev 509) +++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java 2007-12-02 16:48:54 UTC (rev 512) @@ -1,79 +0,0 @@ -package it.openutils.magnoliastripes; - -import info.magnolia.cms.beans.config.Paragraph; -import info.magnolia.cms.beans.config.ParagraphManager; -import net.sourceforge.stripes.action.ActionBean; -import net.sourceforge.stripes.controller.NameBasedActionResolver; - -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * ActionResolver that extends <code>NameBasedActionResolver</code>, registering any found Stripe action as a - * Magnolia paragraph. - * @author fgiust - * @version $Id: $ - */ -public class MgnlActionResolver extends NameBasedActionResolver -{ - - /** - * Logger. - */ - private Logger log = LoggerFactory.getLogger(MgnlActionResolver.class); - - /** - * {@inheritDoc} - */ - @Override - protected void addActionBean(Class< ? extends ActionBean> clazz) - { - String binding = getUrlBinding(clazz); - - // Only process the class if it's properly annotated - if (binding != null) - { - String dialogName = actionNameToParagraphName(binding); - registerSpringParagraph(dialogName, binding); - super.addActionBean(clazz); - } - } - - /** - * Generate a paragraph name from a Stripes binding. This method will take the last token after "/", strip any - * extension and convert everything to lowercase. - * @param binding Stripe action binding - * @return paragraph name - */ - protected String actionNameToParagraphName(String binding) - { - String dialogName = StringUtils.lowerCase(StringUtils.substringBeforeLast(StringUtils.substringAfterLast( - binding, - "/"), ".")); - return dialogName; - } - - /** - * Registers a Magnolia paragraph which will delegate to a Stripe action. - * @param name dialog name - * @param binding Stripes action binding - */ - @SuppressWarnings("unchecked") - private void registerSpringParagraph(String name, String binding) - { - Paragraph paragraph = new Paragraph(); - - paragraph.setName(name); - paragraph.setTitle("paragraph." + name + ".title"); - paragraph.setDescription("paragraph." + name + ".description"); - paragraph.setDialog(name); - paragraph.setTemplatePath(binding); - paragraph.setType("stripes"); - - log.info("Registering stripes paragraph {}", paragraph.getName()); //$NON-NLS-1$ - ParagraphManager.getInstance().getParagraphs().put(paragraph.getName(), paragraph); - } - -} Copied: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java (from rev 510, trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java) =================================================================== --- tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java (rev 0) +++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/MgnlActionResolver.java 2007-12-02 16:48:54 UTC (rev 512) @@ -0,0 +1,99 @@ +package it.openutils.magnoliastripes; + +import info.magnolia.cms.beans.config.Paragraph; +import info.magnolia.cms.beans.config.ParagraphManager; + +import java.util.HashSet; +import java.util.Set; + +import net.sourceforge.stripes.action.ActionBean; +import net.sourceforge.stripes.controller.NameBasedActionResolver; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * ActionResolver that extends <code>NameBasedActionResolver</code>, registering any found Stripe action as a + * Magnolia paragraph. + * @author fgiust + * @version $Id: $ + */ +public class MgnlActionResolver extends NameBasedActionResolver +{ + + /** + * Logger. + */ + private static Logger log = LoggerFactory.getLogger(MgnlActionResolver.class); + + /** + * Configured Stripes paragraphs. + */ + private static Set<Paragraph> paragraphs = new HashSet<Paragraph>(); + + /** + * {@inheritDoc} + */ + @Override + protected void addActionBean(Class< ? extends ActionBean> clazz) + { + String binding = getUrlBinding(clazz); + + // Only process the class if it's properly annotated + if (binding != null) + { + String dialogName = actionNameToParagraphName(binding); + collectStripesParagraphs(dialogName, binding); + super.addActionBean(clazz); + } + } + + /** + * Generate a paragraph name from a Stripes binding. This method will take the last token after "/", strip any + * extension and convert everything to lowercase. + * @param binding Stripe action binding + * @return paragraph name + */ + protected String actionNameToParagraphName(String binding) + { + String dialogName = StringUtils.lowerCase(StringUtils.substringBeforeLast(StringUtils.substringAfterLast( + binding, + "/"), ".")); + return dialogName; + } + + /** + * Registers a Magnolia paragraph which will delegate to a Stripe action. + * @param name dialog name + * @param binding Stripes action binding + */ + @SuppressWarnings("unchecked") + private void collectStripesParagraphs(String name, String binding) + { + Paragraph paragraph = new Paragraph(); + + paragraph.setName(name); + paragraph.setTitle("paragraph." + name + ".title"); + paragraph.setDescription("paragraph." + name + ".description"); + paragraph.setDialog(name); + paragraph.setTemplatePath(binding); + paragraph.setType("stripes"); + paragraphs.add(paragraph); + + log.info("Registering stripes paragraph {}", paragraph.getName()); //$NON-NLS-1$ + ParagraphManager.getInstance().getParagraphs().put(paragraph.getName(), paragraph); + } + + @SuppressWarnings("unchecked") + public static void registerParagraphs() + { + for (Paragraph paragraph : paragraphs) + { + log.info("Registering stripes paragraph {}", paragraph.getName()); //$NON-NLS-1$ + ParagraphManager.getInstance().getParagraphs().put(paragraph.getName(), paragraph); + } + } + +} Copied: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesMagnoliaFilter.java (from rev 510, trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/StripesMagnoliaFilter.java) =================================================================== --- tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesMagnoliaFilter.java (rev 0) +++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesMagnoliaFilter.java 2007-12-02 16:48:54 UTC (rev 512) @@ -0,0 +1,96 @@ +package it.openutils.magnoliastripes; + +import info.magnolia.cms.filters.MgnlFilter; +import info.magnolia.context.MgnlContext; +import info.magnolia.context.WebContext; +import info.magnolia.voting.Voter; +import info.magnolia.voting.Voting; + +import javax.servlet.http.HttpServletRequest; + +import net.sourceforge.stripes.controller.StripesFilter; +import net.sourceforge.stripes.controller.StripesRequestWrapper; +import net.sourceforge.stripes.exception.StripesServletException; + +import org.apache.commons.lang.ArrayUtils; + + +/** + * @author fgiust + * @version $Id: $ + */ +public class StripesMagnoliaFilter extends StripesFilter implements MgnlFilter +{ + + private String name; + + private Voter[] bypasses = new Voter[0]; + + private boolean enabled = true; + + public boolean bypasses(HttpServletRequest request) + { + if (!isEnabled()) + { + return true; + } + if (MgnlContext.hasInstance()) + { + return Voting.Factory.getDefaultVoting().vote(bypasses, request) > 0; + } + return false; + } + + public Voter[] getBypasses() + { + return this.bypasses; + } + + public void addBypass(Voter voter) + { + this.bypasses = (Voter[]) ArrayUtils.add(this.bypasses, voter); + } + + public String getName() + { + return this.name; + } + + public void setName(String name) + { + this.name = name; + } + + public boolean isEnabled() + { + return this.enabled; + } + + public void setEnabled(boolean enabled) + { + this.enabled = enabled; + } + + /** + * Wraps the HttpServletRequest with a StripesServletRequest. This is done to ensure that any form posts that + * contain file uploads get handled appropriately. + * @param servletRequest the HttpServletRequest handed to the dispatcher by the container + * @return an instance of StripesRequestWrapper, which is an HttpServletRequestWrapper + * @throws StripesServletException if the wrapper cannot be constructed + */ + @Override + protected StripesRequestWrapper wrapRequest(HttpServletRequest servletRequest) throws StripesServletException + { + StripesRequestWrapper srw = new StripesRequestWrapper(servletRequest); + + if (MgnlContext.hasInstance()) + { + // be sure that the request wrapper gets setted in mgnlcontext too + WebContext webContext = (WebContext) MgnlContext.getInstance(); + webContext.init(servletRequest, webContext.getResponse(), webContext.getServletContext()); + } + + return srw; + } + +} Deleted: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesModule.java =================================================================== --- trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/StripesModule.java 2007-11-14 14:17:57 UTC (rev 509) +++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesModule.java 2007-12-02 16:48:54 UTC (rev 512) @@ -1,23 +0,0 @@ -package it.openutils.magnoliastripes; - -import info.magnolia.module.ModuleLifecycle; -import info.magnolia.module.ModuleLifecycleContext; - - -/** - * Stripes module. - * @author fgiust - * @version $Id: $ - */ -public class StripesModule implements ModuleLifecycle -{ - - /** - * {@inheritDoc} - */ - public void start(ModuleLifecycleContext moduleLifecycleContext) - { - // anything to do? - } - -} \ No newline at end of file Deleted: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java =================================================================== --- trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java 2007-11-14 14:17:57 UTC (rev 509) +++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java 2007-12-02 16:48:54 UTC (rev 512) @@ -1,333 +0,0 @@ -package it.openutils.magnoliastripes; - -import info.magnolia.cms.beans.config.Paragraph; -import info.magnolia.cms.beans.runtime.ParagraphRenderer; -import info.magnolia.cms.core.Content; -import info.magnolia.cms.core.NodeData; -import info.magnolia.context.MgnlContext; -import info.magnolia.context.WebContext; - -import java.io.IOException; -import java.io.Writer; -import java.lang.reflect.InvocationTargetException; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Stack; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.PageContext; - -import net.sourceforge.stripes.action.ActionBeanContext; -import net.sourceforge.stripes.action.Resolution; -import net.sourceforge.stripes.config.Configuration; -import net.sourceforge.stripes.controller.DispatcherHelper; -import net.sourceforge.stripes.controller.DispatcherServlet; -import net.sourceforge.stripes.controller.ExecutionContext; -import net.sourceforge.stripes.controller.LifecycleStage; -import net.sourceforge.stripes.controller.StripesConstants; -import net.sourceforge.stripes.controller.StripesFilter; -import net.sourceforge.stripes.exception.StripesServletException; -import net.sourceforge.stripes.validation.BooleanTypeConverter; - -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * <p> - * A Magnolia paragraph renderer that delegates to Stripes actions. Most of the code is just a cut and paste from - * Stripes' {@link DispatcherServlet}, adapted to work withing magnolia by: - * </p> - * <ul> - * <li>wrap the request in order to modify the request path and provide a custom requestDispatcher</li> - * <li>wrap the response in order to provide a custom Writer</li> - * <li>use a fake servlet instance/context to setup a Stripe context (there is no servlet here)</li> - * <li>injiect any paragraph property as a parameter</li> - * </ul> - * <p> - * <strong>Todo:</strong> - * </p> - * <ul> - * <li>Handle multipart forms in request wrapper (should be easy to do)</li> - * <li>A better way of handling multivalued properties in paragraph</li> - * <li>Handle binary properties in paragraph</li> - * </ul> - * @author fgiust - * @version $Id: $ - */ -public class StripesParagraphRenderer implements ParagraphRenderer -{ - - private Boolean alwaysInvokeValidate; - - /** - * Logger. - */ - private Logger log = LoggerFactory.getLogger(StripesParagraphRenderer.class); - - /** - * <p> - * Invokes the following instance level methods in order to coordinate the processing of requests: - * </p> - * <ul> - * <li>{@link #resolveActionBean(ExecutionContext)}</li> - * <li>{@link #resolveHandler(ExecutionContext)}</li> - * <li>{@link #doBindingAndValidation(ExecutionContext)}</li> - * <li>{@link #doCustomValidation(ExecutionContext)}</li> - * <li>{@link #handleValidationErrors(ExecutionContext)}</li> - * <li>{@link #invokeEventHandler(ExecutionContext)}</li> - * </ul> - * <p> - * If any of the above methods return a {@link Resolution} the rest of the request processing is aborted and the - * resolution is executed. - * </p> - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public void render(Content content, Paragraph paragraph, Writer out) throws IOException - { - // @fgiust start custom magnolia setup - - WebContext webContext = (WebContext) MgnlContext.getInstance(); - HttpServletResponse response = new StripesParagraphResponseWrapper(webContext.getResponse(), out); - - final String templatePath = paragraph.getTemplatePath(); - Map<String, String[]> nodeDataMap = contentToMap(content); - - HttpServletRequest request; - try - { - request = new StripesParagraphRequestWrapper( - ((WebContext) MgnlContext.getInstance()).getRequest(), - templatePath, - nodeDataMap); - - ((StripesParagraphRequestWrapper) request).setLocale(MgnlContext.getLocale()); - } - catch (StripesServletException e) - { - throw new RuntimeException(e); - } - - // @todo fgiust force include instead of forwarding. Not needed anymore since we are wrapping requestDispatcher? - request.setAttribute(StripesConstants.REQ_ATTR_INCLUDE_PATH, templatePath); - - PageContext pageContext = webContext.getPageContext(); - ServletContext servletContext = null; - - if (pageContext != null) - { - pageContext.getServletContext(); - } - // @fgiust end custom magnolia setup - - // It sucks that we have to do this here (in the request cycle), but there doesn't - // seem to be a good way to get at the Configuration from the Filter in init() - doOneTimeConfiguration(); - - log.debug("Dispatching request to URL: ", request.getRequestURI()); - - try - { - final Configuration config = StripesFilter.getConfiguration(); - - // First manufacture an ActionBeanContext - final ActionBeanContext context = config - .getActionBeanContextFactory() - .getContextInstance(request, response); - context.setServletContext(servletContext); - - // Then setup the ExecutionContext that we'll use to process this request - final ExecutionContext ctx = new ExecutionContext(); - ctx.setInterceptors(config.getInterceptors(LifecycleStage.ActionBeanResolution)); - ctx.setLifecycleStage(LifecycleStage.ActionBeanResolution); - ctx.setActionBeanContext(context); - - ActionBeanContext abc = ctx.getActionBeanContext(); - if (pageContext != null) - { - DispatcherHelper.setPageContext(pageContext); - } - - // Resolve the ActionBean, and if an interceptor returns a resolution, bail now - saveActionBean(request); - Resolution resolution = DispatcherHelper.resolveActionBean(ctx); - - if (resolution == null) - { - resolution = DispatcherHelper.resolveHandler(ctx); - - if (resolution == null) - { - // Then run binding and validation - resolution = DispatcherHelper.doBindingAndValidation(ctx, true); - - if (resolution == null) - { - // Then continue on to custom validation - resolution = DispatcherHelper.doCustomValidation(ctx, alwaysInvokeValidate); - - if (resolution == null) - { - // And then validation error handling - resolution = DispatcherHelper.handleValidationErrors(ctx); - - if (resolution == null) - { - // And finally(ish) invoking of the event handler - resolution = DispatcherHelper.invokeEventHandler(ctx); - - // If the event produced errors, fill them in - DispatcherHelper.fillInValidationErrors(ctx); - } - } - } - } - } - - // Whatever stage it came from, execute the resolution - if (resolution != null) - { - DispatcherHelper.executeResolution(ctx, resolution); - } - } - catch (RuntimeException re) - { - throw re; - } - catch (InvocationTargetException ite) - { - if (ite.getTargetException() instanceof RuntimeException) - { - throw (RuntimeException) ite.getTargetException(); - } - else - { - throw new RuntimeException("ActionBean execution threw an exception.", ite.getTargetException()); - } - } - catch (Exception e) - { - throw new RuntimeException("Exception encountered processing request.", e); - } - finally - { - - if (pageContext != null) - { - // *Don't* release the page context, if set it will be closed by the main magnolia template - // JspFactory.getDefaultFactory().releasePageContext(pageContext); - DispatcherHelper.setPageContext(null); - } - restoreActionBean(request); - } - } - - /** - * @param content paragraph node - * @return a map of Strings (converted nodedata) - */ - @SuppressWarnings("unchecked") - protected Map<String, String[]> contentToMap(Content content) - { - Collection<NodeData> paragraphsData = content.getNodeDataCollection(); - Map<String, String[]> nodeDataMap = new HashMap<String, String[]>(); - for (NodeData nodeData : paragraphsData) - { - String name = StringUtils.replaceChars(nodeData.getName(), "{}", "[]"); - String value = nodeData.getString(); - if (StringUtils.contains(name, "multiple")) - { - nodeDataMap.put(name, StringUtils.split(value, "\n")); - } - else - { - nodeDataMap.put(name, new String[]{value }); - } - } - return nodeDataMap; - } - - /** - * Performs a simple piece of one time configuration that requires access to the Configuration object delivered - * through the Stripes Filter. - */ - private void doOneTimeConfiguration() - { - if (alwaysInvokeValidate == null) - { - // Check to see if, in this application, validate() methods should always be run - // even when validation errors already exist - String callValidateWhenErrorsExist = StripesFilter - .getConfiguration() - .getBootstrapPropertyResolver() - .getProperty(DispatcherServlet.RUN_CUSTOM_VALIDATION_WHEN_ERRORS); - - if (callValidateWhenErrorsExist != null) - { - BooleanTypeConverter c = new BooleanTypeConverter(); - this.alwaysInvokeValidate = c.convert(callValidateWhenErrorsExist, Boolean.class, null); - } - else - { - this.alwaysInvokeValidate = false; // Default behaviour - } - } - } - - /** - * Fetches, and lazily creates if required, a Stack in the request to store ActionBeans should the current request - * involve forwards or includes to other ActionBeans. - * @param request the current HttpServletRequest - * @param create create a Stack if not already set - * @return the Stack if present, or if creation is requested - */ - @SuppressWarnings("unchecked") - protected Stack getActionBeanStack(HttpServletRequest request, boolean create) - { - Stack stack = (Stack) request.getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN_STACK); - if (stack == null && create) - { - stack = new Stack(); - request.setAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN_STACK, stack); - } - - return stack; - } - - /** - * Saves the current value of the 'actionBean' attribute in the request so that it can be restored at a later date - * by calling {@link #restoreActionBean(HttpServletRequest)}. If no ActionBean is currently stored in the request, - * nothing is changed. - * @param request the current HttpServletRequest - */ - @SuppressWarnings("unchecked") - protected void saveActionBean(HttpServletRequest request) - { - if (request.getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN) != null) - { - Stack stack = getActionBeanStack(request, true); - stack.push(request.getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN)); - } - } - - /** - * Restores the previous value of the 'actionBean' attribute in the request. If no ActionBeans have been saved using - * {@link #saveActionBean(HttpServletRequest)} then this method has no effect. - * @param request the current HttpServletRequest - */ - @SuppressWarnings("unchecked") - protected void restoreActionBean(HttpServletRequest request) - { - Stack stack = getActionBeanStack(request, false); - if (stack != null && !stack.empty()) - { - request.setAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN, stack.pop()); - } - } - -} Copied: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java (from rev 510, trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java) =================================================================== --- tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java (rev 0) +++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/StripesParagraphRenderer.java 2007-12-02 16:48:54 UTC (rev 512) @@ -0,0 +1,334 @@ +package it.openutils.magnoliastripes; + +import info.magnolia.cms.beans.config.Paragraph; +import info.magnolia.cms.beans.runtime.ParagraphRenderer; +import info.magnolia.cms.core.Content; +import info.magnolia.cms.core.NodeData; +import info.magnolia.context.MgnlContext; +import info.magnolia.context.WebContext; + +import java.io.IOException; +import java.io.Writer; +import java.lang.reflect.InvocationTargetException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Stack; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.jsp.PageContext; + +import net.sourceforge.stripes.action.ActionBeanContext; +import net.sourceforge.stripes.action.Resolution; +import net.sourceforge.stripes.config.Configuration; +import net.sourceforge.stripes.controller.DispatcherHelper; +import net.sourceforge.stripes.controller.DispatcherServlet; +import net.sourceforge.stripes.controller.ExecutionContext; +import net.sourceforge.stripes.controller.LifecycleStage; +import net.sourceforge.stripes.controller.StripesConstants; +import net.sourceforge.stripes.controller.StripesFilter; +import net.sourceforge.stripes.exception.StripesServletException; +import net.sourceforge.stripes.validation.BooleanTypeConverter; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * <p> + * A Magnolia paragraph renderer that delegates to Stripes actions. Most of the code is just a cut and paste from + * Stripes' {@link DispatcherServlet}, adapted to work withing magnolia by: + * </p> + * <ul> + * <li>wrap the request in order to modify the request path and provide a custom requestDispatcher</li> + * <li>wrap the response in order to provide a custom Writer</li> + * <li>use a fake servlet instance/context to setup a Stripe context (there is no servlet here)</li> + * <li>injiect any paragraph property as a parameter</li> + * </ul> + * <p> + * <strong>Todo:</strong> + * </p> + * <ul> + * <li>Handle multipart forms in request wrapper (should be easy to do)</li> + * <li>A better way of handling multivalued properties in paragraph</li> + * <li>Handle binary properties in paragraph</li> + * </ul> + * @author fgiust + * @version $Id: $ + */ +public class StripesParagraphRenderer implements ParagraphRenderer +{ + + private Boolean alwaysInvokeValidate; + + /** + * Logger. + */ + private Logger log = LoggerFactory.getLogger(StripesParagraphRenderer.class); + + /** + * <p> + * Invokes the following instance level methods in order to coordinate the processing of requests: + * </p> + * <ul> + * <li>{@link #resolveActionBean(ExecutionContext)}</li> + * <li>{@link #resolveHandler(ExecutionContext)}</li> + * <li>{@link #doBindingAndValidation(ExecutionContext)}</li> + * <li>{@link #doCustomValidation(ExecutionContext)}</li> + * <li>{@link #handleValidationErrors(ExecutionContext)}</li> + * <li>{@link #invokeEventHandler(ExecutionContext)}</li> + * </ul> + * <p> + * If any of the above methods return a {@link Resolution} the rest of the request processing is aborted and the + * resolution is executed. + * </p> + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public void render(Content content, Paragraph paragraph, Writer out) throws IOException + { + // @fgiust start custom magnolia setup + + WebContext webContext = (WebContext) MgnlContext.getInstance(); + HttpServletResponse response = new StripesParagraphResponseWrapper(webContext.getResponse(), out); + + final String templatePath = paragraph.getTemplatePath(); + Map<String, String[]> nodeDataMap = contentToMap(content); + + HttpServletRequest request; + try + { + request = new StripesParagraphRequestWrapper( + ((WebContext) MgnlContext.getInstance()).getRequest(), + templatePath, + nodeDataMap); + + ((StripesParagraphRequestWrapper) request).setLocale(MgnlContext.getLocale()); + } + catch (StripesServletException e) + { + throw new RuntimeException(e); + } + + // @todo fgiust force include instead of forwarding. Not needed anymore since we are wrapping requestDispatcher? + request.setAttribute(StripesConstants.REQ_ATTR_INCLUDE_PATH, templatePath); + + PageContext pageContext = webContext.getPageContext(); + ServletContext servletContext = null; + + if (pageContext != null) + { + pageContext.getServletContext(); + } + // @fgiust end custom magnolia setup + + // It sucks that we have to do this here (in the request cycle), but there doesn't + // seem to be a good way to get at the Configuration from the Filter in init() + doOneTimeConfiguration(); + + log.debug("Dispatching request to URL: ", request.getRequestURI()); + + try + { + final Configuration config = StripesFilter.getConfiguration(); + + // First manufacture an ActionBeanContext + final ActionBeanContext context = config + .getActionBeanContextFactory() + .getContextInstance(request, response); + context.setServletContext(servletContext); + + // Then setup the ExecutionContext that we'll use to process this request + final ExecutionContext ctx = new ExecutionContext(); + ctx.setInterceptors(config.getInterceptors(LifecycleStage.ActionBeanResolution)); + ctx.setLifecycleStage(LifecycleStage.ActionBeanResolution); + ctx.setActionBeanContext(context); + + ActionBeanContext abc = ctx.getActionBeanContext(); + if (pageContext != null) + { + DispatcherHelper.setPageContext(pageContext); + } + + // Resolve the ActionBean, and if an interceptor returns a resolution, bail now + saveActionBean(request); + Resolution resolution = DispatcherHelper.resolveActionBean(ctx); + + if (resolution == null) + { + resolution = DispatcherHelper.resolveHandler(ctx); + + if (resolution == null) + { + // Then run binding and validation + resolution = DispatcherHelper.doBindingAndValidation(ctx, true); + + if (resolution == null) + { + // Then continue on to custom validation + resolution = DispatcherHelper.doCustomValidation(ctx, alwaysInvokeValidate); + + if (resolution == null) + { + // And then validation error handling + resolution = DispatcherHelper.handleValidationErrors(ctx); + + if (resolution == null) + { + // And finally(ish) invoking of the event handler + resolution = DispatcherHelper.invokeEventHandler(ctx); + + // If the event produced errors, fill them in + DispatcherHelper.fillInValidationErrors(ctx); + } + } + } + } + } + + // Whatever stage it came from, execute the resolution + if (resolution != null) + { + DispatcherHelper.executeResolution(ctx, resolution); + } + } + catch (RuntimeException re) + { + throw re; + } + catch (InvocationTargetException ite) + { + if (ite.getTargetException() instanceof RuntimeException) + { + throw (RuntimeException) ite.getTargetException(); + } + else + { + Throwable targetEx = ite.getTargetException(); + throw new RuntimeException(targetEx.getClass().getName() + ": " + targetEx.getMessage(), targetEx); + } + } + catch (Exception e) + { + throw new RuntimeException("Exception encountered processing request: " + e.getMessage(), e); + } + finally + { + + if (pageContext != null) + { + // *Don't* release the page context, if set it will be closed by the main magnolia template + // JspFactory.getDefaultFactory().releasePageContext(pageContext); + DispatcherHelper.setPageContext(null); + } + restoreActionBean(request); + } + } + + /** + * @param content paragraph node + * @return a map of Strings (converted nodedata) + */ + @SuppressWarnings("unchecked") + protected Map<String, String[]> contentToMap(Content content) + { + Collection<NodeData> paragraphsData = content.getNodeDataCollection(); + Map<String, String[]> nodeDataMap = new HashMap<String, String[]>(); + for (NodeData nodeData : paragraphsData) + { + String name = StringUtils.replaceChars(nodeData.getName(), "{}", "[]"); + String value = nodeData.getString(); + if (StringUtils.contains(name, "multiple")) + { + nodeDataMap.put(name, StringUtils.split(value, "\n")); + } + else + { + nodeDataMap.put(name, new String[]{value }); + } + } + return nodeDataMap; + } + + /** + * Performs a simple piece of one time configuration that requires access to the Configuration object delivered + * through the Stripes Filter. + */ + private void doOneTimeConfiguration() + { + if (alwaysInvokeValidate == null) + { + // Check to see if, in this application, validate() methods should always be run + // even when validation errors already exist + String callValidateWhenErrorsExist = StripesFilter + .getConfiguration() + .getBootstrapPropertyResolver() + .getProperty(DispatcherServlet.RUN_CUSTOM_VALIDATION_WHEN_ERRORS); + + if (callValidateWhenErrorsExist != null) + { + BooleanTypeConverter c = new BooleanTypeConverter(); + this.alwaysInvokeValidate = c.convert(callValidateWhenErrorsExist, Boolean.class, null); + } + else + { + this.alwaysInvokeValidate = false; // Default behaviour + } + } + } + + /** + * Fetches, and lazily creates if required, a Stack in the request to store ActionBeans should the current request + * involve forwards or includes to other ActionBeans. + * @param request the current HttpServletRequest + * @param create create a Stack if not already set + * @return the Stack if present, or if creation is requested + */ + @SuppressWarnings("unchecked") + protected Stack getActionBeanStack(HttpServletRequest request, boolean create) + { + Stack stack = (Stack) request.getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN_STACK); + if (stack == null && create) + { + stack = new Stack(); + request.setAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN_STACK, stack); + } + + return stack; + } + + /** + * Saves the current value of the 'actionBean' attribute in the request so that it can be restored at a later date + * by calling {@link #restoreActionBean(HttpServletRequest)}. If no ActionBean is currently stored in the request, + * nothing is changed. + * @param request the current HttpServletRequest + */ + @SuppressWarnings("unchecked") + protected void saveActionBean(HttpServletRequest request) + { + if (request.getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN) != null) + { + Stack stack = getActionBeanStack(request, true); + stack.push(request.getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN)); + } + } + + /** + * Restores the previous value of the 'actionBean' attribute in the request. If no ActionBeans have been saved using + * {@link #saveActionBean(HttpServletRequest)} then this method has no effect. + * @param request the current HttpServletRequest + */ + @SuppressWarnings("unchecked") + protected void restoreActionBean(HttpServletRequest request) + { + Stack stack = getActionBeanStack(request, false); + if (stack != null && !stack.empty()) + { + request.setAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN, stack.pop()); + } + } + +} Deleted: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/AddMimeMappingTask.java =================================================================== --- trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/setup/AddMimeMappingTask.java 2007-11-14 14:17:57 UTC (rev 509) +++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/AddMimeMappingTask.java 2007-12-02 16:48:54 UTC (rev 512) @@ -1,67 +0,0 @@ -package it.openutils.magnoliastripes.setup; - -import info.magnolia.cms.beans.config.ContentRepository; -import info.magnolia.cms.core.Content; -import info.magnolia.cms.core.HierarchyManager; -import info.magnolia.cms.core.ItemType; -import info.magnolia.module.InstallContext; -import info.magnolia.module.delta.AbstractRepositoryTask; -import info.magnolia.module.delta.TaskExecutionException; - -import javax.jcr.RepositoryException; - - -/** - * Task that adds a mime mapping to <code>server/MIMIMapping</code>. - * @author fgiust - * @version $Revision: $ ($Author: $) - */ -public class AddMimeMappingTask extends AbstractRepositoryTask -{ - - /** - * Extension (without the <code>.</code>) - */ - private String extension; - - /** - * mime type. - */ - private String mime; - - /** - * Icon path. - */ - private String icon; - - /** - * @param extension Extension (without the <code>.</code>) - * @param mime mime type. - * @param icon Icon path. - */ - public AddMimeMappingTask(String extension, String mime, String icon) - { - super("Add mime mapping task", "Adds a MIME mapping for the " + extension + " extension"); - this.extension = extension; - this.mime = mime; - this.icon = icon; - } - - /** - * {@inheritDoc} - */ - @Override - protected void doExecute(InstallContext ctx) throws RepositoryException, TaskExecutionException - { - HierarchyManager hm = ctx.getHierarchyManager(ContentRepository.CONFIG); - Content mimeNode = hm.getContent("/server/MIMEMapping"); - - if (!mimeNode.hasContent(extension)) - { - Content m = mimeNode.createContent(extension, ItemType.CONTENTNODE); - m.createNodeData("mime-type").setValue(mime); - m.createNodeData("icon").setValue(icon); - } - } - -} Deleted: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java =================================================================== --- trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java 2007-11-14 14:17:57 UTC (rev 509) +++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java 2007-12-02 16:48:54 UTC (rev 512) @@ -1,30 +0,0 @@ -package it.openutils.magnoliastripes.setup; - -import info.magnolia.module.DefaultModuleVersionHandler; -import info.magnolia.module.InstallContext; -import info.magnolia.module.delta.Task; - -import java.util.List; - - -/** - * @author fgiust - * @version $Id: $ - */ -public class StripesModuleVersionHandler extends DefaultModuleVersionHandler -{ - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - @Override - protected List<Task> getBasicInstallTasks(InstallContext installContext) - { - List<Task> installTasks = super.getBasicInstallTasks(installContext); - - installTasks.add(new AddMimeMappingTask("action", "text/plain", "/.resources/file-icons/htm.png")); - - return installTasks; - } -} Copied: tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java (from rev 510, trunk/openutils-mgnlstripes/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java) =================================================================== --- tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java (rev 0) +++ tags/openutils-mgnlstripes-3.5-rc2/src/main/java/it/openutils/magnoliastripes/setup/StripesModuleVersionHandler.java 2007-12-02 16:48:54 UTC (rev 512) @@ -0,0 +1,36 @@ +package it.openutils.magnoliastripes.setup; + +import info.magnolia.module.DefaultModuleVersionHandler; +import info.magnolia.module.InstallContext; +import info.magnolia.module.delta.AddMimeMappingTask; +import info.magnolia.module.delta.FilterOrderingTask; +import info.magnolia.module.delta.Task; + +import java.util.List; + + +/** + * @author fgiust + * @version $Id: $ + */ +public class StripesModuleVersionHandler extends DefaultModuleVersionHandler +{ + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + @Override + protected List<Task> getBasicInstallTasks(InstallContext installContext) + { + List<Task> tasks = super.getBasicInstallTasks(installContext); + + tasks.add(new AddMimeMappingTask("action", "text/plain", "/.resources/file-icons/htm.png")); + + tasks.add(new FilterOrderingTask( + "stripes", + new String[]{"context", "login", "uriSecurity", "multipartRequest" })); + + return tasks; + } +} Copied: tags/openutils-mgnlstripes-3.5-rc2/src/main/resources/mgnl-bootstrap/stripes/config.server.filters.stripes.xml (from rev 510, trunk/openutils-mgnlstripes/src/main/resources/mgnl-bootstrap/stripes/config.server.filters.stripes.xml) =================================================================== --- tags/openutils-mgnlstripes-3.5-rc2/src/main/resources/mgnl-bootstrap/stripes/config.server.filters.stripes.xml (rev 0) +++ tags/openutils-mgnlstripes-3.5-rc2/src/main/resources/mgnl-bootstrap/stripes/config.server.filters.stripes.xml 2007-12-02 16:48:54 UTC (rev 512) @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="UTF-8"?> +<sv:node sv:name="stripes" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:mgnl="http://www.magnolia.info/jcr/mgnl" + xmlns:rep="internal" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" + xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" + xmlns:jcrfn="http://www.jcp.org/jcr/xpath-functions/1.0"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:content</sv:value> + </sv:property> + <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> + <sv:value>mix:versionable</sv:value> + </sv:property> + <sv:property sv:name="jcr:uuid" sv:type="String"> + <sv:value>871bc964-af22-4713-a1d7-a71c80ffcf2f</sv:value> + </sv:property> + <sv:property sv:name="class" sv:type="String"> + <sv:value>it.openutils.magnoliastripes.StripesMagnoliaFilter</sv:value> + </sv:property> + <sv:property sv:name="enabled" sv:type="Boolean"> + <sv:value>true</sv:value> + </sv:property> + <sv:node sv:name="MetaData"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:metaData</sv:value> + </sv:property> + <sv:property sv:name="mgnl:activated" sv:type="Boolean"> + <sv:value>false</sv:value> + </sv:property> + <sv:property sv:name="mgnl:activatorid" sv:type="String"> + <sv:value>superuser</sv:value> + </sv:property> + <sv:property sv:name="mgnl:authorid" sv:type="String"> + <sv:value>superuser</sv:value> + </sv:property> + <sv:property sv:name="mgnl:creationdate" sv:type="Date"> + <sv:value>2006-07-28T23:39:30.812+02:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastaction" sv:type="Date"> + <sv:value>2007-10-04T23:04:20.237+02:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> + <sv:value>2007-10-04T23:05:02.810+02:00</sv:value> + </sv:property> + </sv:node> + <sv:node sv:name="bypasses"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:contentNode</sv:value> + </sv:property> + <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> + <sv:value>mix:versionable</sv:value> + </sv:property> + <sv:property sv:name="jcr:uuid" sv:type="String"> + <sv:value>6cc0bc00-3efa-41be-9278-70f2f93d23c6</sv:value> + </sv:property> + <sv:node sv:name="MetaData"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:metaData</sv:value> + </sv:prope... [truncated message content] |
From: <fg...@us...> - 2008-01-27 11:12:16
|
Revision: 559 http://openutils.svn.sourceforge.net/openutils/?rev=559&view=rev Author: fgiust Date: 2008-01-27 03:12:20 -0800 (Sun, 27 Jan 2008) Log Message: ----------- [maven-release-plugin] copy for tag openutils-testing-2.0 Added Paths: ----------- tags/openutils-testing-2.0/ tags/openutils-testing-2.0/pom.xml tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitConfiguration.java tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitExecution.java tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitTestContext.java tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitUtils.java tags/openutils-testing-2.0/src/main/java/it/openutils/testing/RegExpTableFilter.java tags/openutils-testing-2.0/src/site/apt/dbunit.apt tags/openutils-testing-2.0/src/site/apt/index.apt tags/openutils-testing-2.0/src/site/site.xml Removed Paths: ------------- tags/openutils-testing-2.0/pom.xml tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitConfiguration.java tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitExecution.java tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitTestContext.java tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitUtils.java tags/openutils-testing-2.0/src/main/java/it/openutils/testing/RegExpTableFilter.java tags/openutils-testing-2.0/src/site/apt/index.apt tags/openutils-testing-2.0/src/site/site.xml Copied: tags/openutils-testing-2.0 (from rev 539, trunk/openutils-testing) Deleted: tags/openutils-testing-2.0/pom.xml =================================================================== --- trunk/openutils-testing/pom.xml 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0/pom.xml 2008-01-27 11:12:20 UTC (rev 559) @@ -1,65 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>6</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-testing</artifactId> - <name>openutils test utils</name> - <version>2.0-SNAPSHOT</version> - <description>openutils test utils</description> - <dependencies> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl104-over-slf4j</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.dbunit</groupId> - <artifactId>dbunit</artifactId> - <version>2.2</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>junit-addons</groupId> - <artifactId>junit-addons</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - <properties> - <spring.version>2.5.1</spring.version> - </properties> -</project> Copied: tags/openutils-testing-2.0/pom.xml (from rev 558, trunk/openutils-testing/pom.xml) =================================================================== --- tags/openutils-testing-2.0/pom.xml (rev 0) +++ tags/openutils-testing-2.0/pom.xml 2008-01-27 11:12:20 UTC (rev 559) @@ -0,0 +1,70 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>7</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-testing</artifactId> + <name>openutils test utils</name> + <version>2.0</version> + <description>openutils test utils</description> + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl104-over-slf4j</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.dbunit</groupId> + <artifactId>dbunit</artifactId> + <version>2.2</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>junit-addons</groupId> + <artifactId>junit-addons</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + <properties> + <spring.version>2.5.1</spring.version> + </properties> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-2.0</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-2.0</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-testing-2.0</url> + </scm> +</project> Deleted: tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitConfiguration.java =================================================================== --- trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitConfiguration.java 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitConfiguration.java 2008-01-27 11:12:20 UTC (rev 559) @@ -1,38 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - - -/** - * @author fgiust - * @version $Id: $ - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -@Inherited -@Documented -public @interface DbUnitConfiguration { - - DbUnitExecution[] dbUnitExecutions() default {}; - -} \ No newline at end of file Copied: tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitConfiguration.java (from rev 549, trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitConfiguration.java) =================================================================== --- tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitConfiguration.java (rev 0) +++ tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitConfiguration.java 2008-01-27 11:12:20 UTC (rev 559) @@ -0,0 +1,44 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + + +/** + * A DbUnitConfiguration can contain one or more {@link DbUnitExecution}. + * @author fgiust + * @version $Id: $ + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Inherited +@Documented +public @interface DbUnitConfiguration { + + /** + * Array of {@link DbUnitExecution} + */ + DbUnitExecution[] dbUnitExecutions() default { + + }; + +} \ No newline at end of file Deleted: tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitExecution.java =================================================================== --- trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitExecution.java 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitExecution.java 2008-01-27 11:12:20 UTC (rev 559) @@ -1,55 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.dbunit.operation.DatabaseOperation; - - -/** - * @author fgiust - * @version $Id: $ - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -@Inherited -@Documented -public @interface DbUnitExecution { - - /** - * The resource locations to use for loading dbunit dataset. - */ - String[] datasets() default {}; - - String dataSource() default ""; - - String schema() default ""; - - String excludedTables() default "(^\\$(.*))"; // oracle recycle bin - - boolean truncateAll() default true; - - Class< ? extends DatabaseOperation> truncateOperation() default org.dbunit.operation.TruncateTableOperation.class; - - Class< ? extends DatabaseOperation> insertOperation() default org.dbunit.operation.InsertOperation.class; - -} \ No newline at end of file Copied: tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitExecution.java (from rev 549, trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitExecution.java) =================================================================== --- tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitExecution.java (rev 0) +++ tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitExecution.java 2008-01-27 11:12:20 UTC (rev 559) @@ -0,0 +1,78 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.dbunit.operation.DatabaseOperation; + + +/** + * @author fgiust + * @version $Id: $ + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Inherited +@Documented +public @interface DbUnitExecution { + + /** + * The resource locations to use for loading dbunit dataset. + */ + String[] datasets() default { + + }; + + /** + * The name of the datasource to use. If can be left unset only if there is only one DataSource available in the + * Spring context. + */ + String dataSource() default ""; + + /** + * Db schema name that will be given to dbUnit. Can be left unset if not needed (database specific) + */ + String schema() default ""; + + /** + * A regexp that can match table names. Any table matching this regular expression will not be considered by DbUnit. + * By default tables starting with $ are ignored (oracle recycle bin). + */ + String excludedTables() default "(^\\$(.*))"; // oracle recycle bin + + /** + * If true, <strong>all</strong> the tables in the database will be truncated before loading any dataset. + */ + boolean truncateAll() default true; + + /** + * The database operation that will be used to truncate tables. Defaults to + * org.dbunit.operation.TruncateTableOperation + */ + Class< ? extends DatabaseOperation> truncateOperation() default org.dbunit.operation.TruncateTableOperation.class; + + /** + * The database operation that will be used to load datasets. Defaults to org.dbunit.operation.InsertOperation + */ + Class< ? extends DatabaseOperation> insertOperation() default org.dbunit.operation.InsertOperation.class; + +} \ No newline at end of file Deleted: tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitTestContext.java =================================================================== --- trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitTestContext.java 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitTestContext.java 2008-01-27 11:12:20 UTC (rev 559) @@ -1,246 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing; - -import java.io.IOException; -import java.net.URL; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.Map; - -import javax.sql.DataSource; - -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.lang.StringUtils; -import org.dbunit.DatabaseUnitException; -import org.dbunit.database.DatabaseConnection; -import org.dbunit.database.DatabaseSequenceFilter; -import org.dbunit.database.IDatabaseConnection; -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.FilteredDataSet; -import org.dbunit.dataset.IDataSet; -import org.dbunit.dataset.filter.ITableFilter; -import org.dbunit.dataset.filter.SequenceTableFilter; -import org.dbunit.operation.DatabaseOperation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.ApplicationContext; - - -/** - * @author fgiust - * @version $Id: $ - */ -public class DbUnitTestContext -{ - - /** - * Logger. - */ - private static Logger log = LoggerFactory.getLogger(DbUnitTestContext.class); - - private Object testcase; - - private ApplicationContext applicationContext; - - /** - * Dataset cache. - */ - private Map<String, IDataSet> datasetCache = new HashMap<String, IDataSet>(); - - /** - * Truncate dataset cache. This is kept as a static attribute since the creation of the dataset is very expensive - * and it doesn't change across tests. - */ - protected static Map<String, IDataSet> truncateDataSetCache = new HashMap<String, IDataSet>(); - - public DbUnitTestContext(Object testcase, ApplicationContext applicationContext) - { - this.testcase = testcase; - this.applicationContext = applicationContext; - } - - /** - * Setup the Database before running the test method. - * @throws Exception Any exception. - */ - @SuppressWarnings("unchecked") - public void setUpDbUnit() throws Exception - { - DbUnitExecution singleDbUnitExecution = testcase.getClass().getAnnotation(DbUnitExecution.class); - - DbUnitExecution[] executions; - if (singleDbUnitExecution != null) - { - executions = new DbUnitExecution[]{singleDbUnitExecution }; - } - else - { - DbUnitConfiguration dbUnitConfiguration = testcase.getClass().getAnnotation(DbUnitConfiguration.class); - executions = dbUnitConfiguration.dbUnitExecutions(); - } - - for (DbUnitExecution dbUnitExecution : executions) - { - String[] datasets = dbUnitExecution.datasets(); - String dataSourceName = dbUnitExecution.dataSource(); - String schema = dbUnitExecution.schema(); - if (StringUtils.isEmpty(schema)) - { - schema = null; - } - - IDatabaseConnection connection = new DatabaseConnection( - getDatasource(dataSourceName).getConnection(), - schema); - - try - { - ITableFilter tableFilter = new RegExpTableFilter(dbUnitExecution.excludedTables()); - - if (dbUnitExecution.truncateAll()) - { - truncateAll(connection, tableFilter, dataSourceName, dbUnitExecution - .truncateOperation() - .newInstance()); - } - - DatabaseOperation dbOperation = dbUnitExecution.insertOperation().newInstance(); - for (String datasetFile : datasets) - { - importDataSet(createDataset(datasetFile), connection, tableFilter, dataSourceName, dbOperation); - } - } - finally - { - connection.close(); - } - } - } - - /** - * @param datasetFile - * @return - * @throws IOException - * @throws DataSetException - */ - private IDataSet createDataset(String datasetFile) throws IOException, DataSetException - { - IDataSet dataSet = datasetCache.get(datasetFile); - if (dataSet == null) - { - URL datasetUrl = getClass().getResource(datasetFile); - if (datasetUrl == null) - { - throw new IllegalArgumentException("Dataset " + datasetFile + " not found"); - } - dataSet = DbUnitUtils.loadDataset(datasetUrl); - datasetCache.put(datasetFile, dataSet); - } - return dataSet; - } - - private void importDataSet(IDataSet dataSet, IDatabaseConnection connection, ITableFilter tableFilter, - String dataSourceName, DatabaseOperation databaseOperation) throws SQLException, DataSetException, - DatabaseUnitException - { - - if (dataSet == null) - { - throw new IllegalArgumentException("dataSet is null"); - } - - IDataSet orderedDataset = new FilteredDataSet(tableFilter, dataSet); - if (log.isDebugEnabled()) - { - log.debug("Tables: {}", ArrayUtils.toString(orderedDataset.getTableNames())); - } - - // if a sorted dataset is available, use table sequence for sorting - IDataSet truncateDataSet = getTruncateDataset(dataSourceName, connection.getSchema()); - if (truncateDataSet != null) - { - ITableFilter filter = new SequenceTableFilter(truncateDataSet.getTableNames()); - orderedDataset = new FilteredDataSet(filter, dataSet); - } - - if (dataSet != null) - { - databaseOperation.execute(connection, orderedDataset); - } - - } - - /** - * @param connection - * @param tableFilter - * @throws SQLException - * @throws DataSetException - * @throws DatabaseUnitException - */ - private void truncateAll(IDatabaseConnection connection, ITableFilter tableFilter, String dataSourceName, - DatabaseOperation databaseOperation) throws SQLException, DataSetException, DatabaseUnitException - { - IDataSet truncateDataSet = getTruncateDataset(dataSourceName, connection.getSchema()); - if (truncateDataSet == null) - { - log.debug("Generating sorted dataset for initial cleanup"); - IDataSet unsortedDataSet = connection.createDataSet(); - - log.debug("Unfiltered truncateDataSet: {}", ArrayUtils.toString(unsortedDataSet.getTableNames())); - - ITableFilter filter = new DatabaseSequenceFilter(connection, new FilteredDataSet( - tableFilter, - unsortedDataSet).getTableNames()); - truncateDataSet = new FilteredDataSet(tableFilter, new FilteredDataSet(filter, unsortedDataSet)); - storeTruncateDataset(dataSourceName, connection.getSchema(), truncateDataSet); - log.debug("Sorted dataset generated"); - } - - log.debug("Tables truncateDataSet: {}", ArrayUtils.toString(truncateDataSet.getTableNames())); - if (truncateDataSet != null) - { - databaseOperation.execute(connection, truncateDataSet); - } - } - - private IDataSet getTruncateDataset(String datasourceName, String schema) - { - return truncateDataSetCache.get(datasourceName + "_" + StringUtils.defaultString(schema)); - } - - private IDataSet storeTruncateDataset(String datasourceName, String schema, IDataSet dataset) - { - return truncateDataSetCache.put(datasourceName + "_" + StringUtils.defaultString(schema), dataset); - } - - @SuppressWarnings("unchecked") - protected DataSource getDatasource(String name) - { - if (StringUtils.isEmpty(name)) - { - Map<String, DataSource> dsMap = applicationContext.getBeansOfType(DataSource.class); - if (dsMap == null || dsMap.size() != 1) - { - throw new RuntimeException( - "Unable to find a datasource in spring applicationContext, please specify the datasource bean name " - + "using the \"datasource\" attribute of @DbUnitConfiguration"); - } - return dsMap.values().iterator().next(); - } - return (DataSource) applicationContext.getBean(name); - } -} Copied: tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitTestContext.java (from rev 549, trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitTestContext.java) =================================================================== --- tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitTestContext.java (rev 0) +++ tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitTestContext.java 2008-01-27 11:12:20 UTC (rev 559) @@ -0,0 +1,319 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing; + +import java.io.IOException; +import java.net.URL; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang.StringUtils; +import org.dbunit.DatabaseUnitException; +import org.dbunit.database.DatabaseConnection; +import org.dbunit.database.DatabaseSequenceFilter; +import org.dbunit.database.IDatabaseConnection; +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.FilteredDataSet; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.filter.ITableFilter; +import org.dbunit.dataset.filter.SequenceTableFilter; +import org.dbunit.operation.DatabaseOperation; +import org.dbunit.operation.DeleteAllOperation; +import org.dbunit.operation.DeleteOperation; +import org.dbunit.operation.InsertOperation; +import org.dbunit.operation.RefreshOperation; +import org.dbunit.operation.TruncateTableOperation; +import org.dbunit.operation.UpdateOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.ApplicationContext; + + +/** + * @author fgiust + * @version $Id: $ + */ +public class DbUnitTestContext +{ + + /** + * Truncate dataset cache. This is kept as a static attribute since the creation of the dataset is very expensive + * and it doesn't change across tests. + */ + protected static Map<String, IDataSet> truncateDataSetCache = new HashMap<String, IDataSet>(); + + /** + * Logger. + */ + private static Logger log = LoggerFactory.getLogger(DbUnitTestContext.class); + + /** + * The test instance. + */ + private Object testcase; + + /** + * Spring application context. + */ + private ApplicationContext applicationContext; + + /** + * Dataset cache. + */ + private Map<String, IDataSet> datasetCache = new HashMap<String, IDataSet>(); + + /** + * Instantiates a new DbUnitTestContext + * @param testcase test instance + * @param applicationContext Spring application context + */ + public DbUnitTestContext(Object testcase, ApplicationContext applicationContext) + { + this.testcase = testcase; + this.applicationContext = applicationContext; + } + + /** + * Setup the Database before running the test method. + * @throws Exception Any exception. + */ + @SuppressWarnings("unchecked") + public void setUpDbUnit() throws Exception + { + DbUnitExecution singleDbUnitExecution = testcase.getClass().getAnnotation(DbUnitExecution.class); + + DbUnitExecution[] executions = null; + if (singleDbUnitExecution != null) + { + executions = new DbUnitExecution[]{singleDbUnitExecution }; + } + else + { + DbUnitConfiguration dbUnitConfiguration = testcase.getClass().getAnnotation(DbUnitConfiguration.class); + if (dbUnitConfiguration != null) + { + executions = dbUnitConfiguration.dbUnitExecutions(); + } + } + if (executions != null) + { + for (DbUnitExecution dbUnitExecution : executions) + { + String[] datasets = dbUnitExecution.datasets(); + String dataSourceName = dbUnitExecution.dataSource(); + String schema = dbUnitExecution.schema(); + if (StringUtils.isEmpty(schema)) + { + schema = null; + } + + IDatabaseConnection connection = new DatabaseConnection( + getDatasource(dataSourceName).getConnection(), + schema); + + try + { + ITableFilter tableFilter = new RegExpTableFilter(dbUnitExecution.excludedTables()); + + if (dbUnitExecution.truncateAll()) + { + truncateAll(connection, tableFilter, dataSourceName, getDatabaseOperation(dbUnitExecution + .truncateOperation())); + } + + DatabaseOperation dbOperation = getDatabaseOperation(dbUnitExecution.insertOperation()); + for (String datasetFile : datasets) + { + importDataSet(createDataset(datasetFile), connection, tableFilter, dataSourceName, dbOperation); + } + } + finally + { + connection.close(); + } + } + } + } + + /** + * Instantiates the givec Database Operation. Standard operations in the <code>org.dbunit.operation</code> package + * have protected constructors and needs to be accessed using the public static fields in + * <code>org.dbunit.operation.DatabaseOperation</code>. + * @param dboperationClass db operation class + * @return db operation instance + * @throws InstantiationException if the given db operation class cannot be instantiated + * @throws IllegalAccessException if the given db operation class cannot be instantiated + */ + private DatabaseOperation getDatabaseOperation(Class< ? extends DatabaseOperation> dboperationClass) + throws InstantiationException, IllegalAccessException + { + if (UpdateOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.UPDATE; + } + else if (InsertOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.INSERT; + } + else if (RefreshOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.REFRESH; + } + else if (DeleteOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.DELETE; + } + else if (DeleteAllOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.DELETE_ALL; + } + else if (TruncateTableOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.TRUNCATE_TABLE; + } + else if (DeleteOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.UPDATE; + } + + return dboperationClass.newInstance(); + + } + + /** + * Creates a dataset instance by fetching a file from the classpath + * @param datasetFile name of the file, will be loaded from the classpath + * @return IDataSet instance + * @throws IOException + * @throws DataSetException + */ + private IDataSet createDataset(String datasetFile) throws IOException, DataSetException + { + IDataSet dataSet = datasetCache.get(datasetFile); + if (dataSet == null) + { + URL datasetUrl = getClass().getResource(datasetFile); + if (datasetUrl == null) + { + throw new IllegalArgumentException("Dataset " + datasetFile + " not found"); + } + dataSet = DbUnitUtils.loadDataset(datasetUrl); + datasetCache.put(datasetFile, dataSet); + } + return dataSet; + } + + private void importDataSet(IDataSet dataSet, IDatabaseConnection connection, ITableFilter tableFilter, + String dataSourceName, DatabaseOperation databaseOperation) throws SQLException, DataSetException, + DatabaseUnitException + { + + if (dataSet == null) + { + throw new IllegalArgumentException("dataSet is null"); + } + + IDataSet orderedDataset = new FilteredDataSet(tableFilter, dataSet); + if (log.isDebugEnabled()) + { + log.debug("Tables: {}", ArrayUtils.toString(orderedDataset.getTableNames())); + } + + // if a sorted dataset is available, use table sequence for sorting + IDataSet truncateDataSet = getTruncateDataset(dataSourceName, connection.getSchema()); + if (truncateDataSet != null) + { + ITableFilter filter = new SequenceTableFilter(truncateDataSet.getTableNames()); + orderedDataset = new FilteredDataSet(filter, dataSet); + } + + if (dataSet != null) + { + databaseOperation.execute(connection, orderedDataset); + } + + } + + /** + * @param connection + * @param tableFilter + * @throws SQLException + * @throws DataSetException + * @throws DatabaseUnitException + */ + private void truncateAll(IDatabaseConnection connection, ITableFilter tableFilter, String dataSourceName, + DatabaseOperation databaseOperation) throws SQLException, DataSetException, DatabaseUnitException + { + IDataSet truncateDataSet = getTruncateDataset(dataSourceName, connection.getSchema()); + if (truncateDataSet == null) + { + log.debug("Generating sorted dataset for initial cleanup"); + IDataSet unsortedDataSet = connection.createDataSet(); + + log.debug("Unfiltered truncateDataSet: {}", ArrayUtils.toString(unsortedDataSet.getTableNames())); + + ITableFilter filter = new DatabaseSequenceFilter(connection, new FilteredDataSet( + tableFilter, + unsortedDataSet).getTableNames()); + truncateDataSet = new FilteredDataSet(tableFilter, new FilteredDataSet(filter, unsortedDataSet)); + storeTruncateDataset(dataSourceName, connection.getSchema(), truncateDataSet); + log.debug("Sorted dataset generated"); + } + + log.debug("Tables truncateDataSet: {}", ArrayUtils.toString(truncateDataSet.getTableNames())); + if (truncateDataSet != null) + { + databaseOperation.execute(connection, truncateDataSet); + } + } + + private IDataSet getTruncateDataset(String datasourceName, String schema) + { + return truncateDataSetCache.get(datasourceName + "_" + StringUtils.defaultString(schema)); + } + + private IDataSet storeTruncateDataset(String datasourceName, String schema, IDataSet dataset) + { + return truncateDataSetCache.put(datasourceName + "_" + StringUtils.defaultString(schema), dataset); + } + + /** + * Loads a named datasource from the spring context. + * @param name datasource name. + * @return Datasource instance + */ + @SuppressWarnings("unchecked") + protected DataSource getDatasource(String name) + { + if (StringUtils.isEmpty(name)) + { + Map<String, DataSource> dsMap = applicationContext.getBeansOfType(DataSource.class); + if (dsMap == null || dsMap.size() != 1) + { + throw new RuntimeException( + "Unable to find a datasource in spring applicationContext, please specify the datasource bean name " + + "using the \"datasource\" attribute of @DbUnitConfiguration"); + } + return dsMap.values().iterator().next(); + } + return (DataSource) applicationContext.getBean(name); + } + +} Deleted: tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitUtils.java =================================================================== --- trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitUtils.java 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitUtils.java 2008-01-27 11:12:20 UTC (rev 559) @@ -1,115 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; -import java.sql.SQLException; - -import org.apache.commons.lang.StringUtils; -import org.dbunit.database.IDatabaseConnection; -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.FilteredDataSet; -import org.dbunit.dataset.IDataSet; -import org.dbunit.dataset.excel.XlsDataSet; -import org.dbunit.dataset.xml.XmlDataSet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * @author fgiust - * @version $Id: $ - */ -public final class DbUnitUtils -{ - - /** - * Logger. - */ - private static Logger log = LoggerFactory.getLogger(DbUnitUtils.class); - - /** - * @param connection - * @param tableNames - * @param file - * @param xls - * @throws SQLException - * @throws IOException - * @throws DataSetException - */ - public static void exportDataset(IDatabaseConnection connection, String[] tableNames, File file) - throws SQLException, IOException, DataSetException - { - OutputStream fos = null; - - try - { - IDataSet fullDataSet = connection.createDataSet(); - - if (tableNames != null && tableNames.length > 0) - { - fullDataSet = new FilteredDataSet(tableNames, fullDataSet); - } - - fos = new FileOutputStream(file); - if (StringUtils.equalsIgnoreCase(StringUtils.substringAfterLast(file.getName(), "."), "xls")) - { - XlsDataSet.write(fullDataSet, fos); - } - else - { - XmlDataSet.write(fullDataSet, fos); - } - } - finally - { - connection.close(); - fos.close(); - } - - log.debug("Dataset exported at {}", file.getAbsolutePath()); - } - - /** - * @param url - * @return - * @throws IOException - * @throws DataSetException - */ - public static IDataSet loadDataset(URL url) throws IOException, DataSetException - { - if (url == null) - { - throw new IllegalArgumentException("URL is null"); - } - InputStream is = url.openStream(); - IDataSet dataSet = null; - - if (is != null) - { - log.debug("loading dataset {}", url.getFile()); - dataSet = url.getFile().endsWith(".xls") ? new XlsDataSet(is) : new XmlDataSet(is); - is.close(); - } - return dataSet; - } - -} Copied: tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitUtils.java (from rev 549, trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitUtils.java) =================================================================== --- tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitUtils.java (rev 0) +++ tags/openutils-testing-2.0/src/main/java/it/openutils/testing/DbUnitUtils.java 2008-01-27 11:12:20 UTC (rev 559) @@ -0,0 +1,123 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URL; +import java.sql.SQLException; + +import org.apache.commons.lang.StringUtils; +import org.dbunit.database.IDatabaseConnection; +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.FilteredDataSet; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.excel.XlsDataSet; +import org.dbunit.dataset.xml.XmlDataSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * @author fgiust + * @version $Id: $ + */ +public final class DbUnitUtils +{ + + /** + * Logger. + */ + private static Logger log = LoggerFactory.getLogger(DbUnitUtils.class); + + /** + * Do not instantiate. + */ + private DbUnitUtils() + { + // do not instantiate + } + + /** + * Exports a list of table to an xml/xsl file + * @param file The file name we save the dataset to + * @param connection connection to use + * @param tableNames optional list of table names + * @throws IOException An IO Exception. + * @throws DataSetException A dataset exception. + * @throws SQLException A SQL Exception. + */ + public static void exportDataset(IDatabaseConnection connection, String[] tableNames, File file) + throws SQLException, IOException, DataSetException + { + OutputStream fos = null; + + try + { + IDataSet fullDataSet = connection.createDataSet(); + + if (tableNames != null && tableNames.length > 0) + { + fullDataSet = new FilteredDataSet(tableNames, fullDataSet); + } + + fos = new FileOutputStream(file); + if (StringUtils.equalsIgnoreCase(StringUtils.substringAfterLast(file.getName(), "."), "xls")) + { + XlsDataSet.write(fullDataSet, fos); + } + else + { + XmlDataSet.write(fullDataSet, fos); + } + } + finally + { + connection.close(); + fos.close(); + } + + log.debug("Dataset exported at {}", file.getAbsolutePath()); + } + + /** + * @param url dataset url (can be an xml or excel file) + * @return loaded dataset + * @throws IOException error reading the file + * @throws DataSetException error loading the dataset + */ + public static IDataSet loadDataset(URL url) throws IOException, DataSetException + { + if (url == null) + { + throw new IllegalArgumentException("URL is null"); + } + InputStream is = url.openStream(); + IDataSet dataSet = null; + + if (is != null) + { + log.debug("loading dataset {}", url.getFile()); + dataSet = url.getFile().endsWith(".xls") ? new XlsDataSet(is) : new XmlDataSet(is); + is.close(); + } + return dataSet; + } + +} Deleted: tags/openutils-testing-2.0/src/main/java/it/openutils/testing/RegExpTableFilter.java =================================================================== --- trunk/openutils-testing/src/main/java/it/openutils/testing/RegExpTableFilter.java 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0/src/main/java/it/openutils/testing/RegExpTableFilter.java 2008-01-27 11:12:20 UTC (rev 559) @@ -1,50 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing; - -import java.util.regex.Pattern; - -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.filter.AbstractTableFilter; - - -/** - * @author fgiust - * @version $Id: $ - */ -public class RegExpTableFilter extends AbstractTableFilter -{ - - private Pattern pattern; - - public RegExpTableFilter(String pattern) - { - if (pattern != null) - { - this.pattern = Pattern.compile(pattern); - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isValidName(String tableName) throws DataSetException - { - return pattern == null || !pattern.matcher(tableName).matches(); - } - -} Copied: tags/openutils-testing-2.0/src/main/java/it/openutils/testing/RegExpTableFilter.java (from rev 549, trunk/openutils-testing/src/main/java/it/openutils/testing/RegExpTableFilter.java) =================================================================== --- tags/openutils-testing-2.0/src/main/java/it/openutils/testing/RegExpTableFilter.java (rev 0) +++ tags/openutils-testing-2.0/src/main/java/it/openutils/testing/RegExpTableFilter.java 2008-01-27 11:12:20 UTC (rev 559) @@ -0,0 +1,55 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing; + +import java.util.regex.Pattern; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.filter.AbstractTableFilter; + + +/** + * A table filter that excludes tables mathing the given regexp. + * @author fgiust + * @version $Id: $ + */ +public class RegExpTableFilter extends AbstractTableFilter +{ + + private Pattern pattern; + + /** + * Instantiates a new RegExpTableFilter + * @param pattern regexp pattern + */ + public RegExpTableFilter(String pattern) + { + if (pattern != null) + { + this.pattern = Pattern.compile(pattern); + } + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isValidName(String tableName) throws DataSetException + { + return pattern == null || !pattern.matcher(tableName).matches(); + } + +} Copied: tags/openutils-testing-2.0/src/site/apt/dbunit.apt (from rev 550, trunk/openutils-testing/src/site/apt/dbunit.apt) =================================================================== --- tags/openutils-testing-2.0/src/site/apt/dbunit.apt (rev 0) +++ tags/openutils-testing-2.0/src/site/apt/dbunit.apt 2008-01-27 11:12:20 UTC (rev 559) @@ -0,0 +1,76 @@ + -------------------------- + O p e n u t i l s + -------------------------- + Fabrizio Giustina + -------------------------- + + +DbUnit tests + + Openutils provide a base class that take cares of the common operations involved in preparing the test environment using + DbUnit. + + You can extend <<<it.openutils.testing.testng.AbstractDbUnitTestNGSpringContextTests>>> or + <<<it.openutils.testing.junit.AbstractDbUnitJunitSpringContextTests>>>, depending on the test framework of your choice + (remember to include the appropriate dependency, openutils-testing-testng or openutils-testing-junit). + Apart from the underline test framework used, there is no difference in how those class will work. + + Those base classes extend the standard <<<Abstract*SpringContextTests>>> classes provided by Spring, so they support + dependency injection and needs to be configured from a Spring context. + +How to + + All the setup can be configured using annotations. This is a sample test that can make use of data loaded by DbUnit: + ++----------------------------------------------+ + +@ContextConfiguration(locations = {"/spring-tests.xml" }) +@DbUnitExecution(datasets = {"/db1-load.xml" }) +public class SampleDbUnitTest extends AbstractDbUnitTestNGSpringContextTests +{ + @Test + public void testSomething() { + ... + } +} + ++----------------------------------------------+ + + The <<<DbUnitExecution>>> annotation controls how the setup will be performed. It can be configured with a list of file names + (xml od xsl DbUnit datasets) that will be loaded before every single method in this test class is executed. + + In detail the setup that will be performed before each method is: + + * truncate *any table* in the database. This can be turned of by the <<<truncateAll>>> DbUnitExecution parameter + + * load the given datasets into the db + + [] + + You can setup also more than one execution if your tests depend on more than one database or schema, annotating your + class like in this example: + ++----------------------------------------------+ + +@DbUnitConfiguration(dbUnitExecutions = { + @DbUnitExecution(datasets = {"/db1-load.xml" }, dataSource = "dataSource1"), + @DbUnitExecution(datasets = {"/db2-load.xml" }, dataSource = "dataSource2") }) + ++----------------------------------------------+ + + + Note that this test classes don't extend Spring transactional tests, so you need to manually turn on Transactions using + standard Spring annotations: + ++----------------------------------------------+ + +@TestExecutionListeners({TransactionalTestExecutionListener.class }) +@Transactional + ++----------------------------------------------+ + + Also note that the content of your db will definitively be modified by these tests, they are expected to be run on a + test-only instance! + + + Deleted: tags/openutils-testing-2.0/src/site/apt/index.apt =================================================================== --- trunk/openutils-testing/src/site/apt/index.apt 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0/src/site/apt/index.apt 2008-01-27 11:12:20 UTC (rev 559) @@ -1,8 +0,0 @@ - -------------------------- - O p e n u t i l s - -------------------------- - Fabrizio Giustina - -------------------------- - -openutils-testing - Copied: tags/openutils-testing-2.0/src/site/apt/index.apt (from rev 550, trunk/openutils-testing/src/site/apt/index.apt) =================================================================== --- tags/openutils-testing-2.0/src/site/apt/index.apt (rev 0) +++ tags/openutils-testing-2.0/src/site/apt/index.apt 2008-01-27 11:12:20 UTC (rev 559) @@ -0,0 +1,27 @@ + -------------------------- + O p e n u t i l s + -------------------------- + Fabrizio Giustina + -------------------------- + +openutils-testing + + Openutils-testing extends the standard spring testing framework by providing more high-level base testing classes and utils. + + In particular, it provides a {{{dbunit.html}framework for using with dbunit in Spring test cases}}. + + The openutils-testing jar only contains generic classes that don't depends on any specific test framework. You should + depend on openutils-testing-testng or openutils-testing-junit + + + +Released versions + + openutils-testing-testng: + + {{{http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-testng}http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-testng}} + + openutils-testing-junit: + + {{{http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-junit}http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-junit}} + Deleted: tags/openutils-testing-2.0/src/site/site.xml =================================================================== --- trunk/openutils-testing/src/site/site.xml 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0/src/site/site.xml 2008-01-27 11:12:20 UTC (rev 559) @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="Openutils testing"> - <publishDate position="left" format="yyyy-MM-dd" /> - <bannerRight> - <name>Openutils</name> - <src>http://openutils.sourceforge.net/images/openutils-logo.png</src> - <href>http://openutils.sourceforge.net</href> - </bannerRight> - <bannerLeft> - <name>Sourceforge</name> - <src>http://sourceforge.net/sflogo.php?group_id=150467&amp;type=2</src> - <href>http://www.sourceforge.net/projects/openutils</href> - </bannerLeft> - <body> - <head> - <link rel="icon" href="images/favicon.ico" /> - </head> - <menu name="openutils testing"> - <item name="Usage" href="index.html"></item> - </menu> - <menu ref="modules" inherit="bottom" /> - <menu ref="reports" inherit="bottom" /> - </body> - <skin> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-maven-skin</artifactId> - <version>1.0</version> - </skin> -</project> Copied: tags/openutils-testing-2.0/src/site/site.xml (from rev 553, trunk/openutils-testing/src/site/site.xml) =================================================================== --- tags/openutils-testing-2.0/src/site/site.xml (rev 0) +++ tags/openutils-testing-2.0/src/site/site.xml 2008-01-27 11:12:20 UTC (rev 559) @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="Openutils testing"> + <publishDate position="navigation-bottom" format="yyyy-MM-dd" /> + <version position="navigation-bottom" /> + <bannerRight> + <name>Openutils</name> + <src>http://openutils.sourceforge.net/images/openutils-logo.png</src> + <href>http://openutils.sourceforge.net</href> + </bannerRight> + <bannerLeft> + <name>Sourceforge</name> + <src>http://sourceforge.net/sflogo.php?group_id=150467&amp;type=2</src> + <href>http://www.sourceforge.net/projects/openutils</href> + </bannerLeft> + <body> + <head> + <link rel="icon" href="images/favicon.ico" /> + </head> + <breadcrumbs> + <item name="openutils" href="http://openutils.sourceforge.net/" /> + <item name="openutils-testing" href="http://openutils.sourceforge.net/openutils-testing" /> + </breadcrumbs> + <menu name="openutils testing"> + <item name="Usage" href="index.html"></item> + <item name="DbUnit tests" href="dbunit.html"></item> + </menu> + <menu ref="modules" inherit="bottom" /> + <menu ref="reports" inherit="bottom" /> + </body> + <skin> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-maven-skin</artifactId> + <version>1.0</version> + </skin> +</project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2008-01-27 11:19:10
|
Revision: 563 http://openutils.svn.sourceforge.net/openutils/?rev=563&view=rev Author: fgiust Date: 2008-01-27 03:19:08 -0800 (Sun, 27 Jan 2008) Log Message: ----------- [maven-release-plugin] copy for tag openutils-testing-testng-2.0 Added Paths: ----------- tags/openutils-testing-testng-2.0/ tags/openutils-testing-testng-2.0/pom.xml tags/openutils-testing-testng-2.0/src/main/java/it/openutils/testing/testng/AbstractDbUnitTestNGSpringContextTests.java tags/openutils-testing-testng-2.0/src/site/apt/ tags/openutils-testing-testng-2.0/src/site/site.xml tags/openutils-testing-testng-2.0/src/test/java/it/openutils/testing/testng/SingleDatasourceDbUnitTest.java Removed Paths: ------------- tags/openutils-testing-testng-2.0/derby.log tags/openutils-testing-testng-2.0/pom.xml tags/openutils-testing-testng-2.0/src/main/java/it/openutils/testing/testng/AbstractDbUnitTestNGSpringContextTests.java tags/openutils-testing-testng-2.0/src/site/site.xml tags/openutils-testing-testng-2.0/src/test/java/it/openutils/testing/testng/SingleDatasourceDbUnitTest.java Copied: tags/openutils-testing-testng-2.0 (from rev 536, trunk/openutils-testing-testng) Property changes on: tags/openutils-testing-testng-2.0 ___________________________________________________________________ Name: svn:ignore + .checkstyle target .settings .classpath .project test-output temp-testng-customsuite.xml derby.log release.properties Deleted: tags/openutils-testing-testng-2.0/derby.log =================================================================== --- trunk/openutils-testing-testng/derby.log 2008-01-20 17:02:17 UTC (rev 536) +++ tags/openutils-testing-testng-2.0/derby.log 2008-01-27 11:19:08 UTC (rev 563) @@ -1,12 +0,0 @@ ----------------------------------------------------------------- -2008-01-09 22:30:08.630 GMT: - Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.2.0 - (485682): instance c013800d-0117-60ac-bb18-00000229e5c0 -on database directory /data/apps/openmind/openutils-trunk/openutils-testing-testng/target/test-db1 - -Database Class Loader started - derby.database.classpath='' ----------------------------------------------------------------- -2008-01-09 22:30:09.498 GMT: - Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.2.0 - (485682): instance f81e0010-0117-60ac-bb18-00000229e5c0 -on database directory /data/apps/openmind/openutils-trunk/openutils-testing-testng/target/test-db2 - -Database Class Loader started - derby.database.classpath='' Deleted: tags/openutils-testing-testng-2.0/pom.xml =================================================================== --- trunk/openutils-testing-testng/pom.xml 2008-01-20 17:02:17 UTC (rev 536) +++ tags/openutils-testing-testng-2.0/pom.xml 2008-01-27 11:19:08 UTC (rev 563) @@ -1,185 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>6</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-testing-testng</artifactId> - <name>openutils test utils (testng)</name> - <version>2.0-SNAPSHOT</version> - <description>openutils test utils</description> - <build> - <plugins> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.3.1</version> - <configuration> - <forkMode>once</forkMode> - </configuration> - </plugin> - </plugins> - </build> - <dependencies> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-testing</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl104-over-slf4j</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-orm</artifactId> - <version>${spring.version}</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.dbunit</groupId> - <artifactId>dbunit</artifactId> - <version>2.2</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>junit-addons</groupId> - <artifactId>junit-addons</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <classifier>jdk15</classifier> - <version>5.1</version> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate</artifactId> - <version>3.2.1.ga</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - <version>10.2.2.0</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>commons-dbcp</groupId> - <artifactId>commons-dbcp</artifactId> - <version>1.2.1</version> - <scope>test</scope> - <exclusions> - <exclusion> - <artifactId>xerces</artifactId> - <groupId>xerces</groupId> - </exclusion> - <exclusion> - <artifactId>xml-apis</artifactId> - <groupId>xml-apis</groupId> - </exclusion> - <exclusion> - <artifactId>commons-logging</artifactId> - <groupId>commons-logging</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-jdbc</artifactId> - <version>${spring.version}</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - <properties> - <spring.version>2.5.1</spring.version> - </properties> -</project> \ No newline at end of file Copied: tags/openutils-testing-testng-2.0/pom.xml (from rev 562, trunk/openutils-testing-testng/pom.xml) =================================================================== --- tags/openutils-testing-testng-2.0/pom.xml (rev 0) +++ tags/openutils-testing-testng-2.0/pom.xml 2008-01-27 11:19:08 UTC (rev 563) @@ -0,0 +1,179 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>7</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-testing-testng</artifactId> + <name>openutils test utils (testng)</name> + <version>2.0</version> + <description>openutils test utils</description> + <dependencies> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-testing</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.3</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl104-over-slf4j</artifactId> + <version>1.4.3</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-orm</artifactId> + <version>${spring.version}</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.dbunit</groupId> + <artifactId>dbunit</artifactId> + <version>2.2</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>junit-addons</groupId> + <artifactId>junit-addons</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <classifier>jdk15</classifier> + <version>5.7</version> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.2.1.ga</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.2.2.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>commons-dbcp</groupId> + <artifactId>commons-dbcp</artifactId> + <version>1.2.1</version> + <scope>test</scope> + <exclusions> + <exclusion> + <artifactId>xerces</artifactId> + <groupId>xerces</groupId> + </exclusion> + <exclusion> + <artifactId>xml-apis</artifactId> + <groupId>xml-apis</groupId> + </exclusion> + <exclusion> + <artifactId>commons-logging</artifactId> + <groupId>commons-logging</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-jdbc</artifactId> + <version>${spring.version}</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + <properties> + <spring.version>2.5.1</spring.version> + </properties> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-testng-2.0</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-testng-2.0</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-testing-testng-2.0</url> + </scm> +</project> \ No newline at end of file Deleted: tags/openutils-testing-testng-2.0/src/main/java/it/openutils/testing/testng/AbstractDbUnitTestNGSpringContextTests.java =================================================================== --- trunk/openutils-testing-testng/src/main/java/it/openutils/testing/testng/AbstractDbUnitTestNGSpringContextTests.java 2008-01-20 17:02:17 UTC (rev 536) +++ tags/openutils-testing-testng-2.0/src/main/java/it/openutils/testing/testng/AbstractDbUnitTestNGSpringContextTests.java 2008-01-27 11:19:08 UTC (rev 563) @@ -1,55 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing.testng; - -import it.openutils.testing.DbUnitTestContext; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; -import org.testng.annotations.BeforeMethod; - - -/** - * @author fgiust - * @version $Id: $ - */ -public class AbstractDbUnitTestNGSpringContextTests extends AbstractTestNGSpringContextTests -{ - - /** - * Slf4j logger that can be reused in subclasses. - */ - protected Logger log = LoggerFactory.getLogger(getClass()); - - /** - * DBUnit text context. - */ - private DbUnitTestContext dbUnitTestContext; - - /** - * Setup the Database before running the test method. - * @throws Exception Any exception. - */ - @SuppressWarnings("unchecked") - @BeforeMethod - protected void setUpDbUnit() throws Exception - { - dbUnitTestContext = new DbUnitTestContext(this, applicationContext); - dbUnitTestContext.setUpDbUnit(); - } - -} Copied: tags/openutils-testing-testng-2.0/src/main/java/it/openutils/testing/testng/AbstractDbUnitTestNGSpringContextTests.java (from rev 543, trunk/openutils-testing-testng/src/main/java/it/openutils/testing/testng/AbstractDbUnitTestNGSpringContextTests.java) =================================================================== --- tags/openutils-testing-testng-2.0/src/main/java/it/openutils/testing/testng/AbstractDbUnitTestNGSpringContextTests.java (rev 0) +++ tags/openutils-testing-testng-2.0/src/main/java/it/openutils/testing/testng/AbstractDbUnitTestNGSpringContextTests.java 2008-01-27 11:19:08 UTC (rev 563) @@ -0,0 +1,55 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing.testng; + +import it.openutils.testing.DbUnitTestContext; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.testng.annotations.BeforeMethod; + + +/** + * @author fgiust + * @version $Id: $ + */ +public class AbstractDbUnitTestNGSpringContextTests extends AbstractTestNGSpringContextTests +{ + + /** + * Slf4j logger that can be reused in subclasses. + */ + protected Logger log = LoggerFactory.getLogger(getClass()); + + /** + * DBUnit text context. + */ + protected DbUnitTestContext dbUnitTestContext; + + /** + * Setup the Database before running the test method. + * @throws Exception Any exception. + */ + @SuppressWarnings("unchecked") + @BeforeMethod + protected void setUpDbUnit() throws Exception + { + dbUnitTestContext = new DbUnitTestContext(this, applicationContext); + dbUnitTestContext.setUpDbUnit(); + } + +} Copied: tags/openutils-testing-testng-2.0/src/site/apt (from rev 550, trunk/openutils-testing-testng/src/site/apt) Deleted: tags/openutils-testing-testng-2.0/src/site/site.xml =================================================================== --- trunk/openutils-testing-testng/src/site/site.xml 2008-01-20 17:02:17 UTC (rev 536) +++ tags/openutils-testing-testng-2.0/src/site/site.xml 2008-01-27 11:19:08 UTC (rev 563) @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="Openutils"> - <bannerRight> - <name>Openutils</name> - <href>http://openutils.sourceforge.net</href> - </bannerRight> - <bannerLeft> - <name>Sourceforge</name> - <src>http://sourceforge.net/sflogo.php?group_id=150467&amp;type=2</src> - <href>http://openutils.sourceforge.net</href> - </bannerLeft> - <body> - <menu ref="modules" inherit="bottom" /> - <menu ref="reports" inherit="bottom" /> - <head> - <link rel="icon" href="images/favicon.ico" /> - </head> - </body> - <skin> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-maven-skin</artifactId> - </skin> -</project> Copied: tags/openutils-testing-testng-2.0/src/site/site.xml (from rev 537, trunk/openutils-testing-testng/src/site/site.xml) =================================================================== --- tags/openutils-testing-testng-2.0/src/site/site.xml (rev 0) +++ tags/openutils-testing-testng-2.0/src/site/site.xml 2008-01-27 11:19:08 UTC (rev 563) @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="Openutils testing (testng)"> + <publishDate position="left" format="yyyy-MM-dd" /> + <bannerRight> + <name>Openutils</name> + <src>http://openutils.sourceforge.net/images/openutils-logo.png</src> + <href>http://openutils.sourceforge.net</href> + </bannerRight> + <bannerLeft> + <name>Sourceforge</name> + <src>http://sourceforge.net/sflogo.php?group_id=150467&amp;type=2</src> + <href>http://www.sourceforge.net/projects/openutils</href> + </bannerLeft> + <body> + <head> + <link rel="icon" href="images/favicon.ico" /> + </head> + <menu name="openutils testing (testng)"> + <item name="Usage" href="index.html"></item> + </menu> + <menu ref="modules" inherit="bottom" /> + <menu ref="reports" inherit="bottom" /> + </body> + <skin> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-maven-skin</artifactId> + <version>1.0</version> + </skin> +</project> Deleted: tags/openutils-testing-testng-2.0/src/test/java/it/openutils/testing/testng/SingleDatasourceDbUnitTest.java =================================================================== --- trunk/openutils-testing-testng/src/test/java/it/openutils/testing/testng/SingleDatasourceDbUnitTest.java 2008-01-20 17:02:17 UTC (rev 536) +++ tags/openutils-testing-testng-2.0/src/test/java/it/openutils/testing/testng/SingleDatasourceDbUnitTest.java 2008-01-27 11:19:08 UTC (rev 563) @@ -1,46 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing.testng; - -import it.openutils.testing.DbUnitExecution; - -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestExecutionListeners; -import org.springframework.test.context.transaction.TransactionConfiguration; -import org.springframework.test.context.transaction.TransactionalTestExecutionListener; -import org.springframework.transaction.annotation.Transactional; -import org.testng.annotations.Test; - - -/** - * @author fgiust - * @version $Id: $ - */ -@ContextConfiguration(locations = {"/spring-tests.xml" }) -@DbUnitExecution(datasets = {"/db1-load.xml" }, dataSource = "dataSource1") -@TestExecutionListeners({TransactionalTestExecutionListener.class }) -@Transactional -@TransactionConfiguration(transactionManager = "transactionManager1") -public class SingleDatasourceDbUnitTest extends AbstractDbUnitTestNGSpringContextTests -{ - - @Test - public void testLoad() throws Exception - { - // do nothing - } - -} Copied: tags/openutils-testing-testng-2.0/src/test/java/it/openutils/testing/testng/SingleDatasourceDbUnitTest.java (from rev 541, trunk/openutils-testing-testng/src/test/java/it/openutils/testing/testng/SingleDatasourceDbUnitTest.java) =================================================================== --- tags/openutils-testing-testng-2.0/src/test/java/it/openutils/testing/testng/SingleDatasourceDbUnitTest.java (rev 0) +++ tags/openutils-testing-testng-2.0/src/test/java/it/openutils/testing/testng/SingleDatasourceDbUnitTest.java 2008-01-27 11:19:08 UTC (rev 563) @@ -0,0 +1,47 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing.testng; + +import it.openutils.testing.DbUnitExecution; + +import org.dbunit.operation.InsertOperation; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.transaction.TransactionConfiguration; +import org.springframework.test.context.transaction.TransactionalTestExecutionListener; +import org.springframework.transaction.annotation.Transactional; +import org.testng.annotations.Test; + + +/** + * @author fgiust + * @version $Id: $ + */ +@ContextConfiguration(locations = {"/spring-tests.xml" }) +@DbUnitExecution(datasets = {"/db1-load.xml" }, dataSource = "dataSource1", insertOperation = InsertOperation.class) +@TestExecutionListeners({TransactionalTestExecutionListener.class }) +@Transactional +@TransactionConfiguration(transactionManager = "transactionManager1") +public class SingleDatasourceDbUnitTest extends AbstractDbUnitTestNGSpringContextTests +{ + + @Test + public void testLoad() throws Exception + { + // do nothing + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2008-01-27 11:23:21
|
Revision: 566 http://openutils.svn.sourceforge.net/openutils/?rev=566&view=rev Author: fgiust Date: 2008-01-27 03:23:26 -0800 (Sun, 27 Jan 2008) Log Message: ----------- [maven-release-plugin] copy for tag openutils-testing-junit-2.0 Added Paths: ----------- tags/openutils-testing-junit-2.0/ tags/openutils-testing-junit-2.0/pom.xml tags/openutils-testing-junit-2.0/src/main/java/it/openutils/testing/junit/AbstractDbUnitJunitSpringContextTests.java tags/openutils-testing-junit-2.0/src/site/apt/ tags/openutils-testing-junit-2.0/src/site/site.xml Removed Paths: ------------- tags/openutils-testing-junit-2.0/pom.xml tags/openutils-testing-junit-2.0/src/main/java/it/openutils/testing/junit/AbstractDbUnitJunitSpringContextTests.java tags/openutils-testing-junit-2.0/src/site/site.xml Copied: tags/openutils-testing-junit-2.0 (from rev 536, trunk/openutils-testing-junit) Deleted: tags/openutils-testing-junit-2.0/pom.xml =================================================================== --- trunk/openutils-testing-junit/pom.xml 2008-01-20 17:02:17 UTC (rev 536) +++ tags/openutils-testing-junit-2.0/pom.xml 2008-01-27 11:23:26 UTC (rev 566) @@ -1,122 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>6</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-testing-junit</artifactId> - <name>openutils test utils (junit)</name> - <version>2.0-SNAPSHOT</version> - <description>openutils test utils</description> - <dependencies> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-testing</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.13</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-orm</artifactId> - <version>${spring.version}</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.dbunit</groupId> - <artifactId>dbunit</artifactId> - <version>2.2</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.4</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate</artifactId> - <version>3.2.1.ga</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - <properties> - <spring.version>2.5.1</spring.version> - </properties> -</project> \ No newline at end of file Copied: tags/openutils-testing-junit-2.0/pom.xml (from rev 565, trunk/openutils-testing-junit/pom.xml) =================================================================== --- tags/openutils-testing-junit-2.0/pom.xml (rev 0) +++ tags/openutils-testing-junit-2.0/pom.xml 2008-01-27 11:23:26 UTC (rev 566) @@ -0,0 +1,127 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>7</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-testing-junit</artifactId> + <name>openutils test utils (junit)</name> + <version>2.0</version> + <description>openutils test utils</description> + <dependencies> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-testing</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.3</version> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.13</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-orm</artifactId> + <version>${spring.version}</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.dbunit</groupId> + <artifactId>dbunit</artifactId> + <version>2.2</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.4</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.2.1.ga</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + <properties> + <spring.version>2.5.1</spring.version> + </properties> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-junit-2.0</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-junit-2.0</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-testing-junit-2.0</url> + </scm> +</project> \ No newline at end of file Deleted: tags/openutils-testing-junit-2.0/src/main/java/it/openutils/testing/junit/AbstractDbUnitJunitSpringContextTests.java =================================================================== --- trunk/openutils-testing-junit/src/main/java/it/openutils/testing/junit/AbstractDbUnitJunitSpringContextTests.java 2008-01-20 17:02:17 UTC (rev 536) +++ tags/openutils-testing-junit-2.0/src/main/java/it/openutils/testing/junit/AbstractDbUnitJunitSpringContextTests.java 2008-01-27 11:23:26 UTC (rev 566) @@ -1,54 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing.junit; - -import it.openutils.testing.DbUnitTestContext; - -import org.junit.Before; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; - - -/** - * @author fgiust - * @version $Id: $ - */ -public class AbstractDbUnitJunitSpringContextTests extends AbstractJUnit4SpringContextTests -{ - - /** - * Slf4j logger that can be reused in subclasses. - */ - protected Logger log = LoggerFactory.getLogger(getClass()); - - /** - * DBUnit text context. - */ - private DbUnitTestContext dbUnitTestContext; - - /** - * Setup the Database before running the test method. - * @throws Exception Any exception. - */ - @SuppressWarnings("unchecked") - @Before - protected void setUpDbUnit() throws Exception - { - dbUnitTestContext = new DbUnitTestContext(this, applicationContext); - dbUnitTestContext.setUpDbUnit(); - } -} Copied: tags/openutils-testing-junit-2.0/src/main/java/it/openutils/testing/junit/AbstractDbUnitJunitSpringContextTests.java (from rev 543, trunk/openutils-testing-junit/src/main/java/it/openutils/testing/junit/AbstractDbUnitJunitSpringContextTests.java) =================================================================== --- tags/openutils-testing-junit-2.0/src/main/java/it/openutils/testing/junit/AbstractDbUnitJunitSpringContextTests.java (rev 0) +++ tags/openutils-testing-junit-2.0/src/main/java/it/openutils/testing/junit/AbstractDbUnitJunitSpringContextTests.java 2008-01-27 11:23:26 UTC (rev 566) @@ -0,0 +1,54 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing.junit; + +import it.openutils.testing.DbUnitTestContext; + +import org.junit.Before; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; + + +/** + * @author fgiust + * @version $Id: $ + */ +public class AbstractDbUnitJunitSpringContextTests extends AbstractJUnit4SpringContextTests +{ + + /** + * Slf4j logger that can be reused in subclasses. + */ + protected Logger log = LoggerFactory.getLogger(getClass()); + + /** + * DBUnit text context. + */ + protected DbUnitTestContext dbUnitTestContext; + + /** + * Setup the Database before running the test method. + * @throws Exception Any exception. + */ + @SuppressWarnings("unchecked") + @Before + protected void setUpDbUnit() throws Exception + { + dbUnitTestContext = new DbUnitTestContext(this, applicationContext); + dbUnitTestContext.setUpDbUnit(); + } +} Copied: tags/openutils-testing-junit-2.0/src/site/apt (from rev 550, trunk/openutils-testing-junit/src/site/apt) Deleted: tags/openutils-testing-junit-2.0/src/site/site.xml =================================================================== --- trunk/openutils-testing-junit/src/site/site.xml 2008-01-20 17:02:17 UTC (rev 536) +++ tags/openutils-testing-junit-2.0/src/site/site.xml 2008-01-27 11:23:26 UTC (rev 566) @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="Openutils"> - <bannerRight> - <name>Openutils</name> - <href>http://openutils.sourceforge.net</href> - </bannerRight> - <bannerLeft> - <name>Sourceforge</name> - <src>http://sourceforge.net/sflogo.php?group_id=150467&amp;type=2</src> - <href>http://openutils.sourceforge.net</href> - </bannerLeft> - <body> - <menu ref="modules" inherit="bottom" /> - <menu ref="reports" inherit="bottom" /> - <head> - <link rel="icon" href="images/favicon.ico" /> - </head> - </body> - <skin> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-maven-skin</artifactId> - </skin> -</project> Copied: tags/openutils-testing-junit-2.0/src/site/site.xml (from rev 537, trunk/openutils-testing-junit/src/site/site.xml) =================================================================== --- tags/openutils-testing-junit-2.0/src/site/site.xml (rev 0) +++ tags/openutils-testing-junit-2.0/src/site/site.xml 2008-01-27 11:23:26 UTC (rev 566) @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="Openutils testing (junit)"> + <publishDate position="left" format="yyyy-MM-dd" /> + <bannerRight> + <name>Openutils</name> + <src>http://openutils.sourceforge.net/images/openutils-logo.png</src> + <href>http://openutils.sourceforge.net</href> + </bannerRight> + <bannerLeft> + <name>Sourceforge</name> + <src>http://sourceforge.net/sflogo.php?group_id=150467&amp;type=2</src> + <href>http://www.sourceforge.net/projects/openutils</href> + </bannerLeft> + <body> + <head> + <link rel="icon" href="images/favicon.ico" /> + </head> + <menu name="openutils testing (junit)"> + <item name="Usage" href="index.html"></item> + </menu> + <menu ref="modules" inherit="bottom" /> + <menu ref="reports" inherit="bottom" /> + </body> + <skin> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-maven-skin</artifactId> + <version>1.0</version> + </skin> +</project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fc...@us...> - 2008-01-29 12:02:41
|
Revision: 571 http://openutils.svn.sourceforge.net/openutils/?rev=571&view=rev Author: fcarone Date: 2008-01-29 04:02:37 -0800 (Tue, 29 Jan 2008) Log Message: ----------- [maven-release-plugin] copy for tag openutils-usermanagement-dataobjects-2.0 Added Paths: ----------- tags/openutils-usermanagement-dataobjects-2.0/ tags/openutils-usermanagement-dataobjects-2.0/pom.xml tags/openutils-usermanagement-dataobjects-2.0/src/main/java/it/openutils/usermanagement/dataobjects/User.java Removed Paths: ------------- tags/openutils-usermanagement-dataobjects-2.0/pom.xml tags/openutils-usermanagement-dataobjects-2.0/src/main/java/it/openutils/usermanagement/dataobjects/User.java Copied: tags/openutils-usermanagement-dataobjects-2.0 (from rev 568, trunk/openutils-usermanagement-dataobjects) Deleted: tags/openutils-usermanagement-dataobjects-2.0/pom.xml =================================================================== --- trunk/openutils-usermanagement-dataobjects/pom.xml 2008-01-27 15:25:47 UTC (rev 568) +++ tags/openutils-usermanagement-dataobjects-2.0/pom.xml 2008-01-29 12:02:37 UTC (rev 571) @@ -1,74 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>7</version> - <relativePath>..</relativePath> - </parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-usermanagement-dataobjects</artifactId> - <packaging>jar</packaging> - <name>openutils usermanagement dataobjects</name> - <version>2.0-SNAPSHOT</version> - <description>Usermanagement dataobjects</description> - <dependencies> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-annotations</artifactId> - <version>3.2.0.ga</version> - <exclusions> - <exclusion> - <!-- not needed here, just load annotations --> - <groupId>org.hibernate</groupId> - <artifactId>hibernate</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.acegisecurity</groupId> - <artifactId>acegi-security</artifactId> - <version>1.0.6</version> - <exclusions> - <exclusion> - <groupId>org.springframework</groupId> - <artifactId>spring-remoting</artifactId> - </exclusion> - <exclusion> - <groupId>org.springframework</groupId> - <artifactId>spring-jdbc</artifactId> - </exclusion> - <exclusion> - <groupId>org.springframework</groupId> - <artifactId>spring-support</artifactId> - </exclusion> - <exclusion> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </exclusion> - <exclusion> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - </exclusion> - <exclusion> - <groupId>oro</groupId> - <artifactId>oro</artifactId> - </exclusion> - <exclusion> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - </exclusion> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-usermanagement-dataobjects-2.0/pom.xml (from rev 570, trunk/openutils-usermanagement-dataobjects/pom.xml) =================================================================== --- tags/openutils-usermanagement-dataobjects-2.0/pom.xml (rev 0) +++ tags/openutils-usermanagement-dataobjects-2.0/pom.xml 2008-01-29 12:02:37 UTC (rev 571) @@ -0,0 +1,79 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>7</version> + <relativePath>..</relativePath> + </parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-usermanagement-dataobjects</artifactId> + <packaging>jar</packaging> + <name>openutils usermanagement dataobjects</name> + <version>2.0</version> + <description>Usermanagement dataobjects</description> + <dependencies> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-annotations</artifactId> + <version>3.2.0.ga</version> + <exclusions> + <exclusion> + <!-- not needed here, just load annotations --> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.acegisecurity</groupId> + <artifactId>acegi-security</artifactId> + <version>1.0.6</version> + <exclusions> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-remoting</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-jdbc</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-support</artifactId> + </exclusion> + <exclusion> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + </exclusion> + <exclusion> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + </exclusion> + <exclusion> + <groupId>oro</groupId> + <artifactId>oro</artifactId> + </exclusion> + <exclusion> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + </exclusion> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-usermanagement-dataobjects-2.0</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-usermanagement-dataobjects-2.0</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-usermanagement-dataobjects-2.0</url> + </scm> +</project> \ No newline at end of file Deleted: tags/openutils-usermanagement-dataobjects-2.0/src/main/java/it/openutils/usermanagement/dataobjects/User.java =================================================================== --- trunk/openutils-usermanagement-dataobjects/src/main/java/it/openutils/usermanagement/dataobjects/User.java 2008-01-27 15:25:47 UTC (rev 568) +++ tags/openutils-usermanagement-dataobjects-2.0/src/main/java/it/openutils/usermanagement/dataobjects/User.java 2008-01-29 12:02:37 UTC (rev 571) @@ -1,301 +0,0 @@ -package it.openutils.usermanagement.dataobjects; - -import java.io.Serializable; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.Table; - -import org.acegisecurity.GrantedAuthority; -import org.acegisecurity.GrantedAuthorityImpl; -import org.acegisecurity.userdetails.UserDetails; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; -import org.hibernate.annotations.Fetch; -import org.hibernate.annotations.FetchMode; - - -/** - * @author fberar - * @version $Revision$ ($Author$) - */ -@Entity -@Table(name = "APP_USER") -public class User implements Serializable, UserDetails -{ - - /** - * stable serialVersionUID. - */ - private static final long serialVersionUID = 1L; - - @Id - @Column(name = "ID_USER", length = 50) - private String id; - - @Column(name = "PASSWORD", nullable = false, length = 50) - private String password; - - @Column(name = "ENABLED", nullable = false) - private Boolean enabled; - - @Column(name = "NAME", nullable = false, length = 80) - private String name; - - @Column(name = "SURNAME", nullable = false, length = 80) - private String lastname; - - @Column(name = "EMAIL", nullable = false, length = 150) - private String email; - - @ManyToMany(cascade = CascadeType.PERSIST, targetEntity = Group.class, fetch = FetchType.EAGER) - @Fetch(FetchMode.SUBSELECT) - @JoinTable(name = "APP_USER_GROUP", joinColumns = @JoinColumn(name = "ID_USER"), inverseJoinColumns = @JoinColumn(name = "ID_GROUP")) - private Set<Group> groups; - - public Set<Group> getGroups() - { - return groups; - } - - public void setGroups(Set<Group> groups) - { - this.groups = groups; - } - - /** - * Getter for <code>id</code>. - * @return Returns the id. - */ - public String getId() - { - return this.id; - } - - /** - * Setter for <code>id</code>. - * @param id The id to set. - */ - public void setId(String id) - { - this.id = id; - } - - public Boolean getEnabled() - { - return this.enabled; - } - - public void setEnabled(Boolean enabled) - { - this.enabled = enabled; - } - - public String getPassword() - { - return password; - } - - public void setPassword(String password) - { - this.password = password; - } - - public Set<Role> getRoles() - { - if (groups == null) - { - return null; - } - - Set<Role> roles = new HashSet<Role>(); - - for (Group group : groups) - { - roles.addAll(group.getRoles()); - } - - return roles; - } - - /** - * @see UserDetails.isAccountNonExpired() - */ - public boolean isAccountNonExpired() - { - return (this.enabled == null) ? false : this.enabled.booleanValue(); - } - - /** - * @see UserDetails.isAccountNonLocked() - */ - public boolean isAccountNonLocked() - { - return (this.enabled == null) ? false : this.enabled.booleanValue(); - } - - /** - * @see UserDetails.isCredentialsNonExpired() - */ - public boolean isCredentialsNonExpired() - { - return (this.enabled == null) ? false : this.enabled.booleanValue(); - } - - /** - * @see UserDetails.getAuthorities() - */ - public GrantedAuthority[] getAuthorities() - { - if (this.getRoles() == null) - { - return null; - } - - GrantedAuthority[] auths = new GrantedAuthorityImpl[this.getRoles().size()]; - Iterator<Role> iter = this.getRoles().iterator(); - int i = 0; - while (iter.hasNext()) - { - Role r = iter.next(); - auths[i] = new GrantedAuthorityImpl(r.getId()); - i++; - } - - return auths; - } - - /** - * @see UserDetails.getUsername() - */ - public String getUsername() - { - return this.id; - } - - /** - * @see UserDetails.isEnabled() - */ - public boolean isEnabled() - { - return Boolean.TRUE.equals(this.enabled); - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getSurname() - { - return lastname; - } - - public void setSurname(String surname) - { - this.lastname = surname; - } - - public void setLastname(String lastname) - { - this.lastname = lastname; - } - - public String getLastname() - { - return lastname; - } - - /** - * Getter for <code>email</code>. - * @return Returns the email. - */ - public String getEmail() - { - return this.email; - } - - /** - * Setter for <code>email</code>. - * @param email The email to set. - */ - public void setEmail(String email) - { - this.email = email; - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() - { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", this.id).append( - "enabled", - this.enabled).append("name", this.name).append("surname", this.lastname).append( - "authorities", - this.getAuthorities()).append("username", this.getUsername()).append("email", this.email).append( - "password", - this.password).toString(); - } - - /** - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() - { - final int PRIME = 31; - int result = 1; - result = PRIME * result + ((this.id == null) ? 0 : this.id.hashCode()); - return result; - } - - /** - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) - { - return false; - } - final User other = (User) obj; - if (this.id == null) - { - if (other.id != null) - { - return false; - } - } - else if (!this.id.equals(other.id)) - { - return false; - } - return true; - } - -} Copied: tags/openutils-usermanagement-dataobjects-2.0/src/main/java/it/openutils/usermanagement/dataobjects/User.java (from rev 569, trunk/openutils-usermanagement-dataobjects/src/main/java/it/openutils/usermanagement/dataobjects/User.java) =================================================================== --- tags/openutils-usermanagement-dataobjects-2.0/src/main/java/it/openutils/usermanagement/dataobjects/User.java (rev 0) +++ tags/openutils-usermanagement-dataobjects-2.0/src/main/java/it/openutils/usermanagement/dataobjects/User.java 2008-01-29 12:02:37 UTC (rev 571) @@ -0,0 +1,310 @@ +package it.openutils.usermanagement.dataobjects; + +import java.io.Serializable; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.Table; + +import org.acegisecurity.GrantedAuthority; +import org.acegisecurity.GrantedAuthorityImpl; +import org.acegisecurity.userdetails.UserDetails; +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; + + +/** + * @author fberar + * @version $Revision$ ($Author$) + */ +@Entity +@Table(name = "APP_USER") +public class User implements Serializable, UserDetails +{ + + /** + * stable serialVersionUID. + */ + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "ID_USER", length = 50) + private String id; + + @Column(name = "PASSWORD", nullable = false, length = 50) + private String password; + + @Column(name = "ENABLED", nullable = false) + private Boolean enabled; + + @Column(name = "NAME", nullable = false, length = 80) + private String name; + + @Column(name = "SURNAME", nullable = false, length = 80) + private String lastname; + + @Column(name = "EMAIL", nullable = false, length = 150) + private String email; + + @ManyToMany(cascade = CascadeType.PERSIST, targetEntity = Group.class, fetch = FetchType.EAGER) + @Fetch(FetchMode.SUBSELECT) + @JoinTable(name = "APP_USER_GROUP", joinColumns = @JoinColumn(name = "ID_USER"), inverseJoinColumns = @JoinColumn(name = "ID_GROUP")) + private Set<Group> groups; + + public Set<Group> getGroups() + { + return groups; + } + + public void setGroups(Set<Group> groups) + { + this.groups = groups; + } + + /** + * Getter for <code>id</code>. + * @return Returns the id. + */ + public String getId() + { + return this.id; + } + + /** + * Setter for <code>id</code>. + * @param id The id to set. + */ + public void setId(String id) + { + this.id = id; + } + + public Boolean getEnabled() + { + return this.enabled; + } + + public void setEnabled(Boolean enabled) + { + this.enabled = enabled; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + /** + * @return The set of roles related to the user. It returns null if the user is not in any group, or an empty set + * if the groups the user is in, do not belong to any role. + */ + public Set<Role> getRoles() + { + if (groups == null) + { + return null; + } + + Set<Role> roles = new HashSet<Role>(); + + for (Group group : groups) + { + Set<Role> groupRoles = group.getRoles(); + if (groupRoles == null) + { + continue; + } + roles.addAll(groupRoles); + } + + return roles; + } + + /** + * @see UserDetails.isAccountNonExpired() + */ + public boolean isAccountNonExpired() + { + return (this.enabled == null) ? false : this.enabled.booleanValue(); + } + + /** + * @see UserDetails.isAccountNonLocked() + */ + public boolean isAccountNonLocked() + { + return (this.enabled == null) ? false : this.enabled.booleanValue(); + } + + /** + * @see UserDetails.isCredentialsNonExpired() + */ + public boolean isCredentialsNonExpired() + { + return (this.enabled == null) ? false : this.enabled.booleanValue(); + } + + /** + * @see UserDetails.getAuthorities() + */ + public GrantedAuthority[] getAuthorities() + { + if (this.getRoles() == null) + { + return null; + } + + GrantedAuthority[] auths = new GrantedAuthorityImpl[this.getRoles().size()]; + Iterator<Role> iter = this.getRoles().iterator(); + int i = 0; + while (iter.hasNext()) + { + Role r = iter.next(); + auths[i] = new GrantedAuthorityImpl(r.getId()); + i++; + } + + return auths; + } + + /** + * @see UserDetails.getUsername() + */ + public String getUsername() + { + return this.id; + } + + /** + * @see UserDetails.isEnabled() + */ + public boolean isEnabled() + { + return Boolean.TRUE.equals(this.enabled); + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getSurname() + { + return lastname; + } + + public void setSurname(String surname) + { + this.lastname = surname; + } + + public void setLastname(String lastname) + { + this.lastname = lastname; + } + + public String getLastname() + { + return lastname; + } + + /** + * Getter for <code>email</code>. + * @return Returns the email. + */ + public String getEmail() + { + return this.email; + } + + /** + * Setter for <code>email</code>. + * @param email The email to set. + */ + public void setEmail(String email) + { + this.email = email; + } + + /** + * @see java.lang.Object#toString() + */ + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", this.id).append( + "enabled", + this.enabled).append("name", this.name).append("surname", this.lastname).append( + "authorities", + this.getAuthorities()).append("username", this.getUsername()).append("email", this.email).append( + "password", + this.password).toString(); + } + + /** + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() + { + final int PRIME = 31; + int result = 1; + result = PRIME * result + ((this.id == null) ? 0 : this.id.hashCode()); + return result; + } + + /** + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (getClass() != obj.getClass()) + { + return false; + } + final User other = (User) obj; + if (this.id == null) + { + if (other.id != null) + { + return false; + } + } + else if (!this.id.equals(other.id)) + { + return false; + } + return true; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2008-01-30 21:24:08
|
Revision: 576 http://openutils.svn.sourceforge.net/openutils/?rev=576&view=rev Author: fgiust Date: 2008-01-30 13:24:08 -0800 (Wed, 30 Jan 2008) Log Message: ----------- [maven-release-plugin] copy for tag openutils-testing-junit-2.0.1 Added Paths: ----------- tags/openutils-testing-junit-2.0.1/ tags/openutils-testing-junit-2.0.1/pom.xml tags/openutils-testing-junit-2.0.1/src/ Removed Paths: ------------- tags/openutils-testing-junit-2.0.1/pom.xml tags/openutils-testing-junit-2.0.1/src/ Copied: tags/openutils-testing-junit-2.0.1 (from rev 574, trunk/openutils-testing-junit) Deleted: tags/openutils-testing-junit-2.0.1/pom.xml =================================================================== --- trunk/openutils-testing-junit/pom.xml 2008-01-30 21:23:24 UTC (rev 574) +++ tags/openutils-testing-junit-2.0.1/pom.xml 2008-01-30 21:24:08 UTC (rev 576) @@ -1,160 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>7</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-testing-junit</artifactId> - <name>openutils test utils (junit)</name> - <version>2.0.1-SNAPSHOT</version> - <description>openutils test utils</description> - <dependencies> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-testing</artifactId> - <version>2.0</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.4.3</version> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.13</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-orm</artifactId> - <version>${spring.version}</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.dbunit</groupId> - <artifactId>dbunit</artifactId> - <version>2.2</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.4</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate</artifactId> - <version>3.2.1.ga</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - <version>10.2.2.0</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>commons-dbcp</groupId> - <artifactId>commons-dbcp</artifactId> - <version>1.2.1</version> - <scope>test</scope> - <exclusions> - <exclusion> - <artifactId>xerces</artifactId> - <groupId>xerces</groupId> - </exclusion> - <exclusion> - <artifactId>xml-apis</artifactId> - <groupId>xml-apis</groupId> - </exclusion> - <exclusion> - <artifactId>commons-logging</artifactId> - <groupId>commons-logging</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-jdbc</artifactId> - <version>${spring.version}</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - <properties> - <spring.version>2.5.1</spring.version> - </properties> -</project> \ No newline at end of file Copied: tags/openutils-testing-junit-2.0.1/pom.xml (from rev 575, trunk/openutils-testing-junit/pom.xml) =================================================================== --- tags/openutils-testing-junit-2.0.1/pom.xml (rev 0) +++ tags/openutils-testing-junit-2.0.1/pom.xml 2008-01-30 21:24:08 UTC (rev 576) @@ -0,0 +1,165 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>7</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-testing-junit</artifactId> + <name>openutils test utils (junit)</name> + <version>2.0.1</version> + <description>openutils test utils</description> + <dependencies> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-testing</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.3</version> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.13</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-orm</artifactId> + <version>${spring.version}</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.dbunit</groupId> + <artifactId>dbunit</artifactId> + <version>2.2</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.4</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.2.1.ga</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.2.2.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>commons-dbcp</groupId> + <artifactId>commons-dbcp</artifactId> + <version>1.2.1</version> + <scope>test</scope> + <exclusions> + <exclusion> + <artifactId>xerces</artifactId> + <groupId>xerces</groupId> + </exclusion> + <exclusion> + <artifactId>xml-apis</artifactId> + <groupId>xml-apis</groupId> + </exclusion> + <exclusion> + <artifactId>commons-logging</artifactId> + <groupId>commons-logging</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-jdbc</artifactId> + <version>${spring.version}</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + <properties> + <spring.version>2.5.1</spring.version> + </properties> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-junit-2.0.1</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-junit-2.0.1</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-testing-junit-2.0.1</url> + </scm> +</project> \ No newline at end of file Copied: tags/openutils-testing-junit-2.0.1/src (from rev 573, trunk/openutils-testing-junit/src) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2008-01-31 22:19:50
|
Revision: 581 http://openutils.svn.sourceforge.net/openutils/?rev=581&view=rev Author: fgiust Date: 2008-01-31 14:19:56 -0800 (Thu, 31 Jan 2008) Log Message: ----------- [maven-release-plugin] copy for tag openutils-testing-2.0.2 Added Paths: ----------- tags/openutils-testing-2.0.2/ tags/openutils-testing-2.0.2/pom.xml tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitConfiguration.java tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitExecution.java tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitTestContext.java tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitUtils.java tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/RegExpTableFilter.java tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/dbunit/ tags/openutils-testing-2.0.2/src/site/apt/dbunit.apt tags/openutils-testing-2.0.2/src/site/apt/index.apt tags/openutils-testing-2.0.2/src/site/changes/ tags/openutils-testing-2.0.2/src/site/changes/changes.xml tags/openutils-testing-2.0.2/src/site/site.xml Removed Paths: ------------- tags/openutils-testing-2.0.2/pom.xml tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitConfiguration.java tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitExecution.java tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitTestContext.java tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitUtils.java tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/RegExpTableFilter.java tags/openutils-testing-2.0.2/src/site/apt/index.apt tags/openutils-testing-2.0.2/src/site/changes/changes.xml tags/openutils-testing-2.0.2/src/site/site.xml Copied: tags/openutils-testing-2.0.2 (from rev 539, trunk/openutils-testing) Deleted: tags/openutils-testing-2.0.2/pom.xml =================================================================== --- trunk/openutils-testing/pom.xml 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0.2/pom.xml 2008-01-31 22:19:56 UTC (rev 581) @@ -1,65 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>6</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-testing</artifactId> - <name>openutils test utils</name> - <version>2.0-SNAPSHOT</version> - <description>openutils test utils</description> - <dependencies> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl104-over-slf4j</artifactId> - <version>1.4.1</version> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.dbunit</groupId> - <artifactId>dbunit</artifactId> - <version>2.2</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>junit-addons</groupId> - <artifactId>junit-addons</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - <properties> - <spring.version>2.5.1</spring.version> - </properties> -</project> Copied: tags/openutils-testing-2.0.2/pom.xml (from rev 580, trunk/openutils-testing/pom.xml) =================================================================== --- tags/openutils-testing-2.0.2/pom.xml (rev 0) +++ tags/openutils-testing-2.0.2/pom.xml 2008-01-31 22:19:56 UTC (rev 581) @@ -0,0 +1,70 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>7</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-testing</artifactId> + <name>openutils test utils</name> + <version>2.0.2</version> + <description>openutils test utils</description> + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl104-over-slf4j</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.dbunit</groupId> + <artifactId>dbunit</artifactId> + <version>2.2</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>junit-addons</groupId> + <artifactId>junit-addons</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + <properties> + <spring.version>2.5.1</spring.version> + </properties> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-2.0.2</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-2.0.2</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-testing-2.0.2</url> + </scm> +</project> Deleted: tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitConfiguration.java =================================================================== --- trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitConfiguration.java 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitConfiguration.java 2008-01-31 22:19:56 UTC (rev 581) @@ -1,38 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - - -/** - * @author fgiust - * @version $Id: $ - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -@Inherited -@Documented -public @interface DbUnitConfiguration { - - DbUnitExecution[] dbUnitExecutions() default {}; - -} \ No newline at end of file Copied: tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitConfiguration.java (from rev 549, trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitConfiguration.java) =================================================================== --- tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitConfiguration.java (rev 0) +++ tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitConfiguration.java 2008-01-31 22:19:56 UTC (rev 581) @@ -0,0 +1,44 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + + +/** + * A DbUnitConfiguration can contain one or more {@link DbUnitExecution}. + * @author fgiust + * @version $Id: $ + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Inherited +@Documented +public @interface DbUnitConfiguration { + + /** + * Array of {@link DbUnitExecution} + */ + DbUnitExecution[] dbUnitExecutions() default { + + }; + +} \ No newline at end of file Deleted: tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitExecution.java =================================================================== --- trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitExecution.java 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitExecution.java 2008-01-31 22:19:56 UTC (rev 581) @@ -1,55 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.dbunit.operation.DatabaseOperation; - - -/** - * @author fgiust - * @version $Id: $ - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -@Inherited -@Documented -public @interface DbUnitExecution { - - /** - * The resource locations to use for loading dbunit dataset. - */ - String[] datasets() default {}; - - String dataSource() default ""; - - String schema() default ""; - - String excludedTables() default "(^\\$(.*))"; // oracle recycle bin - - boolean truncateAll() default true; - - Class< ? extends DatabaseOperation> truncateOperation() default org.dbunit.operation.TruncateTableOperation.class; - - Class< ? extends DatabaseOperation> insertOperation() default org.dbunit.operation.InsertOperation.class; - -} \ No newline at end of file Copied: tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitExecution.java (from rev 578, trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitExecution.java) =================================================================== --- tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitExecution.java (rev 0) +++ tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitExecution.java 2008-01-31 22:19:56 UTC (rev 581) @@ -0,0 +1,77 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.dbunit.operation.DatabaseOperation; + + +/** + * @author fgiust + * @version $Id: $ + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Inherited +@Documented +public @interface DbUnitExecution { + + /** + * The resource locations to use for loading dbunit dataset. + */ + String[] datasets() default { + + }; + + /** + * The name of the datasource to use. If can be left unset only if there is only one DataSource available in the + * Spring context. + */ + String dataSource() default ""; + + /** + * Db schema name that will be given to dbUnit. Can be left unset if not needed (database specific) + */ + String schema() default ""; + + /** + * A regexp that can match table names. Any table matching this regular expression will not be considered by DbUnit. + * By default tables starting with $ are ignored (oracle recycle bin). + */ + String excludedTables() default "(^\\$(.*))"; // oracle recycle bin + + /** + * If true, <strong>all</strong> the tables in the database will be truncated before loading any dataset. + */ + boolean truncateAll() default true; + + /** + * The database operation that will be used to truncate tables. Defaults to org.dbunit.operation.DeleteAllOperation + */ + Class< ? extends DatabaseOperation> truncateOperation() default org.dbunit.operation.DeleteAllOperation.class; + + /** + * The database operation that will be used to load datasets. Defaults to org.dbunit.operation.InsertOperation + */ + Class< ? extends DatabaseOperation> insertOperation() default org.dbunit.operation.InsertOperation.class; + +} \ No newline at end of file Deleted: tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitTestContext.java =================================================================== --- trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitTestContext.java 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitTestContext.java 2008-01-31 22:19:56 UTC (rev 581) @@ -1,246 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing; - -import java.io.IOException; -import java.net.URL; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.Map; - -import javax.sql.DataSource; - -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.lang.StringUtils; -import org.dbunit.DatabaseUnitException; -import org.dbunit.database.DatabaseConnection; -import org.dbunit.database.DatabaseSequenceFilter; -import org.dbunit.database.IDatabaseConnection; -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.FilteredDataSet; -import org.dbunit.dataset.IDataSet; -import org.dbunit.dataset.filter.ITableFilter; -import org.dbunit.dataset.filter.SequenceTableFilter; -import org.dbunit.operation.DatabaseOperation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.ApplicationContext; - - -/** - * @author fgiust - * @version $Id: $ - */ -public class DbUnitTestContext -{ - - /** - * Logger. - */ - private static Logger log = LoggerFactory.getLogger(DbUnitTestContext.class); - - private Object testcase; - - private ApplicationContext applicationContext; - - /** - * Dataset cache. - */ - private Map<String, IDataSet> datasetCache = new HashMap<String, IDataSet>(); - - /** - * Truncate dataset cache. This is kept as a static attribute since the creation of the dataset is very expensive - * and it doesn't change across tests. - */ - protected static Map<String, IDataSet> truncateDataSetCache = new HashMap<String, IDataSet>(); - - public DbUnitTestContext(Object testcase, ApplicationContext applicationContext) - { - this.testcase = testcase; - this.applicationContext = applicationContext; - } - - /** - * Setup the Database before running the test method. - * @throws Exception Any exception. - */ - @SuppressWarnings("unchecked") - public void setUpDbUnit() throws Exception - { - DbUnitExecution singleDbUnitExecution = testcase.getClass().getAnnotation(DbUnitExecution.class); - - DbUnitExecution[] executions; - if (singleDbUnitExecution != null) - { - executions = new DbUnitExecution[]{singleDbUnitExecution }; - } - else - { - DbUnitConfiguration dbUnitConfiguration = testcase.getClass().getAnnotation(DbUnitConfiguration.class); - executions = dbUnitConfiguration.dbUnitExecutions(); - } - - for (DbUnitExecution dbUnitExecution : executions) - { - String[] datasets = dbUnitExecution.datasets(); - String dataSourceName = dbUnitExecution.dataSource(); - String schema = dbUnitExecution.schema(); - if (StringUtils.isEmpty(schema)) - { - schema = null; - } - - IDatabaseConnection connection = new DatabaseConnection( - getDatasource(dataSourceName).getConnection(), - schema); - - try - { - ITableFilter tableFilter = new RegExpTableFilter(dbUnitExecution.excludedTables()); - - if (dbUnitExecution.truncateAll()) - { - truncateAll(connection, tableFilter, dataSourceName, dbUnitExecution - .truncateOperation() - .newInstance()); - } - - DatabaseOperation dbOperation = dbUnitExecution.insertOperation().newInstance(); - for (String datasetFile : datasets) - { - importDataSet(createDataset(datasetFile), connection, tableFilter, dataSourceName, dbOperation); - } - } - finally - { - connection.close(); - } - } - } - - /** - * @param datasetFile - * @return - * @throws IOException - * @throws DataSetException - */ - private IDataSet createDataset(String datasetFile) throws IOException, DataSetException - { - IDataSet dataSet = datasetCache.get(datasetFile); - if (dataSet == null) - { - URL datasetUrl = getClass().getResource(datasetFile); - if (datasetUrl == null) - { - throw new IllegalArgumentException("Dataset " + datasetFile + " not found"); - } - dataSet = DbUnitUtils.loadDataset(datasetUrl); - datasetCache.put(datasetFile, dataSet); - } - return dataSet; - } - - private void importDataSet(IDataSet dataSet, IDatabaseConnection connection, ITableFilter tableFilter, - String dataSourceName, DatabaseOperation databaseOperation) throws SQLException, DataSetException, - DatabaseUnitException - { - - if (dataSet == null) - { - throw new IllegalArgumentException("dataSet is null"); - } - - IDataSet orderedDataset = new FilteredDataSet(tableFilter, dataSet); - if (log.isDebugEnabled()) - { - log.debug("Tables: {}", ArrayUtils.toString(orderedDataset.getTableNames())); - } - - // if a sorted dataset is available, use table sequence for sorting - IDataSet truncateDataSet = getTruncateDataset(dataSourceName, connection.getSchema()); - if (truncateDataSet != null) - { - ITableFilter filter = new SequenceTableFilter(truncateDataSet.getTableNames()); - orderedDataset = new FilteredDataSet(filter, dataSet); - } - - if (dataSet != null) - { - databaseOperation.execute(connection, orderedDataset); - } - - } - - /** - * @param connection - * @param tableFilter - * @throws SQLException - * @throws DataSetException - * @throws DatabaseUnitException - */ - private void truncateAll(IDatabaseConnection connection, ITableFilter tableFilter, String dataSourceName, - DatabaseOperation databaseOperation) throws SQLException, DataSetException, DatabaseUnitException - { - IDataSet truncateDataSet = getTruncateDataset(dataSourceName, connection.getSchema()); - if (truncateDataSet == null) - { - log.debug("Generating sorted dataset for initial cleanup"); - IDataSet unsortedDataSet = connection.createDataSet(); - - log.debug("Unfiltered truncateDataSet: {}", ArrayUtils.toString(unsortedDataSet.getTableNames())); - - ITableFilter filter = new DatabaseSequenceFilter(connection, new FilteredDataSet( - tableFilter, - unsortedDataSet).getTableNames()); - truncateDataSet = new FilteredDataSet(tableFilter, new FilteredDataSet(filter, unsortedDataSet)); - storeTruncateDataset(dataSourceName, connection.getSchema(), truncateDataSet); - log.debug("Sorted dataset generated"); - } - - log.debug("Tables truncateDataSet: {}", ArrayUtils.toString(truncateDataSet.getTableNames())); - if (truncateDataSet != null) - { - databaseOperation.execute(connection, truncateDataSet); - } - } - - private IDataSet getTruncateDataset(String datasourceName, String schema) - { - return truncateDataSetCache.get(datasourceName + "_" + StringUtils.defaultString(schema)); - } - - private IDataSet storeTruncateDataset(String datasourceName, String schema, IDataSet dataset) - { - return truncateDataSetCache.put(datasourceName + "_" + StringUtils.defaultString(schema), dataset); - } - - @SuppressWarnings("unchecked") - protected DataSource getDatasource(String name) - { - if (StringUtils.isEmpty(name)) - { - Map<String, DataSource> dsMap = applicationContext.getBeansOfType(DataSource.class); - if (dsMap == null || dsMap.size() != 1) - { - throw new RuntimeException( - "Unable to find a datasource in spring applicationContext, please specify the datasource bean name " - + "using the \"datasource\" attribute of @DbUnitConfiguration"); - } - return dsMap.values().iterator().next(); - } - return (DataSource) applicationContext.getBean(name); - } -} Copied: tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitTestContext.java (from rev 578, trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitTestContext.java) =================================================================== --- tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitTestContext.java (rev 0) +++ tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitTestContext.java 2008-01-31 22:19:56 UTC (rev 581) @@ -0,0 +1,328 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing; + +import java.io.IOException; +import java.net.URL; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang.StringUtils; +import org.dbunit.DatabaseUnitException; +import org.dbunit.database.DatabaseConnection; +import org.dbunit.database.DatabaseSequenceFilter; +import org.dbunit.database.IDatabaseConnection; +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.FilteredDataSet; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.filter.ITableFilter; +import org.dbunit.dataset.filter.SequenceTableFilter; +import org.dbunit.operation.DatabaseOperation; +import org.dbunit.operation.DeleteAllOperation; +import org.dbunit.operation.DeleteOperation; +import org.dbunit.operation.InsertOperation; +import org.dbunit.operation.RefreshOperation; +import org.dbunit.operation.TruncateTableOperation; +import org.dbunit.operation.UpdateOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.ApplicationContext; + + +/** + * @author fgiust + * @version $Id: $ + */ +public class DbUnitTestContext +{ + + /** + * Truncate dataset cache. This is kept as a static attribute since the creation of the dataset is very expensive + * and it doesn't change across tests. + */ + protected static Map<String, IDataSet> truncateDataSetCache = new HashMap<String, IDataSet>(); + + /** + * Logger. + */ + private static Logger log = LoggerFactory.getLogger(DbUnitTestContext.class); + + /** + * The test instance. + */ + private Object testcase; + + /** + * Spring application context. + */ + private ApplicationContext applicationContext; + + /** + * Dataset cache. + */ + private Map<String, IDataSet> datasetCache = new HashMap<String, IDataSet>(); + + /** + * Instantiates a new DbUnitTestContext + * @param testcase test instance + * @param applicationContext Spring application context + */ + public DbUnitTestContext(Object testcase, ApplicationContext applicationContext) + { + this.testcase = testcase; + this.applicationContext = applicationContext; + } + + /** + * Setup the Database before running the test method. + * @throws Exception Any exception. + */ + @SuppressWarnings("unchecked") + public void setUpDbUnit() throws Exception + { + DbUnitExecution singleDbUnitExecution = testcase.getClass().getAnnotation(DbUnitExecution.class); + + DbUnitExecution[] executions = null; + if (singleDbUnitExecution != null) + { + executions = new DbUnitExecution[]{singleDbUnitExecution }; + } + else + { + DbUnitConfiguration dbUnitConfiguration = testcase.getClass().getAnnotation(DbUnitConfiguration.class); + if (dbUnitConfiguration != null) + { + executions = dbUnitConfiguration.dbUnitExecutions(); + } + } + if (executions != null) + { + for (DbUnitExecution dbUnitExecution : executions) + { + String[] datasets = dbUnitExecution.datasets(); + String dataSourceName = dbUnitExecution.dataSource(); + String schema = dbUnitExecution.schema(); + if (StringUtils.isEmpty(schema)) + { + schema = null; + } + + IDatabaseConnection connection = new DatabaseConnection( + getDatasource(dataSourceName).getConnection(), + schema); + + try + { + ITableFilter tableFilter = new RegExpTableFilter(dbUnitExecution.excludedTables()); + + if (dbUnitExecution.truncateAll()) + { + truncateAll(connection, tableFilter, dataSourceName, getDatabaseOperation(dbUnitExecution + .truncateOperation())); + } + + DatabaseOperation dbOperation = getDatabaseOperation(dbUnitExecution.insertOperation()); + for (String datasetFile : datasets) + { + importDataSet(createDataset(datasetFile), connection, tableFilter, dataSourceName, dbOperation); + } + } + finally + { + connection.close(); + } + } + } + } + + /** + * Instantiates the givec Database Operation. Standard operations in the <code>org.dbunit.operation</code> package + * have protected constructors and needs to be accessed using the public static fields in + * <code>org.dbunit.operation.DatabaseOperation</code>. + * @param dboperationClass db operation class + * @return db operation instance + * @throws InstantiationException if the given db operation class cannot be instantiated + * @throws IllegalAccessException if the given db operation class cannot be instantiated + */ + private DatabaseOperation getDatabaseOperation(Class< ? extends DatabaseOperation> dboperationClass) + throws InstantiationException, IllegalAccessException + { + if (UpdateOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.UPDATE; + } + else if (InsertOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.INSERT; + } + else if (RefreshOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.REFRESH; + } + else if (DeleteOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.DELETE; + } + else if (DeleteAllOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.DELETE_ALL; + } + else if (TruncateTableOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.TRUNCATE_TABLE; + } + else if (DeleteOperation.class.equals(dboperationClass)) + { + return DatabaseOperation.UPDATE; + } + + return dboperationClass.newInstance(); + + } + + /** + * Creates a dataset instance by fetching a file from the classpath + * @param datasetFile name of the file, will be loaded from the classpath + * @return IDataSet instance + * @throws IOException + * @throws DataSetException + */ + private IDataSet createDataset(String datasetFile) throws IOException, DataSetException + { + IDataSet dataSet = datasetCache.get(datasetFile); + if (dataSet == null) + { + URL datasetUrl = getClass().getResource(datasetFile); + if (datasetUrl == null) + { + throw new IllegalArgumentException("Dataset " + datasetFile + " not found"); + } + dataSet = DbUnitUtils.loadDataset(datasetUrl); + datasetCache.put(datasetFile, dataSet); + } + return dataSet; + } + + private void importDataSet(IDataSet dataSet, IDatabaseConnection connection, ITableFilter tableFilter, + String dataSourceName, DatabaseOperation databaseOperation) throws SQLException, DataSetException, + DatabaseUnitException + { + + if (dataSet == null) + { + throw new IllegalArgumentException("dataSet is null"); + } + + IDataSet orderedDataset = new FilteredDataSet(tableFilter, dataSet); + if (log.isDebugEnabled()) + { + log.debug("Tables: {}", ArrayUtils.toString(orderedDataset.getTableNames())); + } + + // if a sorted dataset is available, use table sequence for sorting + IDataSet truncateDataSet = getTruncateDataset(dataSourceName, connection.getSchema()); + if (truncateDataSet != null) + { + ITableFilter filter = new SequenceTableFilter(truncateDataSet.getTableNames()); + orderedDataset = new FilteredDataSet(filter, dataSet); + } + + if (dataSet != null) + { + databaseOperation.execute(connection, orderedDataset); + } + + } + + /** + * @param connection + * @param tableFilter + * @throws SQLException + * @throws DataSetException + * @throws DatabaseUnitException + */ + private void truncateAll(IDatabaseConnection connection, ITableFilter tableFilter, String dataSourceName, + DatabaseOperation databaseOperation) throws SQLException, DataSetException, DatabaseUnitException + { + IDataSet truncateDataSet = getTruncateDataset(dataSourceName, connection.getSchema()); + if (truncateDataSet == null) + { + log.debug("Generating sorted dataset for initial cleanup"); + IDataSet unsortedDataSet = connection.createDataSet(); + + if (log.isDebugEnabled()) + { + log.debug("Unfiltered truncateDataSet: {}", ArrayUtils.toString(unsortedDataSet.getTableNames())); + } + + // excluded unwanted tables + unsortedDataSet = new FilteredDataSet(tableFilter, unsortedDataSet); + + // sort tables + ITableFilter sortingFilter = new DatabaseSequenceFilter(connection, unsortedDataSet.getTableNames()); + truncateDataSet = new FilteredDataSet(sortingFilter, unsortedDataSet); + + storeTruncateDataset(dataSourceName, connection.getSchema(), truncateDataSet); + log.debug("Sorted dataset generated"); + } + + if (truncateDataSet != null) + { + if (log.isDebugEnabled()) + { + log.debug("Tables truncateDataSet: {}", ArrayUtils.toString(truncateDataSet.getTableNames())); + } + databaseOperation.execute(connection, truncateDataSet); + } + } + + private IDataSet getTruncateDataset(String datasourceName, String schema) + { + return truncateDataSetCache.get(datasourceName + "_" + StringUtils.defaultString(schema)); + } + + private IDataSet storeTruncateDataset(String datasourceName, String schema, IDataSet dataset) + { + return truncateDataSetCache.put(datasourceName + "_" + StringUtils.defaultString(schema), dataset); + } + + /** + * Loads a named datasource from the spring context. + * @param name datasource name. + * @return Datasource instance + */ + @SuppressWarnings("unchecked") + protected DataSource getDatasource(String name) + { + if (StringUtils.isEmpty(name)) + { + Map<String, DataSource> dsMap = applicationContext.getBeansOfType(DataSource.class); + if (dsMap == null || dsMap.size() != 1) + { + throw new RuntimeException( + "Unable to find a datasource in spring applicationContext, please specify the datasource bean name " + + "using the \"datasource\" attribute of @DbUnitConfiguration"); + } + return dsMap.values().iterator().next(); + } + return (DataSource) applicationContext.getBean(name); + } + +} Deleted: tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitUtils.java =================================================================== --- trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitUtils.java 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitUtils.java 2008-01-31 22:19:56 UTC (rev 581) @@ -1,115 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; -import java.sql.SQLException; - -import org.apache.commons.lang.StringUtils; -import org.dbunit.database.IDatabaseConnection; -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.FilteredDataSet; -import org.dbunit.dataset.IDataSet; -import org.dbunit.dataset.excel.XlsDataSet; -import org.dbunit.dataset.xml.XmlDataSet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * @author fgiust - * @version $Id: $ - */ -public final class DbUnitUtils -{ - - /** - * Logger. - */ - private static Logger log = LoggerFactory.getLogger(DbUnitUtils.class); - - /** - * @param connection - * @param tableNames - * @param file - * @param xls - * @throws SQLException - * @throws IOException - * @throws DataSetException - */ - public static void exportDataset(IDatabaseConnection connection, String[] tableNames, File file) - throws SQLException, IOException, DataSetException - { - OutputStream fos = null; - - try - { - IDataSet fullDataSet = connection.createDataSet(); - - if (tableNames != null && tableNames.length > 0) - { - fullDataSet = new FilteredDataSet(tableNames, fullDataSet); - } - - fos = new FileOutputStream(file); - if (StringUtils.equalsIgnoreCase(StringUtils.substringAfterLast(file.getName(), "."), "xls")) - { - XlsDataSet.write(fullDataSet, fos); - } - else - { - XmlDataSet.write(fullDataSet, fos); - } - } - finally - { - connection.close(); - fos.close(); - } - - log.debug("Dataset exported at {}", file.getAbsolutePath()); - } - - /** - * @param url - * @return - * @throws IOException - * @throws DataSetException - */ - public static IDataSet loadDataset(URL url) throws IOException, DataSetException - { - if (url == null) - { - throw new IllegalArgumentException("URL is null"); - } - InputStream is = url.openStream(); - IDataSet dataSet = null; - - if (is != null) - { - log.debug("loading dataset {}", url.getFile()); - dataSet = url.getFile().endsWith(".xls") ? new XlsDataSet(is) : new XmlDataSet(is); - is.close(); - } - return dataSet; - } - -} Copied: tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitUtils.java (from rev 579, trunk/openutils-testing/src/main/java/it/openutils/testing/DbUnitUtils.java) =================================================================== --- tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitUtils.java (rev 0) +++ tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/DbUnitUtils.java 2008-01-31 22:19:56 UTC (rev 581) @@ -0,0 +1,155 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URL; +import java.sql.SQLException; + +import org.apache.commons.lang.StringUtils; +import org.dbunit.database.IDatabaseConnection; +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.FilteredDataSet; +import org.dbunit.dataset.IDataSet; +import org.dbunit.dataset.excel.XlsDataSet; +import org.dbunit.dataset.filter.ITableFilter; +import org.dbunit.dataset.xml.XmlDataSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * @author fgiust + * @version $Id: $ + */ +public final class DbUnitUtils +{ + + /** + * Logger. + */ + private static Logger log = LoggerFactory.getLogger(DbUnitUtils.class); + + /** + * Do not instantiate. + */ + private DbUnitUtils() + { + // do not instantiate + } + + /** + * Exports a list of table to an xml/xsl file + * @param file The file name we save the dataset to + * @param connection connection to use + * @param tableNames optional list of table names + * @throws IOException An IO Exception. + * @throws DataSetException A dataset exception. + * @throws SQLException A SQL Exception. + */ + public static void exportDataset(IDatabaseConnection connection, String[] tableNames, File file) + throws SQLException, IOException, DataSetException + { + OutputStream fos = null; + + try + { + IDataSet fullDataSet = connection.createDataSet(); + + if (tableNames != null && tableNames.length > 0) + { + fullDataSet = new FilteredDataSet(tableNames, fullDataSet); + } + + fos = new FileOutputStream(file); + if (StringUtils.equalsIgnoreCase(StringUtils.substringAfterLast(file.getName(), "."), "xls")) + { + XlsDataSet.write(fullDataSet, fos); + } + else + { + XmlDataSet.write(fullDataSet, fos); + } + } + finally + { + fos.close(); + } + + log.debug("Dataset exported at {}", file.getAbsolutePath()); + } + + /** + * Exports a full db saving a dataset for each table. + * @param connection dbunit connection + * @param directory export directory + * @param xls if <code>true</code> export will be done using excel datasets + * @param tableFilter optional table filter + * @throws SQLException sql exception + * @throws DataSetException dbunit exception + * @throws IOException IO exception + */ + public void exportTablesToDir(IDatabaseConnection connection, File directory, boolean xls, ITableFilter tableFilter) + throws SQLException, DataSetException, IOException + + { + directory.mkdirs(); + + IDataSet dataset = connection.createDataSet(); + if (tableFilter != null) + { + dataset = new FilteredDataSet(tableFilter, dataset); + } + + String[] tablenames = dataset.getTableNames(); + + for (String table : tablenames) + { + File exportFile = new File(directory, table + (xls ? ".xls" : ".xml")); + log.info("Exporting {}", table); + DbUnitUtils.exportDataset(connection, new String[]{table }, exportFile); + } + } + + /** + * @param url dataset url (can be an xml or excel file) + * @return loaded dataset + * @throws IOException error reading the file + * @throws DataSetException error loading the dataset + */ + public static IDataSet loadDataset(URL url) throws IOException, DataSetException + { + if (url == null) + { + throw new IllegalArgumentException("URL is null"); + } + InputStream is = url.openStream(); + IDataSet dataSet = null; + + if (is != null) + { + log.debug("loading dataset {}", url.getFile()); + dataSet = url.getFile().endsWith(".xls") ? new XlsDataSet(is) : new XmlDataSet(is); + is.close(); + } + return dataSet; + } + +} Deleted: tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/RegExpTableFilter.java =================================================================== --- trunk/openutils-testing/src/main/java/it/openutils/testing/RegExpTableFilter.java 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/RegExpTableFilter.java 2008-01-31 22:19:56 UTC (rev 581) @@ -1,50 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package it.openutils.testing; - -import java.util.regex.Pattern; - -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.filter.AbstractTableFilter; - - -/** - * @author fgiust - * @version $Id: $ - */ -public class RegExpTableFilter extends AbstractTableFilter -{ - - private Pattern pattern; - - public RegExpTableFilter(String pattern) - { - if (pattern != null) - { - this.pattern = Pattern.compile(pattern); - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isValidName(String tableName) throws DataSetException - { - return pattern == null || !pattern.matcher(tableName).matches(); - } - -} Copied: tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/RegExpTableFilter.java (from rev 549, trunk/openutils-testing/src/main/java/it/openutils/testing/RegExpTableFilter.java) =================================================================== --- tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/RegExpTableFilter.java (rev 0) +++ tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/RegExpTableFilter.java 2008-01-31 22:19:56 UTC (rev 581) @@ -0,0 +1,55 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package it.openutils.testing; + +import java.util.regex.Pattern; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.filter.AbstractTableFilter; + + +/** + * A table filter that excludes tables mathing the given regexp. + * @author fgiust + * @version $Id: $ + */ +public class RegExpTableFilter extends AbstractTableFilter +{ + + private Pattern pattern; + + /** + * Instantiates a new RegExpTableFilter + * @param pattern regexp pattern + */ + public RegExpTableFilter(String pattern) + { + if (pattern != null) + { + this.pattern = Pattern.compile(pattern); + } + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isValidName(String tableName) throws DataSetException + { + return pattern == null || !pattern.matcher(tableName).matches(); + } + +} Copied: tags/openutils-testing-2.0.2/src/main/java/it/openutils/testing/dbunit (from rev 578, trunk/openutils-testing/src/main/java/it/openutils/testing/dbunit) Copied: tags/openutils-testing-2.0.2/src/site/apt/dbunit.apt (from rev 550, trunk/openutils-testing/src/site/apt/dbunit.apt) =================================================================== --- tags/openutils-testing-2.0.2/src/site/apt/dbunit.apt (rev 0) +++ tags/openutils-testing-2.0.2/src/site/apt/dbunit.apt 2008-01-31 22:19:56 UTC (rev 581) @@ -0,0 +1,76 @@ + -------------------------- + O p e n u t i l s + -------------------------- + Fabrizio Giustina + -------------------------- + + +DbUnit tests + + Openutils provide a base class that take cares of the common operations involved in preparing the test environment using + DbUnit. + + You can extend <<<it.openutils.testing.testng.AbstractDbUnitTestNGSpringContextTests>>> or + <<<it.openutils.testing.junit.AbstractDbUnitJunitSpringContextTests>>>, depending on the test framework of your choice + (remember to include the appropriate dependency, openutils-testing-testng or openutils-testing-junit). + Apart from the underline test framework used, there is no difference in how those class will work. + + Those base classes extend the standard <<<Abstract*SpringContextTests>>> classes provided by Spring, so they support + dependency injection and needs to be configured from a Spring context. + +How to + + All the setup can be configured using annotations. This is a sample test that can make use of data loaded by DbUnit: + ++----------------------------------------------+ + +@ContextConfiguration(locations = {"/spring-tests.xml" }) +@DbUnitExecution(datasets = {"/db1-load.xml" }) +public class SampleDbUnitTest extends AbstractDbUnitTestNGSpringContextTests +{ + @Test + public void testSomething() { + ... + } +} + ++----------------------------------------------+ + + The <<<DbUnitExecution>>> annotation controls how the setup will be performed. It can be configured with a list of file names + (xml od xsl DbUnit datasets) that will be loaded before every single method in this test class is executed. + + In detail the setup that will be performed before each method is: + + * truncate *any table* in the database. This can be turned of by the <<<truncateAll>>> DbUnitExecution parameter + + * load the given datasets into the db + + [] + + You can setup also more than one execution if your tests depend on more than one database or schema, annotating your + class like in this example: + ++----------------------------------------------+ + +@DbUnitConfiguration(dbUnitExecutions = { + @DbUnitExecution(datasets = {"/db1-load.xml" }, dataSource = "dataSource1"), + @DbUnitExecution(datasets = {"/db2-load.xml" }, dataSource = "dataSource2") }) + ++----------------------------------------------+ + + + Note that this test classes don't extend Spring transactional tests, so you need to manually turn on Transactions using + standard Spring annotations: + ++----------------------------------------------+ + +@TestExecutionListeners({TransactionalTestExecutionListener.class }) +@Transactional + ++----------------------------------------------+ + + Also note that the content of your db will definitively be modified by these tests, they are expected to be run on a + test-only instance! + + + Deleted: tags/openutils-testing-2.0.2/src/site/apt/index.apt =================================================================== --- trunk/openutils-testing/src/site/apt/index.apt 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0.2/src/site/apt/index.apt 2008-01-31 22:19:56 UTC (rev 581) @@ -1,8 +0,0 @@ - -------------------------- - O p e n u t i l s - -------------------------- - Fabrizio Giustina - -------------------------- - -openutils-testing - Copied: tags/openutils-testing-2.0.2/src/site/apt/index.apt (from rev 550, trunk/openutils-testing/src/site/apt/index.apt) =================================================================== --- tags/openutils-testing-2.0.2/src/site/apt/index.apt (rev 0) +++ tags/openutils-testing-2.0.2/src/site/apt/index.apt 2008-01-31 22:19:56 UTC (rev 581) @@ -0,0 +1,27 @@ + -------------------------- + O p e n u t i l s + -------------------------- + Fabrizio Giustina + -------------------------- + +openutils-testing + + Openutils-testing extends the standard spring testing framework by providing more high-level base testing classes and utils. + + In particular, it provides a {{{dbunit.html}framework for using with dbunit in Spring test cases}}. + + The openutils-testing jar only contains generic classes that don't depends on any specific test framework. You should + depend on openutils-testing-testng or openutils-testing-junit + + + +Released versions + + openutils-testing-testng: + + {{{http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-testng}http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-testng}} + + openutils-testing-junit: + + {{{http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-junit}http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-junit}} + Copied: tags/openutils-testing-2.0.2/src/site/changes (from rev 578, trunk/openutils-testing/src/site/changes) Deleted: tags/openutils-testing-2.0.2/src/site/changes/changes.xml =================================================================== --- trunk/openutils-testing/src/site/changes/changes.xml 2008-01-31 13:13:40 UTC (rev 578) +++ tags/openutils-testing-2.0.2/src/site/changes/changes.xml 2008-01-31 22:19:56 UTC (rev 581) @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<!-- - "type" attribute can be: add, remove, update or fix. ---> -<document> - <properties> - <title>Changes</title> - <author email="fgiust(at)users.sourceforge.net">Fabrizio Giustina</author> - </properties> - <body> - <release version="2.0.2" date="in svn" description="2.0.2"> - <action type="add" dev="fgiust"> - New dbunit operation classes for mssql and mysql (extension of standard dbunit operation, but refactored so that - they can be used in annotations). See the javadocs in the it.openutils.testing.dbunit package - </action> - <action type="update" dev="fgiust"> - truncate operation now defaults to DbUnitOperation.DELETE_ALL instead of DbUnitOperation.TRUNCATE. - </action> - <action type="fix" dev="fgiust">DbUnitUtils.exportDataset() doesn't close anymore the provided connection</action> - </release> - <release version="2.0.1" date="2008-01-30" description="2.0.1"> - <action type="fix" dev="fgiust"> - (junit version only). it.openutils.testing.junit.AbstractDbUnitJunitSpringContextTests was totally broken due to - the setup method being protected. Fixed + added tests - </action> - </release> - <release version="2.0" date="2008-01-20" description="2.0 release"> - <action type="update" dev="fgiust">Totally reworked dbunit test framework.</action> - </release> - </body> -</document> \ No newline at end of file Copied: tags/openutils-testing-2.0.2/src/site/changes/changes.xml (from rev 579, trunk/openutils-testing/src/site/changes/changes.xml) =================================================================== --- tags/openutils-testing-2.0.2/src/site/changes/changes.xml (rev 0) +++ tags/openutils-testing-2.0.2/src/site/changes/changes.xml 2008-01-31 22:19:56 UTC (rev 581) @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- + "type" attribute can be: add, remove, update or fix. +--> +<document> + <properties> + <title>Changes</title> + <author email="fgiust(at)users.sourceforge.net">Fabrizio Giustina</author> + </properties> + <body> + <release version="2.0.2" date="in svn" description="2.0.2"> + <action type="add" dev="fgiust"> + New dbunit operation classes for mssql and mysql (extension of standard dbunit operation, but refactored so that + they can be used in annotations). See the javadocs in the it.openutils.testing.dbunit package + </action> + <action type="update" dev="fgiust"> + truncate operation now defaults to DbUnitOperation.DELETE_ALL instead of DbUnitOperation.TRUNCATE. + </action> + <action type="fix" dev="fgiust">DbUnitUtils.exportDataset() doesn't close anymore the provided connection</action> + <action type="add" dev="fgiust">new DbUnitUtils.exportTablesToDir() utility method</action> + </release> + <release version="2.0.1" date="2008-01-30" description="2.0.1"> + <action type="fix" dev="fgiust"> + (junit version only). it.openutils.testing.junit.AbstractDbUnitJunitSpringContextTests was totally broken due to + the setup method being protected. Fixed + added tests + </action> + </release> + <release version="2.0" date="2008-01-20" description="2.0 release"> + <action type="update" dev="fgiust">Totally reworked dbunit test framework.</action> + </release> + </body> +</document> \ No newline at end of file Deleted: tags/openutils-testing-2.0.2/src/site/site.xml =================================================================== --- trunk/openutils-testing/src/site/site.xml 2008-01-20 19:22:22 UTC (rev 539) +++ tags/openutils-testing-2.0.2/src/site/site.xml 2008-01-31 22:19:56 UTC (rev 581) ... [truncated message content] |
From: <fg...@us...> - 2008-01-31 22:24:30
|
Revision: 585 http://openutils.svn.sourceforge.net/openutils/?rev=585&view=rev Author: fgiust Date: 2008-01-31 14:24:31 -0800 (Thu, 31 Jan 2008) Log Message: ----------- [maven-release-plugin] copy for tag openutils-testing-testng-2.0.2 Added Paths: ----------- tags/openutils-testing-testng-2.0.2/ tags/openutils-testing-testng-2.0.2/pom.xml tags/openutils-testing-testng-2.0.2/src/ Removed Paths: ------------- tags/openutils-testing-testng-2.0.2/pom.xml tags/openutils-testing-testng-2.0.2/src/ Copied: tags/openutils-testing-testng-2.0.2 (from rev 583, trunk/openutils-testing-testng) Deleted: tags/openutils-testing-testng-2.0.2/pom.xml =================================================================== --- trunk/openutils-testing-testng/pom.xml 2008-01-31 22:23:34 UTC (rev 583) +++ tags/openutils-testing-testng-2.0.2/pom.xml 2008-01-31 22:24:31 UTC (rev 585) @@ -1,173 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>7</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-testing-testng</artifactId> - <name>openutils test utils (testng)</name> - <version>2.0.1-SNAPSHOT</version> - <description>openutils test utils</description> - <dependencies> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-testing</artifactId> - <version>2.0.2</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.4.3</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl104-over-slf4j</artifactId> - <version>1.4.3</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.version}</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-orm</artifactId> - <version>${spring.version}</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.dbunit</groupId> - <artifactId>dbunit</artifactId> - <version>2.2</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>junit-addons</groupId> - <artifactId>junit-addons</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <classifier>jdk15</classifier> - <version>5.7</version> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate</artifactId> - <version>3.2.1.ga</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - <version>10.2.2.0</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>commons-dbcp</groupId> - <artifactId>commons-dbcp</artifactId> - <version>1.2.1</version> - <scope>test</scope> - <exclusions> - <exclusion> - <artifactId>xerces</artifactId> - <groupId>xerces</groupId> - </exclusion> - <exclusion> - <artifactId>xml-apis</artifactId> - <groupId>xml-apis</groupId> - </exclusion> - <exclusion> - <artifactId>commons-logging</artifactId> - <groupId>commons-logging</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-jdbc</artifactId> - <version>${spring.version}</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - <properties> - <spring.version>2.5.1</spring.version> - </properties> -</project> \ No newline at end of file Copied: tags/openutils-testing-testng-2.0.2/pom.xml (from rev 584, trunk/openutils-testing-testng/pom.xml) =================================================================== --- tags/openutils-testing-testng-2.0.2/pom.xml (rev 0) +++ tags/openutils-testing-testng-2.0.2/pom.xml 2008-01-31 22:24:31 UTC (rev 585) @@ -0,0 +1,179 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>7</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-testing-testng</artifactId> + <name>openutils test utils (testng)</name> + <version>2.0.2</version> + <description>openutils test utils</description> + <dependencies> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-testing</artifactId> + <version>2.0.2</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.3</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl104-over-slf4j</artifactId> + <version>1.4.3</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-orm</artifactId> + <version>${spring.version}</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>org.dbunit</groupId> + <artifactId>dbunit</artifactId> + <version>2.2</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>junit-addons</groupId> + <artifactId>junit-addons</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <classifier>jdk15</classifier> + <version>5.7</version> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.2.1.ga</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.2.2.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>commons-dbcp</groupId> + <artifactId>commons-dbcp</artifactId> + <version>1.2.1</version> + <scope>test</scope> + <exclusions> + <exclusion> + <artifactId>xerces</artifactId> + <groupId>xerces</groupId> + </exclusion> + <exclusion> + <artifactId>xml-apis</artifactId> + <groupId>xml-apis</groupId> + </exclusion> + <exclusion> + <artifactId>commons-logging</artifactId> + <groupId>commons-logging</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-jdbc</artifactId> + <version>${spring.version}</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + <properties> + <spring.version>2.5.1</spring.version> + </properties> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-testng-2.0.2</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-testing-testng-2.0.2</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-testing-testng-2.0.2</url> + </scm> +</project> \ No newline at end of file Copied: tags/openutils-testing-testng-2.0.2/src (from rev 582, trunk/openutils-testing-testng/src) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |