details: https://code.openbravo.com/erp/devel/pi/rev/1009aa7d91bf
changeset: 24085:1009aa7d91bf
user: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
date: Mon Jul 21 09:35:59 2014 +0200
summary: related to bug 27107: fixed test cases in DBPrefixTest
diffstat:
src-test/org/openbravo/test/modularity/DBPrefixTest.java | 40 ++++++++++++----
1 files changed, 30 insertions(+), 10 deletions(-)
diffs (124 lines):
diff -r 4a9073e3b4a9 -r 1009aa7d91bf
src-test/org/openbravo/test/modularity/DBPrefixTest.java
--- a/src-test/org/openbravo/test/modularity/DBPrefixTest.java Fri Jul 18
12:49:36 2014 +0200
+++ b/src-test/org/openbravo/test/modularity/DBPrefixTest.java Mon Jul 21
09:35:59 2014 +0200
@@ -11,7 +11,7 @@
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2009-2011 Openbravo SLU
+ * All portions are Copyright (C) 2009-2014 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
@@ -33,13 +33,31 @@
* This tests check that db prefixes are correctly checked when they are
inserted in DB in order not
* to follow modularity rules
*
+ * IMPORTANT: Test cases are called by one of them called testContent(). The
name of the rest of the
+ * test cases NOT begin by "test...".
*/
public class DBPrefixTest extends BaseTest {
/**
+ * This test contains the invocations for the rest of the test cases. By
this way, we preserve the
+ * execution order of the test cases.
+ */
+ public void testContent() {
+ createModule();
+ addDBPrefixValid1();
+ addDBPrefixValid2();
+ addDBPrefixNotValid1();
+ addDBPrefixNotValid2();
+ addDBPrefixNotValid3();
+ addDBPrefixNotValid4();
+ deleteModule();
+
+ }
+
+ /**
* Creates a new module to test with
*/
- public void testCreateModule() {
+ public void createModule() {
setSystemAdministratorContext();
Module module = OBProvider.getInstance().get(Module.class);
module.setName("Test-dbprefixes-names");
@@ -48,54 +66,55 @@
module.setDescription("Testing dbprefixes");
module.setInDevelopment(true);
OBDal.getInstance().save(module);
+ OBDal.getInstance().flush();
}
/**
* Add a valid dbprefixes, everything should go ok only alphabetic upper
chars
*/
- public void testAddDBPrefixValid1() {
+ public void addDBPrefixValid1() {
insertDBPrefix("OK", true);
}
/**
* alpha numeric chars not starting with a numeric one
*/
- public void testAddDBPrefixValid2() {
+ public void addDBPrefixValid2() {
insertDBPrefix("OK12", true);
}
/**
* Add not valid db prefixes starts with number
*/
- public void testAddDBPrefixNotValid1() {
+ public void addDBPrefixNotValid1() {
insertDBPrefix("1FAIL", false);
}
/**
* contains lower case letters
*/
- public void testAddDBPrefixNotValid2() {
+ public void addDBPrefixNotValid2() {
insertDBPrefix("Fail", false);
}
/**
* contains underscore
*/
- public void testAddDBPrefixNotValid3() {
+ public void addDBPrefixNotValid3() {
insertDBPrefix("FAIL_1", false);
}
/**
* contains other non-alphabetic chars
*/
- public void testAddDBPrefixNotValid4() {
+ public void addDBPrefixNotValid4() {
insertDBPrefix("FAIL&/1", false);
}
/**
* Deletes all the modules matching the name for the testing one
*/
- public void testDeleteModule() {
+ public void deleteModule() {
setSystemAdministratorContext();
final OBCriteria<Module> obCriteria =
OBDal.getInstance().createCriteria(Module.class);
obCriteria.add(Restrictions.eq(Module.PROPERTY_JAVAPACKAGE,
"org.openbravo.test.dbprefix"));
@@ -106,7 +125,7 @@
}
}
- // Obtains the module iserted for testing purposes
+ // Obtains the module inserted for testing purposes
private Module getModule() {
setSystemAdministratorContext();
final OBCriteria<Module> obCriteria =
OBDal.getInstance().createCriteria(Module.class);
@@ -148,5 +167,6 @@
assertFalse("Not inserted a valid prefix:" + name, exception);
else
assertTrue("Inserted a non-valid prefix:" + name, exception);
+ OBDal.getInstance().flush();
}
}
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits