With the minilang deprecation and the migration to groovy, I implemented on the ofbiz testtools the possibility to use groovy for write new integration test or convert current simple xml test.
Now you can define a new element as child of test-group on your xml test-suite file like
<groovy-test-suite name=simple location=component://base/groovyScript/test/SimpleTests.groovy/>
To Write your test, you need to create a Groovy class that extends GroovyScriptTestCase class :
import org.apache.ofbiz.testtools.GroovyScriptTestCase
class BaseTest extends GroovyScriptTestCase {
void testTrue() {
assert 1, 1
}
}
All your function will execute as TestCase.
For more information on groovy specific testing language see http://groovy-lang.org/testing.html
At this time the OFBiz Groovy DSL isn't supported to write groovy test case but you have access to the delegator and the disphatcher as native class variable.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1816335 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9441)
A major refactoring patch that applies the following changes:
- Fully refactor the EntityDataLoadContainer
- Fully refactor the TestRunContainer
- In both above mentioned containers the logic is broken up into smaller
methods to enhance code readability. It also changes the signature of
the method calls to rely on StartupCommand instead of String[] arrays
- Remove most old documentation and commented out code where applicable
- Delete the StratupCommandToArgsAdapter as it is no longer needed
- Create a new feature in which OFBiz by default fails if any data file
fails to load. This can be overridden by passing a flag called
"continue-on-failure" e.g. ./gradlew "ofbiz --load-data continue-on-failure"
- Add a new property to --test called "loglevel" (old code but working properly)
- Add many new properties to the --load-data command including repair-columns,
try-inserts, maintain-txs, etc ... These properties are old, but somehow
did not make it into the command line arguments. This code is now exposed
through the command line to set a direction in the future of whether to
keep or delete these extra commands
- Update the documentation output of ./gradlew "ofbiz --help" to incorporate
the new mentioned properties
- Refactor README.md to incorporate the changes to the gradle commands for both
"-load-data" and "-test" properties. Also remove the gradle GUI
documentation as it is now deprecated.
- Also refactor README.md in other locations to cleanup and make it more
consistent. This icludes moving long notes into new sections and reducing
the verbosity of the security header. Furthermore, created a new header
called Miscellaneous documentation to house the newly created sections
- lots of small changes to remove EOL white space
Thanks: Jacques Le Roux for reviewing and testing
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1805947 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9571)
No functional change.
We read at http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html :
<<Using the integer fields in this class (such as ROUND_HALF_UP) to represent
rounding mode is largely obsolete; the enumeration values of the RoundingMode
enum, (such as RoundingMode.HALF_UP) should be used instead.>>
That's an easy global replacement. But it also needs to import the RoundingMode
class. It was 26 files so I decided to rather clean all the imports in all files
with the help of Eclipse.
This is a 1st step. I will need to closely look at 2 special class: UtilNumber
and Calculate.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1804953 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8337)
Continuing the refactoring work on the startup sequence, this commit
specifically focuses on the ComponentContainer and how it loads
components into the system. The following changes are made:
- simplify and cleanup the ofbiz-containers.xml to have only one entry
- substantially simplify the ComponentLoaderConfig class and remove unnecessary defined state
- delete the JustLoadComponentsContainer (used to exist for the server command --testlist which no longer exists)
- fully refactor the ComponentContainer class and breakup the messy logic into chunks of private methods. The methods are also properly documented.
- remove an old reference to the testlist container which no longer exists
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1772256 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8337)
This is a major refactoring exercise to simplify the startup sequence in
OFBiz. There are no functional changes, however, both the logic and the
API signatures of the core classes in OFBiz are changed to help simplify
the startup sequence. The changes insofar are summarized as:
- Rename ContainerConfig.Container to ContainerConfig.Configuration, the old
nameing was very confusing as it confuses it with actual containers
- Change the signature of ContainerLoader and Container to accept
List<StartupCommand> instead of String[]. And also migrate the adapter for
converting these args into a standalone class called
StartupCommandsToArgsAdapter
- Remove the LockedBy annotation as it is not used
- Substantially simplify the ContainerLoader load and unload logic and delete
the start logic (merge it with load). The interface StartupLoader was updated
accordingly
- Remove old logic to load containers in hot-deploy components
- Remove printThreadDump output from ContainerLoader which used to exist for
debugging purposes and is no longer necessary
- Cleanup the AdminServer startup logic
- Change the StartupControlPanel logic to use only one StartupLoader instead
of a list. The only implementation is ContainerLoader
- Remove the synchronized blocks in StartupControlPanel due to having only one
loader
- Update the startup .properties files to reflect the changes in the startup
logic
- Update the TestRunContainer to use List<StartupCommand> in its logic
We expect more commits (specifically to the containers) to complete this
refactoring initiative
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1765127 13f79535-47bb-0310-9956-ffa450edef68
Notes:
* Also removes empty framework/base/lib/scripting and useless applications\content\lib\uno\README (miss doc in wiki)
* When jpim-0.1.jar will be (hopefully) replaced we can drop lib ref in framework/base/ofbiz-component.xml
* I wonder if we should let the geronimo component alone with only 2 classes, could we not put that in entity or entityext?
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1755306 13f79535-47bb-0310-9956-ffa450edef68
Apply the following:
- remove the testlist command from options available in OFBiz server
- Delete the TestListContainer.java which implement the behavior
- Update the Config file to ignore properties related to that command
- Delete the properties file related to the command.
This has reference to the above JIRA and the below discussion
thread in which the community agreed to remove the testlist
server command from OFBiz. This command is an old and deprecated
command that used to create an ant script which iterates over all
test suites and execute them consecutively. It is both not-needed
and also deprecated given its dependence on Ant.
The discussion thread:
http://ofbiz.markmail.org/message/r64igaf6ihvpolaa
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1754507 13f79535-47bb-0310-9956-ffa450edef68
This is the first of two steps in the above mentioned JIRA. This
first step changes the java source directory for every component
from /src to /src/main/java. The next step will be adding unit
tests to every component in /src/test/java
Thank you to Deepak Dixit for tips on how to use the SVN commands
to make the appropriate file moving.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1752838 13f79535-47bb-0310-9956-ffa450edef68
This is the first patch that takes OFBiz to the point of no return
in terms of switching from Ant to Gradle build system. Specifically
this patch applies the following items:
- Delete all old Ant and Maven build scripts
- Delete 169 Jar libraries and replace them with remote ones in the
gradle build script
- update the gradle build scripts for the dependencies and other minor
changes needed for the script work correctly
All tests pass with the command ./gradlew cleanAll loadDefault testIntegration
Again, thank you for everyone who contributed valueble time and effort in this
process.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1752033 13f79535-47bb-0310-9956-ffa450edef68
This reverts svn:eol-style=native on Java files which were forced by r1044202n, 89 Java files are concerned. This commit hopefully makes things more consistent.
It's indeed hard to see the impact of this change before it's committed. I'll check once done, I already found 116 Java files w/o svn:eol-style=native but there are 1231 Java files at all, so not sure how most are set...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1695126 13f79535-47bb-0310-9956-ffa450edef68
Data loading for xml data was working fine when <delete>,<create>, <create-update> tag were used . But these tags were not working when data was loaded at the time of running J-unit tests. So after researched that how data loading was working fine for simple data load. So I used the same way than in EntityDataLoader.java to parse the XML file.
jleroux: I simply removed the old code Divesh commented out in his patch
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1648668 13f79535-47bb-0310-9956-ffa450edef68
* new factory interface for LocalDispatcher objects
* new factory implementation of GenericDispatcher
* new ServiceContainer container that initializes the factory (based on a configuration parameter)
* moved the getLocalDispatcher method out of GenericDispatcher and refactored (in a thread safe way) into ServiceContainer/GenericDispatcherFactory
* ServiceContainer also maintains the cache of LocalDispatchers that was managed by GenericDispatcher
* added code to ServiceContainer to deregister LocalDispatchers at shutdown: this finally fix the current code that was broken because the thread pool maintained by the JobPoller was never closed because of an issue with LocalDispatchers not being deregistered when not started by the ContextFilter
* change all code to call the ServiceContainer rather than GenericContainer to get a LocalDispatcher: now the implementation is no more directly referenced by calling code
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1364952 13f79535-47bb-0310-9956-ffa450edef68
Seleniumxml was a subcomponent of the framework/testtools intended to facilitate the usage of Selenium tests in OFBiz.
However it was never upgraded to the new version of Selenium and it has not been widely adopted by the community; the OFBiz community agreed to remove components/tools like this from the core distribution if they are optional/very specific or not well maintained or if there is (as in the case of Selenium) a valid external alternative to perform the same actions.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1354380 13f79535-47bb-0310-9956-ffa450edef68
On production systems you can't suppress Debug.log( message by the use of debug.properties file. It is always good to use Debug.* statements that are having log level setup in debug.properties file. The real problem comes with Debug.log( statement when you are printing any list or map object that contains so many records(or data) in it. Here I am changing all the occurrence of Debug.log( with Debug.logInfo(, Debug.logError( or Debug.logWarning( so that we can have better control of Debug.* statements on production system. :-)
Bad use of Debug statement. On production system you will get false alarm that you are having error in code base although the resultant statement is only giving additional information instead of error message.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1335927 13f79535-47bb-0310-9956-ffa450edef68