eu.etaxonomy.taxeditor.cdmlib/.classpath, eu.etaxonomy.taxeditor.cdmlib/META-INF...
authorCherian Mathew <c.mathew@bgbm.org>
Wed, 3 Jun 2015 11:56:16 +0000 (13:56 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Wed, 3 Jun 2015 11:56:16 +0000 (13:56 +0200)
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF : added packages required by test project to exported package list
ContextManager.java : adding check to make sure the workbench is created before initialisation
eu.etaxonomy.taxeditor.test/.classpath : moved resource from src/main/resources to src/test/resourcesto be maven comliant
eu.etaxonomy.taxeditor.test/pom.xml : added tycho-surefire-plugin config to run tests
TaxonNameEditorTest : removed logger setting
BaseRemotingTest : removed unused call to disk cache
CdmPersistentRemoteSourceTest, AbstractLazyInitializerTest, RemoteLazyLoadingTest : changed assert calls to be compatible with junit 4.8.2
OperationTestBase, BaseRemotingTest : changed to abstract to not be included in test run
eu.etaxonomy.taxeditor/pom.xml : made the building of products as optional (separate profile)
pom.xml : added unitils version property
eu.etaxonomy.taxeditor.test/lib : added test dependency jars

19 files changed:
eu.etaxonomy.taxeditor.cdmlib/.classpath
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.cdmlib/build.properties
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/ContextManager.java
eu.etaxonomy.taxeditor.test/.classpath
eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.test/build.properties
eu.etaxonomy.taxeditor.test/lib/dbunit-2.4.9.jar [new file with mode: 0644]
eu.etaxonomy.taxeditor.test/lib/org.springframework.context-3.2.2.RELEASE.jar [new file with mode: 0644]
eu.etaxonomy.taxeditor.test/lib/unitils-core-3.4.2.jar [new file with mode: 0644]
eu.etaxonomy.taxeditor.test/lib/unitils-database-3.4.2.jar [new file with mode: 0644]
eu.etaxonomy.taxeditor.test/lib/unitils-dbmaintainer-3.4.2.jar [new file with mode: 0644]
eu.etaxonomy.taxeditor.test/lib/unitils-dbunit-3.4.2.jar [new file with mode: 0644]
eu.etaxonomy.taxeditor.test/lib/unitils-spring-3.4.2.jar [new file with mode: 0644]
eu.etaxonomy.taxeditor.test/pom.xml
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/util/H2DbSupport.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.test/src/test/resources/unitils.properties
eu.etaxonomy.taxeditor/pom.xml
pom.xml

index 433df8079081a19e3884964b1227708b87885a87..59e3bedb4686a5c0871ce7d5e3f0d9ba368a7f54 100644 (file)
@@ -1,11 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-       <classpathentry exported="true" kind="lib" path="lib/cdm-server-3.5.2-SNAPSHOT.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/unitils-spring-3.4.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/unitils-core-3.4.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/unitils-database-3.4.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/unitils-dbmaintainer-3.4.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/unitils-dbunit-3.4.2.jar"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
        <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
        <classpathentry exported="true" kind="lib" path="lib/xmlbeans-2.3.0.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/poi-ooxml-schemas-3.10-FINAL.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/swagger-annotations-1.3.5.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdm-server-3.5.2-SNAPSHOT.jar"/>
        <classpathentry kind="output" path="target/classes"/>
 </classpath>
index 4c4c417d48ed10464b346536a7ca2dbec28b2d33..9409f988344553f11cd7c22b368815b3e245206a 100644 (file)
@@ -7,6 +7,7 @@ Eclipse-BundleShape: dir
 Export-Package: com.google.api,
  com.google.api.detect,
  com.google.api.translate,
+ eu.etaxonomy.cdm,
  eu.etaxonomy.cdm.api.application,
  eu.etaxonomy.cdm.api.cache,
  eu.etaxonomy.cdm.api.conversation,
@@ -191,6 +192,7 @@ Export-Package: com.google.api,
  eu.etaxonomy.taxeditor.remoting.cache,
  eu.etaxonomy.taxeditor.remoting.server,
  eu.etaxonomy.taxeditor.remoting.source,
+ eu.etaxonomy.taxeditor.service,
  eu.etaxonomy.taxeditor.session,
  eu.etaxonomy.taxeditor.session.mock,
  javassist.util.proxy,
@@ -201,9 +203,13 @@ Export-Package: com.google.api,
  net.sf.ehcache.statistics,
  net.sf.ehcache.store,
  net.sf.json;uses:="net.sf.json.processors,net.sf.json.util,org.apache.commons.lang.exception",
+ org.aopalliance.aop,
  org.apache.commons.collections;uses:="org.apache.commons.collections.keyvalue,new org.apache.commons.collections",
+ org.apache.commons.dbcp,
  org.apache.commons.io;uses:="org.apache.commons.io.filefilter",
  org.apache.commons.lang;uses:="org.apache.commons.lang.exception",
+ org.apache.commons.lang.text,
+ org.apache.commons.logging,
  org.apache.fop.apps,
  org.apache.http,
  org.apache.http.client,
@@ -335,6 +341,9 @@ Export-Package: com.google.api,
  org.odftoolkit.odfdom.dom.element,
  org.odftoolkit.odfdom.dom.element.style,
  org.odftoolkit.odfdom.dom.style,
+ org.slf4j,
+ org.springframework.aop,
+ org.springframework.aop.framework,
  org.springframework.beans,
  org.springframework.beans.factory,
  org.springframework.beans.factory.annotation;
@@ -356,6 +365,7 @@ Export-Package: com.google.api,
    org.springframework.core.io.support,
    org.springframework.beans.factory.config,
    org.springframework.beans.factory",
+ org.springframework.context.config,
  org.springframework.context.event;
   uses:="org.springframework.core,
    org.aopalliance.intercept,
@@ -367,6 +377,7 @@ Export-Package: com.google.api,
  org.springframework.core.io;uses:="org.jboss.virtual",
  org.springframework.core.io.support,
  org.springframework.core.type.classreading,
+ org.springframework.jdbc.datasource,
  org.springframework.orm.hibernate3;
   uses:="org.apache.commons.logging,
    org.aopalliance.intercept,
@@ -398,7 +409,10 @@ Export-Package: com.google.api,
  org.springframework.remoting.support,
  org.springframework.security.access,
  org.springframework.security.authentication,
+ org.springframework.security.authentication.dao,
+ org.springframework.security.authentication.encoding,
  org.springframework.security.authentication.event,
+ org.springframework.security.config,
  org.springframework.security.core,
  org.springframework.security.core.context,
  org.springframework.security.core.userdetails,
@@ -448,13 +462,7 @@ Export-Package: com.google.api,
    org.springframework.context.event,
    javax.servlet,
    org.springframework.ui,
-   javax.servlet.http",
- org.unitils,
- org.unitils.database,
- org.unitils.database.annotations,
- org.unitils.database.util,
- org.unitils.dbunit.annotation,
- org.unitils.spring.annotation
+   javax.servlet.http"
 Bundle-Vendor: EDIT
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.eclipse.osgi,
@@ -661,10 +669,5 @@ Bundle-ClassPath: .,
  lib/xmlbeans-2.3.0.jar,
  lib/poi-ooxml-schemas-3.10-FINAL.jar,
  lib/swagger-annotations-1.3.5.jar,
- lib/unitils-core-3.4.2.jar,
- lib/unitils-database-3.4.2.jar,
- lib/unitils-dbmaintainer-3.4.2.jar,
- lib/unitils-dbunit-3.4.2.jar,
- lib/unitils-spring-3.4.2.jar,
  lib/cdm-server-3.5.2-SNAPSHOT.jar
 Import-Package: org.apache.commons.httpclient.methods
index 1cad966b40ce2f56d207ffce294ac302f8ea624d..e5a0e4b4cc5ef2407d99b5671495e062178ad8b6 100644 (file)
@@ -183,7 +183,7 @@ bin.includes = META-INF/,\
                lib/poi-3.10-FINAL.jar,\\r
                lib/poi-ooxml-3.10-FINAL.jar,\\r
                lib/poi-ooxml-schemas-3.10-FINAL.jar,\\r
-               lib/xmlbeans-2.3.0.jar,\
+               lib/xmlbeans-2.3.0.jar,\\r
                lib/cdmlib-commons-3.5.2-SNAPSHOT-sources.jar,\\r
                lib/cdmlib-commons-3.5.2-SNAPSHOT.jar,\\r
                lib/cdmlib-ext-3.5.2-SNAPSHOT-sources.jar,\\r
@@ -200,7 +200,7 @@ bin.includes = META-INF/,\
                lib/cdmlib-remote-3.5.2-SNAPSHOT.jar,\\r
                lib/cdmlib-services-3.5.2-SNAPSHOT-sources.jar,\\r
                lib/cdmlib-services-3.5.2-SNAPSHOT.jar,\\r
-               lib/swagger-annotations-1.3.5.jar
+               lib/swagger-annotations-1.3.5.jar\r
 \r
 jars.compile.order = .\r
 output.. = bin/\r
index d7ca5a0d06d1916e81d7a0eaa801f7ea9874e362..3e9c8460f23a9510f4ef0afe8bea6dfcc10f8e6f 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -24,6 +24,7 @@ import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchListener;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.XMLMemento;
+import org.eclipse.ui.internal.Workbench;
 
 import eu.etaxonomy.taxeditor.model.IContextListener;
 import eu.etaxonomy.taxeditor.model.MementoHelper;
@@ -38,18 +39,20 @@ import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
  * @version 1.0
  */
 public class ContextManager implements IWorkbenchListener{
-       
-       private ListenerList contextListeners = new ListenerList();
+
+       private final ListenerList contextListeners = new ListenerList();
 
        private IMemento memento;
-               
+
        /**
         * <p>Constructor for ContextManager.</p>
         */
        protected ContextManager() {
-               PlatformUI.getWorkbench().addWorkbenchListener(this);
+           if(Workbench.getInstance() != null) {
+               PlatformUI.getWorkbench().addWorkbenchListener(this);
+           }
        }
-       
+
        /**
         * <p>addContextListener</p>
         *
@@ -58,7 +61,7 @@ public class ContextManager implements IWorkbenchListener{
        public void addContextListener(IContextListener listener){
                contextListeners.add(listener);
        }
-       
+
        /**
         * <p>removeContextListener</p>
         *
@@ -67,14 +70,14 @@ public class ContextManager implements IWorkbenchListener{
        public void removeContextListener(IContextListener listener) {
                contextListeners.remove(listener);
        }
-       
+
        /**
         * <p>notifyContextStart</p>
         */
        public void notifyContextStart() {
                MessagingUtils.info("Notifying context listeners, that the context has started.");
                ProgressMonitorDialog dialog = new ProgressMonitorDialog(StoreUtil.getShell());
-               
+
                try {
                        dialog.run(false, false, new IRunnableWithProgress() {
                                /* (non-Javadoc)
@@ -84,10 +87,10 @@ public class ContextManager implements IWorkbenchListener{
                                public void run(IProgressMonitor monitor)
                                                throws InvocationTargetException, InterruptedException {
                                        monitor.beginTask("Starting context", contextListeners.size());
-                                       
-                                       
-                                       readMemento();                          
-                                       
+
+
+                                       readMemento();
+
                                        for(final Object listener : contextListeners.getListeners()){
                                                ((IContextListener) listener).contextStart(memento, monitor);
                                                monitor.worked(1);
@@ -101,15 +104,15 @@ public class ContextManager implements IWorkbenchListener{
                        MessagingUtils.error(getClass(), e);
                }
        }
-       
+
 
        /**
-        * 
+        *
         */
        public void notifyContextRefresh() {
                MessagingUtils.info("Notifying context listeners, that the context needs to be refreshed.");
                ProgressMonitorDialog dialog = new ProgressMonitorDialog(StoreUtil.getShell());
-               
+
                try {
                        dialog.run(false, false, new IRunnableWithProgress() {
                                /* (non-Javadoc)
@@ -118,8 +121,8 @@ public class ContextManager implements IWorkbenchListener{
                                @Override
                                public void run(IProgressMonitor monitor)
                                                throws InvocationTargetException, InterruptedException {
-                                       monitor.beginTask("Refreshing context", contextListeners.size());                       
-                                       
+                                       monitor.beginTask("Refreshing context", contextListeners.size());
+
                                        for(final Object listener : contextListeners.getListeners()){
                                                ((IContextListener) listener).contextRefresh(monitor);
                                                monitor.worked(1);
@@ -133,7 +136,7 @@ public class ContextManager implements IWorkbenchListener{
                        MessagingUtils.error(getClass(), e);
                }
        }
-       
+
        /**
         * <p>notifyContextAboutToStop</p>
         *
@@ -146,36 +149,36 @@ public class ContextManager implements IWorkbenchListener{
                subMonitor.beginTask("Stoping context", contextListeners.size());
                // we are creating the memento here; even if the context is not stopped
                createMemento();
-               
+
                for(final Object listener : contextListeners.getListeners()){
                        ((IContextListener) listener).contextAboutToStop(memento, subMonitor);
                        subMonitor.worked(1);
-               }       
-               
+               }
+
                subMonitor.done();
        }
-       
+
        /**
         * <p>notifyContextStop</p>
         *
         * @param monitor a {@link org.eclipse.core.runtime.IProgressMonitor} object.
         */
        public void notifyContextStop(IProgressMonitor monitor) {
-               
+
                IProgressMonitor subMonitor = StoreUtil.getSubProgressMonitor(monitor, 1);
 
                subMonitor.beginTask("Stoping context", contextListeners.size());
                MessagingUtils.info("Notifying context listeners, that the context has stopped.");
-                               
+
                for(Object listener : contextListeners.getListeners()){
                        ((IContextListener) listener).contextStop(memento, subMonitor);
                        subMonitor.worked(1);
-               }       
+               }
 
                saveMemento();
                subMonitor.done();
        }
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.ui.IWorkbenchListener#preShutdown(org.eclipse.ui.IWorkbench, boolean)
         */
@@ -184,15 +187,15 @@ public class ContextManager implements IWorkbenchListener{
        public boolean preShutdown(IWorkbench workbench, boolean forced) {
 
                createMemento();
-               
+
                IProgressMonitor monitor = null;
-               
+
                for(Object listener : contextListeners.getListeners()){
                        ((IContextListener) listener).workbenchShutdown(memento, monitor);
-               }       
-               
+               }
+
                saveMemento();
-               
+
                // return true in any case, otherwise the application will not stop
                return true;
        }
@@ -203,11 +206,11 @@ public class ContextManager implements IWorkbenchListener{
        /** {@inheritDoc} */
        @Override
        public void postShutdown(IWorkbench workbench) {
-               
-               
+
+
        }
-       
-       
+
+
        private void readMemento(){
                try {
                        memento = MementoHelper.readMementoFromFile(getStateFileForCurrentDatabase());
@@ -216,17 +219,17 @@ public class ContextManager implements IWorkbenchListener{
                        MessagingUtils.info("No state file for datasource");
                }
        }
-       
+
        private void createMemento(){
-               
+
                if (CdmStore.getActiveCdmSource() != null) {
-                       
+
                        try {
                                String name = CdmStore.getActiveCdmSource().getName();
                                name = name.trim();
                                name = name.replace(" ", "_");
                                memento = XMLMemento.createWriteRoot(name);
-                       
+
                                MessagingUtils.info("DataSource found. Memento created.");
                        } catch (Exception e) {
                                // The memento could not be created, but a not closable editor is avoided for this case.
@@ -235,13 +238,13 @@ public class ContextManager implements IWorkbenchListener{
                } else {
                        MessagingUtils.info("Not storing state data, because no DataSource present.");
                }
-               
+
        }
-       
+
        private boolean saveMemento(){
                return MementoHelper.saveMementoToFile(memento, getStateFileForCurrentDatabase()) != null;
        }
-       
+
        /**
         * <p>getStateFileForCurrentDatabase</p>
         *
@@ -251,7 +254,7 @@ public class ContextManager implements IWorkbenchListener{
                if(CdmStore.getActiveCdmSource() == null){
                        return null;
                }
-               
+
                IPath path = TaxeditorStorePlugin.getDefault().getStateLocation();
                if (path == null) {
                        return null;
index 3f3206eccd8fa0be0ef8d865c3277bc8f88c679d..c4629743dccefb8222607a72b6f22b7243d0f271 100644 (file)
@@ -1,10 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
+       <classpathentry exported="true" kind="lib" path="lib/dbunit-2.4.9.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/unitils-core-3.4.2.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/unitils-database-3.4.2.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/unitils-dbmaintainer-3.4.2.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/unitils-dbunit-3.4.2.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/unitils-spring-3.4.2.jar"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
        <classpathentry including="**/*.java" kind="src" path="src/test/java"/>
-       <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+       <classpathentry excluding="**/*.java" kind="src" path="src/test/resources"/>
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.context-3.2.2.RELEASE.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/byte-buddy-0.5.1.jar"/>
        <classpathentry kind="output" path="target/classes"/>
 </classpath>
-
index 5078e840db4d3abc72d45101cf3a60768454ad99..2b302260300a04691aefa41459dafee45f7aa15d 100644 (file)
@@ -6,20 +6,25 @@ Bundle-Version: 3.5.2.qualifier
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: EDIT
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.apache.log4j,
- org.eclipse.ui,
+Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
- org.eclipse.swtbot.eclipse.core,
- org.eclipse.swtbot.eclipse.finder,
  org.eclipse.ui.ide,
eu.etaxonomy.taxeditor.bulkeditor,
org.junit;bundle-version="4.8.2",
  eu.etaxonomy.taxeditor.cdmlib,
+ eu.etaxonomy.taxeditor.bulkeditor,
  eu.etaxonomy.taxeditor.editor,
  eu.etaxonomy.taxeditor.help,
  eu.etaxonomy.taxeditor.navigation,
  eu.etaxonomy.taxeditor.printpublisher,
- eu.etaxonomy.taxeditor.store
+ eu.etaxonomy.taxeditor.store,
+ org.apache.log4j
 Eclipse-RegisterBuddy: org.apache.log4j
 Bundle-ClassPath: .,
- lib/byte-buddy-0.5.1.jar
-Import-Package: org.apache.http.impl.client
+ lib/byte-buddy-0.5.1.jar,
+ lib/org.springframework.context-3.2.2.RELEASE.jar,
+ lib/unitils-core-3.4.2.jar,
+ lib/unitils-database-3.4.2.jar,
+ lib/unitils-dbmaintainer-3.4.2.jar,
+ lib/unitils-dbunit-3.4.2.jar,
+ lib/unitils-spring-3.4.2.jar,
+ lib/dbunit-2.4.9.jar
index 95673643b973fda719644a0ef136baad59dbf72d..0e7e33b0fd1211246d4c37036bbab4080fef28be 100644 (file)
@@ -1,4 +1,14 @@
-source.. = src/test/java/
+source.. = src/test/java/,\
+           src/test/resources/
 bin.includes = META-INF/,\
                .,\
-               lib/byte-buddy-0.5.1.jar
+               lib/byte-buddy-0.5.1.jar,\
+               src/,\
+               lib/org.springframework.context-3.2.2.RELEASE.jar,\
+               lib/unitils-core-3.4.2.jar,\
+               lib/unitils-database-3.4.2.jar,\
+               lib/unitils-dbmaintainer-3.4.2.jar,\
+               lib/unitils-dbunit-3.4.2.jar,\
+               lib/unitils-spring-3.4.2.jar,\
+               lib/dbunit-2.4.9.jar
+output.. = bin/
diff --git a/eu.etaxonomy.taxeditor.test/lib/dbunit-2.4.9.jar b/eu.etaxonomy.taxeditor.test/lib/dbunit-2.4.9.jar
new file mode 100644 (file)
index 0000000..130921b
Binary files /dev/null and b/eu.etaxonomy.taxeditor.test/lib/dbunit-2.4.9.jar differ
diff --git a/eu.etaxonomy.taxeditor.test/lib/org.springframework.context-3.2.2.RELEASE.jar b/eu.etaxonomy.taxeditor.test/lib/org.springframework.context-3.2.2.RELEASE.jar
new file mode 100644 (file)
index 0000000..e285a21
Binary files /dev/null and b/eu.etaxonomy.taxeditor.test/lib/org.springframework.context-3.2.2.RELEASE.jar differ
diff --git a/eu.etaxonomy.taxeditor.test/lib/unitils-core-3.4.2.jar b/eu.etaxonomy.taxeditor.test/lib/unitils-core-3.4.2.jar
new file mode 100644 (file)
index 0000000..ab4c22e
Binary files /dev/null and b/eu.etaxonomy.taxeditor.test/lib/unitils-core-3.4.2.jar differ
diff --git a/eu.etaxonomy.taxeditor.test/lib/unitils-database-3.4.2.jar b/eu.etaxonomy.taxeditor.test/lib/unitils-database-3.4.2.jar
new file mode 100644 (file)
index 0000000..dfcb6ae
Binary files /dev/null and b/eu.etaxonomy.taxeditor.test/lib/unitils-database-3.4.2.jar differ
diff --git a/eu.etaxonomy.taxeditor.test/lib/unitils-dbmaintainer-3.4.2.jar b/eu.etaxonomy.taxeditor.test/lib/unitils-dbmaintainer-3.4.2.jar
new file mode 100644 (file)
index 0000000..01f8994
Binary files /dev/null and b/eu.etaxonomy.taxeditor.test/lib/unitils-dbmaintainer-3.4.2.jar differ
diff --git a/eu.etaxonomy.taxeditor.test/lib/unitils-dbunit-3.4.2.jar b/eu.etaxonomy.taxeditor.test/lib/unitils-dbunit-3.4.2.jar
new file mode 100644 (file)
index 0000000..778274e
Binary files /dev/null and b/eu.etaxonomy.taxeditor.test/lib/unitils-dbunit-3.4.2.jar differ
diff --git a/eu.etaxonomy.taxeditor.test/lib/unitils-spring-3.4.2.jar b/eu.etaxonomy.taxeditor.test/lib/unitils-spring-3.4.2.jar
new file mode 100644 (file)
index 0000000..f30810b
Binary files /dev/null and b/eu.etaxonomy.taxeditor.test/lib/unitils-spring-3.4.2.jar differ
index 835df5791bc1c24e1b00f358797fdb356a1cd0be..b87c33a9327637ac0b3f7b32e500390fa8fa86a5 100644 (file)
@@ -1,58 +1,69 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <project>\r
 \r
-       <parent>\r
-               <groupId>eu.etaxonomy</groupId>\r
-               <artifactId>taxeditor-parent</artifactId>\r
-               <version>3.5.2-SNAPSHOT</version>\r
-       </parent>\r
-       <modelVersion>4.0.0</modelVersion>\r
-       <artifactId>eu.etaxonomy.taxeditor.test</artifactId>\r
-       <packaging>eclipse-test-plugin</packaging>\r
-       <name>UI Test Bundle</name>\r
-       <description>Holds all UI tests for the Taxonomic Editor</description>\r
-<!--   <build> -->\r
-<!--           <plugins> -->\r
-<!--                   <plugin> -->\r
-<!--                           <groupId>org.eclipse.tycho</groupId> -->\r
-<!--                           <artifactId>tycho-maven-plugin</artifactId> -->\r
-<!--                           <version>${tycho.version}</version> -->\r
-<!--                           <extensions>true</extensions> -->\r
-<!--                   </plugin> -->\r
-<!--                   <plugin> -->\r
-<!--                           <groupId>org.eclipse.tycho</groupId> -->\r
-<!--                           <artifactId>target-platform-configuration</artifactId> -->\r
-<!--                           <version>${tycho.version}</version> -->\r
-<!--                           <configuration> -->\r
-<!--                                   <resolver>p2</resolver> -->\r
-<!--                           </configuration> -->\r
-<!--                   </plugin> -->\r
-<!--                   <plugin> -->\r
-<!--                           <groupId>org.eclipse.tycho</groupId> -->\r
-<!--                           <artifactId>tycho-surefire-plugin</artifactId> -->\r
-<!--                           <version>${tycho.version}</version> -->\r
-<!--                           <configuration> -->\r
-<!--                                   <useUIHarness>true</useUIHarness> -->\r
-<!--                                   <useUIThread>false</useUIThread> -->\r
-<!--                                   <includes> -->\r
-<!--                                           <include>**/*Test.java</include> -->\r
-<!--                                   </includes> -->\r
-<!--                                   <product>eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product -->\r
-<!--                                   </product> -->\r
-<!--                                   <application>eu.etaxonomy.taxeditor.application.application -->\r
-<!--                                   </application> -->\r
-<!--                                   <dependency> <type>p2-installable-unit</type> <artifactId>eu.etaxonomy.taxeditor.product</artifactId> -->\r
-<!--                                           <version>0.0.0</version> </dependency> --> \r
-<!--                           </configuration> -->\r
-<!--                   </plugin> -->\r
-<!--           </plugins> -->\r
-<!--   </build> -->\r
-       <dependencies>\r
-               <dependency>\r
-                       <groupId>junit</groupId>\r
-                       <artifactId>junit</artifactId>\r
-                       <version>4.11</version>\r
-                       <scope>test</scope>\r
-               </dependency>\r
-       </dependencies>\r
+  <parent>\r
+    <groupId>eu.etaxonomy</groupId>\r
+    <artifactId>taxeditor-parent</artifactId>\r
+    <version>3.5.2-SNAPSHOT</version>\r
+  </parent>\r
+  <modelVersion>4.0.0</modelVersion>\r
+  <artifactId>eu.etaxonomy.taxeditor.test</artifactId>\r
+  <packaging>eclipse-test-plugin</packaging>\r
+  <name>UI Test Bundle</name>\r
+  <description>Holds all UI tests for the Taxonomic Editor</description>\r
+  <build>\r
+    <plugins>\r
+      <!-- <plugin> -->\r
+      <!-- <groupId>org.eclipse.tycho</groupId> -->\r
+      <!-- <artifactId>tycho-maven-plugin</artifactId> -->\r
+      <!-- <version>${tycho.version}</version> -->\r
+      <!-- <extensions>true</extensions> -->\r
+      <!-- </plugin> -->\r
+      <plugin>\r
+        <groupId>org.eclipse.tycho</groupId>\r
+        <artifactId>target-platform-configuration</artifactId>\r
+        <version>${tycho.version}</version>\r
+        <configuration>\r
+          <filters>\r
+            <!-- Work around for https://bugs.eclipse.org/bugs/show_bug.cgi?id=348045 -->\r
+            <!-- taken from https://wiki.eclipse.org/index.php?title=Tycho/Target_Platform#Filtering -->\r
+            <filter>\r
+              <type>p2-installable-unit</type>\r
+              <id>org.eclipse.equinox.servletbridge.extensionbundle</id>\r
+              <removeAll />\r
+            </filter>\r
+          </filters>\r
+          <!-- <dependency-resolution> -->\r
+          <!-- <extraRequirements> -->\r
+          <!-- product IU under test -->\r
+          <!-- <requirement> -->\r
+          <!-- <type>p2-installable-unit</type> -->\r
+          <!-- <id>eu.etaxonomy.taxeditor.product</id> -->\r
+          <!-- <versionRange>3.5.2.qualifier</versionRange> -->\r
+          <!-- </requirement> -->\r
+          <!-- </extraRequirements> -->\r
+          <!-- </dependency-resolution> -->\r
+        </configuration>\r
+      </plugin>\r
+      <plugin>\r
+        <groupId>org.eclipse.tycho</groupId>\r
+        <artifactId>tycho-surefire-plugin</artifactId>\r
+        <version>${tycho.version}</version>\r
+        <configuration>\r
+          <!-- <testRuntime>p2-installed</testRuntime> -->\r
+          <!-- <useUIHarness>true</useUIHarness> -->\r
+          <!-- <providerHint>junit4</providerHint> -->\r
+          <dependencies>\r
+            <dependency>\r
+              <type>eclipse-feature</type>\r
+              <artifactId>eu.etaxonomy.taxeditor.feature</artifactId>\r
+              <!-- This is the minimum required version -->\r
+              <version>1.0.0</version>\r
+            </dependency>\r
+          </dependencies>\r
+\r
+        </configuration>\r
+      </plugin>\r
+    </plugins>\r
+  </build>\r
 </project>
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/util/H2DbSupport.java b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/util/H2DbSupport.java
new file mode 100644 (file)
index 0000000..2dddbf5
--- /dev/null
@@ -0,0 +1,166 @@
+package eu.etaxonomy.taxeditor.util;
+
+/**
+ * based on from http://code.google.com/p/java-tester/source/browse/trunk/src/main/java/org/jtester/unitils/database/H2DbSupport.java
+ */
+
+
+import java.util.Set;
+
+import org.unitils.core.dbsupport.DbSupport;
+
+public class H2DbSupport extends DbSupport {
+        /**
+         * Creates support for HsqlDb databases.
+         */
+        public H2DbSupport() {
+                super("h2");
+        }
+
+        @Override
+        public Set<String> getColumnNames(String tableName) {
+                return getSQLHandler().getItemsAsStringSet(
+                                "select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = '" + tableName
+                                                + "' AND TABLE_SCHEMA = '" + getSchemaName() + "'");
+        }
+
+        @Override
+        public Set<String> getTableNames() {
+                return getSQLHandler().getItemsAsStringSet(
+                                "select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_TYPE = 'TABLE' AND TABLE_SCHEMA = '"
+                                                + getSchemaName() + "'");
+        }
+
+        @Override
+        public Set<String> getViewNames() {
+                return getSQLHandler().getItemsAsStringSet(
+                                "select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_TYPE = 'VIEW' AND TABLE_SCHEMA = '"
+                                                + getSchemaName() + "'");
+        }
+
+        @Override
+        public Set<String> getSequenceNames() {
+                return getSQLHandler().getItemsAsStringSet(
+                                "select SEQUENCE_NAME from INFORMATION_SCHEMA.SEQUENCES where SEQUENCE_SCHEMA = '"
+                                                + getSchemaName() + "'");
+        }
+
+        @Override
+        public Set<String> getTriggerNames() {
+                return getSQLHandler().getItemsAsStringSet(
+                                "select TRIGGER_NAME from INFORMATION_SCHEMA.TRIGGERS where TRIGGER_SCHEMA = '" + getSchemaName()
+                                                + "'");
+        }
+
+        @Override
+        public long getSequenceValue(String sequenceName) {
+                return getSQLHandler().getItemAsLong(
+                                "select CURRENT_VALUE from INFORMATION_SCHEMA.SEQUENCES where SEQUENCE_SCHEMA = '"
+                                                + getSchemaName() + "' and SEQUENCE_NAME = '" + sequenceName + "'");
+        }
+
+        @Override
+        public boolean supportsSequences() {
+                return true;
+        }
+
+        @Override
+        public boolean supportsTriggers() {
+                return true;
+        }
+
+        @Override
+        public boolean supportsIdentityColumns() {
+                return true;
+        }
+
+        @Override
+        public void incrementSequenceToValue(String sequenceName, long newSequenceValue) {
+                getSQLHandler().executeUpdate(
+                       "alter sequence " + qualified(sequenceName) + " restart with " + newSequenceValue);
+        }
+
+        @Override
+        public void incrementIdentityColumnToValue(String tableName, String identityColumnName, long identityValue) {
+                getSQLHandler().executeUpdate(
+                      "alter table " + qualified(tableName) + " alter column " + quoted(identityColumnName)
+                           + " RESTART WITH " + identityValue);
+        }
+
+        @Override
+        public void disableReferentialConstraints() {
+                Set<String> tableNames = getTableNames();
+                for (String tableName : tableNames) {
+                       disableReferentialConstraints(tableName);
+                }
+        }
+
+        @Override
+        public void disableValueConstraints() {
+                Set<String> tableNames = getTableNames();
+                for (String tableName : tableNames) {
+                        disableValueConstraints(tableName);
+                }
+        }
+
+        private void disableReferentialConstraints(String tableName) {
+                Set<String> constraintNames = this.getForeignKeyConstraintNames(tableName);
+                for (String constraintName : constraintNames) {
+                       this.removeForeignKeyConstraint(tableName, constraintName);
+                }
+        }
+
+        private void disableValueConstraints(String tableName) {
+                Set<String> primaryKeyColumnNames = this.getPrimaryKeyColumnNames(tableName);
+
+                Set<String> notNullColumnNames = this.getNotNullColummnNames(tableName);
+                for (String notNullColumnName : notNullColumnNames) {
+                    if (primaryKeyColumnNames.contains(notNullColumnName)) {
+                            continue;
+                    }
+                    this.removeNotNullConstraint(tableName, notNullColumnName);
+                }
+        }
+
+        /**
+         * Gets the names of all identity columns of the given table.
+         * <p/>
+         * todo check, at this moment the PK columns are returned
+         *
+         * @param tableName The table, not null
+         * @return The names of the identity columns of the table with the given name
+         */
+        @Override
+        public Set<String> getIdentityColumnNames(String tableName) {
+            return getPrimaryKeyColumnNames(tableName);
+        }
+
+        private Set<String> getPrimaryKeyColumnNames(String tableName) {
+                return getSQLHandler().getItemsAsStringSet(
+                                "select COLUMN_NAME from INFORMATION_SCHEMA.INDEXES where PRIMARY_KEY=TRUE AND TABLE_NAME = '"
+                                                + tableName + "' AND TABLE_SCHEMA = '" + getSchemaName() + "'");
+        }
+
+        private Set<String> getNotNullColummnNames(String tableName) {
+                return getSQLHandler().getItemsAsStringSet(
+                                "select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where IS_NULLABLE = 'NO' AND TABLE_NAME = '"
+                                                + tableName + "' AND TABLE_SCHEMA = '" + getSchemaName() + "'");
+        }
+
+        private Set<String> getForeignKeyConstraintNames(String tableName) {
+                return getSQLHandler().getItemsAsStringSet(
+                                "select CONSTRAINT_NAME from INFORMATION_SCHEMA.CONSTRAINTS "
+                                                + "where CONSTRAINT_TYPE = 'REFERENTIAL' AND TABLE_NAME = '" + tableName
+                                                + "' AND CONSTRAINT_SCHEMA = '" + getSchemaName() + "'");
+        }
+
+        private void removeForeignKeyConstraint(String tableName, String constraintName) {
+                getSQLHandler().executeUpdate(
+                                "alter table " + qualified(tableName) + " drop constraint " + quoted(constraintName));
+        }
+
+        private void removeNotNullConstraint(String tableName, String columnName) {
+                getSQLHandler().executeUpdate(
+                                "alter table " + qualified(tableName) + " alter column " + quoted(columnName) + " set null");
+        }
+}
index 47c604db965b341acf261f6eb76ef6043ba6bd54..daea61b65fe9fcec567238f3afd20c6f593d39de 100644 (file)
@@ -1,69 +1,69 @@
-#\r
-# NOTE: this is the unitils.properties file for the cdmlib-persistence module\r
-# a separate unitils.properties exists for cdmlib-io and for cdmlib-services\r
-#\r
-#\r
-# the list of all properties is found in\r
-# http://unitils.org/unitils-default.properties\r
-#\r
-\r
-### Unitils Modules ###\r
-# List of modules that is loaded. Overloading this list is normally not useful, unless you want to add a custom\r
-# module. Disabling a module can be performed by setting unitils.module.<modulename>.enabled to false.\r
-# If a module's specific dependencies are not found (e.g. hibernate is not in you classpath), this module is not loaded,\r
-# even if it is in this list and the enabled property is set to true. It's therefore not strictly necessary to disable\r
-# any of these modules.\r
-#DEFAULT: unitils.modules=database,dbunit,hibernate,mock,easymock,inject,spring,jpa\r
-unitils.module.easymock.enabled=false\r
-unitils.module.mock.enabled=false\r
-\r
-\r
-### Database ###\r
-#\r
-# Name or path of the user specific properties file. This file should contain the necessary parameters to connect to the\r
-# developer's own unit test schema. It is recommended to override the name of this file in the project specific properties\r
-# file, to include the name of the project. The system will try to find this file in the classpath, the user home folder\r
-# (recommended) or the local filesystem.\r
-#\r
-unitils.configuration.localFileName=unitils-cdmlib-local.properties\r
-\r
-# H2 #\r
-#\r
-database.driverClassName=org.h2.Driver\r
-#database.url=jdbc:h2:file:./src/main/resources/h2/cdmTest;AUTO_SERVER=TRUE\r
-database.url=jdbc:h2:file:./target/classes/h2/cdmTest;AUTO_SERVER=TRUE\r
-database.dialect=h2\r
-database.userName=sa\r
-database.password=\r
-database.schemaNames=PUBLIC\r
-org.dbunit.dataset.datatype.IDataTypeFactory.implClassName.h2=org.dbunit.ext.h2.H2DataTypeFactory\r
-org.unitils.core.dbsupport.DbSupport.implClassName.h2=eu.etaxonomy.cdm.database.H2DbSupport\r
-database.storedIndentifierCase.h2=auto\r
-database.identifierQuoteString.h2=auto\r
-\r
-\r
-#### Transaction mode ###\r
-#\r
-# If set to commit or rollback, each test is run in a transaction,\r
-# which is committed or rolled back after the test is finished.\r
-# Since we have many tests with incomplete data these tests would be\r
-# failing during commit so it is better use rollback as default\r
-# and set commit for individual test where necessary\r
-DatabaseModule.Transactional.value.default=rollback\r
-\r
-# org.unitils.database.transaction.impl.DefaultUnitilsTransactionManager is used by default:\r
-#\r
-#   Implements transactions for unit tests, by delegating to a spring PlatformTransactionManager.\r
-#   The concrete implementation of PlatformTransactionManager that is used depends on the test class.\r
-#   If a custom PlatformTransactionManager was configured in a spring ApplicationContext, this one is used.\r
-#   If not, a suitable subclass of PlatformTransactionManager is created, depending on the configuration\r
-#   of a test. E.g. if some ORM persistence unit was configured on the test, a PlatformTransactionManager\r
-#   that can offer transactional behavior for such a persistence unit is used.\r
-#   If no such configuration is found, a DataSourceTransactionManager is used.\r
-#\r
-# org.unitils.database.transaction.UnitilsTransactionManager.implClassName=org.unitils.database.transaction.impl.SpringTransactionManager\r
-\r
-### Hibernate ###\r
-#\r
-HibernateModule.configuration.implClassName=org.hibernate.cfg.Configuration\r
-\r
+#
+# NOTE: this is the unitils.properties file for the cdmlib-persistence module
+# a separate unitils.properties exists for cdmlib-io and for cdmlib-services
+#
+#
+# the list of all properties is found in
+# http://unitils.org/unitils-default.properties
+#
+
+### Unitils Modules ###
+# List of modules that is loaded. Overloading this list is normally not useful, unless you want to add a custom
+# module. Disabling a module can be performed by setting unitils.module.<modulename>.enabled to false.
+# If a module's specific dependencies are not found (e.g. hibernate is not in you classpath), this module is not loaded,
+# even if it is in this list and the enabled property is set to true. It's therefore not strictly necessary to disable
+# any of these modules.
+#DEFAULT: unitils.modules=database,dbunit,hibernate,mock,easymock,inject,spring,jpa
+unitils.module.easymock.enabled=false
+unitils.module.mock.enabled=false
+
+
+### Database ###
+#
+# Name or path of the user specific properties file. This file should contain the necessary parameters to connect to the
+# developer's own unit test schema. It is recommended to override the name of this file in the project specific properties
+# file, to include the name of the project. The system will try to find this file in the classpath, the user home folder
+# (recommended) or the local filesystem.
+#
+unitils.configuration.localFileName=unitils-cdmlib-local.properties
+
+# H2 #
+#
+database.driverClassName=org.h2.Driver
+#database.url=jdbc:h2:file:./src/main/resources/h2/cdmTest;AUTO_SERVER=TRUE
+database.url=jdbc:h2:file:./target/classes/h2/cdmTest;AUTO_SERVER=TRUE
+database.dialect=h2
+database.userName=sa
+database.password=
+database.schemaNames=PUBLIC
+org.dbunit.dataset.datatype.IDataTypeFactory.implClassName.h2=org.dbunit.ext.h2.H2DataTypeFactory
+org.unitils.core.dbsupport.DbSupport.implClassName.h2=eu.etaxonomy.taxeditor.util.H2DbSupport
+database.storedIndentifierCase.h2=auto
+database.identifierQuoteString.h2=auto
+
+
+#### Transaction mode ###
+#
+# If set to commit or rollback, each test is run in a transaction,
+# which is committed or rolled back after the test is finished.
+# Since we have many tests with incomplete data these tests would be
+# failing during commit so it is better use rollback as default
+# and set commit for individual test where necessary
+DatabaseModule.Transactional.value.default=rollback
+
+# org.unitils.database.transaction.impl.DefaultUnitilsTransactionManager is used by default:
+#
+#   Implements transactions for unit tests, by delegating to a spring PlatformTransactionManager.
+#   The concrete implementation of PlatformTransactionManager that is used depends on the test class.
+#   If a custom PlatformTransactionManager was configured in a spring ApplicationContext, this one is used.
+#   If not, a suitable subclass of PlatformTransactionManager is created, depending on the configuration
+#   of a test. E.g. if some ORM persistence unit was configured on the test, a PlatformTransactionManager
+#   that can offer transactional behavior for such a persistence unit is used.
+#   If no such configuration is found, a DataSourceTransactionManager is used.
+#
+# org.unitils.database.transaction.UnitilsTransactionManager.implClassName=org.unitils.database.transaction.impl.SpringTransactionManager
+
+### Hibernate ###
+#
+HibernateModule.configuration.implClassName=org.hibernate.cfg.Configuration
+
index 62fcda0ded9c0fca535780bcb5f721ddc87df6d7..37a197abdf42641b1f2166859c31528f0a4f5553 100644 (file)
   <name>EDIT Taxonomic Editor Product</name>
   <description>The EDIT Taxonomic Desktop Editor</description>
   <url>http://wp5.e-taxonomy.eu/taxeditor</url>
-  <properties>    
+  <properties>
     <product.id>eu.etaxonomy.taxeditor.product</product.id>
   </properties>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.eclipse.tycho</groupId>
-        <artifactId>tycho-p2-director-plugin</artifactId>
-        <version>${tycho.version}</version>
-        <executions>
-          <execution>
-            <id>materialize-products</id>
-            <goals>
-              <goal>materialize-products</goal>
-            </goals>
-          </execution>
-          <execution>
-            <id>archive-products</id>
-            <goals>
-              <goal>archive-products</goal>
-            </goals>
-          </execution>
-        </executions>
-        <configuration>
-          <products>
-            <product>
-              <id>${product.id}</id>
-              <rootFolder>EDIT Taxonomic Editor</rootFolder>
-            </product>
-          </products>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
+
   <profiles>
+    <profile>
+      <id>buildProducts</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.eclipse.tycho</groupId>
+            <artifactId>tycho-p2-director-plugin</artifactId>
+            <version>${tycho.version}</version>
+            <executions>
+              <execution>
+                <id>materialize-products</id>
+                <goals>
+                  <goal>materialize-products</goal>
+                </goals>
+              </execution>
+              <execution>
+                <id>archive-products</id>
+                <goals>
+                  <goal>archive-products</goal>
+                </goals>
+              </execution>
+            </executions>
+            <configuration>
+              <products>
+                <product>
+                  <id>${product.id}</id>
+                  <rootFolder>EDIT Taxonomic Editor</rootFolder>
+                </product>
+              </products>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
     <profile>
       <id>signJars</id>
       <build>
diff --git a/pom.xml b/pom.xml
index 013d4a79ee02b2f56e89ec00da65aca3a9fc3021..1667aea57cd9c7a9f6a36e2d8cb5c67bd8036f6b 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -23,6 +23,7 @@
     <tycho.version>0.22.0</tycho.version>
     <taxeditor.version>3.5.2-SNAPSHOT</taxeditor.version>
     <update.dir>snapshot</update.dir>
+    <unitils.version>3.4.2</unitils.version>
   </properties>
   <modules>
     <module>eu.etaxonomy.taxeditor.cdmlib</module>