IDEMPIERE-4199 Clean up org.adempiere.extend

This commit is contained in:
hengsin 2020-04-02 19:27:07 +08:00
parent ee4ec74a88
commit 0b3d1415b5
41 changed files with 0 additions and 3738 deletions

View File

@ -62,14 +62,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.adempiere.extend"
download-size="0"
install-size="0"
version="0.0.0"
fragment="true"
unpack="false"/>
<plugin
id="org.adempiere.ui"
download-size="0"

View File

@ -380,7 +380,6 @@
<setEntry value="org.adempiere.base.callout@default:default"/>
<setEntry value="org.adempiere.base.process@default:default"/>
<setEntry value="org.adempiere.base@default:default"/>
<setEntry value="org.adempiere.extend@default:false"/>
<setEntry value="org.adempiere.install@default:default"/>
<setEntry value="org.adempiere.payment.processor@default:default"/>
<setEntry value="org.adempiere.pipo.handlers@default:default"/>

View File

@ -380,7 +380,6 @@
<setEntry value="org.adempiere.base.callout@default:default"/>
<setEntry value="org.adempiere.base.process@default:default"/>
<setEntry value="org.adempiere.base@default:default"/>
<setEntry value="org.adempiere.extend@default:false"/>
<setEntry value="org.adempiere.install@default:default"/>
<setEntry value="org.adempiere.payment.processor@default:default"/>
<setEntry value="org.adempiere.pipo.handlers@default:default"/>

View File

@ -380,7 +380,6 @@
<setEntry value="org.adempiere.base.callout@default:default"/>
<setEntry value="org.adempiere.base.process@default:default"/>
<setEntry value="org.adempiere.base@default:default"/>
<setEntry value="org.adempiere.extend@default:false"/>
<setEntry value="org.adempiere.install@default:default"/>
<setEntry value="org.adempiere.payment.processor@default:default"/>
<setEntry value="org.adempiere.pipo.handlers@default:default"/>

View File

@ -380,7 +380,6 @@
<setEntry value="org.adempiere.base.callout@default:default"/>
<setEntry value="org.adempiere.base.process@default:default"/>
<setEntry value="org.adempiere.base@default:default"/>
<setEntry value="org.adempiere.extend@default:false"/>
<setEntry value="org.adempiere.install@default:default"/>
<setEntry value="org.adempiere.payment.processor@default:default"/>
<setEntry value="org.adempiere.pipo.handlers@default:default"/>

View File

@ -380,7 +380,6 @@
<setEntry value="org.adempiere.base.callout@default:default"/>
<setEntry value="org.adempiere.base.process@default:default"/>
<setEntry value="org.adempiere.base@default:default"/>
<setEntry value="org.adempiere.extend@default:false"/>
<setEntry value="org.adempiere.install@default:default"/>
<setEntry value="org.adempiere.payment.processor@default:default"/>
<setEntry value="org.adempiere.pipo.handlers@default:default"/>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.adempiere.extend</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -1,3 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.release=enabled

View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="extend">
<wb-resource deploy-path="/" source-path="/src"/>
</wb-module>
</project-modules>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="jst.utility"/>
<fixed facet="jst.java"/>
<installed facet="jst.java" version="6.0"/>
<installed facet="jst.utility" version="1.0"/>
</faceted-project>

View File

@ -1,26 +0,0 @@
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<TITLE>Project Extend.jpx</TITLE>
</HEAD>
<BODY>
<H1>Project Notes</H1>
<HR>
<FONT SIZE=+1>
<STRONG>Project: </STRONG>Product Extensions<BR>
<STRONG>Author: </STRONG>Jorg Janke<BR>
<STRONG>Version: </STRONG>$Id: Extend.html,v 1.1 2006/04/21 17:55:19 jjanke Exp $<BR>
<hr>
<STRONG>Description: </STRONG><BR>
Create Jar Extend.jar to be included in Base => Client.
Example of extensions
<HR>
<STRONG>Things to do... </STRONG><BR>
</FONT>
<UL>
<!-- Edit this section to keep track of your to do items -->
<LI>Item 1
<LI>Item 2
</UL>
</BODY>
</HTML>

View File

@ -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

View File

@ -1,141 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
<booleanAttribute key="append.args" value="true"/>
<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
<booleanAttribute key="askclear" value="false"/>
<booleanAttribute key="automaticAdd" value="false"/>
<booleanAttribute key="automaticValidate" value="true"/>
<stringAttribute key="bootstrap" value=""/>
<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="true"/>
<booleanAttribute key="clearws" value="true"/>
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
<booleanAttribute key="default" value="false"/>
<setAttribute key="deselected_workspace_bundles"/>
<booleanAttribute key="includeOptional" value="false"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/Convert_PostgreSQLTest.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.compiere.dbPort.Convert_PostgreSQLTest"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.compiere.db.postgresql.provider"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea --add-modules java.se --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-exports java.desktop/sun.awt=ALL-UNNAMED --add-exports java.sql.rowset/com.sun.rowset=ALL-UNNAMED --add-exports java.naming/com.sun.jndi.ldap=ALL-UNNAMED"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<booleanAttribute key="run_in_ui_thread" value="true"/>
<setAttribute key="selected_target_bundles">
<setEntry value="bcprov@default:default"/>
<setEntry value="com.diffplug.osgi.extension.sun.misc@default:false"/>
<setEntry value="com.google.zxing.core@default:default"/>
<setEntry value="com.ibm.icu*58.2.0.v20181010-1334@default:default"/>
<setEntry value="com.ibm.icu*62.1.0.v20180727-1652@default:default"/>
<setEntry value="com.ibm.icu*63.1.0.v20181030-1705@default:default"/>
<setEntry value="com.ibm.icu*63.1.0@default:default"/>
<setEntry value="com.itextpdf@default:default"/>
<setEntry value="com.jaspersoft.studio.bundles.barbecue@default:default"/>
<setEntry value="com.sun.activation.jakarta.activation@default:default"/>
<setEntry value="com.sun.mail.smtp@default:default"/>
<setEntry value="groovy-console@default:false"/>
<setEntry value="groovy-datetime@default:false"/>
<setEntry value="groovy-json@default:false"/>
<setEntry value="groovy-jsr223@default:false"/>
<setEntry value="groovy-nio@default:false"/>
<setEntry value="groovy-swing@default:false"/>
<setEntry value="groovy-xml@default:false"/>
<setEntry value="groovy@default:default"/>
<setEntry value="jakarta.mail.api@default:default"/>
<setEntry value="jakarta.xml.bind-api@default:default"/>
<setEntry value="javax.annotation-api@default:default"/>
<setEntry value="javax.inject@default:default"/>
<setEntry value="javax.jms@default:default"/>
<setEntry value="javax.transaction@default:false"/>
<setEntry value="net.sf.supercsv.super-csv@default:default"/>
<setEntry value="org.apache.activemq.activemq-core@default:default"/>
<setEntry value="org.apache.activemq.kahadb@default:default"/>
<setEntry value="org.apache.ant*1.10.5.v20180808-0324@default:default"/>
<setEntry value="org.apache.ant*1.9.6.v201510161327@default:default"/>
<setEntry value="org.apache.batik.constants*1.10.0.v20180703-1553@default:default"/>
<setEntry value="org.apache.batik.constants*1.9.1.v20180227-1645@default:default"/>
<setEntry value="org.apache.batik.css*1.10.0.v20180703-1553@default:default"/>
<setEntry value="org.apache.batik.css*1.9.1.v20180313-1559@default:default"/>
<setEntry value="org.apache.batik.css*1.9.1.v20181015-1528@default:default"/>
<setEntry value="org.apache.batik.i18n*1.10.0.v20180703-1553@default:default"/>
<setEntry value="org.apache.batik.i18n*1.9.1.v20180227-1645@default:default"/>
<setEntry value="org.apache.batik.util*1.10.0.v20180703-1553@default:default"/>
<setEntry value="org.apache.batik.util*1.9.1.v20180227-1645@default:default"/>
<setEntry value="org.apache.batik.util*1.9.1.v20180703-1553@default:default"/>
<setEntry value="org.apache.commons.collections@default:default"/>
<setEntry value="org.apache.commons.io*2.2.0.v201405211200@default:default"/>
<setEntry value="org.apache.commons.io*2.6.0@default:default"/>
<setEntry value="org.apache.commons.logging*1.1.1.v201101211721@default:default"/>
<setEntry value="org.apache.commons.logging*1.2.0.v20180409-1502@default:default"/>
<setEntry value="org.apache.commons.net@default:default"/>
<setEntry value="org.apache.felix.scr@1:true"/>
<setEntry value="org.apache.geronimo.specs.geronimo-j2ee-management_1.1_spec@default:default"/>
<setEntry value="org.apache.poi.poi-ooxml@default:default"/>
<setEntry value="org.apache.poi.poi@default:default"/>
<setEntry value="org.apache.servicemix.bundles.cglib@default:default"/>
<setEntry value="org.apache.xmlgraphics*1.4.0.v201301251218@default:default"/>
<setEntry value="org.apache.xmlgraphics*2.2.0.v20180410-1551@default:default"/>
<setEntry value="org.apache.xmlgraphics*2.2.0.v20180809-1640@default:default"/>
<setEntry value="org.cryptacular@default:default"/>
<setEntry value="org.eclipse.ant.core@default:default"/>
<setEntry value="org.eclipse.core.commands@default:default"/>
<setEntry value="org.eclipse.core.contenttype@default:default"/>
<setEntry value="org.eclipse.core.expressions@default:default"/>
<setEntry value="org.eclipse.core.jobs@default:default"/>
<setEntry value="org.eclipse.core.runtime@default:true"/>
<setEntry value="org.eclipse.core.variables@default:default"/>
<setEntry value="org.eclipse.equinox.app@default:default"/>
<setEntry value="org.eclipse.equinox.common@2:true"/>
<setEntry value="org.eclipse.equinox.ds@1:true"/>
<setEntry value="org.eclipse.equinox.event@default:default"/>
<setEntry value="org.eclipse.equinox.preferences@default:default"/>
<setEntry value="org.eclipse.equinox.registry@default:default"/>
<setEntry value="org.eclipse.jetty.osgi-servlet-api@default:default"/>
<setEntry value="org.eclipse.jetty.osgi.alpn.fragment@default:false"/>
<setEntry value="org.eclipse.osgi*3.13.200.v20181116-1621@-1:true"/>
<setEntry value="org.eclipse.osgi*3.13.200.v20181130-2106@-1:true"/>
<setEntry value="org.eclipse.osgi.compatibility.state@default:false"/>
<setEntry value="org.eclipse.osgi.services@default:default"/>
<setEntry value="org.eclipse.osgi.util@default:default"/>
<setEntry value="org.hamcrest.core@default:default"/>
<setEntry value="org.jfree.chart@default:default"/>
<setEntry value="org.jfree.jcommon@default:default"/>
<setEntry value="org.junit@default:default"/>
<setEntry value="org.krysalis.barcode4j@default:default"/>
<setEntry value="org.passay@default:default"/>
<setEntry value="org.w3c.css.sac@default:default"/>
<setEntry value="org.w3c.dom.events@default:default"/>
<setEntry value="org.w3c.dom.smil@default:default"/>
<setEntry value="org.w3c.dom.svg@default:default"/>
<setEntry value="slf4j.api@default:default"/>
<setEntry value="slf4j.jcl@default:false"/>
</setAttribute>
<setAttribute key="selected_workspace_bundles">
<setEntry value="org.adempiere.base@default:default"/>
<setEntry value="org.adempiere.extend@default:false"/>
<setEntry value="org.adempiere.install@default:default"/>
<setEntry value="org.apache.ecs@default:default"/>
<setEntry value="org.compiere.db.postgresql.provider@default:default"/>
<setEntry value="org.idempiere.hazelcast.service.config@default:false"/>
<setEntry value="org.idempiere.hazelcast.service@default:default"/>
</setAttribute>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
<booleanAttribute key="useDefaultConfigArea" value="false"/>
<booleanAttribute key="useProduct" value="false"/>
</launchConfiguration>

View File

@ -1,4 +0,0 @@
bin.includes = META-INF/,\
.
output.. = target/classes/
source.. = src/

View File

@ -1,12 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.idempiere</groupId>
<artifactId>org.idempiere.parent</artifactId>
<version>7.1.0-SNAPSHOT</version>
<relativePath>../org.idempiere.parent/pom.xml</relativePath>
</parent>
<artifactId>org.adempiere.extend</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View File

@ -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<? extends Exception> 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;
}
}
}

View File

@ -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<Object> params = new ArrayList<Object>();
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<Object> params = new ArrayList<Object>();
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");
}
}

View File

@ -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<Object[]> 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);
}
}

View File

@ -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());
}
}
}

View File

@ -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());
}
}
}

View File

@ -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());
}
}
}

View File

@ -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);
}
}

View File

@ -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));
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
};
}

View File

@ -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());
}
}

View File

@ -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());
}
}
}

View File

@ -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:
* <ul>
* <li>{@link org.compiere.model.PO#is_Changed()}
* <li>{@link org.compiere.model.PO#is_ValueChanged(String)}
* </ul>
* Applies to following bugs:
* <ul>
* <li>[ 1704828 ] PO.is_Changed() and PO.is_ValueChanged are not consistent
* </ul>
* @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());
}
/**
* <li>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();
}
}

View File

@ -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<MTable> 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<MTable> 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<MTable> 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<KeyNamePair> elements = new ArrayList<KeyNamePair> ();
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]);
}
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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

View File

@ -88,7 +88,6 @@
</setAttribute>
<setAttribute key="selected_workspace_bundles">
<setEntry value="org.adempiere.base@default:default"/>
<setEntry value="org.adempiere.extend@default:false"/>
<setEntry value="org.adempiere.install@default:default"/>
<setEntry value="org.apache.ecs@default:default"/>
<setEntry value="org.compiere.db.oracle.provider@default:default"/>

View File

@ -88,7 +88,6 @@
</setAttribute>
<setAttribute key="selected_workspace_bundles">
<setEntry value="org.adempiere.base@default:default"/>
<setEntry value="org.adempiere.extend@default:false"/>
<setEntry value="org.adempiere.install@default:default"/>
<setEntry value="org.apache.ecs@default:default"/>
<setEntry value="org.compiere.db.oracle.provider@default:default"/>

View File

@ -407,7 +407,6 @@
<setEntry value="org.adempiere.base.process@default:default"/>
<setEntry value="org.adempiere.base@default:default"/>
<setEntry value="org.adempiere.eclipse.equinox.http.servlet@default:false"/>
<setEntry value="org.adempiere.extend@default:false"/>
<setEntry value="org.adempiere.install@default:default"/>
<setEntry value="org.adempiere.payment.processor@default:default"/>
<setEntry value="org.adempiere.pipo.handlers@default:default"/>

View File

@ -408,7 +408,6 @@
<setEntry value="org.adempiere.base.process@default:default"/>
<setEntry value="org.adempiere.base@default:default"/>
<setEntry value="org.adempiere.eclipse.equinox.http.servlet@default:default"/>
<setEntry value="org.adempiere.extend@default:false"/>
<setEntry value="org.adempiere.install@default:default"/>
<setEntry value="org.adempiere.payment.processor@default:default"/>
<setEntry value="org.adempiere.pipo.handlers@default:default"/>

View File

@ -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/,\

View File

@ -15,7 +15,6 @@
<module>org.adempiere.base</module>
<module>org.adempiere.base.callout</module>
<module>org.adempiere.base.process</module>
<module>org.adempiere.extend</module>
<module>org.adempiere.payment.processor</module>
<module>org.adempiere.eclipse.equinox.http.servlet</module>
<module>org.adempiere.install</module>