Remove DB unit tests.
authorMathieu Baudier <mbaudier@argeo.org>
Fri, 4 Oct 2019 08:55:18 +0000 (10:55 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Fri, 4 Oct 2019 08:55:18 +0000 (10:55 +0200)
org.argeo.slc.unit/src/org/argeo/slc/unit/db/DbUnitDeployment.java [deleted file]
org.argeo.slc.unit/src/org/argeo/slc/unit/db/DbUnitDeploymentData.java [deleted file]

diff --git a/org.argeo.slc.unit/src/org/argeo/slc/unit/db/DbUnitDeployment.java b/org.argeo.slc.unit/src/org/argeo/slc/unit/db/DbUnitDeployment.java
deleted file mode 100644 (file)
index 25ecb06..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*\r
- * Copyright (C) 2007-2012 Argeo GmbH\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *         http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.unit.db;\r
-\r
-import java.sql.SQLException;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.UnsupportedException;\r
-import org.argeo.slc.build.Distribution;\r
-import org.argeo.slc.deploy.DeployedSystem;\r
-import org.argeo.slc.deploy.Deployment;\r
-import org.argeo.slc.deploy.DeploymentData;\r
-import org.argeo.slc.deploy.TargetData;\r
-import org.argeo.slc.support.deploy.db.DbModel;\r
-import org.argeo.slc.support.deploy.db.JdbcAware;\r
-import org.dbunit.DataSourceDatabaseTester;\r
-import org.dbunit.DatabaseUnitException;\r
-import org.dbunit.IDatabaseTester;\r
-import org.dbunit.database.IDatabaseConnection;\r
-import org.dbunit.dataset.IDataSet;\r
-import org.dbunit.operation.DatabaseOperation;\r
-\r
-public class DbUnitDeployment implements Deployment {\r
-       private static Log log = LogFactory.getLog(DbUnitDeployment.class);\r
-\r
-       private JdbcAware jdbcAware;\r
-       private DbUnitDeploymentData deploymentData;\r
-       private DbModel dbModel;\r
-\r
-       public void run() {\r
-               try {\r
-                       IDatabaseTester databaseTester = new DataSourceDatabaseTester(\r
-                                       jdbcAware.getDataSource());\r
-                       databaseTester.setSetUpOperation(new DatabaseOperation() {\r
-\r
-                               @Override\r
-                               public void execute(IDatabaseConnection connection,\r
-                                               IDataSet dataSet) throws DatabaseUnitException,\r
-                                               SQLException {\r
-                                       if (dbModel != null) {\r
-                                               dbModel.createSchema(connection.getConnection());\r
-                                               DatabaseOperation.INSERT.execute(connection, dataSet);\r
-                                       } else {\r
-                                               DatabaseOperation.UPDATE.execute(connection, dataSet);\r
-                                       }\r
-                               }\r
-\r
-                       });\r
-                       databaseTester.setDataSet(deploymentData.createDataSet());\r
-                       databaseTester.onSetup();\r
-                       databaseTester.onTearDown();\r
-\r
-                       log.info("Database deployed.");\r
-               } catch (Exception e) {\r
-                       throw new SlcException("Could not initialize the database", e);\r
-               }\r
-       }\r
-\r
-       public DeployedSystem getDeployedSystem() {\r
-               throw new UnsupportedOperationException();\r
-       }\r
-\r
-       public void setDbModel(DbModel dbModel) {\r
-               this.dbModel = dbModel;\r
-       }\r
-\r
-       public void setDeploymentData(DeploymentData deploymentData) {\r
-               this.deploymentData = (DbUnitDeploymentData) deploymentData;\r
-       }\r
-\r
-       public void setTargetData(TargetData targetData) {\r
-               this.jdbcAware = (JdbcAware) targetData;\r
-\r
-       }\r
-\r
-       public void setDistribution(Distribution distribution) {\r
-               throw new UnsupportedException("Method not supported");\r
-       }\r
-\r
-}\r
diff --git a/org.argeo.slc.unit/src/org/argeo/slc/unit/db/DbUnitDeploymentData.java b/org.argeo.slc.unit/src/org/argeo/slc/unit/db/DbUnitDeploymentData.java
deleted file mode 100644 (file)
index 46835c6..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*\r
- * Copyright (C) 2007-2012 Argeo GmbH\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *         http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.unit.db;\r
-\r
-import java.io.InputStream;\r
-\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.deploy.DeploymentData;\r
-import org.dbunit.dataset.IDataSet;\r
-import org.dbunit.dataset.xml.FlatXmlDataSet;\r
-import org.springframework.core.io.Resource;\r
-\r
-public class DbUnitDeploymentData implements DeploymentData {\r
-       private Resource dataSetLocation;\r
-\r
-       public IDataSet createDataSet() {\r
-               try {\r
-                       InputStream in = dataSetLocation.getInputStream();\r
-                       IDataSet dataSet = new FlatXmlDataSet(in);\r
-                       in.close();\r
-                       return dataSet;\r
-               } catch (Exception e) {\r
-                       throw new SlcException("Cannot create data set", e);\r
-               }\r
-\r
-       }\r
-\r
-       public void setDataSetLocation(Resource dataSetLocation) {\r
-               this.dataSetLocation = dataSetLocation;\r
-       }\r
-\r
-}\r