IDEMPIERE-4199 Clean up org.adempiere.extend
This commit is contained in:
parent
b6898a8f99
commit
4947e24850
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/org.adempiere.extend/src/test/functional/FunctionalTestSuite.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
|
||||
</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.junit3"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="test.functional.FunctionalTestSuite"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.adempiere.extend"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
|
||||
</launchConfiguration>
|
|
@ -1,48 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/org.adempiere.extend/src/test/functional/inventory/InventoryTest.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
|
||||
</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.junit3"/>
|
||||
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="extend" path="1" type="4"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="3" projectName="fix_fifo_costing" type="1"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="extend"/> </runtimeClasspathEntry> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="3" projectName="base" type="1"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="3" projectName="tools" type="1"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/jstl.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/Verisign.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/standard.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/barbecue-1.5-beta1.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/poi-3.0.1-FINAL-20070705.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/jnlp.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/log4j.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/activation.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/mail.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/jpayment.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/bsh-2.0b5.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/script-api.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/bsh-engine.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/groovy-all-1.5.1.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/groovy-engine.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/jython.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/jython-engine.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/jcommon-1.0.14.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/jfreechart-1.0.11.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/tools/lib/javaee.jar" path="3" type="2"/> "/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="test.functional.inventory.InventoryTest"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.adempiere.extend"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
|
||||
</launchConfiguration>
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/org.adempiere.extend/src/test/performance/SingleMProductTest.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
|
||||
<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
|
||||
<mapEntry key="[run]" value="org.eclipse.jdt.junit.launchconfig"/>
|
||||
</mapAttribute>
|
||||
<booleanAttribute key="org.eclipse.hyades.trace.ui.ATTR_AUTO_MONITORING" value="true"/>
|
||||
<stringAttribute key="org.eclipse.hyades.trace.ui.ATTR_DATA_COLLECTOR" value="org.eclipse.tptp.trace.ui.jvmpiMechanism:org.eclipse.tptp.analysisType.memoryHeap,org.eclipse.tptp.analysisType.execution"/>
|
||||
<stringAttribute key="org.eclipse.hyades.trace.ui.ATTR_DESTINATION_FILE" value=""/>
|
||||
<stringAttribute key="org.eclipse.hyades.trace.ui.ATTR_DESTINATION_MONITOR" value="DefaultMonitor"/>
|
||||
<stringAttribute key="org.eclipse.hyades.trace.ui.ATTR_DESTINATION_PROJECT" value="ProfileProject"/>
|
||||
<stringAttribute key="org.eclipse.hyades.trace.ui.ATTR_FILTER_SET" value="org.eclipse.hyades.trace.ui.filterSet.default"/>
|
||||
<booleanAttribute key="org.eclipse.hyades.trace.ui.ATTR_PROFILE_TO_FILE" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.hyades.trace.ui.ATTR_PROFILING_LIMIT_INVOCATIONS" value="false"/>
|
||||
<intAttribute key="org.eclipse.hyades.trace.ui.ATTR_PROFILING_LIMIT_INVOCATIONS_NUM" value="10000"/>
|
||||
<booleanAttribute key="org.eclipse.hyades.trace.ui.ATTR_PROFILING_LIMIT_SECONDS" value="false"/>
|
||||
<intAttribute key="org.eclipse.hyades.trace.ui.ATTR_PROFILING_LIMIT_SECONDS_NUM" value="5"/>
|
||||
<stringAttribute key="org.eclipse.hyades.trace.ui.ATTR_PROFILING_SET" value="tptp-dummy-profiling-set-Profile-SingleMProductTest"/>
|
||||
<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.junit3"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="test.performance.SingleMProductTest"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.adempiere.extend"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
|
||||
</launchConfiguration>
|
|
@ -1,19 +0,0 @@
|
|||
@Title Build Extend
|
||||
@Rem $Header: /cvsroot/adempiere/extend/RUN_build.bat,v 1.9 2005/09/16 00:49:02 jjanke Exp $
|
||||
|
||||
@CALL ..\utils_dev\myDevEnv.bat
|
||||
@IF NOT %ADEMPIERE_ENV%==Y GOTO NOBUILD
|
||||
|
||||
@echo Cleanup ...
|
||||
@"%JAVA_HOME%\bin\java" -Dant.home="." %ANT_PROPERTIES% org.apache.tools.ant.Main clean
|
||||
|
||||
@echo Building ...
|
||||
@"%JAVA_HOME%\bin\java" -Dant.home="." %ANT_PROPERTIES% org.apache.tools.ant.Main dist
|
||||
|
||||
@Echo Done ...
|
||||
@sleep 60
|
||||
@exit
|
||||
|
||||
:NOBUILD
|
||||
@Echo Check myDevEnv.bat (copy from myDevEnvTemplate.bat)
|
||||
@Pause
|
|
@ -1,18 +0,0 @@
|
|||
# Module compiling script
|
||||
# Ported from Windows script Marek Mosiewicz<marek.mosiewicz@jotel.com.pl>
|
||||
|
||||
|
||||
SAVED_DIR=`pwd` #save current dir
|
||||
cd `dirname $0`/../utils_dev #change dir to place where script resides - doesn not work with sym links
|
||||
UTILS_DEV=`pwd` #this is ADempiere source
|
||||
cd $SAVED_DIR #back to the saved directory
|
||||
|
||||
. $UTILS_DEV/myDevEnv.sh #call environment
|
||||
echo done
|
||||
if [ ! $ADEMPIERE_ENV==Y ] ; then
|
||||
echo "Can't set development environment - check myDevEnv.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo running Ant
|
||||
$JAVA_HOME/bin/java -Dant.home="." $ANT_PROPERTIES org.apache.tools.ant.Main
|
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* Example View DDL SQL
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: XX_View.sql,v 1.1 2006/04/21 17:55:19 jjanke Exp $
|
||||
*/
|
||||
|
||||
-- Inspect data
|
||||
SELECT C_Invoice_ID,
|
||||
AD_Client_ID,AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy,
|
||||
IsSOTrx, DocumentNo, DocStatus, DocAction, Processed,
|
||||
SalesRep_ID, DateInvoiced, DatePrinted, DateAcct,
|
||||
C_BPartner_ID, C_BPartner_Location_ID, AD_User_ID,
|
||||
C_Currency_ID,
|
||||
TotalLines, GrandTotal,
|
||||
Multiplier, MultiplierAP, DocBaseType
|
||||
FROM C_Invoice_V
|
||||
/
|
||||
|
||||
-- The view
|
||||
CREATE OR REPLACE VIEW XX_BPartner_Total
|
||||
AS
|
||||
SELECT AD_Client_ID,AD_Org_ID,
|
||||
'Y' AS IsActive, SysDate AS Created, 0 AS CreatedBy, SysDate AS Updated, 0 AS UpdatedBy,
|
||||
C_BPartner_ID, C_BPartner_Location_ID, AD_User_ID,
|
||||
C_Currency_ID,
|
||||
SUM(InvoiceOpen (C_Invoice_ID, 0) * MultiplierAP) AS OpenAmount
|
||||
FROM C_Invoice_V
|
||||
WHERE Processed='Y'
|
||||
AND IsPaid='N'
|
||||
GROUP BY AD_Client_ID,AD_Org_ID,
|
||||
C_BPartner_ID, C_BPartner_Location_ID, AD_User_ID,
|
||||
C_Currency_ID
|
||||
/
|
|
@ -1,43 +0,0 @@
|
|||
/**
|
||||
* Example Table DDL SQL
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: XX_Visit.sql,v 1.1 2006/04/21 17:55:19 jjanke Exp $
|
||||
*/
|
||||
CREATE TABLE XX_Visit(
|
||||
XX_Visit_ID NUMBER(10, 0) NOT NULL,
|
||||
AD_Client_ID NUMBER(10, 0) NOT NULL,
|
||||
AD_Org_ID NUMBER(10, 0) NOT NULL,
|
||||
IsActive CHAR(1) DEFAULT 'Y' NOT NULL
|
||||
CHECK (IsActive in ('Y','N')),
|
||||
Created DATE DEFAULT SYSDATE NOT NULL,
|
||||
CreatedBy NUMBER(10, 0) NOT NULL,
|
||||
Updated DATE DEFAULT SYSDATE NOT NULL,
|
||||
UpdatedBy NUMBER(10, 0) NOT NULL,
|
||||
Name NVARCHAR2(60) NOT NULL,
|
||||
Description NVARCHAR2(255),
|
||||
VisitTime DATE NOT NULL,
|
||||
Minutes NUMBER(10, 0) NOT NULL,
|
||||
C_BPartner_ID NUMBER(10, 0) NOT NULL,
|
||||
C_BPartner_Location_ID NUMBER(10, 0) NOT NULL,
|
||||
AD_User_ID NUMBER(10, 0) NOT NULL,
|
||||
SalesRep_ID NUMBER(10, 0) NOT NULL,
|
||||
R_InterestArea_ID NUMBER(10, 0) NOT NULL,
|
||||
Processed CHAR(1),
|
||||
Processing CHAR(1),
|
||||
CONSTRAINT XX_Visit_Key PRIMARY KEY (XX_Visit_ID),
|
||||
CONSTRAINT CBPLoction_XXVisit FOREIGN KEY (C_BPartner_Location_ID)
|
||||
REFERENCES C_BPartner_Location(C_BPartner_Location_ID),
|
||||
CONSTRAINT ADUser_XXVisit FOREIGN KEY (AD_User_ID)
|
||||
REFERENCES AD_User(AD_User_ID),
|
||||
CONSTRAINT RInterestArea_XXVisit FOREIGN KEY (R_InterestArea_ID)
|
||||
REFERENCES R_InterestArea(R_InterestArea_ID),
|
||||
CONSTRAINT ADUserSalesRep_XXVisit FOREIGN KEY (SalesRep_ID)
|
||||
REFERENCES AD_User(AD_User_ID),
|
||||
CONSTRAINT CBPartner_XXVisit FOREIGN KEY (C_BPartner_ID)
|
||||
REFERENCES C_BPartner(C_BPartner_ID)
|
||||
)
|
||||
/
|
||||
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
@Rem API Documentation for Base
|
||||
|
||||
call ..\doc\documentation.bat src doc -private
|
||||
|
||||
@pause
|
|
@ -1,107 +0,0 @@
|
|||
/**********************************************************************
|
||||
* This file is part of Adempiere ERP Bazaar *
|
||||
* 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: *
|
||||
* - Company (http://www.d3-soft.com) *
|
||||
***********************************************************************/
|
||||
package test.functional;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.model.MAlert;
|
||||
import org.compiere.model.MAlertProcessor;
|
||||
import org.compiere.model.MAlertProcessorLog;
|
||||
import org.compiere.model.X_AD_AlertProcessor;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
|
||||
/**
|
||||
* Example Test which shows usage of new methods.
|
||||
*
|
||||
* @author Trifon Trifonov
|
||||
* @version $Id$
|
||||
*/
|
||||
public class AlertTest extends AdempiereTestCase
|
||||
{
|
||||
|
||||
/** Logger */
|
||||
private static final CLogger log = CLogger.getCLogger (AlertTest.class);
|
||||
|
||||
/**
|
||||
* Run
|
||||
*/
|
||||
public void testAlertCreation() throws Exception
|
||||
{
|
||||
if (log.isLoggable(Level.INFO)) log.info("trx = " + getTrxName());
|
||||
boolean resultSave = false;
|
||||
|
||||
//----- Old way:
|
||||
MAlert alertOldWay = new MAlert(Env.getCtx(), 100, getTrxName());
|
||||
if (log.isLoggable(Level.INFO)) log.info(alertOldWay.toString());
|
||||
|
||||
X_AD_AlertProcessor alertProcessorOldWay = new X_AD_AlertProcessor(Env.getCtx(), alertOldWay.getAD_AlertProcessor_ID(), getTrxName());
|
||||
if (log.isLoggable(Level.INFO)) log.info("alertProcessorOldWay.getAD_AlertProcessor_ID = " + alertProcessorOldWay.getAD_AlertProcessor_ID());
|
||||
|
||||
alertOldWay.setDescription("Trifon test");
|
||||
//--- Save;
|
||||
resultSave = alertOldWay.save();
|
||||
if (log.isLoggable(Level.INFO)) log.info("resultSave = " + resultSave);
|
||||
|
||||
System.out.println("New value of Description = " + alertOldWay.getDescription());
|
||||
|
||||
//----- New way:
|
||||
/* I_AD_Alert alert = new MAlert(Env.getCtx(), 100, trx.getTrxName());
|
||||
log.info(alert.toString());
|
||||
|
||||
I_AD_AlertProcessor alertProcessor = alert.getI_AD_AlertProcessor();
|
||||
log.info("I_AD_AlertProcessor.getAD_AlertProcessor_ID = " + alertProcessor.getAD_AlertProcessor_ID());
|
||||
|
||||
log.info("alert.getAD_AlertProcessor_ID = " + alert.getAD_AlertProcessor_ID());
|
||||
|
||||
alert.setDescription("Trifon Description modified!");
|
||||
//--- Save; PO.save(PO) must be static method!!! Two way of usage: PO.save(Object) or PO.save(PO)
|
||||
//resultSave = PO.save((PO)alert);
|
||||
resultSave = PO.save(alert); // Overloaded save method; For simple usage!
|
||||
log.info("resultSave = " + resultSave);
|
||||
|
||||
System.out.println("New value of Description = " + alert.getDescription());
|
||||
*/
|
||||
|
||||
commit();
|
||||
}
|
||||
public void testAlertProcessor() {
|
||||
MAlertProcessor alertpro = new MAlertProcessor(getCtx(), 100,null);
|
||||
alertpro.setAD_AlertProcessor_ID(100);
|
||||
MAlertProcessorLog[] test = (MAlertProcessorLog[]) alertpro.getLogs();
|
||||
assertTrue("Alert Processor has logs", test.length > 0);
|
||||
MAlert[] alerts = (MAlert[])alertpro.getAlerts(true);
|
||||
assertTrue("There are alerts", alerts.length> 0);
|
||||
assertTrue ("There are active recs", MAlertProcessor.getActive(getCtx()).length > 0);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +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.MAsset;
|
||||
import org.compiere.model.MAssetDelivery;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 borrows from MInvoiceTest
|
||||
*/
|
||||
public class MAssetTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{ //test with mock A_Asset and A_Asset_Delivery record
|
||||
MAsset asset = new MAsset(getCtx(), 1000000, getTrxName());
|
||||
MAssetDelivery[] assets = asset.getDeliveries();
|
||||
assertTrue("assets must have values", assets.length > 0);
|
||||
MAsset getstmt = MAsset.getFromShipment(getCtx(), 1000000, getTrxName());
|
||||
assertTrue("stmt must be active", getstmt.isActive() == true);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,47 +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.MAttribute;
|
||||
import org.compiere.model.MAttributeInstance;
|
||||
import org.compiere.model.MAttributeValue;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 borrows from MInvoiceTest
|
||||
*/
|
||||
public class MAttributeTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MAttribute attrib = new MAttribute(getCtx(), 100, getTrxName());
|
||||
MAttribute[] attbClient = MAttribute.getOfClient(getCtx(), true, true);
|
||||
assertTrue("atrributes must be true", attbClient.length > 0);
|
||||
MAttributeValue[] av = attrib.getMAttributeValues();
|
||||
assertTrue("atrributes must have values", av.length > 0);
|
||||
MAttributeInstance ai = attrib.getMAttributeInstance(100);
|
||||
assertTrue("atrributes must have values", ai.isActive());
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,550 +0,0 @@
|
|||
//MBPartnerTest.java
|
||||
package test.functional;
|
||||
|
||||
import org.compiere.model.MBPartner;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
public class MBPartnerTest extends AdempiereTestCase {
|
||||
|
||||
// Variables needed for importing/migrating business partners
|
||||
//private MLocation location = null;
|
||||
|
||||
//private MBPartner m_partner = null; //business partner
|
||||
/*
|
||||
private MBPartnerLocation 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 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");
|
||||
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 )
|
||||
m_partner.saveEx();
|
||||
|
||||
commit();
|
||||
} catch(Exception e) {
|
||||
fail(e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
} */
|
||||
public void testBPartner() {
|
||||
MBPartner test = MBPartner.getBPartnerCashTrx(getCtx(), 11);
|
||||
assertTrue("Confirming right BPartner record", test.getC_BPartner_ID() == 112);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +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.MCashBook;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 borrows from MInvoiceTest
|
||||
*/
|
||||
public class MCashBookTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MCashBook cshbk = MCashBook.get(getCtx(), 11, 100);
|
||||
assertTrue("Must have cash book", cshbk.getC_CashBook_ID()==101);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +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.MClient;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 borrows from MInvoiceTest
|
||||
*/
|
||||
public class MClientTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MClient[] allClients = MClient.getAll(getCtx());
|
||||
assertTrue("atrributes must have values", allClients.length > 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +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.MColor;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 borrows from MInvoiceTest
|
||||
*/
|
||||
public class MColorTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MColor clr = new MColor(getCtx(),1,getTrxName()); //red1 put in dummy record that has COLORTYPE = 'R' for and ADImageID = 101
|
||||
assertTrue("Color must be right", clr.getAD_Image_ID() > 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +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.MContactInterest;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 borrows from MInvoiceTest
|
||||
*/
|
||||
public class MContactInterestTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{ //red1 tested InterestArea_ID with true and false conditions (101 retValue not null, 100 - retValue = null)
|
||||
MContactInterest retValue = MContactInterest.get(getCtx(), 101, 104, true, getTrxName());
|
||||
assertTrue("interest area must have record",retValue.get_ID()>0);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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.MCostDetail;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 borrows from MInvoiceTest
|
||||
*/
|
||||
public class MCostDetailTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MCostDetail cd = MCostDetail.get(getCtx(), "C_InvoiceLine_ID=?", 1000003, 1000001, 1000001, getTrxName());
|
||||
assertTrue("Such Cost Detail record exists", cd.get_ID() > 0);
|
||||
MProduct prod = new MProduct(getCtx(),1000002,getTrxName());
|
||||
assertTrue("must have true result", MCostDetail.processProduct(prod, getTrxName())); //red1 test mock falce recs in MCostDetail
|
||||
}
|
||||
|
||||
}
|
|
@ -1,69 +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.Collection;
|
||||
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MCostElement;
|
||||
import org.compiere.model.X_M_CostElement;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro // copied by red1 from MInvoiceTest
|
||||
*/
|
||||
public class MCostElementTest extends AdempiereTestCase
|
||||
{
|
||||
public static final int BPARTNER_Standard = 112;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
X_M_CostElement ce =new X_M_CostElement(getCtx(), 102, null);
|
||||
MClient client = MClient.get(ce.getCtx());
|
||||
MCostElement retValue = MCostElement.getMaterialCostElement(client, "F"); //red1 -- change to "S" and"I" to test firstOnly() (false/true)
|
||||
//red1 -- remove .getCtx to test Public static MCostElement getMaterialCostElement (PO po, String CostingMethod)
|
||||
assertTrue("getMaterialCostElement returns value", retValue.getName().equals("Fifo")); //red1 -- options above will fail this return (OK)
|
||||
//testquery1
|
||||
|
||||
Collection<MCostElement> retValue2 = MCostElement.getCostElementsWithCostingMethods(client);
|
||||
assertTrue("getostElementsWithCostingMethods returns 8", retValue2.size() == 8);
|
||||
//testquery2
|
||||
|
||||
MCostElement[] retValue3 = MCostElement.getCostingMethods(client);
|
||||
assertTrue("getCostingMethods returns 4", retValue3.length == 4);
|
||||
//testquery3
|
||||
|
||||
MCostElement[] retValue4 = MCostElement.getNonCostingMethods(client);
|
||||
assertTrue("getNonCostingMethods returns 1", retValue4.length == 1);
|
||||
//testquery3
|
||||
|
||||
MCostElement[] retValue5 = MCostElement.getElements(client.getCtx(), null);
|
||||
assertTrue("getElements returns 8", retValue5.length == 8);
|
||||
//testquery3
|
||||
|
||||
Collection<MCostElement> retValue6 = MCostElement.getByCostingMethod(client.getCtx(), "F");
|
||||
assertTrue("getByCostingMethod has recs", retValue6.size() > 0);
|
||||
//testquery3
|
||||
}
|
||||
|
||||
}
|
|
@ -1,45 +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.MAcctSchemaDefault;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 borrows from MInvoiceTest
|
||||
*/
|
||||
public class MCurrencyAcctTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{ //red1 create C_Currency_Acct wih SchemaDef = 101 and C_Currency = 100
|
||||
@SuppressWarnings("unused")
|
||||
MAcctSchemaDefault as = MAcctSchemaDefault.get(getCtx(), 101);
|
||||
|
||||
// IDEMPIERE-362 Hide things that don't work on iDempiere
|
||||
|
||||
//int a = as.getRealizedGain_Acct(100);
|
||||
//assertTrue("No test record been setup", a > 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,41 +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.MDistribution;
|
||||
import org.compiere.model.MDistributionLine;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 borrows from MInvoiceTest
|
||||
*/
|
||||
public class MDistributionTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MDistribution dist = new MDistribution(getCtx(), 100, getTrxName());
|
||||
MDistributionLine[] dl = dist.getLines(true); //red1 test with false no effect as mlines is null
|
||||
assertTrue("Dist Lines exists", dl.length > 0);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,55 +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.MInOutLine;
|
||||
import org.compiere.model.MInvoice;
|
||||
import org.compiere.model.MInvoiceLine;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 reused for InvoiceLine test
|
||||
*/
|
||||
public class MInvoiceTest extends AdempiereTestCase
|
||||
{
|
||||
public static final int BPARTNER_TreeFarm = 114;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MInvoice.setIsPaid(getCtx(), BPARTNER_TreeFarm, getTrxName());
|
||||
|
||||
MInvoice[] invoices = MInvoice.getOfBPartner(getCtx(), BPARTNER_TreeFarm, getTrxName());
|
||||
assertTrue("Partner "+BPARTNER_TreeFarm+" should have invoices", invoices.length > 0);
|
||||
|
||||
for (MInvoice invoice : invoices)
|
||||
{
|
||||
invoice.getLines(true); // test query
|
||||
invoice.getTaxes(true); // test query
|
||||
}
|
||||
//test MinvoiceLine getOfInOutLine
|
||||
MInOutLine iol = new MInOutLine(getCtx(),101,getTrxName()); //get InOutLine thats from InvoiceLine
|
||||
MInvoiceLine invl = MInvoiceLine.getOfInOutLine(iol);
|
||||
assertTrue("getOfInOutLine must work",invl.get_ID()>0);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,46 +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.MLot;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 copy from MInvoiceTest
|
||||
*/
|
||||
public class MLotTest extends AdempiereTestCase
|
||||
{
|
||||
public static final int BPARTNER_TreeFarm = 114;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
// to set up record - in a clean seed database
|
||||
// open material receipt window
|
||||
// create a material receipt for the product Fertilizer #50
|
||||
// and push the "New Record" button on the attribute set instance dialog
|
||||
MLot retValue = MLot.getProductLot(getCtx(), 136, "100", getTrxName());
|
||||
assertTrue("Last Lot Rec is 101", retValue.getM_Lot_ID() == 1000000);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package test.functional;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.model.MMatchInv;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca
|
||||
*
|
||||
*/
|
||||
public class MMatchInvTest extends AdempiereTestCase
|
||||
{
|
||||
/**
|
||||
* Only check if new API was correctly introduced
|
||||
*/
|
||||
public void testNewQueryAPI() throws Exception
|
||||
{
|
||||
Properties ctx = getCtx();
|
||||
String trxName = getTrxName();
|
||||
int C_Invoice_ID = 100;
|
||||
int C_InvoiceLine_ID = 100;
|
||||
int M_InOut_ID = 100;
|
||||
int M_InOutLine_ID = 100;
|
||||
//
|
||||
MMatchInv.get(ctx, M_InOutLine_ID, C_InvoiceLine_ID, trxName);
|
||||
MMatchInv.getInvoice(ctx, C_Invoice_ID, trxName);
|
||||
MMatchInv.getInvoiceLine(ctx, C_InvoiceLine_ID, trxName);
|
||||
MMatchInv.getInOut(ctx, M_InOut_ID, trxName);
|
||||
MMatchInv.getInOutLine(ctx, M_InOutLine_ID, trxName);
|
||||
}
|
||||
}
|
|
@ -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.MMediaServer;
|
||||
import org.compiere.model.MWebProject;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 borrowed from MInvoiceTest
|
||||
*/
|
||||
public class MMediaServerTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MWebProject m_project = new MWebProject(getCtx(),102,getTrxName());
|
||||
MMediaServer[] mserver = MMediaServer.getMediaServer(m_project);
|
||||
assertTrue("MediaServer must have values", mserver.length > 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +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.MMenu;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 borrows from MInvoiceTest
|
||||
*/
|
||||
public class MMenuTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MMenu[] menus = MMenu.get(getCtx(), "AD_Menu_ID=100",null); //red1 tested with null and IsActive - no failures
|
||||
assertTrue("atrributes must have values", menus.length > 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +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.MPInstance;
|
||||
import org.compiere.model.MPInstancePara;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro
|
||||
*/
|
||||
public class MPInstanceTest extends AdempiereTestCase
|
||||
{
|
||||
private MPInstance lines = null;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
lines = new MPInstance(getCtx(), 1000000, getTrxName());
|
||||
MPInstancePara[] params = lines.getParameters();
|
||||
assertTrue("There should be params", params.length > 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +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.MPaySelection;
|
||||
import org.compiere.model.MPaySelectionLine;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro
|
||||
*/
|
||||
public class MPaySelectionTest extends AdempiereTestCase
|
||||
{
|
||||
private MPaySelection lines = null;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
lines = new MPaySelection(getCtx(), 100, getTrxName());
|
||||
MPaySelectionLine[] payselection = lines.getLines(true);
|
||||
assertTrue("There should be payment lines", payselection.length > 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +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.MPayment;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro // copied by red1 from MInvoiceTest
|
||||
*/
|
||||
public class MPaymentTest extends AdempiereTestCase
|
||||
{
|
||||
public static final int BPARTNER_Standard = 112;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MPayment.getOfBPartner(getCtx(), BPARTNER_Standard, getTrxName());
|
||||
|
||||
MPayment[] payments = MPayment.getOfBPartner(getCtx(), BPARTNER_Standard, getTrxName());
|
||||
assertTrue("Partner "+BPARTNER_Standard+" should have payments", payments.length > 0);
|
||||
//testquery
|
||||
}
|
||||
|
||||
}
|
|
@ -1,41 +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.MPriceListVersion;
|
||||
import org.compiere.model.MProductPrice;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro //red1 borrows from MInvoiceTest
|
||||
*/
|
||||
public class MPriceListVersionTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MPriceListVersion plv = new MPriceListVersion(getCtx(), 101, getTrxName());
|
||||
MProductPrice[] pp = plv.getProductPrice("AND isActive='Y'"); //red1 tested also with (true) and (false)
|
||||
assertTrue("product must have prices", pp.length > 0);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,58 +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.MBOM;
|
||||
import org.compiere.model.MProductBOM;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro // used by red1
|
||||
*/
|
||||
public class MProductBOMTest extends AdempiereTestCase
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MProductBOM[] lines = MProductBOM.getBOMLines(getCtx(), 145, getTrxName());
|
||||
assertTrue("ProductBOM should have lines", lines.length > 0);
|
||||
}
|
||||
private MBOM bom = null;
|
||||
|
||||
public void testBOMCreation() {
|
||||
bom = new MBOM(getCtx(), 0, getTrxName());
|
||||
// BOM load test case of qualified bom parent for testing MBOM.getOfProduct
|
||||
bom.setM_Product_ID(134);
|
||||
bom.setBOMType("A");
|
||||
bom.setName("PatioTable");
|
||||
|
||||
boolean saveResult = bom.save(); //
|
||||
assertTrue("MBOM.save()", saveResult);
|
||||
try {
|
||||
commit();
|
||||
} catch (Exception e) {
|
||||
fail(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
//MProductTest.java
|
||||
package test.functional;
|
||||
|
||||
import org.compiere.model.MProductPrice;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
public class MProductTest extends AdempiereTestCase {
|
||||
/*
|
||||
public int getProduct_Category_ID(String productCategory) {
|
||||
String sql = "select m_product_category_id from m_product_category where name = ?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
int M_ProductCategory_ID = -1;
|
||||
|
||||
try {
|
||||
pstmt = DB.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, getTrxName());
|
||||
pstmt.setString(1, productCategory.trim());
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
|
||||
while (rs.next()) {
|
||||
M_ProductCategory_ID = rs.getInt(1);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
fail(e.getLocalizedMessage());
|
||||
} finally {
|
||||
DB.close( rs, pstmt );
|
||||
}
|
||||
|
||||
return M_ProductCategory_ID;
|
||||
|
||||
}
|
||||
|
||||
public int getUOM_ID(String UOM) {
|
||||
System.out.println("In getUOM_ID");
|
||||
|
||||
String sql = "select c_uom_id from c_uom where name = ?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
int C_Uom_ID = -1;
|
||||
|
||||
try {
|
||||
pstmt = DB.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, getTrxName());
|
||||
pstmt.setString(1, UOM.trim());
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
|
||||
while (rs.next()) {
|
||||
C_Uom_ID = rs.getInt(1);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
fail(e.getLocalizedMessage());
|
||||
} finally {
|
||||
DB.close( rs, pstmt );
|
||||
}
|
||||
System.out.println("Uom: " + UOM);
|
||||
System.out.println("C_Uom_ID: " + C_Uom_ID);
|
||||
|
||||
return C_Uom_ID;
|
||||
|
||||
}
|
||||
|
||||
public void testCreateMProduct() {
|
||||
MProduct m_product = new MProduct(getCtx(), 0, getTrxName());
|
||||
m_product.setAD_Org_ID(0);
|
||||
m_product.setProductType (X_I_Product.PRODUCTTYPE_Item); // I
|
||||
m_product.setIsBOM (false); // N
|
||||
m_product.setIsInvoicePrintDetails (false);
|
||||
m_product.setIsPickListPrintDetails (false);
|
||||
m_product.setIsPurchased (true); // Y
|
||||
m_product.setIsSold (true); // Y
|
||||
m_product.setIsStocked (true); // Y
|
||||
m_product.setIsSummary (false);
|
||||
m_product.setIsVerified (false); // N
|
||||
m_product.setIsWebStoreFeatured (false);
|
||||
m_product.setIsSelfService(true);
|
||||
m_product.setIsExcludeAutoDelivery(false);
|
||||
m_product.setProcessing (false); // N
|
||||
m_product.setName("Test Product"); // N
|
||||
m_product.setC_UOM_ID(getUOM_ID("Each"));
|
||||
|
||||
boolean saveResult = m_product.saveEx();
|
||||
assertEquals("Create new product.", true, saveResult);
|
||||
}
|
||||
|
||||
public void testSetBaseInfo() {
|
||||
MProductPricing prodprice = new MProductPricing(122,100, Env.ONEHUNDRED,true);
|
||||
int uom = 0;
|
||||
uom = prodprice.getC_UOM_ID();
|
||||
assertTrue("UOM must be correct", uom == 100);
|
||||
} */
|
||||
|
||||
public void testPrice() {
|
||||
MProductPrice test = MProductPrice.get(getCtx(), 105, 124, getTrxName());
|
||||
assertTrue("Confirming Prod ID to be true", test.getM_Product_ID() == 124);
|
||||
}
|
||||
}
|
|
@ -1,55 +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.MProject;
|
||||
import org.compiere.model.MProjectIssue;
|
||||
import org.compiere.model.MProjectLine;
|
||||
import org.compiere.model.MProjectPhase;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro // used by red1
|
||||
*/
|
||||
public class MProjectTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MProject proj = new MProject(getCtx(),101,null);
|
||||
{
|
||||
//test ProjectLines
|
||||
MProjectLine[] lines = proj.getLines();
|
||||
assertTrue("There should be lines in this project", lines.length > 0);
|
||||
}
|
||||
{
|
||||
//test ProjectIssue
|
||||
MProjectIssue[] issues = proj.getIssues();
|
||||
assertTrue("There are no issues in this project", issues.length == 0);
|
||||
}
|
||||
{
|
||||
//test ProjectPhase
|
||||
MProjectPhase[] lines = proj.getPhases();
|
||||
assertTrue("There are no phases in this project", lines.length == 0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,40 +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.MRequestType;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro
|
||||
*/
|
||||
public class MRequestTypeTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MRequestType req = MRequestType.getDefault(getCtx());
|
||||
assertTrue("There should be default requesttype", req.getAD_Client_ID() == 11);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,46 +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.List;
|
||||
|
||||
import org.compiere.model.MRule;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro
|
||||
*/
|
||||
public class MRuleTest extends AdempiereTestCase
|
||||
{
|
||||
public static final int BPARTNER_TreeFarm = 114;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
MRule getrule = MRule.get(getCtx(), "beanshell:getAvailable");
|
||||
assertTrue("BeanRule must be exact", getrule.getAD_Rule_ID()==1000000);
|
||||
List<MRule> rules = MRule.getModelValidatorLoginRules(getCtx());
|
||||
assertTrue("Rules has array", rules.size() > 0); //red1 set in DB Rule.EventType = L before testing
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package test.functional;
|
||||
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MInvoice;
|
||||
import org.compiere.model.MReference;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
public class TrifonTest extends AdempiereTestCase {
|
||||
|
||||
// Test: Specific variables
|
||||
//private MProduct product = null;
|
||||
|
||||
public void testMProductCreation() {
|
||||
|
||||
MTable mTable = MTable.get(Env.getCtx(), MInvoice.Table_Name );
|
||||
System.out.println("XML presentation... is: " + mTable.get_xmlDocument(false));
|
||||
|
||||
MColumn mcolumn[] = mTable.getColumns(true);
|
||||
|
||||
for (int i = 0; i < mcolumn.length; i++) {
|
||||
|
||||
System.out.println("Name............ is: " + mcolumn[i].getName());
|
||||
System.out.println("ColumnName...... is: " + mcolumn[i].getColumnName());
|
||||
System.out.println("Desc............ is: " + mcolumn[i].getDescription());
|
||||
System.out.println("Length.......... is: " + mcolumn[i].getFieldLength());
|
||||
System.out.println("Reference_ID.... is: " + mcolumn[i].getAD_Reference_ID());
|
||||
MReference reference = new MReference(Env.getCtx(), mcolumn[i].getAD_Reference_ID(), getTrxName());
|
||||
System.out.println("ReferenceName... is: " + reference.getName());
|
||||
System.out.println("..............................");
|
||||
}
|
||||
|
||||
assertTrue(this.getClass().getName(), true);
|
||||
}
|
||||
}
|
|
@ -1,97 +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.MRequisition;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.wf.MWFActivity;
|
||||
import org.compiere.wf.MWFEventAudit;
|
||||
import org.compiere.wf.MWFNode;
|
||||
import org.compiere.wf.MWFNodeNext;
|
||||
import org.compiere.wf.MWFNodePara;
|
||||
import org.compiere.wf.MWFProcess;
|
||||
import org.compiere.wf.MWorkflow;
|
||||
import org.compiere.wf.MWorkflowProcessor;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
/**
|
||||
* Test Workflow related classes
|
||||
* @author Teo Sarca, www.arhipac.ro
|
||||
*/
|
||||
public class WorkflowTest extends AdempiereTestCase
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
assertEquals("Client is not GardenWorld", 11, Env.getAD_Client_ID(getCtx()));
|
||||
}
|
||||
|
||||
public void testQuery() throws Exception
|
||||
{
|
||||
//
|
||||
// Check MWFActivity
|
||||
int AD_Table_ID = MRequisition.Table_ID;
|
||||
int Record_ID = 1; // dummy;
|
||||
MWFActivity.get(getCtx(), AD_Table_ID, Record_ID, false);
|
||||
MWFActivity.get(getCtx(), AD_Table_ID, Record_ID, true);
|
||||
//
|
||||
// Check MWFEventAudit
|
||||
int AD_WF_Process_ID = 1; // dummy
|
||||
int AD_WF_Node_ID = 1; // dummy
|
||||
MWFEventAudit.get(getCtx(), AD_WF_Process_ID, AD_WF_Node_ID, getTrxName());
|
||||
MWFEventAudit.get(getCtx(), AD_WF_Process_ID, getTrxName());
|
||||
//
|
||||
// Check MWFProcess
|
||||
MWFProcess proc = new Query(getCtx(), MWFProcess.Table_Name, null, getTrxName())
|
||||
.setClient_ID()
|
||||
.setOrderBy(MWFProcess.COLUMNNAME_AD_WF_Process_ID)
|
||||
.first();
|
||||
if (proc != null)
|
||||
{
|
||||
proc.getActivities(true, false, getTrxName());
|
||||
proc.getActivities(true, true, getTrxName());
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: check MWFProcess - need better test
|
||||
}
|
||||
//
|
||||
// Check MWorkflow, MWFNode, MWFNodeNext etc
|
||||
int AD_Client_ID = getAD_Client_ID();
|
||||
int AD_Workflow_ID = 115; // Process_Requisition
|
||||
MWorkflow wf = MWorkflow.get(getCtx(), AD_Workflow_ID);
|
||||
for (MWFNode node : wf.getNodes(false, AD_Client_ID))
|
||||
{
|
||||
MWFNodePara.getParameters(node.getCtx(), node.getAD_WF_Node_ID());
|
||||
|
||||
for (MWFNodeNext next : node.getTransitions(AD_Client_ID))
|
||||
{
|
||||
next.getConditions(true);
|
||||
next.getConditions(false);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Check MWorkflowProcessor
|
||||
for (MWorkflowProcessor processor : MWorkflowProcessor.getActive(getCtx()))
|
||||
{
|
||||
processor.getLogs();
|
||||
}
|
||||
//
|
||||
//
|
||||
}
|
||||
}
|
|
@ -1,191 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2009 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.inventory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.supercsv.io.CsvListReader;
|
||||
import org.supercsv.io.ICsvListReader;
|
||||
import org.supercsv.prefs.CsvPreference;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro
|
||||
*/
|
||||
public class CSVFactory
|
||||
{
|
||||
public static final DateFormat s_dateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||
|
||||
private ICsvListReader reader;
|
||||
|
||||
public Collection<MMScenario> read(InputStream in) throws Exception
|
||||
{
|
||||
ArrayList<MMScenario> tests = new ArrayList<MMScenario>();
|
||||
//
|
||||
reader = new CsvListReader(new InputStreamReader(in), CsvPreference.STANDARD_PREFERENCE);
|
||||
String[] header = getCSVHeader();
|
||||
//
|
||||
List<String> line;
|
||||
int last_lineNo = -1;
|
||||
MMScenario scenario = null;
|
||||
try
|
||||
{
|
||||
while ( (line = reader.read()) != null)
|
||||
{
|
||||
if (last_lineNo == -1 || last_lineNo + 1 < reader.getLineNumber())
|
||||
{
|
||||
if (scenario != null)
|
||||
{
|
||||
tests.add(scenario);
|
||||
}
|
||||
scenario = new MMScenario("junit-test-line_"+(new DecimalFormat("000").format(reader.getLineNumber())));
|
||||
}
|
||||
readDocument(scenario, header, line);
|
||||
last_lineNo = reader.getLineNumber();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException("Error on line "+reader.getLineNumber()+": "+e.getLocalizedMessage(), e);
|
||||
}
|
||||
if (scenario != null)
|
||||
{
|
||||
tests.add(scenario);
|
||||
}
|
||||
//
|
||||
return tests;
|
||||
}
|
||||
|
||||
private String[] getCSVHeader() throws IOException
|
||||
{
|
||||
String[] header = reader.getHeader(true);
|
||||
for (int i = 0; i < header.length; i++)
|
||||
{
|
||||
header[i] = header[i].trim().replaceAll("\\s", "");
|
||||
}
|
||||
return header;
|
||||
}
|
||||
|
||||
private void readDocument(MMScenario scenario, String[] header, List<String> line)
|
||||
{
|
||||
MMDocument doc = new MMDocument(scenario);
|
||||
doc.csvLineNo = reader.getLineNumber();
|
||||
doc.DocBaseType = getValue("DocType", String.class, header, line);
|
||||
doc.DocumentNo = getValue("DocumentNo", String.class, header, line);
|
||||
doc.LocatorValue = getValue("LocatorValue", String.class, header, line);
|
||||
doc.LocatorValueTo = getValue("LocatorValueTo", String.class, header, line);
|
||||
doc.ProductValue = getValue("ProductValue", String.class, header, line);
|
||||
doc.Price = getValue("Price", BigDecimal.class, header, line);
|
||||
doc.Qty = getValue("Qty", BigDecimal.class, header, line);
|
||||
doc.QtyOrdered = getValue("QtyOrdered", BigDecimal.class, header, line);
|
||||
doc.QtyReserved = getValue("QtyReserved", BigDecimal.class, header, line);
|
||||
doc.ASI = getValue("ASI", String.class, header, line);
|
||||
doc.Date = getValue("MovementDate", Timestamp.class, header, line);
|
||||
doc.PODocumentNo = getValue("PODocumentNo", String.class, header, line);
|
||||
doc.IsReversal = getValue("IsReversal", Boolean.class, header, line);
|
||||
scenario.docs.add(doc);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: refactor
|
||||
* @param <T>
|
||||
* @param name
|
||||
* @param clazz
|
||||
* @param headers
|
||||
* @param values
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T getValue(String name, Class<T> clazz, String[] headers, List<String> values)
|
||||
{
|
||||
String value = null;
|
||||
for (int i = 0; i < headers.length; i++)
|
||||
{
|
||||
if (name.equalsIgnoreCase(headers[i]))
|
||||
{
|
||||
if (values.size() > i)
|
||||
{
|
||||
value = values.get(i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (value != null && value.trim().length() == 0)
|
||||
{
|
||||
value = null;
|
||||
}
|
||||
//
|
||||
if (String.class == clazz)
|
||||
{
|
||||
return (T)value;
|
||||
}
|
||||
else if (BigDecimal.class == clazz)
|
||||
{
|
||||
if (value == null)
|
||||
return (T)BigDecimal.ZERO;
|
||||
else
|
||||
return (T)new BigDecimal(value);
|
||||
}
|
||||
else if (Integer.class == clazz)
|
||||
{
|
||||
if (value == null)
|
||||
return (T)Integer.valueOf(0);
|
||||
else
|
||||
return (T)((Integer)Integer.parseInt(value));
|
||||
}
|
||||
else if (Timestamp.class == clazz)
|
||||
{
|
||||
if (value == null)
|
||||
return null;
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
Date date = s_dateFormat.parse(value);
|
||||
return (T)new Timestamp(date.getTime());
|
||||
}
|
||||
catch(ParseException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Boolean.class == clazz)
|
||||
{
|
||||
if (value == null)
|
||||
return (T)Boolean.FALSE;
|
||||
else if ("Y".equals(value))
|
||||
return (T)Boolean.TRUE;
|
||||
else if ("N".equals(value))
|
||||
return (T)Boolean.FALSE;
|
||||
else
|
||||
throw new IllegalStateException("Invalid boolean value '"+value+"'");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("clazz not supported - "+clazz);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,273 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2009 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.inventory;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.exceptions.DBException;
|
||||
import org.compiere.model.MDocType;
|
||||
import org.compiere.model.MLocator;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.process.DocAction;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Trx;
|
||||
import org.compiere.util.TrxRunnable;
|
||||
import org.compiere.util.Util;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
|
||||
/**
|
||||
* Run Inventory Tests
|
||||
* @author Teo Sarca, www.arhipac.ro
|
||||
*/
|
||||
public class InventoryTest extends AdempiereTestCase
|
||||
{
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
Env.setContext(Env.getCtx(), "$C_Currency_ID", 346);
|
||||
|
||||
// MLocator locator = InventoryUtil.getCreateLocator(-1, "junit-wh1", "l1");
|
||||
Env.setContext(Env.getCtx(), "#M_Warehouse_ID", -1);
|
||||
|
||||
Env.setContext(Env.getCtx(), "#PO_PriceList_ID",
|
||||
InventoryUtil.getCreatePriceList("junit-PO", false).get_ID());
|
||||
Env.setContext(Env.getCtx(), "#SO_PriceList_ID",
|
||||
InventoryUtil.getCreatePriceList("junit-SO", true).get_ID());
|
||||
}
|
||||
|
||||
public void test01() throws Exception
|
||||
{
|
||||
InputStream in;
|
||||
if (System.getProperty("TestFile") != null)
|
||||
{
|
||||
in = new FileInputStream(System.getProperty("TestFile"));
|
||||
}
|
||||
else //if (System.getProperty("UseArhipacURL") != null)
|
||||
{
|
||||
String url = "http://spreadsheets.google.com/pub?key=p_F3GDtQxWTA9YbH8MRkyKA&output=csv&gid=0";
|
||||
in = new URL(url).openStream();
|
||||
}
|
||||
//
|
||||
CSVFactory factory = new CSVFactory();
|
||||
Collection<MMScenario> tests = factory.read(in);
|
||||
String trxName = getTrxName();
|
||||
//
|
||||
for (MMScenario scenario : tests)
|
||||
{
|
||||
// Uncomment below line only if you want to run only one test!
|
||||
//if ("junit-test-line_053".compareTo(scenario.name) <= 0)
|
||||
runMMScenario(scenario, trxName);
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
private void runMMScenario(MMScenario scenario, String trxName)
|
||||
{
|
||||
scenario.key = ""+System.currentTimeMillis();
|
||||
for (MMDocument doc : scenario.docs)
|
||||
{
|
||||
boolean ok = false;
|
||||
try
|
||||
{
|
||||
createDocument(doc, trxName);
|
||||
ok = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
InventoryTestException ie = (e instanceof InventoryTestException ? (InventoryTestException)e : new InventoryTestException(e));
|
||||
ie.scenario = scenario;
|
||||
ie.document = doc;
|
||||
throw ie;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!ok)
|
||||
{
|
||||
dumpStatus(doc, trxName);
|
||||
try
|
||||
{
|
||||
commit();
|
||||
}
|
||||
catch (Exception e){}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createDocument(final MMDocument doc, String trxName)
|
||||
{
|
||||
Trx.run(trxName, new TrxRunnable(){
|
||||
//@Override
|
||||
public void run(String trxName) {
|
||||
if (doc.IsReversal)
|
||||
{
|
||||
MMDocument docOrig = doc.scenario.get(doc.DocBaseType, doc.DocumentNo);
|
||||
doc.ProductValue = docOrig.ProductValue;
|
||||
doc.LocatorValue = docOrig.LocatorValue;
|
||||
doc.LocatorValueTo = docOrig.LocatorValueTo;
|
||||
InventoryUtil.processDocument(docOrig, DocAction.ACTION_Reverse_Correct, DocAction.STATUS_Reversed);
|
||||
return;
|
||||
}
|
||||
|
||||
if (doc.ProductValue == null)
|
||||
throw new RuntimeException("ProductValue is null");
|
||||
doc.ProductValue = "junit-"+doc.ProductValue+"-"+doc.scenario.key;
|
||||
|
||||
// Check document No conflict
|
||||
if (doc.scenario.get(doc.DocBaseType, doc.DocumentNo) != null)
|
||||
{
|
||||
throw new AdempiereException("DocumentNo conflict - "+doc.DocumentNo);
|
||||
}
|
||||
|
||||
if (MDocType.DOCBASETYPE_PurchaseOrder.equals(doc.DocBaseType)
|
||||
|| MDocType.DOCBASETYPE_SalesOrder.equals(doc.DocBaseType) )
|
||||
{
|
||||
InventoryUtil.createOrder(doc, trxName);
|
||||
}
|
||||
else if (MDocType.DOCBASETYPE_MaterialReceipt.equals(doc.DocBaseType)
|
||||
|| MDocType.DOCBASETYPE_MaterialDelivery.equals(doc.DocBaseType) )
|
||||
{
|
||||
InventoryUtil.createInOut(doc, trxName);
|
||||
}
|
||||
else if (MDocType.DOCBASETYPE_MaterialMovement.equals(doc.DocBaseType))
|
||||
{
|
||||
InventoryUtil.createMovement(doc, trxName);
|
||||
}
|
||||
else if (MDocType.DOCBASETYPE_MaterialPhysicalInventory.equals(doc.DocBaseType))
|
||||
{
|
||||
InventoryUtil.createInventory(doc, trxName);
|
||||
}
|
||||
else if ("TST".equals(doc.DocBaseType))
|
||||
{
|
||||
assertStorage(doc, trxName);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AdempiereException("DocBaseType not supported for "+doc);
|
||||
}
|
||||
}});
|
||||
}
|
||||
|
||||
private void assertStorage(MMDocument doc, String trxName)
|
||||
{
|
||||
MLocator locator = InventoryUtil.getCreateLocator(-1, doc.LocatorValue, doc.LocatorValue);
|
||||
MProduct product = InventoryUtil.getCreateProduct(doc.ProductValue, null);
|
||||
int M_ASI_ID = -1;
|
||||
if (!Util.isEmpty(doc.ASI, true))
|
||||
{
|
||||
M_ASI_ID = doc.scenario.getM_ASI_ID(doc.ASI);
|
||||
}
|
||||
ArrayList<Object> params = new ArrayList<Object>();
|
||||
String sql = "SELECT"
|
||||
+" COALESCE(SUM(QtyOnHand),0)"
|
||||
+" FROM M_StorageOnHand"
|
||||
+" WHERE M_Locator_ID=? AND M_Product_ID=?";
|
||||
params.add(locator.get_ID());
|
||||
params.add(product.get_ID());
|
||||
if (M_ASI_ID >= 0)
|
||||
{
|
||||
sql += " AND "+MStorageOnHand.COLUMNNAME_M_AttributeSetInstance_ID+"=?";
|
||||
params.add(M_ASI_ID);
|
||||
}
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
BigDecimal qtyOnHand = Env.ZERO;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, trxName);
|
||||
DB.setParameters(pstmt, params);
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
qtyOnHand = rs.getBigDecimal(1);
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
throw new DBException(e, sql);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
//
|
||||
//
|
||||
assertEquals("QtyOnHand not match "+doc, doc.Qty, qtyOnHand);
|
||||
|
||||
}
|
||||
|
||||
private void dumpStatus(MMDocument doc, String trxName)
|
||||
{
|
||||
MProduct product = InventoryUtil.getCreateProduct(doc.ProductValue, null);
|
||||
MStorageOnHand[] storage = MStorageOnHand.getOfProduct(getCtx(), product.get_ID(), trxName);
|
||||
|
||||
System.err.println("STORAGE____________________________________________________");
|
||||
System.err.println(" "+doc);
|
||||
for (MStorageOnHand s : storage)
|
||||
{
|
||||
System.err.println(""+s);
|
||||
}
|
||||
//
|
||||
System.err.println(doc.scenario.toString());
|
||||
//
|
||||
System.err.println("___________________________________________________________");
|
||||
System.err.flush();
|
||||
System.err.flush();
|
||||
}
|
||||
}
|
||||
|
||||
class InventoryTestException extends RuntimeException
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8354291934731598998L;
|
||||
public MMScenario scenario = null;
|
||||
public MMDocument document = null;
|
||||
|
||||
public InventoryTestException(Exception e)
|
||||
{
|
||||
super(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
String retValue = "";
|
||||
|
||||
retValue = super.getMessage()
|
||||
+ "\n document=" + this.document
|
||||
+ "\n scenario=" + this.scenario
|
||||
;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,506 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2009 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.inventory;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.compiere.model.I_C_BPartner;
|
||||
import org.compiere.model.I_M_Product;
|
||||
import org.compiere.model.I_M_Product_Category;
|
||||
import org.compiere.model.I_M_Warehouse;
|
||||
import org.compiere.model.MBPGroup;
|
||||
import org.compiere.model.MBPartner;
|
||||
import org.compiere.model.MBPartnerLocation;
|
||||
import org.compiere.model.MCharge;
|
||||
import org.compiere.model.MDocType;
|
||||
import org.compiere.model.MInOut;
|
||||
import org.compiere.model.MInOutLine;
|
||||
import org.compiere.model.MInventory;
|
||||
import org.compiere.model.MInventoryLine;
|
||||
import org.compiere.model.MLocation;
|
||||
import org.compiere.model.MLocator;
|
||||
import org.compiere.model.MMovement;
|
||||
import org.compiere.model.MMovementLine;
|
||||
import org.compiere.model.MOrder;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MPriceList;
|
||||
import org.compiere.model.MPriceListVersion;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MProductCategory;
|
||||
import org.compiere.model.MProductPrice;
|
||||
import org.compiere.model.MTaxCategory;
|
||||
import org.compiere.model.MWarehouse;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.process.DocAction;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.TimeUtil;
|
||||
import org.compiere.util.Util;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro
|
||||
*/
|
||||
public final class InventoryUtil
|
||||
{
|
||||
public static MProduct getCreateProduct(String value, String MMPolicy)
|
||||
{
|
||||
Properties ctx = Env.getCtx();
|
||||
MProduct product = new Query(ctx, I_M_Product.Table_Name, "Value=?", null)
|
||||
.setParameters(value)
|
||||
.setOnlyActiveRecords(true)
|
||||
.setClient_ID()
|
||||
.firstOnly();
|
||||
if (product == null)
|
||||
{
|
||||
product = new MProduct(ctx, 0, null);
|
||||
}
|
||||
product.setValue(value);
|
||||
product.setName(value);
|
||||
setGeneratedTag(product);
|
||||
product.setProductType(MProduct.PRODUCTTYPE_Item);
|
||||
product.setIsStocked(true);
|
||||
product.setC_UOM_ID(100); // Each
|
||||
product.setC_TaxCategory_ID(getDefault_TaxCategory_ID());
|
||||
product.setM_Product_Category_ID(getCreateProductCategory(value, MMPolicy).get_ID());
|
||||
product.saveEx();
|
||||
//
|
||||
getCreateProductPrice("#PO_PriceList_ID", product.get_ID(), 10);
|
||||
getCreateProductPrice("#SO_PriceList_ID", product.get_ID(), 20);
|
||||
//
|
||||
return product;
|
||||
}
|
||||
|
||||
public static MProductPrice getCreateProductPrice (String ctxPriceList, int M_Product_ID, int price)
|
||||
{
|
||||
Properties ctx = Env.getCtx();
|
||||
int M_PriceList_ID = Env.getContextAsInt(ctx, ctxPriceList);
|
||||
MPriceList pl = MPriceList.get(ctx, M_PriceList_ID, null);
|
||||
MPriceListVersion plv = pl.getPriceListVersion(null);
|
||||
//
|
||||
BigDecimal priceBD = BigDecimal.valueOf(price);
|
||||
MProductPrice pp = MProductPrice.get(ctx, plv.get_ID(), M_Product_ID, null);
|
||||
if (pp == null)
|
||||
{
|
||||
pp = new MProductPrice(plv, M_Product_ID, priceBD, priceBD, priceBD);
|
||||
}
|
||||
pp.setPrices(priceBD, priceBD, priceBD);
|
||||
pp.saveEx();
|
||||
return pp;
|
||||
}
|
||||
|
||||
public static MProductCategory getCreateProductCategory(String value, String MMPolicy)
|
||||
{
|
||||
if (MMPolicy == null)
|
||||
MMPolicy = MProductCategory.MMPOLICY_FiFo;
|
||||
Properties ctx = Env.getCtx();
|
||||
final String whereClause = I_M_Product_Category.COLUMNNAME_Value+"=?";
|
||||
MProductCategory pc = new Query(ctx, I_M_Product_Category.Table_Name, whereClause, null)
|
||||
.setParameters(value)
|
||||
.setOnlyActiveRecords(true)
|
||||
.setClient_ID()
|
||||
.firstOnly();
|
||||
if (pc == null)
|
||||
{
|
||||
pc = new MProductCategory(ctx, 0, null);
|
||||
}
|
||||
pc.setValue(value);
|
||||
pc.setName(value);
|
||||
setGeneratedTag(pc);
|
||||
pc.setMMPolicy(MMPolicy);
|
||||
//
|
||||
pc.saveEx();
|
||||
return pc;
|
||||
}
|
||||
|
||||
public static int getDefault_TaxCategory_ID()
|
||||
{
|
||||
Properties ctx = Env.getCtx();
|
||||
MTaxCategory taxCategory = new Query(ctx, MTaxCategory.Table_Name, "IsDefault='Y'", null)
|
||||
.setClient_ID()
|
||||
.setOnlyActiveRecords(true)
|
||||
.firstOnly();
|
||||
return taxCategory != null ? taxCategory.get_ID() : 0;
|
||||
}
|
||||
|
||||
public static MBPartner getCreatePartner(String value)
|
||||
{
|
||||
Properties ctx = Env.getCtx();
|
||||
final String whereClause = MBPartner.COLUMNNAME_Value+"=?";
|
||||
MBPartner bp = new Query(ctx, I_C_BPartner.Table_Name, whereClause, null)
|
||||
.setParameters(value)
|
||||
.setClient_ID()
|
||||
.firstOnly();
|
||||
if (bp == null)
|
||||
{
|
||||
bp = new MBPartner(ctx, 0, null);
|
||||
}
|
||||
bp.setValue(value);
|
||||
bp.setName(value);
|
||||
setGeneratedTag(bp);
|
||||
bp.setIsCustomer(true);
|
||||
bp.setIsVendor(true);
|
||||
bp.setC_BP_Group_ID(MBPGroup.getDefault(ctx).get_ID());
|
||||
bp.saveEx();
|
||||
//
|
||||
if (bp.getLocations(false).length == 0)
|
||||
{
|
||||
MLocation loc = new MLocation(ctx, 0, null);
|
||||
loc.saveEx();
|
||||
//
|
||||
MBPartnerLocation bpl = new MBPartnerLocation(bp);
|
||||
bpl.setC_Location_ID(loc.get_ID());
|
||||
bpl.saveEx();
|
||||
}
|
||||
return bp;
|
||||
}
|
||||
|
||||
public static MOrder createOrder(MMDocument doc, String trxName)
|
||||
{
|
||||
Properties ctx = Env.getCtx();
|
||||
int M_PriceList_ID;
|
||||
boolean isSOTrx;
|
||||
if (MDocType.DOCBASETYPE_SalesOrder.equals(doc.DocBaseType))
|
||||
{
|
||||
M_PriceList_ID = Env.getContextAsInt(ctx, "SO_PriceList_ID");
|
||||
isSOTrx = true;
|
||||
}
|
||||
else if (MDocType.DOCBASETYPE_PurchaseOrder.equals(doc.DocBaseType))
|
||||
{
|
||||
M_PriceList_ID = Env.getContextAsInt(ctx, "PO_PriceList_ID");
|
||||
isSOTrx = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("DocBaseType not supported - "+doc);
|
||||
}
|
||||
//
|
||||
int AD_Org_ID = getFirst_Org_ID();
|
||||
MLocator locator = getCreateLocator(AD_Org_ID, doc.LocatorValue, doc.LocatorValue);
|
||||
//
|
||||
MOrder order = new MOrder(ctx, 0, trxName);
|
||||
order.setAD_Org_ID(AD_Org_ID);
|
||||
order.setIsSOTrx(isSOTrx);
|
||||
order.setC_DocTypeTarget_ID();
|
||||
order.setDateOrdered(doc.Date);
|
||||
order.setDateAcct(doc.Date);
|
||||
order.setDatePromised(doc.Date);
|
||||
order.setBPartner(getCreatePartner(doc.BPValue));
|
||||
order.setM_PriceList_ID(M_PriceList_ID);
|
||||
order.setM_Warehouse_ID(locator.getM_Warehouse_ID());
|
||||
setGeneratedTag(order);
|
||||
order.saveEx();
|
||||
//
|
||||
MProduct product = getCreateProduct(doc.ProductValue, null);
|
||||
MOrderLine line = new MOrderLine(order);
|
||||
line.setProduct(product);
|
||||
line.setQty(doc.Qty);
|
||||
line.saveEx();
|
||||
//
|
||||
doc.document = order;
|
||||
processDocument(doc, MOrder.DOCACTION_Complete, MOrder.DOCSTATUS_Completed);
|
||||
return order;
|
||||
}
|
||||
|
||||
public static MInOut createInOut(MMDocument doc, String trxName)
|
||||
{
|
||||
MOrder order;
|
||||
if (MDocType.DOCBASETYPE_MaterialReceipt.equals(doc.DocBaseType))
|
||||
{
|
||||
order = (MOrder)doc.scenario.get(MDocType.DOCBASETYPE_PurchaseOrder, doc.PODocumentNo).document;
|
||||
}
|
||||
else if (MDocType.DOCBASETYPE_MaterialDelivery.equals(doc.DocBaseType))
|
||||
{
|
||||
order = (MOrder)doc.scenario.get(MDocType.DOCBASETYPE_SalesOrder, doc.PODocumentNo).document;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("DocBaseType not supported - "+doc);
|
||||
}
|
||||
|
||||
// if (trxName != null && trxName.equals(order.get_TrxName()))
|
||||
// throw new AdempiereException("Internal exception - not same trxName");
|
||||
|
||||
MInOut io = new MInOut(order, 0, doc.Date);
|
||||
setGeneratedTag(io);
|
||||
io.saveEx();
|
||||
//
|
||||
MInOutLine iol = null;
|
||||
for (MOrderLine oline : order.getLines(true, null))
|
||||
{
|
||||
iol = new MInOutLine(io);
|
||||
iol.setOrderLine(oline, 0, doc.Qty);
|
||||
iol.setQty(doc.Qty);
|
||||
iol.saveEx();
|
||||
break;
|
||||
}
|
||||
//
|
||||
doc.document = io;
|
||||
processDocument(doc, MInOut.DOCACTION_Complete, MInOut.DOCSTATUS_Completed);
|
||||
|
||||
if (!Util.isEmpty(doc.ASI))
|
||||
{
|
||||
iol.load(trxName);
|
||||
doc.scenario.registerASICode(doc.ASI, iol.getM_AttributeSetInstance_ID(), !io.isSOTrx());
|
||||
}
|
||||
|
||||
return io;
|
||||
}
|
||||
|
||||
public static MMovement createMovement(MMDocument doc, String trxName)
|
||||
{
|
||||
Properties ctx = Env.getCtx();
|
||||
int AD_Org_ID = getFirst_Org_ID();
|
||||
MProduct product = getCreateProduct(doc.ProductValue, null);
|
||||
MLocator locator = getCreateLocator(AD_Org_ID, doc.LocatorValue, doc.LocatorValue);
|
||||
MLocator locatorTo = getCreateLocator(AD_Org_ID, doc.LocatorValueTo, doc.LocatorValueTo);
|
||||
//
|
||||
MMovement m = new MMovement(ctx, 0, trxName);
|
||||
m.setAD_Org_ID(AD_Org_ID);
|
||||
m.setMovementDate(doc.Date);
|
||||
m.saveEx();
|
||||
//
|
||||
MMovementLine line = new MMovementLine(m);
|
||||
line.setM_Product_ID(product.get_ID());
|
||||
line.setM_Locator_ID(locator.get_ID());
|
||||
line.setM_LocatorTo_ID(locatorTo.get_ID());
|
||||
line.setMovementQty(doc.Qty);
|
||||
line.saveEx();
|
||||
//
|
||||
doc.document = m;
|
||||
processDocument(doc, MMovement.DOCACTION_Complete, MMovement.DOCSTATUS_Completed);
|
||||
return m;
|
||||
}
|
||||
|
||||
public static MInventory createInventory(MMDocument doc, String trxName)
|
||||
{
|
||||
Properties ctx = Env.getCtx();
|
||||
int AD_Org_ID = getFirst_Org_ID();
|
||||
MProduct product = getCreateProduct(doc.ProductValue, null);
|
||||
MLocator locator = getCreateLocator(AD_Org_ID, doc.LocatorValue, doc.LocatorValue);
|
||||
//
|
||||
MInventory inv = new MInventory(ctx, 0, trxName);
|
||||
inv.setAD_Org_ID(AD_Org_ID);
|
||||
//inv.setIsInternalUseInventory(true);
|
||||
inv.setMovementDate(doc.Date);
|
||||
inv.setM_Warehouse_ID(locator.getM_Warehouse_ID());
|
||||
setGeneratedTag(inv);
|
||||
inv.saveEx();
|
||||
//
|
||||
MInventoryLine line = new MInventoryLine(inv,
|
||||
locator.get_ID(), product.get_ID(), 0,
|
||||
null, null);
|
||||
line.setQtyInternalUse(doc.Qty);
|
||||
line.setC_Charge_ID(getCreateCharge("junit-charge").get_ID());
|
||||
line.saveEx();
|
||||
//
|
||||
doc.document = inv;
|
||||
processDocument(doc, MInventory.DOCACTION_Complete, MInventory.DOCSTATUS_Completed);
|
||||
|
||||
if (!Util.isEmpty(doc.ASI))
|
||||
{
|
||||
line.load(trxName);
|
||||
doc.scenario.registerASICode(doc.ASI, line.getM_AttributeSetInstance_ID(), line.getQtyInternalUse().signum() <= 0);
|
||||
}
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static int getFirst_Org_ID()
|
||||
{
|
||||
int AD_Org_ID = Env.getAD_Org_ID(Env.getCtx());
|
||||
if (AD_Org_ID > 0)
|
||||
return AD_Org_ID;
|
||||
String sql = "SELECT MIN(AD_Org_ID) FROM AD_Org WHERE AD_Client_ID=?";
|
||||
return DB.getSQLValueEx(null, sql, Env.getAD_Client_ID(Env.getCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper Method : Create Warehouse
|
||||
*/
|
||||
public static MWarehouse getCreateWarehouse(int AD_Org_ID, String value)
|
||||
{
|
||||
if (AD_Org_ID <= 0)
|
||||
AD_Org_ID = getFirst_Org_ID();
|
||||
Properties ctx = Env.getCtx();
|
||||
final String whereClause = "AD_Org_ID=? AND Value=?";
|
||||
MWarehouse wh = new Query(ctx, I_M_Warehouse.Table_Name, whereClause, null)
|
||||
.setParameters(AD_Org_ID, value)
|
||||
.setClient_ID()
|
||||
.firstOnly();
|
||||
if (wh != null)
|
||||
return wh;
|
||||
wh = new MWarehouse(ctx, 0, null);
|
||||
wh.setAD_Org_ID(AD_Org_ID);
|
||||
wh.setValue(value);
|
||||
wh.setName(value);
|
||||
|
||||
MLocation loc = new MLocation(ctx, 0, null);
|
||||
loc.saveEx();
|
||||
wh.setC_Location_ID(loc.get_ID());
|
||||
wh.saveEx();
|
||||
return wh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper Method : Create Locator
|
||||
*/
|
||||
public static MLocator getCreateLocator(int AD_Org_ID, String whValue, String value)
|
||||
{
|
||||
if (AD_Org_ID <= 0)
|
||||
AD_Org_ID = getFirst_Org_ID();
|
||||
MWarehouse wh = getCreateWarehouse(AD_Org_ID, whValue);
|
||||
MLocator locator = null;
|
||||
for (MLocator loc : wh.getLocators(false))
|
||||
{
|
||||
if (loc.getValue().equals(value))
|
||||
{
|
||||
locator = loc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (locator == null)
|
||||
{
|
||||
locator = new MLocator(wh, value);
|
||||
locator.setXYZ(value, value, value);
|
||||
}
|
||||
if (wh.getLocators(false).length == 0)
|
||||
{
|
||||
locator.setIsDefault(true);
|
||||
}
|
||||
locator.saveEx();
|
||||
//
|
||||
return locator;
|
||||
}
|
||||
|
||||
public static MPriceList getCreatePriceList(String value, boolean IsSOPriceList)
|
||||
{
|
||||
Properties ctx = Env.getCtx();
|
||||
int C_Currency_ID = Env.getContextAsInt(ctx, "$C_Currency_ID");
|
||||
String whereClause = MPriceList.COLUMNNAME_Name+"=?"
|
||||
+" AND "+MPriceList.COLUMNNAME_IsSOPriceList+"=?"
|
||||
+" AND "+MPriceList.COLUMNNAME_C_Currency_ID+"=?";
|
||||
MPriceList pl = new Query(ctx, MPriceList.Table_Name, whereClause, null)
|
||||
.setParameters(new Object[]{value, IsSOPriceList, C_Currency_ID})
|
||||
.setClient_ID()
|
||||
.setOnlyActiveRecords(true)
|
||||
.firstOnly();
|
||||
if (pl == null)
|
||||
{
|
||||
pl = new MPriceList(ctx, 0, null);
|
||||
pl.setName(value);
|
||||
pl.setIsSOPriceList(IsSOPriceList);
|
||||
pl.setC_Currency_ID(C_Currency_ID);
|
||||
}
|
||||
setGeneratedTag(pl);
|
||||
pl.setIsTaxIncluded(false);
|
||||
pl.saveEx();
|
||||
//
|
||||
Timestamp ValidFrom = TimeUtil.getDay(1970, 1, 1);
|
||||
MPriceListVersion plv = pl.getPriceListVersion(ValidFrom);
|
||||
if (plv == null)
|
||||
{
|
||||
plv = new MPriceListVersion(pl);
|
||||
plv.setValidFrom(ValidFrom);
|
||||
plv.setM_DiscountSchema_ID(getM_DiscountSchema_ID());
|
||||
setGeneratedTag(plv);
|
||||
plv.saveEx();
|
||||
}
|
||||
//
|
||||
return pl;
|
||||
}
|
||||
public static int getM_DiscountSchema_ID()
|
||||
{
|
||||
Properties ctx = Env.getCtx();
|
||||
int AD_Client_ID = Env.getAD_Client_ID(ctx);
|
||||
final String sql = "SELECT MIN(M_DiscountSchema_ID) FROM M_DiscountSchema" +
|
||||
" WHERE AD_Client_ID=?";
|
||||
return DB.getSQLValueEx(null, sql, AD_Client_ID);
|
||||
|
||||
}
|
||||
|
||||
public static void setGeneratedTag(PO po)
|
||||
{
|
||||
String desc = "Generated by "+InventoryUtil.class
|
||||
+" on "+new Timestamp(System.currentTimeMillis());
|
||||
po.set_ValueOfColumn("Description", desc);
|
||||
}
|
||||
|
||||
public static void processDocument(MMDocument doc,
|
||||
String docAction, String targetDocStatus)
|
||||
{
|
||||
PO po = (PO)doc.document;
|
||||
// po.saveEx();
|
||||
po.load(po.get_TrxName());
|
||||
po.set_ValueOfColumn("DocAction", docAction);
|
||||
//
|
||||
try
|
||||
{
|
||||
if (!doc.document.processIt(docAction))
|
||||
throw new AdempiereException(doc.document.getProcessMsg());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw (e instanceof AdempiereException ? (AdempiereException)e : new AdempiereException(e));
|
||||
}
|
||||
po.saveEx();
|
||||
//
|
||||
// Check DocSatus
|
||||
if (targetDocStatus != null && !targetDocStatus.equals(doc.document.getDocStatus()))
|
||||
{
|
||||
throw new AdempiereException("Doc process error "+doc
|
||||
+" (TargetDocStatus="+targetDocStatus
|
||||
+", DocStatus="+doc.document.getDocStatus()
|
||||
+")");
|
||||
}
|
||||
//
|
||||
// Is Completed ?
|
||||
if (DocAction.STATUS_Completed.equals(doc.document.getDocStatus()))
|
||||
{
|
||||
// Track ASI:
|
||||
if (!Util.isEmpty(doc.ASI))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static MCharge getCreateCharge(String value)
|
||||
{
|
||||
Properties ctx = Env.getCtx();
|
||||
String whereClause = MCharge.COLUMNNAME_Name+"=?";
|
||||
MCharge charge = new Query(ctx, MCharge.Table_Name, whereClause, null)
|
||||
.setParameters(new Object[]{value})
|
||||
.setOnlyActiveRecords(true)
|
||||
.setClient_ID()
|
||||
.firstOnly();
|
||||
if (charge == null)
|
||||
{
|
||||
charge = new MCharge(ctx, 0, null);
|
||||
charge.setName(value);
|
||||
setGeneratedTag(charge);
|
||||
charge.saveEx();
|
||||
}
|
||||
return charge;
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2009 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.inventory;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import org.compiere.process.DocAction;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro
|
||||
*/
|
||||
public class MMDocument
|
||||
{
|
||||
public final MMScenario scenario;
|
||||
|
||||
public int csvLineNo = -1;
|
||||
public String DocBaseType;
|
||||
public String DocumentNo;
|
||||
public String BPValue = "junit-test-bp01";
|
||||
public String LocatorValue;
|
||||
public String LocatorValueTo;
|
||||
public String ProductValue;
|
||||
public BigDecimal Price;
|
||||
public BigDecimal Qty;
|
||||
public BigDecimal QtyOrdered;
|
||||
public BigDecimal QtyReserved;
|
||||
public Timestamp Date;
|
||||
public String ASI;
|
||||
public String PODocumentNo;
|
||||
public boolean IsReversal = false;
|
||||
//
|
||||
public DocAction document = null;
|
||||
|
||||
public MMDocument(MMScenario scenario)
|
||||
{
|
||||
this.scenario = scenario;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a <code>String</code> with all attributes
|
||||
* in name = value format.
|
||||
*
|
||||
* @return a <code>String</code> representation
|
||||
* of this object.
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
final String TAB = " ";
|
||||
|
||||
String retValue = "";
|
||||
|
||||
retValue = "MMDocument ( "
|
||||
// + super.toString() + TAB
|
||||
+ "csvLineNo = " + this.csvLineNo + TAB
|
||||
+ "DocBaseType = " + this.DocBaseType + TAB
|
||||
+ "DocumentNo = " + this.DocumentNo + TAB
|
||||
+ "LocatorValue = " + this.LocatorValue + TAB
|
||||
+ "LocatorValueTo = " + this.LocatorValueTo + TAB
|
||||
+ "ProductValue = " + this.ProductValue + TAB
|
||||
+ "Price = " + this.Price + TAB
|
||||
+ "Qty = " + this.Qty + TAB
|
||||
+ "QtyOrdered = " + this.QtyOrdered + TAB
|
||||
+ "QtyReserved = " + this.QtyReserved + TAB
|
||||
+ "ASI = " + this.ASI + TAB
|
||||
+ "Date = " + this.Date + TAB
|
||||
+ "PODocumentNo = " + this.PODocumentNo + TAB
|
||||
+ "IsReversal = " + this.IsReversal + TAB
|
||||
+ "document = " + this.document + TAB
|
||||
+ " )";
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2009 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.inventory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
|
||||
/**
|
||||
* @author Teo Sarca, www.arhipac.ro
|
||||
*/
|
||||
public class MMScenario
|
||||
{
|
||||
public final String name;
|
||||
public String key = null;
|
||||
public final List<MMDocument> docs = new ArrayList<MMDocument>();
|
||||
|
||||
/** ASI Code -> M_AttributeSetInstance_ID */
|
||||
public final HashMap<String, Integer> asiCodes = new HashMap<String, Integer>();
|
||||
|
||||
public MMScenario(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public MMDocument get(String docBaseType, String documentNo)
|
||||
{
|
||||
if (documentNo == null)
|
||||
throw new IllegalArgumentException("documentNo is null");
|
||||
//
|
||||
for (MMDocument doc : docs)
|
||||
{
|
||||
if (docBaseType.equals(doc.DocBaseType) && documentNo.equals(documentNo))
|
||||
return doc;
|
||||
}
|
||||
throw new AdempiereException("["+name+"] document not found for"
|
||||
+" DocBaseType="+docBaseType+", documentNo="+documentNo);
|
||||
}
|
||||
|
||||
public void registerASICode(String asiCode, int M_ASI_ID, boolean isCreated)
|
||||
{
|
||||
asiCode = asiCode.trim();
|
||||
|
||||
if (isCreated && asiCodes.get(asiCode) != null)
|
||||
{
|
||||
throw new AdempiereException("ASI Should be unique : Code="+asiCode+", ID="+M_ASI_ID);
|
||||
}
|
||||
asiCodes.put(asiCode, M_ASI_ID);
|
||||
}
|
||||
|
||||
public int getM_ASI_ID(String asiCode)
|
||||
{
|
||||
asiCode = asiCode.trim();
|
||||
if (asiCode.equals("0"))
|
||||
return 0;
|
||||
|
||||
Integer asi_id = asiCodes.get(asiCode);
|
||||
if (asi_id == null)
|
||||
{
|
||||
throw new AdempiereException("No ASI created for Code="+asiCode);
|
||||
}
|
||||
return asi_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("__SCENARIO________________________________________________\n");
|
||||
sb.append(" Name : "+this.name).append("\n");
|
||||
sb.append(" Key : "+this.key).append("\n");
|
||||
//
|
||||
sb.append("Lines: \n");
|
||||
for (MMDocument doc : this.docs)
|
||||
{
|
||||
sb.append(" ").append(doc.toString()).append("\n");
|
||||
}
|
||||
//
|
||||
sb.append("ASI(Code=>ID): ");
|
||||
for (Entry<String, Integer> entry : this.asiCodes.entrySet())
|
||||
{
|
||||
sb.append("(")
|
||||
.append(entry.getKey()).append("=>").append(entry.getValue())
|
||||
.append("); ");
|
||||
}
|
||||
sb.append("\n");
|
||||
//
|
||||
sb.append("__________________________________________________________\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,155 +0,0 @@
|
|||
package test.performance;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.util.CLogMgt;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Ini;
|
||||
|
||||
public class SingleMProductTest extends TestCase {
|
||||
|
||||
// Test: General
|
||||
private Properties testProperties = null;
|
||||
|
||||
private Properties m_Ctx = null;
|
||||
|
||||
private String fileName_DefaultValue = "J:/Trifon-CD-0.3/workspace/adempiere-trunk/adempiere/Adempiere/Adempiere.properties";
|
||||
private String fileName_Key = "AdempiereProperties";
|
||||
private String fileName_Value = "";
|
||||
|
||||
private String isClient_DefaultValue = "Y";
|
||||
private String isClient_Key = "isClient";
|
||||
private boolean isClient_Value = true;
|
||||
|
||||
private String AD_User_ID_DefaultValue = "0";
|
||||
private String AD_User_ID_Key = "AD_User_ID";
|
||||
private int AD_User_ID_Value = 0;
|
||||
|
||||
// Test: Specific variables
|
||||
private MProduct product = null;
|
||||
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
testProperties = new Properties();
|
||||
testProperties.load(new FileInputStream("test.properties"));
|
||||
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) );
|
||||
|
||||
m_Ctx = new Properties();
|
||||
m_Ctx.setProperty("#AD_User_ID", Integer.valueOf(AD_User_ID_Value).toString());
|
||||
System.out.println("m_Ctx: " + m_Ctx);
|
||||
|
||||
if (fileName_Value.length() < 1) {
|
||||
assertEquals("Please specify path to Adempiere.properties file!", true, false);
|
||||
}
|
||||
|
||||
System.setProperty("PropertyFile", fileName_Value);
|
||||
Ini.setClient (isClient_Value);
|
||||
org.compiere.Adempiere.startup(isClient_Value);
|
||||
|
||||
// Force connection if there are enough parameters. Else we work with Adempiere.properties
|
||||
// if (args.length >= 6) {
|
||||
// CConnection cc = CConnection.get(Database.DB_ORACLE, args[1], Integer.valueOf(args[2]).intValue(), args[3], args[4], args[5]);
|
||||
// System.out.println("DB UserID:"+cc.getDbUid());
|
||||
// DB.setDBTarget(cc);
|
||||
// }
|
||||
|
||||
//CLogMgt.setLevel(Level.ALL);
|
||||
CLogMgt.setLevel(Level.OFF);
|
||||
/* Available levels:
|
||||
Level.OFF, Level.SEVERE, Level.WARNING, Level.INFO,
|
||||
Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST, Level.ALL
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
|
||||
testProperties = null;
|
||||
m_Ctx = null;
|
||||
}
|
||||
|
||||
public void testMProductCreation() {
|
||||
boolean singleCommit = true;
|
||||
String trxName = "test";
|
||||
m_Ctx.setProperty("#AD_Client_ID", Integer.valueOf(11).toString());
|
||||
|
||||
// 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));
|
||||
int startCount = 5;
|
||||
int count = 1;
|
||||
|
||||
for (int idx= startCount; idx < (startCount + count); idx++) {
|
||||
//product = MProduct.get(m_Ctx, int M_Product_ID)
|
||||
product = new MProduct(m_Ctx, 0, trxName);
|
||||
//
|
||||
product.setAD_Org_ID(0);
|
||||
product.setValue("Test-Single-Product-" + idx);
|
||||
product.setName("Test-Single-Product-" + idx);
|
||||
|
||||
// M_Product_Category
|
||||
int M_Product_Category_ID = 105; // TODO - Trifon
|
||||
product.setM_Product_Category_ID(M_Product_Category_ID);
|
||||
// C_TaxCategory
|
||||
int C_TaxCategory_ID = 107; // TODO - Trifon
|
||||
product.setC_TaxCategory_ID(C_TaxCategory_ID);
|
||||
// C_UOM
|
||||
int C_UOM_ID = 100; // TODO - Trifon
|
||||
product.setC_UOM_ID(C_UOM_ID);
|
||||
// C_UOM
|
||||
String ProductType = "I"; // TODO - Trifon
|
||||
product.setProductType(ProductType);
|
||||
|
||||
boolean saveResult = product.save();
|
||||
if (!saveResult) {
|
||||
assertEquals("Product not updated!", true, saveResult);
|
||||
} else {
|
||||
//System.out.println("product.getM_Product_ID: " + product.getM_Product_ID());
|
||||
if (singleCommit) {
|
||||
try {
|
||||
DB.commit(true, trxName);
|
||||
} catch (Exception e) {
|
||||
assertEquals("Product not updated!", true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end loop
|
||||
|
||||
if (!singleCommit) {
|
||||
try {
|
||||
DB.commit(true, trxName);
|
||||
} catch (Exception e) {
|
||||
assertEquals("Product not updated!", true, false);
|
||||
}
|
||||
}
|
||||
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 = " + count
|
||||
+ "; Time(seconds) = " + time + "; Produsts/Second = " + ((float)count/time) + "; ");
|
||||
|
||||
assertTrue(this.getClass().getName(), true);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue