From 0b3d1415b52fbbfc0851a4814a7cd79bb19c783f Mon Sep 17 00:00:00 2001 From: hengsin Date: Thu, 2 Apr 2020 19:27:07 +0800 Subject: [PATCH] IDEMPIERE-4199 Clean up org.adempiere.extend --- org.adempiere.base-feature/feature.xml | 8 - .../model.generator.launch | 1 - .../packinfolder.app.launch | 1 - .../sign.database.build.launch | 1 - .../synchronize-terminology.app.launch | 1 - .../translation.app.launch | 1 - org.adempiere.extend/.classpath | 11 - org.adempiere.extend/.project | 34 -- .../org.eclipse.core.resources.prefs | 2 - .../.settings/org.eclipse.jdt.core.prefs | 3 - .../.settings/org.eclipse.m2e.core.prefs | 4 - .../org.eclipse.wst.common.component | 6 - ....eclipse.wst.common.project.facet.core.xml | 7 - org.adempiere.extend/Extend.html | 26 - org.adempiere.extend/META-INF/MANIFEST.MF | 20 - org.adempiere.extend/SamplePluginTest.launch | 141 ----- org.adempiere.extend/build.properties | 4 - org.adempiere.extend/pom.xml | 12 - .../src/test/AdempiereTestCase.java | 259 -------- .../src/test/functional/DBTest.java | 219 ------- .../functional/EmailFormatValidatorTest.java | 98 --- .../src/test/functional/MBPGroupTest.java | 526 ---------------- .../functional/MBPartnerLocationTest.java | 575 ------------------ .../src/test/functional/MLocationTest.java | 33 - .../src/test/functional/MRefListTest.java | 70 --- .../src/test/functional/MSessionTest.java | 35 -- .../src/test/functional/MStorageTest.java | 83 --- .../src/test/functional/MSysConfigTest.java | 86 --- .../src/test/functional/MUOMTest.java | 42 -- .../src/test/functional/MUserTest.java | 561 ----------------- .../src/test/functional/POTest.java | 270 -------- .../src/test/functional/QueryTest.java | 309 ---------- .../src/test/functional/TrxTest.java | 114 ---- .../src/test/performance/MProductTest.java | 145 ----- org.adempiere.extend/testTemplate.properties | 24 - org.adempiere.install/install.app.launch | 1 - .../install.console.app.launch | 1 - .../server.product.functionaltest.launch | 1 - .../server.product.launch | 1 - org.idempiere.javadoc/build.properties | 1 - pom.xml | 1 - 41 files changed, 3738 deletions(-) delete mode 100644 org.adempiere.extend/.classpath delete mode 100644 org.adempiere.extend/.project delete mode 100644 org.adempiere.extend/.settings/org.eclipse.core.resources.prefs delete mode 100644 org.adempiere.extend/.settings/org.eclipse.jdt.core.prefs delete mode 100644 org.adempiere.extend/.settings/org.eclipse.m2e.core.prefs delete mode 100644 org.adempiere.extend/.settings/org.eclipse.wst.common.component delete mode 100644 org.adempiere.extend/.settings/org.eclipse.wst.common.project.facet.core.xml delete mode 100644 org.adempiere.extend/Extend.html delete mode 100644 org.adempiere.extend/META-INF/MANIFEST.MF delete mode 100644 org.adempiere.extend/SamplePluginTest.launch delete mode 100644 org.adempiere.extend/build.properties delete mode 100644 org.adempiere.extend/pom.xml delete mode 100644 org.adempiere.extend/src/test/AdempiereTestCase.java delete mode 100644 org.adempiere.extend/src/test/functional/DBTest.java delete mode 100644 org.adempiere.extend/src/test/functional/EmailFormatValidatorTest.java delete mode 100644 org.adempiere.extend/src/test/functional/MBPGroupTest.java delete mode 100644 org.adempiere.extend/src/test/functional/MBPartnerLocationTest.java delete mode 100644 org.adempiere.extend/src/test/functional/MLocationTest.java delete mode 100644 org.adempiere.extend/src/test/functional/MRefListTest.java delete mode 100644 org.adempiere.extend/src/test/functional/MSessionTest.java delete mode 100644 org.adempiere.extend/src/test/functional/MStorageTest.java delete mode 100644 org.adempiere.extend/src/test/functional/MSysConfigTest.java delete mode 100644 org.adempiere.extend/src/test/functional/MUOMTest.java delete mode 100644 org.adempiere.extend/src/test/functional/MUserTest.java delete mode 100644 org.adempiere.extend/src/test/functional/POTest.java delete mode 100644 org.adempiere.extend/src/test/functional/QueryTest.java delete mode 100644 org.adempiere.extend/src/test/functional/TrxTest.java delete mode 100644 org.adempiere.extend/src/test/performance/MProductTest.java delete mode 100644 org.adempiere.extend/testTemplate.properties diff --git a/org.adempiere.base-feature/feature.xml b/org.adempiere.base-feature/feature.xml index ae829e05b7..180b4fb743 100644 --- a/org.adempiere.base-feature/feature.xml +++ b/org.adempiere.base-feature/feature.xml @@ -62,14 +62,6 @@ version="0.0.0" unpack="false"/> - - - diff --git a/org.adempiere.base-feature/packinfolder.app.launch b/org.adempiere.base-feature/packinfolder.app.launch index 384e6146d2..367d7595ad 100644 --- a/org.adempiere.base-feature/packinfolder.app.launch +++ b/org.adempiere.base-feature/packinfolder.app.launch @@ -380,7 +380,6 @@ - diff --git a/org.adempiere.base-feature/sign.database.build.launch b/org.adempiere.base-feature/sign.database.build.launch index 7a9ffc17dc..2d31b70adb 100644 --- a/org.adempiere.base-feature/sign.database.build.launch +++ b/org.adempiere.base-feature/sign.database.build.launch @@ -380,7 +380,6 @@ - diff --git a/org.adempiere.base-feature/synchronize-terminology.app.launch b/org.adempiere.base-feature/synchronize-terminology.app.launch index 77c8a63e7a..6906e5df29 100644 --- a/org.adempiere.base-feature/synchronize-terminology.app.launch +++ b/org.adempiere.base-feature/synchronize-terminology.app.launch @@ -380,7 +380,6 @@ - diff --git a/org.adempiere.base-feature/translation.app.launch b/org.adempiere.base-feature/translation.app.launch index c9fcc7d2d9..14fff3fa11 100644 --- a/org.adempiere.base-feature/translation.app.launch +++ b/org.adempiere.base-feature/translation.app.launch @@ -380,7 +380,6 @@ - diff --git a/org.adempiere.extend/.classpath b/org.adempiere.extend/.classpath deleted file mode 100644 index 423c974870..0000000000 --- a/org.adempiere.extend/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/org.adempiere.extend/.project b/org.adempiere.extend/.project deleted file mode 100644 index b140e29ce4..0000000000 --- a/org.adempiere.extend/.project +++ /dev/null @@ -1,34 +0,0 @@ - - - org.adempiere.extend - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.jdt.core.javanature - org.eclipse.pde.PluginNature - - diff --git a/org.adempiere.extend/.settings/org.eclipse.core.resources.prefs b/org.adempiere.extend/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0203..0000000000 --- a/org.adempiere.extend/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/org.adempiere.extend/.settings/org.eclipse.jdt.core.prefs b/org.adempiere.extend/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 6783713ef0..0000000000 --- a/org.adempiere.extend/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.release=enabled diff --git a/org.adempiere.extend/.settings/org.eclipse.m2e.core.prefs b/org.adempiere.extend/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1cb..0000000000 --- a/org.adempiere.extend/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/org.adempiere.extend/.settings/org.eclipse.wst.common.component b/org.adempiere.extend/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 48bf5a1b75..0000000000 --- a/org.adempiere.extend/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/org.adempiere.extend/.settings/org.eclipse.wst.common.project.facet.core.xml b/org.adempiere.extend/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index fd534a9527..0000000000 --- a/org.adempiere.extend/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/org.adempiere.extend/Extend.html b/org.adempiere.extend/Extend.html deleted file mode 100644 index f45d5f8d81..0000000000 --- a/org.adempiere.extend/Extend.html +++ /dev/null @@ -1,26 +0,0 @@ - - - -Project Extend.jpx - - -

Project Notes

-
- -Project: Product Extensions
-Author: Jorg Janke
-Version: $Id: Extend.html,v 1.1 2006/04/21 17:55:19 jjanke Exp $
-
-Description:
-Create Jar Extend.jar to be included in Base => Client. -Example of extensions -
-Things to do...
-
-
    - -
  • Item 1 -
  • Item 2 -
- - diff --git a/org.adempiere.extend/META-INF/MANIFEST.MF b/org.adempiere.extend/META-INF/MANIFEST.MF deleted file mode 100644 index 5c21e2aeba..0000000000 --- a/org.adempiere.extend/META-INF/MANIFEST.MF +++ /dev/null @@ -1,20 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: iDempiere extend -Bundle-SymbolicName: org.adempiere.extend;singleton:=true -Bundle-Version: 7.1.0.qualifier -Eclipse-RegisterBuddy: org.adempiere.tools -Bundle-RequiredExecutionEnvironment: JavaSE-11 -Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=11))" -Export-Package: test -Fragment-Host: org.adempiere.base;bundle-version="0.0.0" -Eclipse-PatchFragment: true -Import-Package: junit.framework;version="3.8.2", - org.junit;version="4.8.2", - org.junit.runner, - org.junit.runners;version="4.8.2", - org.supercsv.io, - org.supercsv.prefs -Bundle-ClassPath: . -Automatic-Module-Name: org.adempiere.extend -Bundle-Vendor: iDempiere Community diff --git a/org.adempiere.extend/SamplePluginTest.launch b/org.adempiere.extend/SamplePluginTest.launch deleted file mode 100644 index 8d551311a1..0000000000 --- a/org.adempiere.extend/SamplePluginTest.launch +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.adempiere.extend/build.properties b/org.adempiere.extend/build.properties deleted file mode 100644 index ba31debd0e..0000000000 --- a/org.adempiere.extend/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -bin.includes = META-INF/,\ - . -output.. = target/classes/ -source.. = src/ diff --git a/org.adempiere.extend/pom.xml b/org.adempiere.extend/pom.xml deleted file mode 100644 index 7adc9ef97f..0000000000 --- a/org.adempiere.extend/pom.xml +++ /dev/null @@ -1,12 +0,0 @@ - - 4.0.0 - - org.idempiere - org.idempiere.parent - 7.1.0-SNAPSHOT - ../org.idempiere.parent/pom.xml - - org.adempiere.extend - eclipse-plugin - \ No newline at end of file diff --git a/org.adempiere.extend/src/test/AdempiereTestCase.java b/org.adempiere.extend/src/test/AdempiereTestCase.java deleted file mode 100644 index b53f677ba8..0000000000 --- a/org.adempiere.extend/src/test/AdempiereTestCase.java +++ /dev/null @@ -1,259 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 Adempiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package test; - -import java.io.File; -import java.io.FileInputStream; -import java.util.Properties; -import java.util.Random; -import java.util.logging.Level; - -import javax.swing.JFileChooser; - -import junit.framework.TestCase; - -import org.compiere.util.CLogMgt; -import org.compiere.util.CLogger; -import org.compiere.util.Env; -import org.compiere.util.Ini; -import org.compiere.util.Trx; - -/** - * ADempiere Base Test Case - * @author Teo Sarca - */ -public class AdempiereTestCase extends TestCase -{ - // Test: General - protected Properties testProperties = null; - protected String testPropertiesFileName = "test.properties"; - - // Test Context - private Properties m_Ctx = null; - - // Filename - public final String fileName_Key = "AdempiereProperties"; - private String fileName_DefaultValue = "idempiere.properties"; - private String fileName_Value = ""; - - // IsClient - public final String isClient_Key = "isClient"; - private String isClient_DefaultValue = "Y"; - private boolean isClient_Value = true; - - // AD_User - public final String AD_User_ID_Key = "AD_User_ID"; - private String AD_User_ID_DefaultValue = "100"; //SuperUser - private int AD_User_ID_Value = 0; - - // AD_Client - public final String AD_Client_ID_Key = "AD_Client_ID"; - private String AD_Client_ID_DefaultValue = "11"; //GardenWorld - private int AD_Client_ID_Value = 11; - - // LogLevel: - public final String LogLevel_Key = "LogLevel"; - private String LogLevel_DefaultValue = Level.FINEST.toString(); - private Level LogLevel_Value = Level.FINEST; - - /** Logger */ - protected final CLogger log = CLogger.getCLogger(getClass()); - - /** Trx name */ - private String trxName = Trx.createTrxName(getClass().getName()+"_"); - - /** Random numbers generator */ - private Random m_randGenerator = new Random(System.currentTimeMillis()); - - /** - * - * @return environment context - */ - public Properties getCtx() { - return m_Ctx; - } - - /** - * - * @return active transaction name - */ - public String getTrxName() { - return trxName; - } - - /** - * - * @return client id - */ - public int getAD_Client_ID() { - return AD_Client_ID_Value; - } - - /** - * - * @return user id - */ - public int getAD_User_ID() { - return AD_User_ID_Value; - } - - /** - * - * @return is running as client - */ - public boolean isClient() { - return isClient_Value; - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - - // Load properties - testProperties = new Properties(); - File file = new File(testPropertiesFileName); - if (!file.isFile()) { - log.warning("File not found - "+file.getAbsolutePath()); - JFileChooser chooser = new JFileChooser(); - int returnVal = chooser.showOpenDialog(null); - if(returnVal == JFileChooser.APPROVE_OPTION) { - file = chooser.getSelectedFile(); - } - else { - file = null; - } - } - testProperties.load(new FileInputStream(file)); - - // - fileName_Value = testProperties.getProperty(fileName_Key, fileName_DefaultValue); - isClient_Value = "Y".equals( testProperties.getProperty(isClient_Key, isClient_DefaultValue) ); - AD_User_ID_Value = Integer.parseInt(testProperties.getProperty(AD_User_ID_Key, AD_User_ID_DefaultValue) ); - AD_Client_ID_Value = Integer.parseInt(testProperties.getProperty(AD_Client_ID_Key, AD_Client_ID_DefaultValue) ); - try { - LogLevel_Value = Level.parse(testProperties.getProperty(LogLevel_Key, LogLevel_DefaultValue)); - } catch (Exception e) { - } - - //m_Ctx = new Properties(); - m_Ctx = Env.getCtx(); - m_Ctx.setProperty("#AD_User_ID", Integer.valueOf(AD_User_ID_Value).toString()); - m_Ctx.setProperty("#AD_Client_ID", Integer.valueOf(AD_Client_ID_Value).toString()); - - if (fileName_Value.length() < 1) { - assertEquals("Please specify path to idempiere.properties file!", true, false); - } - - System.setProperty("PropertyFile", fileName_Value); - Ini.setClient (isClient_Value); - org.compiere.Adempiere.startup(isClient_Value); - - CLogMgt.setLevel(LogLevel_Value); - } - - /** - * Commit active transaction - * @throws Exception - */ - protected void commit() throws Exception { - Trx trx = null; - if (trxName != null) - trx = Trx.get(trxName, false); - if (trx != null && trx.isActive()) { - trx.commit(true); - } - } - - /** - * Rollback active transaction - */ - protected void rollback() { - Trx trx = null; - if (trxName != null) - trx = Trx.get(trxName, false); - if (trx != null && trx.isActive()) { - trx.rollback(); - } - } - - /** - * Close active transaction - */ - protected void close() { - Trx trx = null; - if (trxName != null) - trx = Trx.get(trxName, false); - if (trx != null) { - trx.close(); - } - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - - // Rollback the transaction, if any - Trx trx = null; - if (trxName != null) - trx = Trx.get(trxName, false); - if (trx != null && trx.isActive()) { - trx.rollback(); - } - if (trx != null) { - trx.close(); - } - trx = null; - - testProperties = null; - m_Ctx = null; - } - - /** - * Generate random integer - * @param max - * @return random integer - */ - public int randomInt(int max) - { - return m_randGenerator.nextInt(max); - } - - /** - * Assert Exception is throw - * @param message optional error message - * @param exceptionType optional exception type - * @param runnable runnable piece of code - * @throws Exception - */ - public void assertExceptionThrown(String message, Class exceptionType, Runnable runnable) - throws Exception - { - Exception ex = null; - try - { - runnable.run(); - } - catch (Exception e) - { - ex = e; - //e.printStackTrace(); - } - assertNotNull("No exception was throwed : "+message, ex); - // - if (exceptionType != null && !exceptionType.isAssignableFrom(ex.getClass())) - { - throw ex; - } - } -} diff --git a/org.adempiere.extend/src/test/functional/DBTest.java b/org.adempiere.extend/src/test/functional/DBTest.java deleted file mode 100644 index 7cb3da1546..0000000000 --- a/org.adempiere.extend/src/test/functional/DBTest.java +++ /dev/null @@ -1,219 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 2008 SC ARHIPAC SERVICE SRL. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package test.functional; - -import java.math.BigDecimal; -import java.sql.Timestamp; -import java.util.ArrayList; - -import org.adempiere.exceptions.DBException; -import org.compiere.model.MTable; -import org.compiere.util.DB; -import org.compiere.util.KeyNamePair; -import org.compiere.util.TimeUtil; -import org.compiere.util.ValueNamePair; - -import test.AdempiereTestCase; - -/** - * Test {@link org.compiere.util.DB} class - * @author Teo Sarca, www.arhipac.ro - */ -public class DBTest extends AdempiereTestCase -{ - public void test_getSQLValueEx() throws Exception - { - int result = DB.getSQLValueEx(null, "SELECT 10 FROM DUAL"); - assertEquals(10, result); - // - result = DB.getSQLValue(null, "SELECT 10 FROM AD_SYSTEM WHERE 1=2"); - assertEquals("No value should be returned", -1, result); - // - DBException ex = null; - try - { - result = DB.getSQLValueEx(null, "SELECT 10 FROM INEXISTENT_TABLE"); - } - catch (DBException e) - { - ex = e; - } - assertNotNull("No DBException Was Throwed", ex); - } - - public void test_getSQLValue() throws Exception - { - int result = DB.getSQLValue(null, "SELECT 10 FROM DUAL"); - assertEquals(10, result); - // - result = DB.getSQLValue(null, "SELECT 10 FROM AD_SYSTEM WHERE 1=2"); - assertEquals("No value should be returned", -1, result); - // - result = DB.getSQLValue(null, "SELECT 10 FROM INEXISTENT_TABLE"); - assertEquals("Error should be signaled", -1, result); - } - - public void test_getSQLValueBDEx() throws Exception - { - BigDecimal result = DB.getSQLValueBDEx(null, "SELECT 10 FROM DUAL"); - assertEquals(BigDecimal.TEN, result); - // - result = DB.getSQLValueBD(null, "SELECT 10 FROM AD_SYSTEM WHERE 1=2"); - assertNull("No value should be returned", result); - // - DBException ex = null; - try - { - result = DB.getSQLValueBDEx(null, "SELECT 10 FROM INEXISTENT_TABLE"); - } - catch (DBException e) - { - ex = e; - } - assertNotNull("No DBException Was Throwed", ex); - } - - public void test_getSQLValueBD() throws Exception - { - BigDecimal result = DB.getSQLValueBD(null, "SELECT 10 FROM DUAL"); - assertEquals(BigDecimal.TEN, result); - // - result = DB.getSQLValueBD(null, "SELECT 10 FROM AD_SYSTEM WHERE 1=2"); - assertNull("No value should be returned", result); - // - result = DB.getSQLValueBD(null, "SELECT 10 FROM INEXISTENT_TABLE"); - assertNull("Error should be signaled", result); - } - - public void test_getSQLValueStringEx() throws Exception - { - String result = DB.getSQLValueStringEx(null, "SELECT 'string' FROM DUAL"); - assertEquals("string", result); - // - result = DB.getSQLValueStringEx(null, "SELECT 10 FROM AD_SYSTEM WHERE 1=2"); - assertNull("No value should be returned", result); - // - DBException ex = null; - try - { - result = DB.getSQLValueStringEx(null, "SELECT 'string' FROM INEXISTENT_TABLE"); - } - catch (DBException e) - { - ex = e; - } - assertNotNull("No DBException Was Throwed", ex); - } - - public void test_getSQLValueString() throws Exception - { - String result = DB.getSQLValueString(null, "SELECT 'string' FROM DUAL"); - assertEquals("string", result); - // - result = DB.getSQLValueString(null, "SELECT 'string' FROM AD_SYSTEM WHERE 1=2"); - assertNull("No value should be returned", result); - // - result = DB.getSQLValueString(null, "SELECT 'string' FROM INEXISTENT_TABLE"); - assertNull("Error should be signaled", result); - } - - public void test_getSQLValueTSEx() throws Exception - { - final Timestamp target = TimeUtil.getDay(2008, 01, 01); - // - Timestamp result = DB.getSQLValueTSEx(null, "SELECT TO_DATE('2008-01-01','YYYY-MM-DD') FROM AD_SYSTEM"); - assertEquals(target, result); - // - result = DB.getSQLValueTSEx(null, "SELECT TO_DATE('2008-01-01','YYYY-MM-DD') FROM AD_SYSTEM WHERE 1=2"); - assertNull("No value should be returned", result); - // - DBException ex = null; - try - { - result = DB.getSQLValueTSEx(null, "SELECT TO_DATE('2008-01-01','YYYY-MM-DD') FROM INEXISTENT_TABLE"); - } - catch (DBException e) - { - ex = e; - } - assertNotNull("No DBException Was Throwed", ex); - } - - public void test_getSQLValueTS() throws Exception - { - final Timestamp target = TimeUtil.getDay(2008, 01, 01); - // - Timestamp result = DB.getSQLValueTS(null, "SELECT TO_DATE('2008-01-01','YYYY-MM-DD') FROM DUAL"); - assertEquals(target, result); - // - result = DB.getSQLValueTS(null, "SELECT TO_DATE('2008-01-01','YYYY-MM-DD') FROM AD_SYSTEM WHERE 1=2"); - assertNull("No value should be returned", result); - // - result = DB.getSQLValueTS(null, "SELECT TO_DATE('2008-01-01','YYYY-MM-DD') FROM INEXISTENT_TABLE"); - assertNull("Error should be signaled", result); - } - - public void test_getValueNamePairs() throws Exception - { - ArrayList params = new ArrayList(); - params.add(MTable.ACCESSLEVEL_AD_Reference_ID); - final String sql = "SELECT Value, Name FROM AD_Ref_List WHERE AD_Reference_ID=? ORDER BY Value"; - // Get (with optional item) - ValueNamePair[] arr = DB.getValueNamePairs(sql, true, params); - assertEquals("Invalid size", 6+1, arr.length); - assertSame("First value should be EMPTY", ValueNamePair.EMPTY, arr[0]); - assertEquals(arr[1].getValue(), "1"); - assertEquals(arr[2].getValue(), "2"); - assertEquals(arr[3].getValue(), "3"); - assertEquals(arr[4].getValue(), "4"); - assertEquals(arr[5].getValue(), "6"); - assertEquals(arr[6].getValue(), "7"); - // Get (NO optional item) - arr = DB.getValueNamePairs(sql, false, params); - assertEquals("Invalid size", 6, arr.length); - assertEquals(arr[0].getValue(), "1"); - assertEquals(arr[1].getValue(), "2"); - assertEquals(arr[2].getValue(), "3"); - assertEquals(arr[3].getValue(), "4"); - assertEquals(arr[4].getValue(), "6"); - assertEquals(arr[5].getValue(), "7"); - } - - public void test_getKeyNamePairs() throws Exception - { - ArrayList params = new ArrayList(); - params.add(MTable.ACCESSLEVEL_AD_Reference_ID); - final String sql = "SELECT AD_Ref_List_ID, Value FROM AD_Ref_List WHERE AD_Reference_ID=? ORDER BY Value"; - // Get (with optional item) - KeyNamePair[] arr = DB.getKeyNamePairs(sql, true, params); - assertEquals("Invalid size", 6+1, arr.length); - assertSame("First value should be EMPTY", KeyNamePair.EMPTY, arr[0]); - assertEquals(arr[1].getName(), "1"); - assertEquals(arr[2].getName(), "2"); - assertEquals(arr[3].getName(), "3"); - assertEquals(arr[4].getName(), "4"); - assertEquals(arr[5].getName(), "6"); - assertEquals(arr[6].getName(), "7"); - // Get (NO optional item) - arr = DB.getKeyNamePairs(sql, false, params); - assertEquals("Invalid size", 6, arr.length); - assertEquals(arr[0].getName(), "1"); - assertEquals(arr[1].getName(), "2"); - assertEquals(arr[2].getName(), "3"); - assertEquals(arr[3].getName(), "4"); - assertEquals(arr[4].getName(), "6"); - assertEquals(arr[5].getName(), "7"); - } - -} diff --git a/org.adempiere.extend/src/test/functional/EmailFormatValidatorTest.java b/org.adempiere.extend/src/test/functional/EmailFormatValidatorTest.java deleted file mode 100644 index dce093f487..0000000000 --- a/org.adempiere.extend/src/test/functional/EmailFormatValidatorTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/********************************************************************** -* This file is part of iDempiere ERP Open Source * -* http://www.idempiere.org * -* * -* Copyright (C) Contributors * -* * -* This program is free software; you can redistribute it and/or * -* modify it under the terms of the GNU General Public License * -* as published by the Free Software Foundation; either version 2 * -* of the License, or (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the Free Software * -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * -* MA 02110-1301, USA. * -* * -* Contributors: * -* - Carlos Ruiz - globalqss * -**********************************************************************/ -package test.functional; - -import static org.junit.Assert.assertEquals; - -import java.util.Arrays; -import java.util.Collection; - -import org.compiere.util.EMail; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; - -/* - * Unit test sample from http://examples.javacodegeeks.com/core-java/util/regex/matcher/validate-email-address-with-java-regular-expression-example/ - */ - -@RunWith(Parameterized.class) -public class EmailFormatValidatorTest { - - private String arg; - private Boolean expectedValidation; - - public EmailFormatValidatorTest(String str, Boolean expectedValidation) { - this.arg = str; - this.expectedValidation = expectedValidation; - } - - @BeforeClass - public static void initialize() { - } - - @Parameters - public static Collection data() { - Object[][] data = new Object[][] { - { "javacodegeeks@gmail.com.2j",true }, - { "java@java@oracle.com", false }, // you cannot have @ twice in the address - { "java!!!@example.com", true }, - { "mysite@.com", false }, // tld cannot start with a dot - { "javacodegees.com", false }, // must contain a @ character and a tld - { ".javacodegees.com@at.com", true }, - { "javacodegees..javacom@at.com", true }, - { "javacodegeeks@gmail.com",true }, - { "nikos+mylist@gmail.com", true }, - { "abc.efg-900@gmail-list.com", true }, - { "abc123@example.com.gr", true }, - { "username+detail@example.com", true }, - { "user@example.museum", true }, - { "myemail+sketchysite@gmail.com", true }, - { "micky.o'finnagan@wherever.com", true }, - { "exampleemail@testing.info", true }, - { "marcelo.calbucci%mandic@fapesp.com.br", true }, - { "customer/department=shipping@example.com", true }, - { "$A12345@example.com", true }, - { "!def!xyz%abc@example.com", true }, - { "_somename@example.com", true }, - { "nuñez@globalqss.com", false }, - { "name@tld", true }, - { "john@server.department.company.com", true } - }; - - return Arrays.asList(data); - } - - @Test - public void test() { - Boolean res = EMail.validate(this.arg); - String validv = (res) ? "valid" : "invalid"; - System.out.println("EMail "+arg+ " is " + validv); - assertEquals("Result", this.expectedValidation, res); - } - -} \ No newline at end of file diff --git a/org.adempiere.extend/src/test/functional/MBPGroupTest.java b/org.adempiere.extend/src/test/functional/MBPGroupTest.java deleted file mode 100644 index 4297ccb705..0000000000 --- a/org.adempiere.extend/src/test/functional/MBPGroupTest.java +++ /dev/null @@ -1,526 +0,0 @@ -//MBPGroupTest.java -package test.functional; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.compiere.model.MBPGroup; -import org.compiere.util.DB; - -import test.AdempiereTestCase; - -public class MBPGroupTest extends AdempiereTestCase { - - // Variables needed for importing/migrating business partners - //private MLocation location = null; - - private MBPGroup m_group = null; //business partner - /* - private MBPGroupLocation bpl = null; //business partner location - private MUser user = null; //business contact - private MContactInterest ci = null; //contact interest area - - // Variables needed for importing/migrating accounts - private MElementValue ev = null; //element value - private MAcctSchema as = null; //account schema - private MAccount acct = null; //account - - // Variables needed for importing/migrating bank statements - private MBankStatement statement = null; - private MBankAccount account = null; - private MBankStatementLine line = null; - - // Variables needed for importing/migrating conversion rates - private MConversionRate rate = null; - - // Variables needed for importing/migrating General Ledger Journal - private MJournalBatch batch = null; - private MJournal journal = null; - private MJournalLine line = null; - - // Variables needed for importing/migrating Inventory - private MInventory inventory = null; - private MProduct product = null; - private MAttributeSet mas = null; - private MAttributeSetInstance masi = null; - private MInventoryLine line = null; - - // Variables needed for importing/migrating Invoices - private MInvoice invoice = null; - private MInvoiceLine line = null; - - // Variables needed for importing/migrating orders - private MOrder order = null; - private MOrderLine line = null; - - // Variables needed for importing/migrating payments - private MPayment payment = null; - - // Variables needed for importing/migrating products - private MProduct product = null; - private MProductPrice pp = null; - - // Variables needed for mrp - - private MCost cost = null; - private MCostElement costElement = null; - private MForecastLine forcastLine = null; - private MOrder order = null; - private MOrderLine line = null; - private MPPCostCollector costCollector = null; - private MPPOrderBOM orderBOM = null; - private MPPOrderBOMLine = null; - private MPPOrderBOMLineMA = null; - private MPPOrderCost = null; - private MPPOrder = null; - private MPPProductBOM = null; - private MPPProductBOMLine = null; - private MPPProductCosting = null; - private MPPProductPlanning = null; - private MPPProfileBOMCost = null; - private MPPProfileBOM = null; - private MPPProfileBOMProduct = null; - private MPPProfileBOMReal = null; - private MPPProfileBOMSelected = null; - private MQMSpecification = null; - private MQMSpecificationLine = null; - private MRequisition = null; - private MRequisitionLine = null; - - - // other variables that may be needed: - - private MAdvertisement = null; - private MAging = null; - private MAlert = null; - private MAlertRecipient = null; - private MAlertRule = null; - - private MAllocationHdr = null; - private MAllocationLine = null; - - private MAssetDelivery = null; - private MAssetGroup = null; - private MAsset = null; - private MAssignmentSlot = null; - private MAttributeInstance = null; - - private MAccessProfile = null; - private MMailText = null; - private MAcctProcessor = null; - private MMatchInv = null; - private MAcctProcessorLog = null; - private MMatchPO = null; - private MAchievement = null; - private MMeasureCalc = null; - private MActivity = null; - private MMeasure = null; - private MAd = null; - private MMediaDeploy = null; - private MAdvertisement = null; - private MMedia = null; - private MAging = null; - private MMediaServer = null; - private MAlert = null; - private MMovementConfirm = null; - private MAlertProcessor = null; - private MMovement = null; - private MAlertProcessorLog = null; - private MMovementLineConfirm = null; - private MAlertRecipient = null; - private MMovementLine = null; - private MAlertRule = null; - private MMovementLineMA = null; - private MAllocationHdr = null; - private MNewsChannel = null; - private MAllocationLine = null; - private MNewsItem = null; - private MAssetDelivery = null; - private MOrder = null; - private MAssetGroup = null; - private MOrderLine = null; - private MAsset = null; - private MOrderTax = null; - private MAssignmentSlot = null; - private MPackage = null; - private MAttributeInstance = null; - private MPackageLine = null; - private MAttribute = null; - private MPaymentAllocate = null; - private MAttributeSetInstance = null; - private MPaymentBatch = null; - private MAttributeSet = null; - private MPayment = null; - private MAttributeUse = null; - private MPaymentProcessor = null; - private MAttributeValue = null; - private MPaymentTerm = null; - private MBankAccount = null; - private MPaymentValidate = null; - private MBank = null; - private MPaySchedule = null; - private MBankStatement = null; - private MPaySelectionCheck = null; - private MBankStatementLine = null; - private MPaySelection = null; - private MBankStatementLoader = null; - private MPaySelectionLine = null; - private MBankStatementMatcher = null; - private MPeriodControl = null; - private MBOM = null; - private MPeriod = null; - private MBOMProduct = null; - private MPOS = null; - private MBPGroupInfo = null; - private MPOSKey = null; - private MPOSKeyLayout = null; - private MPreference = null; - private MBPBankAccount = null; - private MPriceList = null; - private MBPGroup = null; - private MPriceListVersion = null; - private MCalendar = null; - private MProductBOM = null; - private MCampaign = null; - private MProductCategoryAcct = null; - private MCashBook = null; - private MProductCategory = null; - private MCash = null; - private MProductCosting = null; - private MCashLine = null; - private MProductDownload = null; - private MChangeNotice = null; - private MProduct = null; - private MChangeRequest = null; - private MProductPO = null; - private MCharge = null; - private MProductPrice = null; - private MChatEntry = null; - private MProductPricing = null; - private MChat = null; - private MProjectIssue = null; - private MChatType = null; - private MProject = null; - private MClickCount = null; - private MProjectLine = null; - private MClick = null; - private MProjectPhase = null; - private MColor = null; - private MProjectTask = null; - private MColorSchema = null; - private MProjectType = null; - private MCommissionAmt = null; - private MProjectTypePhase = null; - private MCommissionDetail = null; - private MProjectTypeTask = null; - private MCommission = null; - private MRecurring = null; - private MCommissionLine = null; - private MRecurringRun = null; - private MCommissionRun = null; - private MRefTable = null; - private MContactInterest = null; - private MRegistrationAttribute = null; - private MContainerElement = null; - private MRegistration = null; - private MContainer = null; - private MRegistrationValue = null; - private MCostDetail = null; - private MReplication = null; - private MCost = null; - private MReplicationLog = null; - private MCostQueue = null; - private MReplicationRun = null; - private MCounterCount = null; - private MRequestAction = null; - private MCStageElement = null; - private MRequestCategory = null; - private MCStage = null; - private MRequest = null; - private MDesktop = null; - private MRequestProcessor = null; - private MDiscountSchemaBreak = null; - private MRequestProcessorLog = null; - private MDiscountSchema = null; - private MRequestProcessorRoute = null; - private MDiscountSchemaLine = null; - private MRequestType = null; - private MDistribution = null; - private MRequestUpdate = null; - private MDistributionLine = null; - private MRequisition = null; - private MDistributionList = null; - private MRequisitionLine = null; - private MDistributionListLine = null; - private MResolution = null; - private MDistributionRunDetail = null; - private MResourceAssignment = null; - private MDistributionRun = null; - private MResource = null; - private MDistributionRunLine = null; - private MResourceType = null; - private MDocTypeCounter = null; - private MResourceUnAvailable = null; - private MDunning = null; - private MRevenueRecognition = null; - private MDunningLevel = null; - private MRevenueRecognitionPlan = null; - private MDunningRunEntry = null; - private MRfQ = null; - private MDunningRun = null; - private MRfQLine = null; - private MDunningRunLine = null; - private MRfQLineQty = null; - private Measure = null; - private MRfQResponse = null; - private MEntityType = null; - private MRfQResponseLine = null; - private MExpenseType = null; - private MRfQResponseLineQty = null; - private MFactAcct = null; - private MRfQTopic = null; - private MFormAccess = null; - private MRfQTopicSubscriber = null; - private MForm = null; - private MRfQTopicSubscriberOnly = null; - private MGLCategory = null; - private MRMA = null; - private MGoal = null; - private MRMALine = null; - private MGoalRestriction = null; - private MScheduler = null; - private MGroup = null; - private MSchedulerLog = null; - private MHierarchy = null; - private MSchedulerPara = null; - private MIndex = null; - private MSchedulerRecipient = null; - private MIndexStop = null; - private MSerNoCtl = null; - private MInfoColumn = null; - private MSetup = null; - private MInfoWindow = null; - private MShipper = null; - private MInOutConfirm = null; - private MSLACriteria = null; - private MInOut = null; - private MSLAGoal = null; - private MInOutLineConfirm = null; - private MSLAMeasure = null; - private MInOutLine = null; - private MStatusCategory = null; - private MInOutLineMA = null; - private MStatus = null; - private MInterestArea = null; - private MStorage = null; - private MInventory = null; - private MStore = null; - private MInventoryLine = null; - private MTask = null; - private MInventoryLineMA = null; - private MTaxCategory = null; - private MInvoiceBatch = null; - private MTaxDeclarationAcct = null; - private MInvoiceBatchLine = null; - private MTaxDeclaration = null; - private MInvoice = null; - private MTaxDeclarationLine = null; - private MInvoiceLine = null; - private MTax = null; - private MInvoicePaySchedule = null; - private MTaxPostal = null; - private MInvoiceSchedule = null; - private MTemplate = null; - private MInvoiceTax = null; - private MTimeExpense = null; - private MJournalBatch = null; - private MTimeExpenseLine = null; - private MJournal = null; - private MTransaction = null; - private MJournalLine = null; - private MTree = null; - private MKCategory = null; - private MTreeNode = null; - private MLandedCostAllocation = null; - private MultiMap = null; - private MLandedCost = null; - private MUOMConversion = null; - private MLdapAccess = null; - private MUOM = null; - private MLdapProcessor = null; - private MUserMail = null; - private MLdapProcessorLog = null; - private MWarehousePrice = null; - private MLdapUser = null; - private MWebProjectDomain = null; - private MLotCtl = null; - private MWebProject = null; - private MLot = null; - private MWithholding = null; - private MMailMsg = null; - private MYear = null; - - - - // from dbPort/src/org/compiere/model - - private MAccessLog = null; - private MIssueProject = null; - private MRecordAccess = null; - private MAccount = null; - private MIssueSystem = null; - private MRefList = null; - private MAccountLookup = null; - private MIssueUser = null; - private MRegion = null; - private MAcctSchemaDefault = null; - private MLanguage = null; - private M_Registration = null; - private MAcctSchemaElement = null; - private MLocation = null; - private MRole = null; - private MAcctSchemaGL = null; - private MLocationLookup = null; - private MRoleOrgAccess = null; - private MAcctSchema = null; - private MLocator = null; - private MRoleTest = null; - private MArchive = null; - private MLocatorLookup = null; - private MSalesRegion = null; - private MAttachmentEntry = null; - private MLookupCache = null; - private MSequence = null; - private MAttachment = null; - private MLookupFactory = null; - private MSession = null; - private MAttachmentNote = null; - private MLookupInfo = null; - private MSysConfig = null; - private MChangeLog = null; - private MLookup = null; - private MSystem = null; - private MClientInfo = null; - private MMenu = null; - private MTab = null; - private MClient = null; - private MMessage = null; - private MTableAccess = null; - private MClientShare = null; - private MNote = null; - private MTable = null; - private MColumnAccess = null; - private ModelValidationEngine = null; - private MTest = null; - private MColumn = null; - private ModelValidator = null; - private MTree_Base = null; - private MConversionRate = null; - private MOrgInfo = null; - private MTree_NodeBP = null; - private MConversionType = null; - private MOrg = null; - private MTree_NodeCMC = null; - private MCostElement = null; - private MPackageExpCommon = null; - private MTree_NodeCMS = null; - private MCostType = null; - private MPackageExpDetail = null; - private MTree_Node = null; - private MCountry = null; - private MPackageExp = null; - private MTree_NodeMM = null; - private MCurrencyAcct = null; - private MPAttributeLookup = null; - private MTree_NodePR = null; - private MCurrency = null; - private MPInstance = null; - private MUser = null; - private MDocType = null; - private MPInstanceLog = null; - private MUserOrgAccess = null; - private M_Element = null; - private MPInstancePara = null; - private MUserRoles = null; - private MElement = null; - private MPrivateAccess = null; - private MWarehouse = null; - private MElementValue = null; - private MProcessAccess = null; - private MWindowAccess = null; - private MField = null; - private MProcess = null; - private MWindow = null; - private MImage = null; - private MProcessPara = null; - private MIssue = null; - private MQuery = null; - */ - - public int getC_Region_ID(String Region) { - String sql = "select c_region_id from c_region where name = ?"; - PreparedStatement pstmt = null; - ResultSet rs = null; - - int C_Region_ID = -1; - - try { - pstmt = DB.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, getTrxName()); - pstmt.setString(1, Region); - rs = pstmt.executeQuery(); - - - while (rs.next()) { - C_Region_ID = rs.getInt(1); - } - } catch (SQLException e) { - fail(e.getLocalizedMessage()); - } finally { - DB.close( rs, pstmt ); - } - return C_Region_ID; - } - - public int getC_Country_ID(String Country) { - String sql = "select c_country_id from c_country where name = ?"; - PreparedStatement pstmt = null; - ResultSet rs = null; - - int C_Country_ID = -1; - - try { - pstmt = DB.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, getTrxName()); - pstmt.setString(1, Country); - rs = pstmt.executeQuery(); - while (rs.next()) { - C_Country_ID = rs.getInt(1); - } - } catch (SQLException e) { - fail(e.getLocalizedMessage()); - } finally { - DB.close( rs, pstmt ); - } - - return C_Country_ID; - } - - public void testCreateMBPGroup() - { - try { - m_group = new MBPGroup (getCtx(), 0, getTrxName()); - m_group.setName ("Test Group Name"); // N - m_group.setIsConfidentialInfo (false); // N - m_group.setIsDefault (false); - - m_group.setPriorityBase(MBPGroup.PRIORITYBASE_Same); - m_group.saveEx(); - - commit(); - } catch(Exception e) { - fail(e.getLocalizedMessage()); - } - - } - -} diff --git a/org.adempiere.extend/src/test/functional/MBPartnerLocationTest.java b/org.adempiere.extend/src/test/functional/MBPartnerLocationTest.java deleted file mode 100644 index 566916f2a7..0000000000 --- a/org.adempiere.extend/src/test/functional/MBPartnerLocationTest.java +++ /dev/null @@ -1,575 +0,0 @@ -//MBPartnerLocationTest.java -package test.functional; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.compiere.model.MBPGroup; -import org.compiere.model.MBPartner; -import org.compiere.model.MBPartnerLocation; -import org.compiere.model.MLocation; -import org.compiere.util.DB; -import org.compiere.util.Env; - -import test.AdempiereTestCase; - -public class MBPartnerLocationTest extends AdempiereTestCase { - - // Variables needed for importing/migrating business partners - private MBPartner m_partner = null; //business partner - private MLocation location = null; - private MBPartnerLocation bpl = null; //business partner location - private MBPGroup m_group = null; - - /* - private MUser user = null; //business contact - private MContactInterest ci = null; //contact interest area - - // Variables needed for importing/migrating accounts - private MElementValue ev = null; //element value - private MAcctSchema as = null; //account schema - private MAccount acct = null; //account - - // Variables needed for importing/migrating bank statements - private MBankStatement statement = null; - private MBankAccount account = null; - private MBankStatementLine line = null; - - // Variables needed for importing/migrating conversion rates - private MConversionRate rate = null; - - // Variables needed for importing/migrating General Ledger Journal - private MJournalBatch batch = null; - private MJournal journal = null; - private MJournalLine line = null; - - // Variables needed for importing/migrating Inventory - private MInventory inventory = null; - private MProduct product = null; - private MAttributeSet mas = null; - private MAttributeSetInstance masi = null; - private MInventoryLine line = null; - - // Variables needed for importing/migrating Invoices - private MInvoice invoice = null; - private MInvoiceLine line = null; - - // Variables needed for importing/migrating orders - private MOrder order = null; - private MOrderLine line = null; - - // Variables needed for importing/migrating payments - private MPayment payment = null; - - // Variables needed for importing/migrating products - private MProduct product = null; - private MProductPrice pp = null; - - // Variables needed for mrp - - private MCost cost = null; - private MCostElement costElement = null; - private MForecastLine forcastLine = null; - private MOrder order = null; - private MOrderLine line = null; - private MPPCostCollector costCollector = null; - private MPPOrderBOM orderBOM = null; - private MPPOrderBOMLine = null; - private MPPOrderBOMLineMA = null; - private MPPOrderCost = null; - private MPPOrder = null; - private MPPProductBOM = null; - private MPPProductBOMLine = null; - private MPPProductCosting = null; - private MPPProductPlanning = null; - private MPPProfileBOMCost = null; - private MPPProfileBOM = null; - private MPPProfileBOMProduct = null; - private MPPProfileBOMReal = null; - private MPPProfileBOMSelected = null; - private MQMSpecification = null; - private MQMSpecificationLine = null; - private MRequisition = null; - private MRequisitionLine = null; - - - // other variables that may be needed: - - private MAdvertisement = null; - private MAging = null; - private MAlert = null; - private MAlertRecipient = null; - private MAlertRule = null; - - private MAllocationHdr = null; - private MAllocationLine = null; - - private MAssetDelivery = null; - private MAssetGroup = null; - private MAsset = null; - private MAssignmentSlot = null; - private MAttributeInstance = null; - - private MAccessProfile = null; - private MMailText = null; - private MAcctProcessor = null; - private MMatchInv = null; - private MAcctProcessorLog = null; - private MMatchPO = null; - private MAchievement = null; - private MMeasureCalc = null; - private MActivity = null; - private MMeasure = null; - private MAd = null; - private MMediaDeploy = null; - private MAdvertisement = null; - private MMedia = null; - private MAging = null; - private MMediaServer = null; - private MAlert = null; - private MMovementConfirm = null; - private MAlertProcessor = null; - private MMovement = null; - private MAlertProcessorLog = null; - private MMovementLineConfirm = null; - private MAlertRecipient = null; - private MMovementLine = null; - private MAlertRule = null; - private MMovementLineMA = null; - private MAllocationHdr = null; - private MNewsChannel = null; - private MAllocationLine = null; - private MNewsItem = null; - private MAssetDelivery = null; - private MOrder = null; - private MAssetGroup = null; - private MOrderLine = null; - private MAsset = null; - private MOrderTax = null; - private MAssignmentSlot = null; - private MPackage = null; - private MAttributeInstance = null; - private MPackageLine = null; - private MAttribute = null; - private MPaymentAllocate = null; - private MAttributeSetInstance = null; - private MPaymentBatch = null; - private MAttributeSet = null; - private MPayment = null; - private MAttributeUse = null; - private MPaymentProcessor = null; - private MAttributeValue = null; - private MPaymentTerm = null; - private MBankAccount = null; - private MPaymentValidate = null; - private MBank = null; - private MPaySchedule = null; - private MBankStatement = null; - private MPaySelectionCheck = null; - private MBankStatementLine = null; - private MPaySelection = null; - private MBankStatementLoader = null; - private MPaySelectionLine = null; - private MBankStatementMatcher = null; - private MPeriodControl = null; - private MBOM = null; - private MPeriod = null; - private MBOMProduct = null; - private MPOS = null; - private MBPartnerInfo = null; - private MPOSKey = null; - private MPOSKeyLayout = null; - private MPreference = null; - private MBPBankAccount = null; - private MPriceList = null; - private MBPGroup = null; - private MPriceListVersion = null; - private MCalendar = null; - private MProductBOM = null; - private MCampaign = null; - private MProductCategoryAcct = null; - private MCashBook = null; - private MProductCategory = null; - private MCash = null; - private MProductCosting = null; - private MCashLine = null; - private MProductDownload = null; - private MChangeNotice = null; - private MProduct = null; - private MChangeRequest = null; - private MProductPO = null; - private MCharge = null; - private MProductPrice = null; - private MChatEntry = null; - private MProductPricing = null; - private MChat = null; - private MProjectIssue = null; - private MChatType = null; - private MProject = null; - private MClickCount = null; - private MProjectLine = null; - private MClick = null; - private MProjectPhase = null; - private MColor = null; - private MProjectTask = null; - private MColorSchema = null; - private MProjectType = null; - private MCommissionAmt = null; - private MProjectTypePhase = null; - private MCommissionDetail = null; - private MProjectTypeTask = null; - private MCommission = null; - private MRecurring = null; - private MCommissionLine = null; - private MRecurringRun = null; - private MCommissionRun = null; - private MRefTable = null; - private MContactInterest = null; - private MRegistrationAttribute = null; - private MContainerElement = null; - private MRegistration = null; - private MContainer = null; - private MRegistrationValue = null; - private MCostDetail = null; - private MReplication = null; - private MCost = null; - private MReplicationLog = null; - private MCostQueue = null; - private MReplicationRun = null; - private MCounterCount = null; - private MRequestAction = null; - private MCStageElement = null; - private MRequestCategory = null; - private MCStage = null; - private MRequest = null; - private MDesktop = null; - private MRequestProcessor = null; - private MDiscountSchemaBreak = null; - private MRequestProcessorLog = null; - private MDiscountSchema = null; - private MRequestProcessorRoute = null; - private MDiscountSchemaLine = null; - private MRequestType = null; - private MDistribution = null; - private MRequestUpdate = null; - private MDistributionLine = null; - private MRequisition = null; - private MDistributionList = null; - private MRequisitionLine = null; - private MDistributionListLine = null; - private MResolution = null; - private MDistributionRunDetail = null; - private MResourceAssignment = null; - private MDistributionRun = null; - private MResource = null; - private MDistributionRunLine = null; - private MResourceType = null; - private MDocTypeCounter = null; - private MResourceUnAvailable = null; - private MDunning = null; - private MRevenueRecognition = null; - private MDunningLevel = null; - private MRevenueRecognitionPlan = null; - private MDunningRunEntry = null; - private MRfQ = null; - private MDunningRun = null; - private MRfQLine = null; - private MDunningRunLine = null; - private MRfQLineQty = null; - private Measure = null; - private MRfQResponse = null; - private MEntityType = null; - private MRfQResponseLine = null; - private MExpenseType = null; - private MRfQResponseLineQty = null; - private MFactAcct = null; - private MRfQTopic = null; - private MFormAccess = null; - private MRfQTopicSubscriber = null; - private MForm = null; - private MRfQTopicSubscriberOnly = null; - private MGLCategory = null; - private MRMA = null; - private MGoal = null; - private MRMALine = null; - private MGoalRestriction = null; - private MScheduler = null; - private MGroup = null; - private MSchedulerLog = null; - private MHierarchy = null; - private MSchedulerPara = null; - private MIndex = null; - private MSchedulerRecipient = null; - private MIndexStop = null; - private MSerNoCtl = null; - private MInfoColumn = null; - private MSetup = null; - private MInfoWindow = null; - private MShipper = null; - private MInOutConfirm = null; - private MSLACriteria = null; - private MInOut = null; - private MSLAGoal = null; - private MInOutLineConfirm = null; - private MSLAMeasure = null; - private MInOutLine = null; - private MStatusCategory = null; - private MInOutLineMA = null; - private MStatus = null; - private MInterestArea = null; - private MStorage = null; - private MInventory = null; - private MStore = null; - private MInventoryLine = null; - private MTask = null; - private MInventoryLineMA = null; - private MTaxCategory = null; - private MInvoiceBatch = null; - private MTaxDeclarationAcct = null; - private MInvoiceBatchLine = null; - private MTaxDeclaration = null; - private MInvoice = null; - private MTaxDeclarationLine = null; - private MInvoiceLine = null; - private MTax = null; - private MInvoicePaySchedule = null; - private MTaxPostal = null; - private MInvoiceSchedule = null; - private MTemplate = null; - private MInvoiceTax = null; - private MTimeExpense = null; - private MJournalBatch = null; - private MTimeExpenseLine = null; - private MJournal = null; - private MTransaction = null; - private MJournalLine = null; - private MTree = null; - private MKCategory = null; - private MTreeNode = null; - private MLandedCostAllocation = null; - private MultiMap = null; - private MLandedCost = null; - private MUOMConversion = null; - private MLdapAccess = null; - private MUOM = null; - private MLdapProcessor = null; - private MUserMail = null; - private MLdapProcessorLog = null; - private MWarehousePrice = null; - private MLdapUser = null; - private MWebProjectDomain = null; - private MLotCtl = null; - private MWebProject = null; - private MLot = null; - private MWithholding = null; - private MMailMsg = null; - private MYear = null; - - - - // from dbPort/src/org/compiere/model - - private MAccessLog = null; - private MIssueProject = null; - private MRecordAccess = null; - private MAccount = null; - private MIssueSystem = null; - private MRefList = null; - private MAccountLookup = null; - private MIssueUser = null; - private MRegion = null; - private MAcctSchemaDefault = null; - private MLanguage = null; - private M_Registration = null; - private MAcctSchemaElement = null; - private MLocation = null; - private MRole = null; - private MAcctSchemaGL = null; - private MLocationLookup = null; - private MRoleOrgAccess = null; - private MAcctSchema = null; - private MLocator = null; - private MRoleTest = null; - private MArchive = null; - private MLocatorLookup = null; - private MSalesRegion = null; - private MAttachmentEntry = null; - private MLookupCache = null; - private MSequence = null; - private MAttachment = null; - private MLookupFactory = null; - private MSession = null; - private MAttachmentNote = null; - private MLookupInfo = null; - private MSysConfig = null; - private MChangeLog = null; - private MLookup = null; - private MSystem = null; - private MClientInfo = null; - private MMenu = null; - private MTab = null; - private MClient = null; - private MMessage = null; - private MTableAccess = null; - private MClientShare = null; - private MNote = null; - private MTable = null; - private MColumnAccess = null; - private ModelValidationEngine = null; - private MTest = null; - private MColumn = null; - private ModelValidator = null; - private MTree_Base = null; - private MConversionRate = null; - private MOrgInfo = null; - private MTree_NodeBP = null; - private MConversionType = null; - private MOrg = null; - private MTree_NodeCMC = null; - private MCostElement = null; - private MPackageExpCommon = null; - private MTree_NodeCMS = null; - private MCostType = null; - private MPackageExpDetail = null; - private MTree_Node = null; - private MCountry = null; - private MPackageExp = null; - private MTree_NodeMM = null; - private MCurrencyAcct = null; - private MPAttributeLookup = null; - private MTree_NodePR = null; - private MCurrency = null; - private MPInstance = null; - private MUser = null; - private MDocType = null; - private MPInstanceLog = null; - private MUserOrgAccess = null; - private M_Element = null; - private MPInstancePara = null; - private MUserRoles = null; - private MElement = null; - private MPrivateAccess = null; - private MWarehouse = null; - private MElementValue = null; - private MProcessAccess = null; - private MWindowAccess = null; - private MField = null; - private MProcess = null; - private MWindow = null; - private MImage = null; - private MProcessPara = null; - private MIssue = null; - private MQuery = null; - */ - - public int getC_Region_ID(String Region) { - - String sql = "select c_region_id from c_region where name = ?"; - PreparedStatement pstmt = null; - ResultSet rs = null; - - int C_Region_ID = -1; - - try { - pstmt = DB.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, getTrxName()); - pstmt.setString(1, Region); - rs = pstmt.executeQuery(); - - - while (rs.next()) { - C_Region_ID = rs.getInt(1); - } - } catch (SQLException e) { - fail(e.getLocalizedMessage()); - } finally { - DB.close( rs, pstmt ); - } - return C_Region_ID; - } - - public int getC_Country_ID(String Country) { - - String sql = "select c_country_id from c_country where name = ?"; - PreparedStatement pstmt = null; - ResultSet rs = null; - - int C_Country_ID = -1; - - try { - pstmt = DB.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, getTrxName()); - pstmt.setString(1, Country); - rs = pstmt.executeQuery(); - - - while (rs.next()) { - C_Country_ID = rs.getInt(1); - } - } catch (SQLException e) { - fail(e.getLocalizedMessage()); - } finally { - DB.close( rs, pstmt ); - } - - return C_Country_ID; - - } - - public void testCreatePartnerLocation() - { - try { - location = new MLocation(getCtx(), 0, getTrxName()); - location.setC_Country_ID(getC_Country_ID("United States")); - location.setC_Region_ID(getC_Region_ID("CA")); - location.setCity("Windsor"); - location.setAddress1("Happy Lane"); - location.setAddress2("Happy Lane 2"); - String zipcode = ("95492"); - location.setPostal(zipcode); - location.setPostal_Add(zipcode); - location.setAD_Org_ID(0); - location.saveEx(); - - m_group = new MBPGroup (getCtx(), 0, getTrxName()); - m_group.setName ("Test Group Name"); // N - m_group.setIsConfidentialInfo (false); // N - m_group.setIsDefault (false); - - m_group.setPriorityBase(MBPGroup.PRIORITYBASE_Same); - m_group.saveEx(); - - m_partner = new MBPartner (getCtx(), 0, getTrxName()); - m_partner.setValue (""); - m_partner.setName ("Test Business Partner Location"); - m_partner.setName2 (null); - m_partner.setDUNS(""); - m_partner.setFirstSale(null); - // - m_partner.setSO_CreditLimit (Env.ZERO); - m_partner.setSO_CreditUsed (Env.ZERO); - m_partner.setTotalOpenBalance (Env.ZERO); - // s_m_partner.setRating(null); - // - m_partner.setActualLifeTimeValue(Env.ZERO); - m_partner.setPotentialLifeTimeValue(Env.ZERO); - m_partner.setAcqusitionCost(Env.ZERO); - m_partner.setShareOfCustomer(0); - m_partner.setSalesVolume(0); - m_partner.setBPGroup(m_group); - // Reset Created, Updated to current system time ( teo_sarca ) - if(m_partner.save()) { - bpl = new MBPartnerLocation (getCtx(), 0, getTrxName()); - bpl.setIsActive(true); - bpl.setName("Test Business Partner Location"); - bpl.setC_BPartner_ID(m_partner.get_ID()); - bpl.setC_Location_ID(location.get_ID()); - bpl.saveEx(); - } - - commit(); - } catch(Exception e) { - fail(e.getLocalizedMessage()); - } - - } -} diff --git a/org.adempiere.extend/src/test/functional/MLocationTest.java b/org.adempiere.extend/src/test/functional/MLocationTest.java deleted file mode 100644 index 69f6b987cc..0000000000 --- a/org.adempiere.extend/src/test/functional/MLocationTest.java +++ /dev/null @@ -1,33 +0,0 @@ -//MLocationTest.java -package test.functional; - -import org.compiere.model.MLocation; - -import test.AdempiereTestCase; - -public class MLocationTest extends AdempiereTestCase { - - // Test: Specific variables - private MLocation location = null; - - public void testMLocationCreation() { - location = new MLocation(getCtx(), 0, getTrxName()); - // location.loadDefaults(); - location.setC_Country_ID(100); - location.setC_Region_ID(103); - location.setCity("Windsor"); - location.setAddress1("nyb"); - location.setAddress2(""); - location.setPostal("95492"); - location.setPostal_Add("95492"); - location.setAD_Org_ID(0); - - boolean saveResult = location.save(); - assertTrue("MLocation.save()", saveResult); - try { - commit(); - } catch (Exception e) { - fail(e.getLocalizedMessage()); - } - } -} diff --git a/org.adempiere.extend/src/test/functional/MRefListTest.java b/org.adempiere.extend/src/test/functional/MRefListTest.java deleted file mode 100644 index 062a420605..0000000000 --- a/org.adempiere.extend/src/test/functional/MRefListTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 2008 SC ARHIPAC SERVICE SRL. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package test.functional; - -import org.compiere.model.MRefList; -import org.compiere.model.X_AD_Table; -import org.compiere.util.Env; -import org.compiere.util.ValueNamePair; - -import test.AdempiereTestCase; - -/** - * Test MRefList class - * @author Teo Sarca, www.arhipac.ro - */ -public class MRefListTest extends AdempiereTestCase { - - @Override - protected void setUp() throws Exception - { - super.setUp(); - Env.setContext(getCtx(), Env.LANGUAGE, "en_US"); - } - - public void testGet() throws Exception - { - // - // Should be found - MRefList rl = MRefList.get(getCtx(), - X_AD_Table.ACCESSLEVEL_AD_Reference_ID, - X_AD_Table.ACCESSLEVEL_Organization, - getTrxName()); - assertNotNull(rl); - assertEquals("Should be found", X_AD_Table.ACCESSLEVEL_Organization, rl.getValue()); - // - // Should not be found - rl = MRefList.get(getCtx(), 7654321, "7654321", getTrxName()); - assertNull("Should not be found", rl); - } - - public void testGetListName() throws Exception - { - String name = MRefList.getListName(getCtx(), - X_AD_Table.ACCESSLEVEL_AD_Reference_ID, - X_AD_Table.ACCESSLEVEL_All); - assertEquals("All", name); - // - name = MRefList.getListName(getCtx(), - X_AD_Table.ACCESSLEVEL_AD_Reference_ID, - "InvalidAccessLevelValue"); - assertTrue("Should not be found", org.compiere.util.Util.isEmpty(name)); - } - - public void testGetList() throws Exception - { - ValueNamePair[] vnp = MRefList.getList (getCtx(), X_AD_Table.ACCESSLEVEL_AD_Reference_ID, false); - assertTrue("Invalid result ", vnp.length > 0); - } -} diff --git a/org.adempiere.extend/src/test/functional/MSessionTest.java b/org.adempiere.extend/src/test/functional/MSessionTest.java deleted file mode 100644 index 7cebb0225f..0000000000 --- a/org.adempiere.extend/src/test/functional/MSessionTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 2008 SC ARHIPAC SERVICE SRL. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package test.functional; - -import org.compiere.model.MSession; -import org.compiere.util.Env; - -import test.AdempiereTestCase; - -/** - * Test MSession class - * @author Teo Sarca, SC ARHIPAC SERVICE SRL - */ -public class MSessionTest extends AdempiereTestCase { - - /** - * Test - BF [ 1810182 ] Session lost after cache reset - */ - public void testBF1810182 () { - assertNotNull("Session not found, should not fail here", MSession.get(getCtx(), true)); - Env.reset(false); - assertNotNull("Session not found after cache reset", MSession.get(getCtx(), false)); - } -} diff --git a/org.adempiere.extend/src/test/functional/MStorageTest.java b/org.adempiere.extend/src/test/functional/MStorageTest.java deleted file mode 100644 index 9e80c2817b..0000000000 --- a/org.adempiere.extend/src/test/functional/MStorageTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 2008 SC ARHIPAC SERVICE SRL. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package test.functional; - -import java.math.BigDecimal; -import java.math.RoundingMode; - -import org.compiere.model.MLocator; -import org.compiere.model.MStorageOnHand; -import org.compiere.model.MStorageReservation; -import org.compiere.model.MWarehouse; -import org.compiere.util.Env; - -import test.AdempiereTestCase; - -/** - * Test MStorage class - * @author Teo Sarca, SC ARHIPAC SERVICE SRL - */ -public class MStorageTest extends AdempiereTestCase -{ - int product_id = 122; // standard - int location_id = 114; - - protected void setUp() throws Exception - { - super.setUp(); - assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx())); - } - - private MLocator createLocator(MWarehouse wh, String locatorValue, double qtyOnHand) - { - MLocator loc = new MLocator(wh, wh.getValue()+"-"+locatorValue); - loc.setXYZ("X"+locatorValue, "Y"+locatorValue, "Z"+locatorValue); - loc.saveEx(); - // - BigDecimal targetQty = BigDecimal.valueOf(qtyOnHand).setScale(12, RoundingMode.HALF_UP); - MStorageOnHand s1 = MStorageOnHand.getCreate(getCtx(), loc.get_ID(), product_id, 0,null, getTrxName()); - s1.setQtyOnHand(targetQty); - s1.saveEx(); - // - BigDecimal qty = MStorageReservation.getQtyAvailable(wh.get_ID(), product_id, 0, getTrxName()).setScale(12, RoundingMode.HALF_UP); - assertEquals("Error on locator "+locatorValue, targetQty, qty); - // - return loc; - } - private void assertWarehouseQty(MWarehouse wh, BigDecimal targetQty) - { - BigDecimal qty = MStorageReservation.getQtyAvailable(wh.get_ID(), product_id, 0, getTrxName()); - qty = qty.setScale(12, RoundingMode.HALF_UP); - targetQty = targetQty.setScale(12, RoundingMode.HALF_UP); - assertEquals(targetQty, qty); - } - - public void testGetQtyAvailable() throws Exception - { - BigDecimal whQty = Env.ZERO; - MWarehouse wh = new MWarehouse(getCtx(), 0, getTrxName()); - wh.setValue("test-wh"); - wh.setName("test-wh"); - wh.setC_Location_ID(location_id); - wh.saveEx(); - assertWarehouseQty(wh, whQty); - // - for (int i = 1; i <= 10; i++) - { - createLocator(wh, ""+i, i); - whQty = whQty.add(BigDecimal.valueOf(i)); - assertWarehouseQty(wh, whQty); - } - } -} diff --git a/org.adempiere.extend/src/test/functional/MSysConfigTest.java b/org.adempiere.extend/src/test/functional/MSysConfigTest.java deleted file mode 100644 index a5b7ae9702..0000000000 --- a/org.adempiere.extend/src/test/functional/MSysConfigTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 2008 SC ARHIPAC SERVICE SRL. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package test.functional; - -import java.util.Properties; - -import org.compiere.model.MSysConfig; -import org.compiere.util.DB; - -import test.AdempiereTestCase; - -/** - * MSysConfig Test Case - * @author Teo Sarca, SC ARHIPAC SERVICE SRL - * - */ -public class MSysConfigTest extends AdempiereTestCase { - private String varname = null; - - @Override - protected void setUp() throws Exception { - super.setUp(); - // - varname = "MSysConfigTestVariable" + System.currentTimeMillis(); - new TestableSysConfig(getCtx(), 0, 0, varname, "0_0", null).saveEx(); - new TestableSysConfig(getCtx(), 11, 0, varname, "11_0", null).saveEx(); - new TestableSysConfig(getCtx(), 11, 11, varname, "11_11", null).saveEx(); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - // - String sql = "DELETE FROM "+MSysConfig.Table_Name - +" WHERE "+MSysConfig.COLUMNNAME_Name+"=?"; - DB.executeUpdateEx(sql, new Object[]{varname}, null); - } - - public void testGetSet1() throws Exception { - // - assertEquals("0_0", MSysConfig.getValue(varname)); - // - assertEquals("0_0", MSysConfig.getValue(varname, 0)); - assertEquals("11_0", MSysConfig.getValue(varname, 11)); - assertEquals("0_0", MSysConfig.getValue(varname, 12345)); - // - assertEquals("0_0", MSysConfig.getValue(varname, 0, 0)); - assertEquals("11_0", MSysConfig.getValue(varname, 11, 0)); - assertEquals("11_11", MSysConfig.getValue(varname, 11, 11)); - assertEquals("0_0", MSysConfig.getValue(varname, 12345, 12345)); - assertEquals("11_0", MSysConfig.getValue(varname, 11, 12345)); - } - - private static class TestableSysConfig extends MSysConfig - { - /** - * - */ - private static final long serialVersionUID = -536206101431286540L; - - public TestableSysConfig(Properties ctx, - int AD_Client_ID, int AD_Org_ID, - String Name, String Value, - String trxName) - { - super(ctx, 0, trxName); - setAD_Client_ID(AD_Client_ID); - setAD_Org_ID(AD_Org_ID); - setName(Name); - setValue(Value); - setConfigurationLevel(CONFIGURATIONLEVEL_Organization); - } - - }; -} diff --git a/org.adempiere.extend/src/test/functional/MUOMTest.java b/org.adempiere.extend/src/test/functional/MUOMTest.java deleted file mode 100644 index d84825f866..0000000000 --- a/org.adempiere.extend/src/test/functional/MUOMTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 2008 SC ARHIPAC SERVICE SRL. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package test.functional; - -import org.compiere.model.MUOM; -import org.compiere.util.Ini; - -import test.AdempiereTestCase; - -/** - * @author Teo Sarca, SC ARHIPAC SERVICE SRL - * - */ -public class MUOMTest extends AdempiereTestCase { - public void testGet() throws Exception { - assertEquals("UOM not found", "EA", MUOM.get(getCtx(), 100).getX12DE355()); - assertEquals("UOM not found", "HR", MUOM.get(getCtx(), 101).getX12DE355()); - assertEquals("UOM not found", "MJ", MUOM.get(getCtx(), 103).getX12DE355()); - } - - public void testGetMinute_UOM_ID() throws Exception { - int uom_id = MUOM.getMinute_UOM_ID(getCtx()); - assertTrue("Not Minute UOM (client="+Ini.isClient()+")", MUOM.get(getCtx(), uom_id).isMinute()); - // - Ini.setClient(!Ini.isClient()); - uom_id = MUOM.getMinute_UOM_ID(getCtx()); - assertTrue("Not Minute UOM (client="+Ini.isClient()+")", MUOM.get(getCtx(), uom_id).isMinute()); - // - Ini.setClient(!Ini.isClient()); - } -} diff --git a/org.adempiere.extend/src/test/functional/MUserTest.java b/org.adempiere.extend/src/test/functional/MUserTest.java deleted file mode 100644 index 6a32ef7902..0000000000 --- a/org.adempiere.extend/src/test/functional/MUserTest.java +++ /dev/null @@ -1,561 +0,0 @@ -//MUserTest.java -package test.functional; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.compiere.model.MBPGroup; -import org.compiere.model.MBPartner; -import org.compiere.model.MUser; -import org.compiere.util.DB; -import org.compiere.util.Env; - -import test.AdempiereTestCase; - -public class MUserTest extends AdempiereTestCase { - - // Variables needed for importing/migrating business partners - //private MLocation location = null; - - private MBPartner m_partner = null; //business partner - private MUser m_contact = null; //business contact - /* - private MBPartnerLocation bpl = null; //business partner location - private MContactInterest ci = null; //contact interest area - - // Variables needed for importing/migrating accounts - private MElementValue ev = null; //element value - private MAcctSchema as = null; //account schema - private MAccount acct = null; //account - - // Variables needed for importing/migrating bank statements - private MBankStatement statement = null; - private MBankAccount account = null; - private MBankStatementLine line = null; - - // Variables needed for importing/migrating conversion rates - private MConversionRate rate = null; - - // Variables needed for importing/migrating General Ledger Journal - private MJournalBatch batch = null; - private MJournal journal = null; - private MJournalLine line = null; - - // Variables needed for importing/migrating Inventory - private MInventory inventory = null; - private MProduct product = null; - private MAttributeSet mas = null; - private MAttributeSetInstance masi = null; - private MInventoryLine line = null; - - // Variables needed for importing/migrating Invoices - private MInvoice invoice = null; - private MInvoiceLine line = null; - - // Variables needed for importing/migrating orders - private MOrder order = null; - private MOrderLine line = null; - - // Variables needed for importing/migrating payments - private MPayment payment = null; - - // Variables needed for importing/migrating products - private MProduct product = null; - private MProductPrice pp = null; - - // Variables needed for mrp - - private MCost cost = null; - private MCostElement costElement = null; - private MForecastLine forcastLine = null; - private MOrder order = null; - private MOrderLine line = null; - private MPPCostCollector costCollector = null; - private MPPOrderBOM orderBOM = null; - private MPPOrderBOMLine = null; - private MPPOrderBOMLineMA = null; - private MPPOrderCost = null; - private MPPOrder = null; - private MPPProductBOM = null; - private MPPProductBOMLine = null; - private MPPProductCosting = null; - private MPPProductPlanning = null; - private MPPProfileBOMCost = null; - private MPPProfileBOM = null; - private MPPProfileBOMProduct = null; - private MPPProfileBOMReal = null; - private MPPProfileBOMSelected = null; - private MQMSpecification = null; - private MQMSpecificationLine = null; - private MRequisition = null; - private MRequisitionLine = null; - - - // other variables that may be needed: - - private MAdvertisement = null; - private MAging = null; - private MAlert = null; - private MAlertRecipient = null; - private MAlertRule = null; - - private MAllocationHdr = null; - private MAllocationLine = null; - - private MAssetDelivery = null; - private MAssetGroup = null; - private MAsset = null; - private MAssignmentSlot = null; - private MAttributeInstance = null; - - private MAccessProfile = null; - private MMailText = null; - private MAcctProcessor = null; - private MMatchInv = null; - private MAcctProcessorLog = null; - private MMatchPO = null; - private MAchievement = null; - private MMeasureCalc = null; - private MActivity = null; - private MMeasure = null; - private MAd = null; - private MMediaDeploy = null; - private MAdvertisement = null; - private MMedia = null; - private MAging = null; - private MMediaServer = null; - private MAlert = null; - private MMovementConfirm = null; - private MAlertProcessor = null; - private MMovement = null; - private MAlertProcessorLog = null; - private MMovementLineConfirm = null; - private MAlertRecipient = null; - private MMovementLine = null; - private MAlertRule = null; - private MMovementLineMA = null; - private MAllocationHdr = null; - private MNewsChannel = null; - private MAllocationLine = null; - private MNewsItem = null; - private MAssetDelivery = null; - private MOrder = null; - private MAssetGroup = null; - private MOrderLine = null; - private MAsset = null; - private MOrderTax = null; - private MAssignmentSlot = null; - private MPackage = null; - private MAttributeInstance = null; - private MPackageLine = null; - private MAttribute = null; - private MPaymentAllocate = null; - private MAttributeSetInstance = null; - private MPaymentBatch = null; - private MAttributeSet = null; - private MPayment = null; - private MAttributeUse = null; - private MPaymentProcessor = null; - private MAttributeValue = null; - private MPaymentTerm = null; - private MBankAccount = null; - private MPaymentValidate = null; - private MBank = null; - private MPaySchedule = null; - private MBankStatement = null; - private MPaySelectionCheck = null; - private MBankStatementLine = null; - private MPaySelection = null; - private MBankStatementLoader = null; - private MPaySelectionLine = null; - private MBankStatementMatcher = null; - private MPeriodControl = null; - private MBOM = null; - private MPeriod = null; - private MBOMProduct = null; - private MPOS = null; - private MBPartnerInfo = null; - private MPOSKey = null; - private MPOSKeyLayout = null; - private MPreference = null; - private MBPBankAccount = null; - private MPriceList = null; - private MBPGroup = null; - private MPriceListVersion = null; - private MCalendar = null; - private MProductBOM = null; - private MCampaign = null; - private MProductCategoryAcct = null; - private MCashBook = null; - private MProductCategory = null; - private MCash = null; - private MProductCosting = null; - private MCashLine = null; - private MProductDownload = null; - private MChangeNotice = null; - private MProduct = null; - private MChangeRequest = null; - private MProductPO = null; - private MCharge = null; - private MProductPrice = null; - private MChatEntry = null; - private MProductPricing = null; - private MChat = null; - private MProjectIssue = null; - private MChatType = null; - private MProject = null; - private MClickCount = null; - private MProjectLine = null; - private MClick = null; - private MProjectPhase = null; - private MColor = null; - private MProjectTask = null; - private MColorSchema = null; - private MProjectType = null; - private MCommissionAmt = null; - private MProjectTypePhase = null; - private MCommissionDetail = null; - private MProjectTypeTask = null; - private MCommission = null; - private MRecurring = null; - private MCommissionLine = null; - private MRecurringRun = null; - private MCommissionRun = null; - private MRefTable = null; - private MContactInterest = null; - private MRegistrationAttribute = null; - private MContainerElement = null; - private MRegistration = null; - private MContainer = null; - private MRegistrationValue = null; - private MCostDetail = null; - private MReplication = null; - private MCost = null; - private MReplicationLog = null; - private MCostQueue = null; - private MReplicationRun = null; - private MCounterCount = null; - private MRequestAction = null; - private MCStageElement = null; - private MRequestCategory = null; - private MCStage = null; - private MRequest = null; - private MDesktop = null; - private MRequestProcessor = null; - private MDiscountSchemaBreak = null; - private MRequestProcessorLog = null; - private MDiscountSchema = null; - private MRequestProcessorRoute = null; - private MDiscountSchemaLine = null; - private MRequestType = null; - private MDistribution = null; - private MRequestUpdate = null; - private MDistributionLine = null; - private MRequisition = null; - private MDistributionList = null; - private MRequisitionLine = null; - private MDistributionListLine = null; - private MResolution = null; - private MDistributionRunDetail = null; - private MResourceAssignment = null; - private MDistributionRun = null; - private MResource = null; - private MDistributionRunLine = null; - private MResourceType = null; - private MDocTypeCounter = null; - private MResourceUnAvailable = null; - private MDunning = null; - private MRevenueRecognition = null; - private MDunningLevel = null; - private MRevenueRecognitionPlan = null; - private MDunningRunEntry = null; - private MRfQ = null; - private MDunningRun = null; - private MRfQLine = null; - private MDunningRunLine = null; - private MRfQLineQty = null; - private Measure = null; - private MRfQResponse = null; - private MEntityType = null; - private MRfQResponseLine = null; - private MExpenseType = null; - private MRfQResponseLineQty = null; - private MFactAcct = null; - private MRfQTopic = null; - private MFormAccess = null; - private MRfQTopicSubscriber = null; - private MForm = null; - private MRfQTopicSubscriberOnly = null; - private MGLCategory = null; - private MRMA = null; - private MGoal = null; - private MRMALine = null; - private MGoalRestriction = null; - private MScheduler = null; - private MGroup = null; - private MSchedulerLog = null; - private MHierarchy = null; - private MSchedulerPara = null; - private MIndex = null; - private MSchedulerRecipient = null; - private MIndexStop = null; - private MSerNoCtl = null; - private MInfoColumn = null; - private MSetup = null; - private MInfoWindow = null; - private MShipper = null; - private MInOutConfirm = null; - private MSLACriteria = null; - private MInOut = null; - private MSLAGoal = null; - private MInOutLineConfirm = null; - private MSLAMeasure = null; - private MInOutLine = null; - private MStatusCategory = null; - private MInOutLineMA = null; - private MStatus = null; - private MInterestArea = null; - private MStorage = null; - private MInventory = null; - private MStore = null; - private MInventoryLine = null; - private MTask = null; - private MInventoryLineMA = null; - private MTaxCategory = null; - private MInvoiceBatch = null; - private MTaxDeclarationAcct = null; - private MInvoiceBatchLine = null; - private MTaxDeclaration = null; - private MInvoice = null; - private MTaxDeclarationLine = null; - private MInvoiceLine = null; - private MTax = null; - private MInvoicePaySchedule = null; - private MTaxPostal = null; - private MInvoiceSchedule = null; - private MTemplate = null; - private MInvoiceTax = null; - private MTimeExpense = null; - private MJournalBatch = null; - private MTimeExpenseLine = null; - private MJournal = null; - private MTransaction = null; - private MJournalLine = null; - private MTree = null; - private MKCategory = null; - private MTreeNode = null; - private MLandedCostAllocation = null; - private MultiMap = null; - private MLandedCost = null; - private MUOMConversion = null; - private MLdapAccess = null; - private MUOM = null; - private MLdapProcessor = null; - private MUserMail = null; - private MLdapProcessorLog = null; - private MWarehousePrice = null; - private MLdapUser = null; - private MWebProjectDomain = null; - private MLotCtl = null; - private MWebProject = null; - private MLot = null; - private MWithholding = null; - private MMailMsg = null; - private MYear = null; - - - - // from dbPort/src/org/compiere/model - - private MAccessLog = null; - private MIssueProject = null; - private MRecordAccess = null; - private MAccount = null; - private MIssueSystem = null; - private MRefList = null; - private MAccountLookup = null; - private MIssueUser = null; - private MRegion = null; - private MAcctSchemaDefault = null; - private MLanguage = null; - private M_Registration = null; - private MAcctSchemaElement = null; - private MLocation = null; - private MRole = null; - private MAcctSchemaGL = null; - private MLocationLookup = null; - private MRoleOrgAccess = null; - private MAcctSchema = null; - private MLocator = null; - private MRoleTest = null; - private MArchive = null; - private MLocatorLookup = null; - private MSalesRegion = null; - private MAttachmentEntry = null; - private MLookupCache = null; - private MSequence = null; - private MAttachment = null; - private MLookupFactory = null; - private MSession = null; - private MAttachmentNote = null; - private MLookupInfo = null; - private MSysConfig = null; - private MChangeLog = null; - private MLookup = null; - private MSystem = null; - private MClientInfo = null; - private MMenu = null; - private MTab = null; - private MClient = null; - private MMessage = null; - private MTableAccess = null; - private MClientShare = null; - private MNote = null; - private MTable = null; - private MColumnAccess = null; - private ModelValidationEngine = null; - private MTest = null; - private MColumn = null; - private ModelValidator = null; - private MTree_Base = null; - private MConversionRate = null; - private MOrgInfo = null; - private MTree_NodeBP = null; - private MConversionType = null; - private MOrg = null; - private MTree_NodeCMC = null; - private MCostElement = null; - private MPackageExpCommon = null; - private MTree_NodeCMS = null; - private MCostType = null; - private MPackageExpDetail = null; - private MTree_Node = null; - private MCountry = null; - private MPackageExp = null; - private MTree_NodeMM = null; - private MCurrencyAcct = null; - private MPAttributeLookup = null; - private MTree_NodePR = null; - private MCurrency = null; - private MPInstance = null; - private MUser = null; - private MDocType = null; - private MPInstanceLog = null; - private MUserOrgAccess = null; - private M_Element = null; - private MPInstancePara = null; - private MUserRoles = null; - private MElement = null; - private MPrivateAccess = null; - private MWarehouse = null; - private MElementValue = null; - private MProcessAccess = null; - private MWindowAccess = null; - private MField = null; - private MProcess = null; - private MWindow = null; - private MImage = null; - private MProcessPara = null; - private MIssue = null; - private MQuery = null; - */ - - public int getC_Region_ID(String Region) { - - String sql = "select c_region_id from c_region where name = ?"; - PreparedStatement pstmt = null; - ResultSet rs = null; - - int C_Region_ID = -1; - try { - pstmt = DB.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, getTrxName()); - pstmt.setString(1, Region); - rs = pstmt.executeQuery(); - while (rs.next()) { - C_Region_ID = rs.getInt(1); - } - } catch (SQLException e) { - fail(e.getLocalizedMessage()); - } finally { - DB.close( rs, pstmt ); - } - - return C_Region_ID; - } - - public int getC_Country_ID(String Country) { - String sql = "select c_country_id from c_country where name = ?"; - PreparedStatement pstmt = null; - ResultSet rs = null; - - int C_Country_ID = -1; - - try { - pstmt = DB.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, getTrxName()); - pstmt.setString(1, Country); - rs = pstmt.executeQuery(); - - - while (rs.next()) { - C_Country_ID = rs.getInt(1); - } - } catch (SQLException e) { - fail(e.getLocalizedMessage()); - } finally { - DB.close( rs, pstmt ); - } - - return C_Country_ID; - - } - - public void testCreateMBPartner() - { - try { - - m_partner = new MBPartner (getCtx(), 0, getTrxName()); - m_partner.setValue (""); - m_partner.setName ("Test MBPartner with contact"); - m_partner.setName2 (null); - m_partner.setDUNS(""); - m_partner.setFirstSale(null); - // - m_partner.setSO_CreditLimit (Env.ZERO); - m_partner.setSO_CreditUsed (Env.ZERO); - m_partner.setTotalOpenBalance (Env.ZERO); - // s_m_partner.setRating(null); - // - m_partner.setActualLifeTimeValue(Env.ZERO); - m_partner.setPotentialLifeTimeValue(Env.ZERO); - m_partner.setAcqusitionCost(Env.ZERO); - m_partner.setShareOfCustomer(0); - m_partner.setSalesVolume(0); - - MBPGroup m_group = new MBPGroup (getCtx(), 0, getTrxName()); - m_group.setName ("Test Group Name"); // N - m_group.setIsConfidentialInfo (false); // N - m_group.setIsDefault (false); - - m_group.setPriorityBase(MBPGroup.PRIORITYBASE_Same); - - m_group.saveEx(); - - m_partner.setBPGroup(m_group); - // Reset Created, Updated to current system time ( teo_sarca ) - if(m_partner.save()) { - m_contact = new MUser(getCtx(), 0, getTrxName()); - m_contact.setName("Test Contact Name"); - m_contact.setIsActive(true); - m_contact.setC_BPartner_ID(m_partner.get_ID()); - m_contact.saveEx(); - } - - commit(); - } catch(Exception e) { - fail(e.getLocalizedMessage()); - } - - } - -} diff --git a/org.adempiere.extend/src/test/functional/POTest.java b/org.adempiere.extend/src/test/functional/POTest.java deleted file mode 100644 index 47c99fa56c..0000000000 --- a/org.adempiere.extend/src/test/functional/POTest.java +++ /dev/null @@ -1,270 +0,0 @@ -package test.functional; - -import java.util.Properties; - -import org.compiere.model.MBPartner; -import org.compiere.model.MTest; -import org.compiere.model.POInfo; -import org.compiere.util.DB; - -import test.AdempiereTestCase; - -/** - * Tests for {@link org.compiere.model.PO} class. - * @author Teo Sarca, SC ARHIPAC SERVICE SRL - */ -public class POTest extends AdempiereTestCase -{ - public static class MyTestPO extends MTest - { - private static final long serialVersionUID = -6861171283806782985L; - protected boolean failOnSave = false; - - - private MyTestPO m_parent = null; - private MyTestPO m_dependentRecord = null; - - public static String getName(int Test_ID, String trxName) - { - String sql = "SELECT "+COLUMNNAME_Name+" FROM "+Table_Name - +" WHERE "+COLUMNNAME_Test_ID+"=?"; - return DB.getSQLValueStringEx(trxName, sql, Test_ID); - } - - public static boolean exists(int Test_ID, String trxName) - { - final String sql = "SELECT "+COLUMNNAME_Test_ID+" FROM "+Table_Name - +" WHERE "+COLUMNNAME_Test_ID+"=?"; - int id = DB.getSQLValueEx(trxName, sql, Test_ID); - return id > 0 && id == Test_ID; - } - - public MyTestPO(Properties ctx, boolean failOnSave, String trxName) - { - super(ctx, "Test_"+System.currentTimeMillis(), 10); - this.set_TrxName(trxName); - this.setDescription(""+getClass()); - this.failOnSave = failOnSave; - } - public MyTestPO(Properties ctx, int id, String trxName) - { - super(ctx, id, trxName); - } - @Override - protected boolean afterSave(boolean newRecord, boolean success) - { - if (m_parent == null) - { - m_dependentRecord = new MyTestPO(getCtx(), false, get_TrxName()); - m_dependentRecord.m_parent = this; - m_dependentRecord.setName("D_"+this.getName()); - m_dependentRecord.saveEx(); - } - - if (this.failOnSave) - throw new RuntimeException("Never save this object [trxName="+get_TrxName()+", success="+success+"]"); - return true; - } - - public int getDependent_ID() - { - return (m_dependentRecord != null ? m_dependentRecord.get_ID() : -1); - } - }; - - /** - * Tests the following methods: - *
    - *
  • {@link org.compiere.model.PO#is_Changed()} - *
  • {@link org.compiere.model.PO#is_ValueChanged(String)} - *
- * Applies to following bugs: - *
    - *
  • [ 1704828 ] PO.is_Changed() and PO.is_ValueChanged are not consistent - *
- * @throws Exception - */ - public void test_Changed() throws Exception - { - String[] testStrings = new String[] { - "a", - "test", - }; - // Create the test PO and save - MTest testPO = new MTest(getCtx(), getClass().getName(), 1); - testPO.set_TrxName(getTrxName()); - - for (String str : testStrings) - { - testPO.setHelp(str); - testPO.saveEx(); - String originalString = testPO.getHelp(); - String info = "testString=[" + str + "]" + ", originalString=[" + originalString + "]"; - - // Initial asserts (nothing changed) - assertFalse(info, testPO.is_ValueChanged(MTest.COLUMNNAME_Help)); - assertFalse(info, testPO.is_Changed()); - // Set the same name - testPO.setHelp(originalString); - assertFalse(info, testPO.is_ValueChanged(MTest.COLUMNNAME_Help)); - assertFalse(info, testPO.is_Changed()); - // Set a new name - testPO.setHelp(originalString+"-changed"); - assertTrue(info, testPO.is_ValueChanged(MTest.COLUMNNAME_Help)); - assertTrue(info, testPO.is_Changed()); - // Set the original name back - testPO.setHelp(originalString); - assertFalse(info, testPO.is_ValueChanged(MTest.COLUMNNAME_Help)); - assertFalse(info, testPO.is_Changed()); - } - - // Finally, delete the testPO - testPO.delete(true, getTrxName()); - } - - - /** - *
  • BF [ 1990856 ] PO.set_Value* : truncate string more than needed - */ - public void testTruncatedStrings() { - // - // Creating a huge string for testing: - StringBuilder sb = new StringBuilder(); - for (int i = 1; i <= 1000; i++) { - sb.append("0123456789"); - } - String bigString = sb.toString(); - // - // Create the test PO: - MTest testPO = new MTest(getCtx(), getClass().getName(), 1); - testPO.set_TrxName(getTrxName()); - // - // Getting Max Length: - POInfo info = POInfo.getPOInfo(getCtx(), MTest.Table_ID); - int maxLength = info.getFieldLength(info.getColumnIndex(MTest.COLUMNNAME_Name)); - // - // Test with a string that has less then maxLength - { - testPO.set_ValueOfColumn(MTest.COLUMNNAME_Name, bigString.substring(0, maxLength - 1)); - String resultString = (String) testPO.get_Value(MTest.COLUMNNAME_Name); - assertEquals("String was not truncated correctly (1)", maxLength - 1, resultString.length()); - // - testPO.setName(bigString.substring(0, maxLength - 1)); - assertEquals("String was not truncated correctly (2)", maxLength - 1, testPO.getName().length()); - } - // - // Test with a string that has maxLength - { - testPO.set_ValueOfColumn(MTest.COLUMNNAME_Name, bigString.substring(0, maxLength)); - String resultString = (String) testPO.get_Value(MTest.COLUMNNAME_Name); - assertEquals("String was not truncated correctly (3)", maxLength, resultString.length()); - // - testPO.setName(bigString.substring(0, maxLength)); - assertEquals("String was not truncated correctly (4)", maxLength, testPO.getName().length()); - } - // - // Test with a string that has more than maxLength - { - testPO.set_ValueOfColumn(MTest.COLUMNNAME_Name, bigString); - String resultString = (String) testPO.get_Value(MTest.COLUMNNAME_Name); - assertEquals("String was not truncated correctly (5)", maxLength, resultString.length()); - // - testPO.setName(bigString); - assertEquals("String was not truncated correctly (6)", maxLength, testPO.getName().length()); - } - } - - /** - * Object should NOT be saved if afterSave fails EVEN if is outside transaction (trxName=null) - */ - public void testAfterSaveError() - { - // - // Test for new objects - { - MyTestPO test = new MyTestPO(getCtx(), true, null); - assertFalse("Object should not be saved -- "+test, test.save()); - assertFalse("Object should not be saved -- "+test, test.get_ID() <= 0); - assertFalse("Object should not be saved(2) -- "+test, MyTestPO.exists(test.get_ID(), null)); - } - // - // Test for old objects - { - MyTestPO test = new MyTestPO(getCtx(), false, null); - assertTrue("Object *should* be saved -- "+test, test.save()); - // - MyTestPO test2 = new MyTestPO(getCtx(), test.get_ID(), null); - assertEquals("Object not found", test.get_ID(), test2.get_ID()); - test2.failOnSave = true; - test2.setName(test2.getName()+"_2"); - assertFalse("Object should not be saved -- "+test2, test2.save()); - // - String name = MyTestPO.getName(test2.get_ID(), null); - assertEquals("Object should not be modified(2) -- id="+test2, test.getName(), name); - } - } - - /** - * If one object fails on after save we should not revert all transaction. - * BF [ 2849122 ] PO.AfterSave is not rollback on error - * https://sourceforge.net/tracker/index.php?func=detail&aid=2849122&group_id=176962&atid=879332# - * @throws Exception - */ - public void testAfterSaveError_BF2849122() throws Exception - { - assertNotNull("TrxName should not be null", getTrxName()); - - MyTestPO t1 = new MyTestPO(getCtx(), false, getTrxName()); - t1.saveEx(); - assertTrue("Object not found(1) - t1="+t1, MyTestPO.exists(t1.get_ID(), getTrxName())); - assertTrue("Object not found(1) - t1(dep)="+t1, MyTestPO.exists(t1.getDependent_ID(), getTrxName())); - // - final MyTestPO t2 = new MyTestPO(getCtx(), true, getTrxName()); - try - { - t2.saveEx(); - } - catch (Exception e){} - assertTrue("Object not found(2) - t1="+t1, MyTestPO.exists(t1.get_ID(), getTrxName())); - assertTrue("Object not found(2) - t1(dep)="+t1, MyTestPO.exists(t1.getDependent_ID(), getTrxName())); - assertFalse("Object found(2) - t2="+t2, MyTestPO.exists(t2.get_ID(), getTrxName())); - assertFalse("Object found(2) - t2(dep)="+t2, MyTestPO.exists(t2.getDependent_ID(), getTrxName())); - // - final MyTestPO t3 = new MyTestPO(getCtx(), false, getTrxName()); - t3.saveEx(); - assertTrue("Object not found(3) - t1="+t1, MyTestPO.exists(t1.get_ID(), getTrxName())); - assertTrue("Object not found(3) - t1(dep)="+t1, MyTestPO.exists(t1.getDependent_ID(), getTrxName())); - assertFalse("Object found(3) - t2="+t2, MyTestPO.exists(t2.get_ID(), getTrxName())); - assertFalse("Object found(3) - t2(dep)="+t2, MyTestPO.exists(t2.getDependent_ID(), getTrxName())); - assertTrue("Object not found(3) - t3="+t3, MyTestPO.exists(t3.get_ID(), getTrxName())); - assertTrue("Object not found(3) - t3(dep)="+t3, MyTestPO.exists(t3.getDependent_ID(), getTrxName())); - } - - /** - * BF [ 2859125 ] Can't set AD_OrgBP_ID - * https://sourceforge.net/tracker/index.php?func=detail&aid=2859125&group_id=176962&atid=879332# - */ - public void testAD_OrgBP_ID_Issue() throws Exception - { - MBPartner bp = new MBPartner(getCtx(), 50004, getTrxName()); // Store Central - // - // Try to change AD_OrgBP_ID field value to a new value - final int old_org_id = bp.getAD_OrgBP_ID_Int(); - int new_org_id = 50005; // Store East Org - if (old_org_id == new_org_id) - { - new_org_id = 12; // Store Central - } - bp.setAD_OrgBP_ID(new_org_id); - // - // Following line throws: - // java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String - // at org.compiere.model.X_C_BPartner.getAD_OrgBP_ID(X_C_BPartner.java:165) - // at org.compiere.model.MBPartner.getAD_OrgBP_ID_Int(MBPartner.java:602) - // at test.functional.POTest.testAD_OrgBP_ID_Issue(POTest.java:192) - bp.getAD_OrgBP_ID_Int(); - // - // Test save: - bp.saveEx(); - } -} diff --git a/org.adempiere.extend/src/test/functional/QueryTest.java b/org.adempiere.extend/src/test/functional/QueryTest.java deleted file mode 100644 index b09e88d465..0000000000 --- a/org.adempiere.extend/src/test/functional/QueryTest.java +++ /dev/null @@ -1,309 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 2008 SC ARHIPAC SERVICE SRL. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package test.functional; - -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.adempiere.exceptions.DBException; -import org.compiere.model.MTable; -import org.compiere.model.POResultSet; -import org.compiere.model.Query; -import org.compiere.model.X_AD_Element; -import org.compiere.util.DB; -import org.compiere.util.Env; -import org.compiere.util.KeyNamePair; - -import test.AdempiereTestCase; - -/** - * Test {@link org.compiere.model.Query} class - * @author Teo Sarca, www.arhipac.ro - */ -public class QueryTest extends AdempiereTestCase -{ - public void testQuery_NoTable() throws Exception - { - assertExceptionThrown("", IllegalArgumentException.class, new Runnable(){ - public void run() - { - new Query(getCtx(), "NO_TABLE_DEFINED", null, getTrxName()); - } - }); - } - - public void testList() throws Exception - { - List list = new Query(getCtx(), "AD_Table", "TableName IN (?,?)", getTrxName()) - .setParameters(new Object[]{"C_Invoice", "M_InOut"}) - .setOrderBy("TableName") - .list(); - assertEquals("Invalid list size", 2, list.size()); - assertEquals("Invalid object 1", list.get(0).getTableName(), "C_Invoice"); - assertEquals("Invalid object 2", list.get(1).getTableName(), "M_InOut"); - } - - public void testScroll() throws Exception - { - POResultSet rs = new Query(getCtx(), "AD_Table", "TableName IN (?,?)", getTrxName()) - .setParameters(new Object[]{"C_Invoice", "M_InOut"}) - .setOrderBy("TableName") - .scroll(); - try - { - int i = 0; - while (rs.hasNext()) - { - MTable t = rs.next(); - if (i == 0) - { - assertEquals("Invalid object "+i, "C_Invoice", t.getTableName()); - } - else if (i == 1) - { - assertEquals("Invalid object "+i, "M_InOut", t.getTableName()); - } - else - { - assertFalse("More objects retrived than expected", true); - } - i++; - } - } - finally - { - DB.close(rs); - rs = null; - } - - } - - public void testIterate() throws Exception - { - Iterator it = new Query(getCtx(), "AD_Table", "TableName IN (?,?)", getTrxName()) - .setParameters(new Object[]{"C_Invoice", "M_InOut"}) - .setOrderBy("TableName") - .iterate(); - int i = 0; - while(it.hasNext()) - { - MTable t = it.next(); - if (i == 0) - { - assertEquals("Invalid object "+i, "C_Invoice", t.getTableName()); - } - else if (i == 1) - { - assertEquals("Invalid object "+i, "M_InOut", t.getTableName()); - } - else - { - assertFalse("More objects retrived than expected", true); - } - i++; - } - - } - - public void testCount() throws Exception - { - int count = new Query(getCtx(), "AD_Table", "TableName IN (?,?)", getTrxName()) - .setParameters(new Object[]{"C_Invoice", "M_InOut"}) - .setOrderBy("TableName") - .count(); - assertEquals("Invalid count", 2, count); - } - - public void testCount_BadSQL() throws Exception - { - assertExceptionThrown(null, DBException.class, new Runnable(){ - public void run() - { - new Query(getCtx(), "AD_Table", "TableName IN (?,?) AND BAD_SQL", getTrxName()) - .setParameters(new Object[]{"C_Invoice", "M_InOut"}) - .setOrderBy("TableName") - .count(); - } - }); - } - - public void testCount_NoValues() throws Exception - { - int count = new Query(getCtx(), "AD_Table", "1=2", getTrxName()).count(); - assertEquals("Counter should be ZERO", 0, count); - } - - public void testFirst() throws Exception - { - MTable t = new Query(getCtx(), "AD_Table", "TableName IN (?,?)", getTrxName()) - .setParameters(new Object[]{"C_Invoice", "M_InOut"}) - .setOrderBy("TableName") - .first(); - assertEquals("Invalid object", "C_Invoice", t.getTableName()); - } - - public void testFirstId() throws Exception - { - int id = new Query(getCtx(), "AD_Table", "TableName IN (?,?)", getTrxName()) - .setParameters(new Object[]{"C_Invoice", "M_InOut"}) - .setOrderBy("TableName") - .firstId(); - int expectedId = 318; // C_Invoice - assertEquals("Invalid ID", expectedId, id); - } - - public void testFirstOnly() throws Exception - { - MTable t = new Query(getCtx(), "AD_Table", "AD_Table_ID=?", getTrxName()) - .setParameters(new Object[]{318}) - .firstOnly(); - assertEquals("Invalid table ID", 318, t.get_ID()); - // - assertExceptionThrown(null, DBException.class, new Runnable(){ - public void run() - { - new Query(getCtx(), "AD_Table", "TableName IN (?,?)", getTrxName()) - .setParameters(new Object[]{"C_Invoice", "M_InOut"}) - .setOrderBy("TableName") - .firstOnly(); - } - }); - } - - public void testFirstIdOnly() throws Exception - { - int expectedId = 318; // C_Invoice - int id = new Query(getCtx(), "AD_Table", "AD_Table_ID=?", getTrxName()) - .setParameters(new Object[]{expectedId}) - .firstIdOnly(); - assertEquals("Invalid table ID", expectedId, id); - // - assertExceptionThrown(null, DBException.class, new Runnable(){ - public void run() - { - new Query(getCtx(), "AD_Table", "TableName IN (?,?)", getTrxName()) - .setParameters(new Object[]{"C_Invoice", "M_InOut"}) - .setOrderBy("TableName") - .firstIdOnly(); - } - }); - } - - public void testSetClient_ID() throws Exception - { - int AD_Client_ID = Env.getAD_Client_ID(getCtx()); - String sql = "SELECT COUNT(*) FROM C_Invoice WHERE IsActive='Y' AND AD_Client_ID="+AD_Client_ID; - int targetCount = DB.getSQLValue(null, sql); - // - int count = new Query(getCtx(), "C_Invoice", "1=1", getTrxName()) - .setOnlyActiveRecords(true) - .setClient_ID() - .count(); - assertEquals("Invoice # not match", targetCount, count); - } - - public void testGet_IDs() throws Exception - { - final String whereClause = "AD_Element_ID IN (101, 102)"; - int[] ids = new Query(getCtx(), "AD_Element", whereClause, getTrxName()) - .setOrderBy("AD_Element_ID") - .getIDs(); - assertNotNull(ids); - assertEquals(2, ids.length); - assertEquals(101, ids[0]); - assertEquals(102, ids[1]); - } - - public void testAggregate() throws Exception - { - final int AD_Client_ID = Env.getAD_Client_ID(getCtx()); - final String sqlFrom = "FROM C_InvoiceLine WHERE IsActive='Y' AND AD_Client_ID="+AD_Client_ID; - final Query query = new Query(getCtx(), "C_InvoiceLine", null, getTrxName()) - .setOnlyActiveRecords(true) - .setClient_ID(); - // - // Test COUNT: - assertEquals("COUNT not match", - DB.getSQLValueBDEx(getTrxName(), "SELECT COUNT(*) "+sqlFrom), - query.aggregate(null, Query.AGGREGATE_COUNT)); - // - // Test SUM: - assertEquals("SUM not match", - DB.getSQLValueBDEx(getTrxName(), "SELECT SUM(LineNetAmt+TaxAmt) "+sqlFrom), - query.aggregate("LineNetAmt+TaxAmt", Query.AGGREGATE_SUM)); - // - // Test MIN: - assertEquals("MIN not match", - DB.getSQLValueBDEx(getTrxName(), "SELECT MIN(LineNetAmt) "+sqlFrom), - query.aggregate("LineNetAmt", Query.AGGREGATE_MIN)); - // - // Test MAX: - assertEquals("MAX not match", - DB.getSQLValueBDEx(getTrxName(), "SELECT MAX(LineNetAmt) "+sqlFrom), - query.aggregate("LineNetAmt", Query.AGGREGATE_MAX)); - // - // Test aggregate (String) - FR [ 2726447 ] - assertEquals("MAX not match (String)", - DB.getSQLValueStringEx(getTrxName(), "SELECT MAX(Description) "+sqlFrom), - (String)query.aggregate("Description", Query.AGGREGATE_MAX, String.class)); - // - // Test aggregate (Timestamp) - FR [ 2726447 ] - assertEquals("MAX not match (Timestamp)", - DB.getSQLValueTSEx(getTrxName(), "SELECT MAX(Updated) "+sqlFrom), - (Timestamp)query.aggregate("Updated", Query.AGGREGATE_MAX, Timestamp.class)); - // - // Test Exception : No Aggregate Function defined - assertExceptionThrown("No Aggregate Function defined", DBException.class, new Runnable(){ - public void run() - { - query.aggregate("*", null); - }}); - // - // Test Exception : No Expression defined - assertExceptionThrown("No Expression defined", DBException.class, new Runnable(){ - public void run() - { - query.aggregate(null, Query.AGGREGATE_SUM); - }}); - } - - public void testOnlySelection() throws Exception - { - // Get one AD_PInstance_ID - int AD_PInstance_ID = DB.getSQLValueEx(null, "SELECT MAX(AD_PInstance_ID) FROM AD_PInstance"); - assertTrue(AD_PInstance_ID > 0); - - // Create selection list - List elements = new ArrayList (); - elements.add(new KeyNamePair(102, null)); // AD_Element_ID=102 => AD_Client_ID - elements.add(new KeyNamePair(104, null)); // AD_Element_ID=104 => AD_Column_ID - DB.executeUpdateEx("DELETE FROM T_Selection WHERE AD_PInstance_ID="+AD_PInstance_ID, getTrxName()); - DB.createT_SelectionNew (AD_PInstance_ID, elements, getTrxName()); - - String whereClause = "1=1"; // some dummy where clause - int[] ids = new Query(getCtx(), X_AD_Element.Table_Name, whereClause, getTrxName()) - .setOnlySelection(AD_PInstance_ID) - .setOrderBy(X_AD_Element.COLUMNNAME_AD_Element_ID) - .getIDs(); - assertEquals("Resulting number of elements differ", elements.size(), ids.length); - - for (int i = 0; i < elements.size(); i++) - { - int expected = elements.get(i).getKey(); - assertEquals("Element "+i+" not equals", expected, ids[i]); - } - } -} diff --git a/org.adempiere.extend/src/test/functional/TrxTest.java b/org.adempiere.extend/src/test/functional/TrxTest.java deleted file mode 100644 index d652f9db34..0000000000 --- a/org.adempiere.extend/src/test/functional/TrxTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 2008 SC ARHIPAC SERVICE SRL. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package test.functional; - -import org.adempiere.exceptions.AdempiereException; -import org.compiere.model.MTest; -import org.compiere.model.Query; -import org.compiere.util.Trx; -import org.compiere.util.TrxRunnable; - -import test.AdempiereTestCase; - -/** - * Test {@link Trx} class - * @author Teo Sarca, http://www.arhipac.ro - */ -public class TrxTest extends AdempiereTestCase { - private int m_id2 = -1; - - /** - * Test {@link Trx#run(TrxRunnable)} and {@link Trx#run(String, TrxRunnable)} methods - */ - public void testRunTrxRunnable() throws Exception - { - // - // Create test outside trx - success - m_id2 = -1; - Trx.run(new TrxRunnable() { - public void run(String trxName) { - m_id2 = createTest(trxName).get_ID(); - } - }); - assertTestExists(m_id2, true, null); - new MTest(getCtx(), m_id2, null).deleteEx(true); - - // - // Create test outside trx - fail - m_id2 = -1; - try { - Trx.run(new TrxRunnable() { - public void run(String trxName) { - m_id2 = createTest(trxName).get_ID(); - throw new AdempiereException("FORCE"); - } - }); - // - assertTrue("Should not happen because previous code is throwing exception", false); - } - catch (AdempiereException e) { - } - assertTestExists(m_id2, false, null); - - // - // Create test1 - String trxName = getTrxName(); - MTest test1 = createTest(trxName); - - // - // Fail creating test2 - m_id2 = -1; - try { - Trx.run(trxName, new TrxRunnable() { - public void run(String trxName) { - m_id2 = createTest(trxName).get_ID(); - throw new AdempiereException("FORCE"); - } - }); - // - assertTrue("Should not happen because previous code is throwing exception", false); - } - catch (AdempiereException e) { - } - assertTestExists(m_id2, false, trxName); - assertTestExists(test1.get_ID(), true, trxName); - - // - // Success creating test2 - m_id2 = -1; - Trx.run(trxName, new TrxRunnable() { - public void run(String trxName) { - m_id2 = createTest(trxName).get_ID(); - } - }); - assertTestExists(m_id2, true, trxName); - assertTestExists(test1.get_ID(), true, trxName); - } - - private final MTest createTest(String trxName) { - MTest test = new MTest (getCtx(), "test-"+getClass(), 10); - test.set_TrxName(trxName); - test.saveEx(); - return test; - } - - private final void assertTestExists(int test_id, boolean existsTarget, String trxName) - { - String whereClause = MTest.COLUMNNAME_Test_ID+"=?"; - boolean exists = new Query(getCtx(), MTest.Table_Name, whereClause, trxName) - .setParameters(new Object[]{test_id}) - .match(); - assertEquals("Test "+test_id+" [trxName="+trxName+"] - existance issue", existsTarget, exists); - } -} diff --git a/org.adempiere.extend/src/test/performance/MProductTest.java b/org.adempiere.extend/src/test/performance/MProductTest.java deleted file mode 100644 index 386e761b4d..0000000000 --- a/org.adempiere.extend/src/test/performance/MProductTest.java +++ /dev/null @@ -1,145 +0,0 @@ -package test.performance; - -/********************************************************************** -* This file is part of ADempiere Business Suite * -* http://www.adempiere.org * -* * -* Copyright (C) Trifon Trifonov. * -* Copyright (C) Contributors * -* * -* This program is free software; you can redistribute it and/or * -* modify it under the terms of the GNU General Public License * -* as published by the Free Software Foundation; either version 2 * -* of the License, or (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the Free Software * -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * -* MA 02110-1301, USA. * -* * -* Contributors: * -* - Trifon Trifonov (trifonnt@users.sourceforge.net) * -* * -* Sponsors: * -* - Catura AG (http://www.catura.de) * -***********************************************************************/ - -import java.text.DecimalFormat; -import java.text.NumberFormat; -import org.compiere.model.MProduct; -import test.AdempiereTestCase; - -/** - * @author Trifon Trifonov - */ -public class MProductTest extends AdempiereTestCase { - - private MProduct product = null; - private int AD_Org_ID = 0; - private int M_Product_Category_ID = 0; - private int C_TaxCategory_ID = 0; - private int C_UOM_ID = 0; - private String ProductType = null; - private int startIndex = 43000; - private int runCount = 500; - private boolean singleCommit = false; - - protected void setUp() throws Exception - { - super.setUp(); - // How to setup language - //Env.setContext(getCtx(), Env.LANGUAGE, "en_US"); - - // Organization - AD_Org_ID = Integer.parseInt( testProperties.getProperty("AD_Org_ID", "0") ); // 0 in Any Tenant - // M_Product_Category - M_Product_Category_ID = Integer.parseInt( testProperties.getProperty("M_Product_Category_ID", "105") ); // 105 in GardenWorld - // C_TaxCategory - C_TaxCategory_ID = Integer.parseInt( testProperties.getProperty("C_TaxCategory_ID", "107") ); // 107 in GardenWorld - // C_UOM - C_UOM_ID = Integer.parseInt( testProperties.getProperty("C_UOM_ID", "100") ); // 100 in GardenWorld - // ProductType - ProductType = testProperties.getProperty("ProductType", "I"); // 'I' in GardenWorld - - startIndex = Integer.parseInt( testProperties.getProperty("startIndex", "43000") ); - runCount = Integer.parseInt( testProperties.getProperty("runCount", "500") ); - singleCommit = Boolean.parseBoolean( testProperties.getProperty("singleCommit", "false") ); - - // How to setup Log Level. Not necessary as AdempiereTestCase is taking care of it! -// CLogMgt.setLevel(Level.OFF); -/* Available levels: - Level.OFF, Level.SEVERE, Level.WARNING, Level.INFO, - Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST, Level.ALL -*/ - -// assertEquals("Client is NOT GardenWorld", 11, Env.getAD_Client_ID(getCtx())); - - } - - public void testMProductCreation() { - // Start time - 20:16 - long startTime = System.currentTimeMillis(); - System.out.println("Start Time(ms) = " + startTime); - System.out.println("Start Time = " + new java.util.Date(startTime)); - - // The 0 symbol shows a digit or 0 if no digit present - // The # symbol shows a digit or nothing if no digit present - NumberFormat formatter = new DecimalFormat("00000"); // -001235 - - for (int idx= startIndex; idx < (startIndex + runCount); idx++) { - //System.out.println("idx = " + idx); - product = new MProduct(getCtx(), 0, getTrxName()); - - String formattedIdx = formatter.format( idx ); - product.setValue("test-product-" + formattedIdx); - product.setName("Test Product " + formattedIdx); - - product.setAD_Org_ID(AD_Org_ID); - product.setM_Product_Category_ID(M_Product_Category_ID); - product.setC_TaxCategory_ID(C_TaxCategory_ID); - product.setC_UOM_ID(C_UOM_ID); - product.setProductType(ProductType); - - boolean saveResult = product.save(); - assertTrue("MProduct.save()", saveResult); - //System.out.println("product.getM_Product_ID: " + product.getM_Product_ID()); - if (singleCommit) { - try { - commit(); - } catch (Exception e) { - fail(e.getLocalizedMessage()); - } - } - } // end 'for' loop - - if (!singleCommit) { - try { - commit(); - } catch (Exception e) { - fail(e.getLocalizedMessage()); - } - } - long endTime = System.currentTimeMillis(); - System.out.println("End Time(ms) = " + endTime); - System.out.println("End Time = " + new java.util.Date(endTime)); - long time = endTime - startTime; - System.out.println("Duration(ms) = " + time); - - time = time / 1000; - System.out.println("Duration(sec.) = " + time); - if (time > 0) { - System.out.println("Duration(min.) = " + time / 60); - } - - System.out.println( - "Count = " + runCount - + "; Time(seconds) = " + time + "; Produsts/Second = " + ((float)runCount/time) + "; "); - - assertTrue(this.getClass().getName(), true); - } -} diff --git a/org.adempiere.extend/testTemplate.properties b/org.adempiere.extend/testTemplate.properties deleted file mode 100644 index 215ae681f5..0000000000 --- a/org.adempiere.extend/testTemplate.properties +++ /dev/null @@ -1,24 +0,0 @@ -AdempiereProperties=C:/idempiere/idempiere.properties -isClient=Y -AD_Client_ID=11 -#AD_Client_ID=1000006 -AD_User_ID=0 -# LogLevel: OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL -LogLevel=OFF - -# MProductTest - Tenant: GardenWorld -AD_Org_ID=0 -M_Product_Category_ID=105 -C_TaxCategory_ID=107 -C_UOM_ID=100 -ProductType=I -startIndex=43000 -runCount=500 -singleCommit=false - -# MProductTest - Tenant: Test6 -#AD_Org_ID=0 -#M_Product_Category_ID=1000006 -#C_TaxCategory_ID=1000010 -#C_UOM_ID=100 -#ProductType=I diff --git a/org.adempiere.install/install.app.launch b/org.adempiere.install/install.app.launch index 563dd399d9..7ff77a9da0 100644 --- a/org.adempiere.install/install.app.launch +++ b/org.adempiere.install/install.app.launch @@ -88,7 +88,6 @@ - diff --git a/org.adempiere.install/install.console.app.launch b/org.adempiere.install/install.console.app.launch index 4bc41e75a7..196bf406ee 100644 --- a/org.adempiere.install/install.console.app.launch +++ b/org.adempiere.install/install.console.app.launch @@ -88,7 +88,6 @@ - diff --git a/org.adempiere.server-feature/server.product.functionaltest.launch b/org.adempiere.server-feature/server.product.functionaltest.launch index 053dcc8888..b7d4987e9d 100644 --- a/org.adempiere.server-feature/server.product.functionaltest.launch +++ b/org.adempiere.server-feature/server.product.functionaltest.launch @@ -407,7 +407,6 @@ - diff --git a/org.adempiere.server-feature/server.product.launch b/org.adempiere.server-feature/server.product.launch index 6bbd0529af..2cb0bb70d8 100644 --- a/org.adempiere.server-feature/server.product.launch +++ b/org.adempiere.server-feature/server.product.launch @@ -408,7 +408,6 @@ - diff --git a/org.idempiere.javadoc/build.properties b/org.idempiere.javadoc/build.properties index 23ce6e4a3b..0174f77d06 100644 --- a/org.idempiere.javadoc/build.properties +++ b/org.idempiere.javadoc/build.properties @@ -5,7 +5,6 @@ jars.extra.classpath = platform:/plugin/org.adempiere.base/,\ platform:/plugin/org.adempiere.base.callout/,\ platform:/plugin/org.adempiere.base.process/,\ platform:/plugin/org.adempiere.eclipse.equinox.http.servlet/,\ - platform:/plugin/org.adempiere.extend/,\ platform:/plugin/org.adempiere.install/,\ platform:/plugin/org.adempiere.payment.processor/,\ platform:/plugin/org.adempiere.pipo/,\ diff --git a/pom.xml b/pom.xml index 8197dc3c7a..8d5c5584c7 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,6 @@ org.adempiere.base org.adempiere.base.callout org.adempiere.base.process - org.adempiere.extend org.adempiere.payment.processor org.adempiere.eclipse.equinox.http.servlet org.adempiere.install