You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/07/07 08:50:26 UTC
svn commit: r1608347 [3/3] - in
/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./
applications/accounting/widget/
applications/marketing/script/org/ofbiz/marketing/campaign/
applications/marketing/script/org/ofbiz/marketing/contact/ applica...
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Mon Jul 7 06:50:24 2014
@@ -355,7 +355,7 @@ public class ModelEntity implements Comp
enableAuditLog = "true".equals(fieldElement.getAttribute("enable-audit-log"));
}
newField = ModelField.create(this, description, existingField.getName(), type, colName, existingField.getColValue(), existingField.getFieldSet(),
- existingField.getIsNotNull(), existingField.getIsPk(), existingField.getEncrypt(), existingField.getIsAutoCreatedInternal(),
+ existingField.getIsNotNull(), existingField.getIsPk(), existingField.getEncryptMethod(), existingField.getIsAutoCreatedInternal(),
enableAuditLog, existingField.getValidators());
}
// add to the entity as a new field
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelField.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelField.java?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelField.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelField.java Mon Jul 7 06:50:24 2014
@@ -24,6 +24,7 @@ import java.util.Iterator;
import java.util.List;
import org.ofbiz.base.lang.ThreadSafe;
+import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilXml;
import org.ofbiz.entity.jdbc.DatabaseUtil;
import org.w3c.dom.Document;
@@ -36,6 +37,27 @@ import org.w3c.dom.Element;
@ThreadSafe
@SuppressWarnings("serial")
public final class ModelField extends ModelChild {
+ public static final String module = ModelField.class.getName();
+
+ public enum EncryptMethod {
+ FALSE {
+ public boolean isEncrypted() {
+ return false;
+ }
+ },
+ TRUE {
+ public boolean isEncrypted() {
+ return true;
+ }
+ },
+ SALT {
+ public boolean isEncrypted() {
+ return true;
+ }
+ };
+
+ public abstract boolean isEncrypted();
+ }
/**
* Returns a new <code>ModelField</code> instance, initialized with the specified values.
@@ -67,6 +89,10 @@ public final class ModelField extends Mo
* @param validators The validators for this field.
*/
public static ModelField create(ModelEntity modelEntity, String description, String name, String type, String colName, String colValue, String fieldSet, boolean isNotNull, boolean isPk, boolean encrypt, boolean isAutoCreatedInternal, boolean enableAuditLog, List<String> validators) {
+ return create(modelEntity, description, name, type, colName, colValue, fieldSet, isNotNull, isPk, encrypt ? EncryptMethod.TRUE : EncryptMethod.FALSE, isAutoCreatedInternal, enableAuditLog, validators);
+ }
+
+ public static ModelField create(ModelEntity modelEntity, String description, String name, String type, String colName, String colValue, String fieldSet, boolean isNotNull, boolean isPk, EncryptMethod encrypt, boolean isAutoCreatedInternal, boolean enableAuditLog, List<String> validators) {
// TODO: Validate parameters.
if (description == null) {
description = "";
@@ -121,7 +147,11 @@ public final class ModelField extends Mo
if (isPk) {
isNotNull = true;
}
- boolean encrypt = "true".equals(fieldElement.getAttribute("encrypt"));
+ EncryptMethod encrypt = EncryptMethod.valueOf(fieldElement.getAttribute("encrypt").toUpperCase());
+ if (encrypt == null) {
+ Debug.logWarning("invalid encrypt value: %s", module, fieldElement.getAttribute("encrypt"));
+ encrypt = EncryptMethod.FALSE;
+ }
boolean enableAuditLog = "true".equals(fieldElement.getAttribute("enable-audit-log"));
List<String>validators = Collections.emptyList();
List<? extends Element> elementList = UtilXml.childElementList(fieldElement, "validate");
@@ -151,7 +181,7 @@ public final class ModelField extends Mo
String description = "";
String colValue = "";
String fieldSet = "";
- boolean encrypt = false;
+ EncryptMethod encrypt = EncryptMethod.FALSE;
boolean enableAuditLog = false;
return new ModelField(modelEntity, description, name, type, colName, colValue, fieldSet, isNotNull, isPk, encrypt, false, enableAuditLog, Collections.<String>emptyList());
}
@@ -175,7 +205,7 @@ public final class ModelField extends Mo
/** boolean which specifies whether or not the Field is a Primary Key */
private final boolean isPk;
- private final boolean encrypt;
+ private final EncryptMethod encrypt;
private final boolean isNotNull;
private final boolean isAutoCreatedInternal;
private final boolean enableAuditLog;
@@ -186,7 +216,7 @@ public final class ModelField extends Mo
/** validators to be called when an update is done */
private final List<String> validators;
- private ModelField(ModelEntity modelEntity, String description, String name, String type, String colName, String colValue, String fieldSet, boolean isNotNull, boolean isPk, boolean encrypt, boolean isAutoCreatedInternal, boolean enableAuditLog, List<String> validators) {
+ private ModelField(ModelEntity modelEntity, String description, String name, String type, String colName, String colValue, String fieldSet, boolean isNotNull, boolean isPk, EncryptMethod encrypt, boolean isAutoCreatedInternal, boolean enableAuditLog, List<String> validators) {
super(modelEntity, description);
this.name = name;
this.type = type;
@@ -231,7 +261,12 @@ public final class ModelField extends Mo
}
/** Returns <code>true</code> if this field is encrypted. */
+ @Deprecated
public boolean getEncrypt() {
+ return this.encrypt.isEncrypted();
+ }
+
+ public EncryptMethod getEncryptMethod() {
return this.encrypt;
}
@@ -267,8 +302,8 @@ public final class ModelField extends Mo
root.setAttribute("col-name", this.getColName());
}
root.setAttribute("type", this.getType());
- if (this.getEncrypt()) {
- root.setAttribute("encrypt", "true");
+ if (this.getEncryptMethod().isEncrypted()) {
+ root.setAttribute("encrypt", this.getEncryptMethod().toString().toLowerCase());
}
if (this.getIsNotNull()) {
root.setAttribute("not-null", "true");
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java Mon Jul 7 06:50:24 2014
@@ -431,7 +431,7 @@ public class ModelViewEntity extends Mod
String fieldSet = "";
boolean isNotNull = false;
boolean isPk = false;
- boolean encrypt = false;
+ ModelField.EncryptMethod encryptMethod = ModelField.EncryptMethod.FALSE;
boolean isAutoCreatedInternal = false;
boolean enableAuditLog = false;
List<String> validators = null;
@@ -458,7 +458,7 @@ public class ModelViewEntity extends Mod
} else {
isPk = aliasedField.getIsPk();
}
- encrypt = aliasedField.getEncrypt();
+ encryptMethod = aliasedField.getEncryptMethod();
type = aliasedField.getType();
validators = aliasedField.getValidators();
colValue = alias.entityAlias + "." + SqlJdbcUtil.filterColName(aliasedField.getColName());
@@ -492,7 +492,7 @@ public class ModelViewEntity extends Mod
colValue = prefix + colValue + ")";
}
}
- ModelField field = ModelField.create(this, description, name, type, colName, colValue, fieldSet, isNotNull, isPk, encrypt, isAutoCreatedInternal, enableAuditLog, validators);
+ ModelField field = ModelField.create(this, description, name, type, colName, colValue, fieldSet, isNotNull, isPk, encryptMethod, isAutoCreatedInternal, enableAuditLog, validators);
// if this is a groupBy field, add it to the groupBys list
if (alias.groupBy || groupByFields.contains(alias.name)) {
this.groupBys.add(field);
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java Mon Jul 7 06:50:24 2014
@@ -95,21 +95,22 @@ public class EntityTestSuite extends Ent
*/
public void testMakeValue() throws Exception {
// This method call directly stores a new value into the entity engine
- GenericValue createdValue = delegator.create("TestingType", "testingTypeId", "TEST-1", "description", "Testing Type #1");
+ GenericValue createdValue = delegator.create("TestingType", "testingTypeId", "TEST-MAKE-1", "description", "Testing Type #Make-1");
assertTrue("Created value is mutable", createdValue.isMutable());
assertFalse("Observable has not changed", createdValue.hasChanged());
// This sequence creates the GenericValue entities first, puts them in a List, then calls the delegator to store them all
List<GenericValue> newValues = new LinkedList<GenericValue>();
- newValues.add(delegator.makeValue("TestingType", "testingTypeId", "TEST-2", "description", "Testing Type #2"));
- newValues.add(delegator.makeValue("TestingType", "testingTypeId", "TEST-3", "description", "Testing Type #3"));
- newValues.add(delegator.makeValue("TestingType", "testingTypeId", "TEST-4", "description", "Testing Type #4"));
+ newValues.add(delegator.makeValue("TestingType", "testingTypeId", "TEST-MAKE-2", "description", "Testing Type #Make-2"));
+ newValues.add(delegator.makeValue("TestingType", "testingTypeId", "TEST-MAKE-3", "description", "Testing Type #Make-3"));
+ newValues.add(delegator.makeValue("TestingType", "testingTypeId", "TEST-MAKE-4", "description", "Testing Type #Make-4"));
delegator.storeAll(newValues);
// finds a List of newly created values. the second parameter specifies the fields to order results by.
- List<GenericValue> newlyCreatedValues = delegator.findList("TestingType", null, null, UtilMisc.toList("testingTypeId"), null, false);
- assertEquals("4 TestingTypes found", 4, newlyCreatedValues.size());
+ EntityCondition condition = EntityCondition.makeCondition("testingTypeId", EntityOperator.LIKE, "TEST-MAKE-%");
+ List<GenericValue> newlyCreatedValues = delegator.findList("TestingType", condition, null, UtilMisc.toList("testingTypeId"), null, false);
+ assertEquals("4 TestingTypes(for make) found", 4, newlyCreatedValues.size());
}
/*
@@ -117,37 +118,45 @@ public class EntityTestSuite extends Ent
*/
public void testUpdateValue() throws Exception {
// retrieve a sample GenericValue, make sure it's correct
- GenericValue testValue = delegator.findOne("TestingType", false, "testingTypeId", "TEST-1");
- assertEquals("Retrieved value has the correct description", "Testing Type #1", testValue.getString("description"));
+ delegator.removeByCondition("TestingType", EntityCondition.makeCondition("testingTypeId", EntityOperator.LIKE, "TEST-UPDATE-%"));
+ GenericValue testValue = delegator.findOne("TestingType", false, "testingTypeId", "TEST-UPDATE-1");
+ assertNull("No pre-existing type value", testValue);
+ delegator.create("TestingType", "testingTypeId", "TEST-UPDATE-1", "description", "Testing Type #Update-1");
+ testValue = delegator.findOne("TestingType", false, "testingTypeId", "TEST-UPDATE-1");
+ assertEquals("Retrieved value has the correct description", "Testing Type #Update-1", testValue.getString("description"));
// Test Observable aspect
assertFalse("Observable has not changed", testValue.hasChanged());
TestObserver observer = new TestObserver();
testValue.addObserver(observer);
- testValue.put("description", "New Testing Type #1");
+ testValue.put("description", "New Testing Type #Update-1");
assertEquals("Observer called with original GenericValue field name", "description", observer.arg);
observer.observable = null;
observer.arg = null;
GenericValue clonedValue = (GenericValue) testValue.clone();
- clonedValue.put("description", "New Testing Type #1");
+ clonedValue.put("description", "New Testing Type #Update-1");
assertTrue("Cloned Observable has changed", clonedValue.hasChanged());
assertEquals("Observer called with cloned GenericValue field name", "description", observer.arg);
// now store it
testValue.store();
assertFalse("Observable has not changed", testValue.hasChanged());
// now retrieve it again and make sure that the updated value is correct
- testValue = delegator.findOne("TestingType", false, "testingTypeId", "TEST-1");
- assertEquals("Retrieved value has the correct description", "New Testing Type #1", testValue.getString("description"));
+ testValue = delegator.findOne("TestingType", false, "testingTypeId", "TEST-UPDATE-1");
+ assertEquals("Retrieved value has the correct description", "New Testing Type #Update-1", testValue.getString("description"));
}
public void testRemoveValue() throws Exception {
// Retrieve a sample GenericValue, make sure it's correct
- GenericValue testValue = delegator.findOne("TestingType", false, "testingTypeId", "TEST-4");
- assertEquals("Retrieved value has the correct description", "Testing Type #4", testValue.getString("description"));
+ delegator.removeByCondition("TestingType", EntityCondition.makeCondition("testingTypeId", EntityOperator.LIKE, "TEST-REMOVE-%"));
+ GenericValue testValue = delegator.findOne("TestingType", false, "testingTypeId", "TEST-REMOVE-1");
+ assertNull("No pre-existing type value", testValue);
+ delegator.create("TestingType", "testingTypeId", "TEST-REMOVE-1", "description", "Testing Type #Remove-1");
+ testValue = delegator.findOne("TestingType", false, "testingTypeId", "TEST-REMOVE-1");
+ assertEquals("Retrieved value has the correct description", "Testing Type #Remove-1", testValue.getString("description"));
testValue.remove();
assertFalse("Observable has not changed", testValue.hasChanged());
// Test immutable
try {
- testValue.put("description", "New Testing Type #4");
+ testValue.put("description", "New Testing Type #Remove-4");
fail("Modified an immutable GenericValue");
} catch (IllegalStateException e) {
}
@@ -156,7 +165,7 @@ public class EntityTestSuite extends Ent
fail("Modified an immutable GenericValue");
} catch (UnsupportedOperationException e) {
}
- testValue = delegator.findOne("TestingType", false, "testingTypeId", "TEST-4");
+ testValue = delegator.findOne("TestingType", false, "testingTypeId", "TEST-REMOVE-1");
assertEquals("Finding removed value returns null", null, testValue);
}
@@ -165,11 +174,16 @@ public class EntityTestSuite extends Ent
*/
public void testEntityCache() throws Exception {
// Test primary key cache
- GenericValue testValue = delegator.findOne("TestingType", true, "testingTypeId", "TEST-3");
- assertEquals("Retrieved from cache value has the correct description", "Testing Type #3", testValue.getString("description"));
+ delegator.removeByCondition("TestingType", EntityCondition.makeCondition("testingTypeId", EntityOperator.LIKE, "TEST-CACHE-%"));
+ delegator.removeByCondition("TestingSubtype", EntityCondition.makeCondition("testingTypeId", EntityOperator.LIKE, "TEST-CACHE-%"));
+ GenericValue testValue = delegator.findOne("TestingType", true, "testingTypeId", "TEST-CACHE-1");
+ assertNull("No pre-existing type value", testValue);
+ delegator.create("TestingType", "testingTypeId", "TEST-CACHE-1", "description", "Testing Type #Cache-1");
+ testValue = delegator.findOne("TestingType", true, "testingTypeId", "TEST-CACHE-1");
+ assertEquals("Retrieved from cache value has the correct description", "Testing Type #Cache-1", testValue.getString("description"));
// Test immutable
try {
- testValue.put("description", "New Testing Type #3");
+ testValue.put("description", "New Testing Type #Cache-1");
fail("Modified an immutable GenericValue");
} catch (IllegalStateException e) {
}
@@ -180,21 +194,24 @@ public class EntityTestSuite extends Ent
}
// Test entity value update operation updates the cache
testValue = (GenericValue) testValue.clone();
- testValue.put("description", "New Testing Type #3");
+ testValue.put("description", "New Testing Type #Cache-1");
testValue.store();
- testValue = delegator.findOne("TestingType", true, "testingTypeId", "TEST-3");
- assertEquals("Retrieved from cache value has the correct description", "New Testing Type #3", testValue.getString("description"));
+ testValue = delegator.findOne("TestingType", true, "testingTypeId", "TEST-CACHE-1");
+ assertEquals("Retrieved from cache value has the correct description", "New Testing Type #Cache-1", testValue.getString("description"));
// Test entity value remove operation updates the cache
testValue = (GenericValue) testValue.clone();
testValue.remove();
- testValue = delegator.findOne("TestingType", true, "testingTypeId", "TEST-3");
+ testValue = delegator.findOne("TestingType", true, "testingTypeId", "TEST-CACHE-1");
assertEquals("Retrieved from cache value is null", null, testValue);
// Test entity condition cache
- EntityCondition testCondition = EntityCondition.makeCondition("description", EntityOperator.EQUALS, "Testing Type #2");
+ EntityCondition testCondition = EntityCondition.makeCondition("description", EntityOperator.EQUALS, "Testing Type #Cache-2");
List<GenericValue> testList = delegator.findList("TestingType", testCondition, null, null, null, true);
+ assertEquals("Delegator findList returned no values", 0, testList.size());
+ delegator.create("TestingType", "testingTypeId", "TEST-CACHE-2", "description", "Testing Type #Cache-2");
+ testList = delegator.findList("TestingType", testCondition, null, null, null, true);
assertEquals("Delegator findList returned one value", 1, testList.size());
testValue = testList.get(0);
- assertEquals("Retrieved from cache value has the correct description", "Testing Type #2", testValue.getString("description"));
+ assertEquals("Retrieved from cache value has the correct description", "Testing Type #Cache-2", testValue.getString("description"));
// Test immutable
try {
testValue.put("description", "New Testing Type #2");
@@ -208,12 +225,12 @@ public class EntityTestSuite extends Ent
}
// Test entity value create operation updates the cache
testValue = (GenericValue) testValue.clone();
- testValue.put("testingTypeId", "TEST-9");
+ testValue.put("testingTypeId", "TEST-CACHE-3");
testValue.create();
testList = delegator.findList("TestingType", testCondition, null, null, null, true);
assertEquals("Delegator findList returned two values", 2, testList.size());
// Test entity value update operation updates the cache
- testValue.put("description", "New Testing Type #2");
+ testValue.put("description", "New Testing Type #Cache-3");
testValue.store();
testList = delegator.findList("TestingType", testCondition, null, null, null, true);
assertEquals("Delegator findList returned one value", 1, testList.size());
@@ -224,19 +241,21 @@ public class EntityTestSuite extends Ent
testList = delegator.findList("TestingType", testCondition, null, null, null, true);
assertEquals("Delegator findList returned empty list", 0, testList.size());
// Test view entities in the pk cache - updating an entity should clear pk caches for all view entities containing that entity.
- testValue = delegator.create("TestingSubtype", "testingTypeId", "TEST-9", "subtypeDescription", "Testing Subtype #9");
+ testValue = delegator.findOne("TestingSubtype", true, "testingTypeId", "TEST-CACHE-3");
+ assertNull("No pre-existing TestingSubtype", testValue);
+ testValue = delegator.create("TestingSubtype", "testingTypeId", "TEST-CACHE-3", "subtypeDescription", "Testing Subtype #Cache-3");
assertNotNull("TestingSubtype created", testValue);
// Confirm member entity appears in the view
- testValue = delegator.findOne("TestingViewPks", true, "testingTypeId", "TEST-9");
- assertEquals("View retrieved from cache has the correct member description", "Testing Subtype #9", testValue.getString("subtypeDescription"));
- testValue = delegator.findOne("TestingSubtype", true, "testingTypeId", "TEST-9");
+ testValue = delegator.findOne("TestingViewPks", true, "testingTypeId", "TEST-CACHE-3");
+ assertEquals("View retrieved from cache has the correct member description", "Testing Subtype #Cache-3", testValue.getString("subtypeDescription"));
+ testValue = delegator.findOne("TestingSubtype", true, "testingTypeId", "TEST-CACHE-3");
// Modify member entity
testValue = (GenericValue) testValue.clone();
- testValue.put("subtypeDescription", "New Testing Subtype #9");
+ testValue.put("subtypeDescription", "New Testing Subtype #Cache-3");
testValue.store();
// Check if cached view contains the modification
- testValue = delegator.findOne("TestingViewPks", true, "testingTypeId", "TEST-9");
- assertEquals("View retrieved from cache has the correct member description", "New Testing Subtype #9", testValue.getString("subtypeDescription"));
+ testValue = delegator.findOne("TestingViewPks", true, "testingTypeId", "TEST-CACHE-3");
+ assertEquals("View retrieved from cache has the correct member description", "New Testing Subtype #Cache-3", testValue.getString("subtypeDescription"));
}
/*
@@ -260,14 +279,7 @@ public class EntityTestSuite extends Ent
TransactionUtil.rollback(transBegin, null, null);
}
- /*
- * Tests storing data with the delegator's .create method. Also tests .findCountByCondition and .getNextSeqId
- */
- public void testCreateTree() throws Exception {
- // get how many child nodes did we have before creating the tree
- EntityCondition isChild = EntityCondition.makeCondition("primaryParentNodeId", EntityOperator.NOT_EQUAL, GenericEntity.NULL_FIELD);
- long alreadyStored = delegator.findCountByCondition("TestingNode", isChild, null, null);
-
+ protected long flushAndRecreateTree(String descriptionPrefix) throws Exception {
//
// The tree has a root, the root has level1max children.
//
@@ -276,27 +288,38 @@ public class EntityTestSuite extends Ent
GenericValue root = delegator.create("TestingNode",
"testingNodeId", delegator.getNextSeqId("TestingNode"),
"primaryParentNodeId", GenericEntity.NULL_FIELD,
- "description", "root");
+ "description", descriptionPrefix + ":0:root");
int level1;
for (level1 = 0; level1 < _level1max; level1++) {
String nextSeqId = delegator.getNextSeqId("TestingNode");
GenericValue v = delegator.create("TestingNode", "testingNodeId", nextSeqId,
"primaryParentNodeId", root.get("testingNodeId"),
- "description", "node-level #1");
+ "description", descriptionPrefix + ":1:node-level #1");
assertNotNull(v);
}
+ return level1 + 1;
+ }
- long created = level1;
- long newlyStored = delegator.findCountByCondition("TestingNode", isChild, null, null);
+ /*
+ * Tests storing data with the delegator's .create method. Also tests .findCountByCondition and .getNextSeqId
+ */
+ public void testCreateTree() throws Exception {
+ // get how many child nodes did we have before creating the tree
+ delegator.removeByCondition("TestingNode", EntityCondition.makeCondition("description", EntityOperator.LIKE, "create:"));
+ long created = flushAndRecreateTree("create");
+ long newlyStored = delegator.findCountByCondition("TestingNode", EntityCondition.makeCondition("description", EntityOperator.LIKE, "create:%"), null, null);
- // Normally, newlyStored = alreadyStored + created
- assertEquals("Created/Stored Nodes", created + alreadyStored, newlyStored);
+ assertEquals("Created/Stored Nodes", created, newlyStored);
}
/*
* More tests of storing data with .storeAll. Also prepares data for testing view-entities (see below.)
*/
public void testAddMembersToTree() throws Exception {
+ delegator.removeByCondition("TestingType", EntityCondition.makeCondition("testingTypeId", EntityOperator.LIKE, "TEST-TREE-%"));
+ GenericValue testValue = delegator.findOne("TestingType", true, "testingTypeId", "TEST-TREE-1");
+ assertNull("No pre-existing type value", testValue);
+ delegator.create("TestingType", "testingTypeId", "TEST-TREE-1", "description", "Testing Type #Tree-1");
// get the level1 nodes
EntityCondition isLevel1 = EntityCondition.makeCondition("primaryParentNodeId", EntityOperator.NOT_EQUAL, GenericEntity.NULL_FIELD);
List<GenericValue> nodeLevel1 = delegator.findList("TestingNode", isLevel1, null, null, null, false);
@@ -307,7 +330,7 @@ public class EntityTestSuite extends Ent
for (GenericValue node: nodeLevel1) {
GenericValue testing = delegator.makeValue("Testing",
"testingId", delegator.getNextSeqId("Testing"),
- "testingTypeId", "TEST-1"
+ "testingTypeId", "TEST-TREE-1"
);
testing.put("testingName", "leaf-#" + node.getString("testingNodeId"));
testing.put("description", "level1 leaf");
@@ -330,11 +353,45 @@ public class EntityTestSuite extends Ent
assertEquals("Created/Stored Nodes", newValues.size(), n);
}
+ protected void purgeTestingByTypeId(String likeTypeId) throws GenericEntityException {
+ delegator.removeByCondition("Testing", EntityCondition.makeCondition("testingTypeId", EntityOperator.LIKE, likeTypeId));
+ delegator.removeByCondition("TestingTest", EntityCondition.makeCondition("testingTypeId", EntityOperator.LIKE, likeTypeId));
+ }
+
+ protected void createNodeMembers(String typeId, String typeDescription, String descriptionPrefix) throws GenericEntityException {
+ delegator.removeByCondition("TestingType", EntityCondition.makeCondition("testingTypeId", EntityOperator.EQUALS, typeId));
+ delegator.create("TestingType", "testingTypeId", typeId, "description", typeDescription);
+ int i = 0;
+ Timestamp now = UtilDateTime.nowTimestamp();
+ for (GenericValue node: delegator.findList("TestingNode", EntityCondition.makeCondition("description", EntityOperator.LIKE, descriptionPrefix + "%"), null, null, null, false)) {
+ if (i % 2 == 0) {
+ GenericValue testing = delegator.create("Testing", "testingId", descriptionPrefix + ":" + node.get("testingNodeId"), "testingTypeId", typeId, "description", node.get("description"));
+ GenericValue member = delegator.makeValue("TestingNodeMember",
+ "testingNodeId", node.get("testingNodeId"),
+ "testingId", testing.get("testingId")
+ );
+
+ member.put("fromDate", now);
+ member.put("thruDate", UtilDateTime.getNextDayStart(now));
+ member.create();
+ }
+ i++;
+ }
+ }
+
/*
* Tests findByCondition and tests searching on a view-entity
*/
public void testCountViews() throws Exception {
- EntityCondition isNodeWithMember = EntityCondition.makeCondition("testingId", EntityOperator.NOT_EQUAL, GenericEntity.NULL_FIELD);
+ delegator.removeByCondition("Testing", EntityCondition.makeCondition("testingId", EntityOperator.LIKE, "TEST-COUNT-VIEW-%"));
+ flushAndRecreateTree("count-views");
+ createNodeMembers("TEST-COUNT-VIEW", "Testing Type #Count", "count-views");
+
+ EntityCondition isNodeWithMember = EntityCondition.makeCondition(
+ EntityCondition.makeCondition("testingId", EntityOperator.NOT_EQUAL, GenericEntity.NULL_FIELD),
+ EntityOperator.AND,
+ EntityCondition.makeCondition("description", EntityOperator.LIKE, "count-views:%")
+ );
List<GenericValue> nodeWithMembers = delegator.findList("TestingNodeAndMember", isNodeWithMember, null, null, null, false);
for (GenericValue v: nodeWithMembers) {
@@ -347,7 +404,7 @@ public class EntityTestSuite extends Ent
Debug.logInfo(field.toString() + " = " + ((value == null) ? "[null]" : value), module);
}
}
- long testingcount = delegator.findCountByCondition("Testing", null, null, null);
+ long testingcount = delegator.findCountByCondition("Testing", EntityCondition.makeCondition("testingTypeId", EntityOperator.EQUALS, "TEST-COUNT-VIEW"), null, null);
assertEquals("Number of views should equal number of created entities in the test.", testingcount, nodeWithMembers.size());
}
@@ -355,6 +412,20 @@ public class EntityTestSuite extends Ent
* Tests findByCondition and a find by distinct
*/
public void testFindDistinct() throws Exception {
+ delegator.removeByCondition("Testing", EntityCondition.makeCondition("testingTypeId", EntityOperator.LIKE, "TEST-DISTINCT-%"));
+ List<GenericValue> testingDistinctList = delegator.findList("Testing", EntityCondition.makeCondition("testingTypeId", EntityOperator.LIKE, "TEST-DISTINCT-%"), null, null, null, false);
+ assertEquals("No existing Testing entities for distinct", 0, testingDistinctList.size());
+ delegator.removeByCondition("TestingType", EntityCondition.makeCondition("testingTypeId", EntityOperator.LIKE, "TEST-DISTINCT-%"));
+ GenericValue testValue = delegator.findOne("TestingType", true, "testingTypeId", "TEST-DISTINCT-1");
+ assertNull("No pre-existing type value", testValue);
+ delegator.create("TestingType", "testingTypeId", "TEST-DISTINCT-1", "description", "Testing Type #Distinct-1");
+ testValue = delegator.findOne("TestingType", true, "testingTypeId", "TEST-DISTINCT-1");
+ assertNotNull("Found newly created type value", testValue);
+
+ delegator.create("Testing", "testingId", "TEST-DISTINCT-1", "testingTypeId", "TEST-DISTINCT-1", "testingSize", Long.valueOf(10), "comments", "No-comments");
+ delegator.create("Testing", "testingId", "TEST-DISTINCT-2", "testingTypeId", "TEST-DISTINCT-1", "testingSize", Long.valueOf(10), "comments", "Some-comments");
+ delegator.create("Testing", "testingId", "TEST-DISTINCT-3", "testingTypeId", "TEST-DISTINCT-1", "testingSize", Long.valueOf(9), "comments", "No-comments");
+ delegator.create("Testing", "testingId", "TEST-DISTINCT-4", "testingTypeId", "TEST-DISTINCT-1", "testingSize", Long.valueOf(11), "comments", "Some-comments");
List<EntityExpr> exprList = UtilMisc.toList(
EntityCondition.makeCondition("testingSize", EntityOperator.EQUALS, Long.valueOf(10)),
EntityCondition.makeCondition("comments", EntityOperator.EQUALS, "No-comments"));
@@ -411,7 +482,7 @@ public class EntityTestSuite extends Ent
/*
* Tests foreign key integrity by trying to remove an entity which has foreign-key dependencies. Should cause an exception.
*/
- public void testForeignKeyRemove() {
+ public void testForeignKeyRemove() throws Exception {
try {
String helperName = delegator.getEntityHelper("TestingNode").getHelperName();
Datasource datasourceInfo = EntityConfigUtil.getDatasource(helperName);
@@ -422,9 +493,14 @@ public class EntityTestSuite extends Ent
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
+ delegator.removeByCondition("TestingNode", EntityCondition.makeCondition("description", EntityOperator.LIKE, "foreign-key-remove #%"));
+ delegator.create("TestingNode", "testingNodeId", "TEST-FK-REMOVE-0", "description", "foreign-key-remove #0");
+ delegator.create("TestingNode", "testingNodeId", "TEST-FK-REMOVE-1", "primaryParentNodeId", "TEST-FK-REMOVE-0", "description", "foreign-key-remove #1");
+ delegator.create("TestingNode", "testingNodeId", "TEST-FK-REMOVE-2", "primaryParentNodeId", "TEST-FK-REMOVE-1", "description", "foreign-key-remove #2");
+ delegator.create("TestingNode", "testingNodeId", "TEST-FK-REMOVE-3", "primaryParentNodeId", "TEST-FK-REMOVE-2", "description", "foreign-key-remove #3");
GenericEntityException caught = null;
try {
- EntityCondition isLevel1 = EntityCondition.makeCondition("description", EntityOperator.EQUALS, "node-level #1");
+ EntityCondition isLevel1 = EntityCondition.makeCondition("description", EntityOperator.EQUALS, "foreign-key-remove #1");
delegator.removeByCondition("TestingNode", isLevel1);
} catch (GenericEntityException e) {
caught = e;
@@ -437,10 +513,13 @@ public class EntityTestSuite extends Ent
* Tests the .getRelatedOne method and removeAll for removing entities
*/
public void testRemoveNodeMemberAndTesting() throws Exception {
+ flushAndRecreateTree("rnmat");
+ createNodeMembers("TEST-RNMAT", "remove-node-member-and-testing", "rnmat");
//
// Find the testing entities tru the node member and build a list of them
//
- List<GenericValue> values = delegator.findList("TestingNodeMember", null, null, null, null, false);
+ EntityCondition isNodeWithMember = EntityCondition.makeCondition("testingId", EntityOperator.LIKE, "rnmat:%");
+ List<GenericValue> values = delegator.findList("TestingNodeMember", isNodeWithMember, null, null, null, false);
ArrayList<GenericValue> testings = new ArrayList<GenericValue>();
@@ -449,11 +528,11 @@ public class EntityTestSuite extends Ent
}
// and remove the nodeMember afterwards
delegator.removeAll(values);
- values = delegator.findList("TestingNodeMember", null, null, null, null, false);
+ values = delegator.findList("TestingNodeMember", isNodeWithMember, null, null, null, false);
assertEquals("No more Node Member entities", 0, values.size());
delegator.removeAll(testings);
- values = delegator.findList("Testing", null, null, null, null, false);
+ values = delegator.findList("Testing", EntityCondition.makeCondition("description", EntityOperator.LIKE, "rnmat:%"), null, null, null, false);
assertEquals("No more Testing entities", 0, values.size());
}
@@ -461,9 +540,11 @@ public class EntityTestSuite extends Ent
* Tests the storeByCondition operation
*/
public void testStoreByCondition() throws Exception {
+ flushAndRecreateTree("store-by-condition-a");
+ flushAndRecreateTree("store-by-condition-b");
// change the description of all the level1 nodes
- EntityCondition isLevel1 = EntityCondition.makeCondition("description", EntityOperator.EQUALS, "node-level #1");
- Map<String, String> fieldsToSet = UtilMisc.toMap("description", "node-level #1 (updated)");
+ EntityCondition isLevel1 = EntityCondition.makeCondition("description", EntityOperator.LIKE, "store-by-condition-a:%");
+ Map<String, String> fieldsToSet = UtilMisc.toMap("description", "store-by-condition-a:updated");
delegator.storeByCondition("TestingNode", fieldsToSet, isLevel1);
List<GenericValue> updatedNodes = delegator.findByAnd("TestingNode", fieldsToSet, null, false);
int n = updatedNodes.size();
@@ -474,10 +555,11 @@ public class EntityTestSuite extends Ent
* Tests the .removeByCondition method for removing entities directly
*/
public void testRemoveByCondition() throws Exception {
+ flushAndRecreateTree("remove-by-condition-a");
//
// remove all the level1 nodes by using a condition on the description field
//
- EntityCondition isLevel1 = EntityCondition.makeCondition("description", EntityOperator.EQUALS, "node-level #1 (updated)");
+ EntityCondition isLevel1 = EntityCondition.makeCondition("description", EntityOperator.LIKE, "remove-by-condition-a:1:%");
int n = delegator.removeByCondition("TestingNode", isLevel1);
assertTrue("testRemoveByCondition nodes > 0", n > 0);
}
@@ -486,11 +568,16 @@ public class EntityTestSuite extends Ent
* Test the .removeByPrimaryKey by using findByCondition and then retrieving the GenericPk from a GenericValue
*/
public void testRemoveByPK() throws Exception {
+ flushAndRecreateTree("remove-by-pk");
//
// Find all the root nodes,
// delete them their primary key
//
- EntityCondition isRoot = EntityCondition.makeCondition("primaryParentNodeId", EntityOperator.EQUALS, GenericEntity.NULL_FIELD);
+ EntityCondition isRoot = EntityCondition.makeCondition(
+ EntityCondition.makeCondition("description", EntityOperator.LIKE, "remove-by-pk:%"),
+ EntityOperator.AND,
+ EntityCondition.makeCondition("primaryParentNodeId", EntityOperator.NOT_EQUAL, GenericEntity.NULL_FIELD)
+ );
List<GenericValue> rootValues = delegator.findList("TestingNode", isRoot, UtilMisc.toSet("testingNodeId"), null, null, false);
for (GenericValue value: rootValues) {
@@ -501,7 +588,7 @@ public class EntityTestSuite extends Ent
// no more TestingNode should be in the data base anymore.
- List<GenericValue> testingNodes = delegator.findList("TestingNode", null, null, null, null, false);
+ List<GenericValue> testingNodes = delegator.findList("TestingNode", isRoot, null, null, null, false);
assertEquals("No more TestingNode after removing the roots", 0, testingNodes.size());
}
@@ -509,28 +596,38 @@ public class EntityTestSuite extends Ent
* Tests the .removeAll method only.
*/
public void testRemoveType() throws Exception {
- List<GenericValue> values = delegator.findList("TestingType", null, null, null, null, false);
+ List<GenericValue> values = delegator.findList("TestingRemoveAll", null, null, null, null, false);
+ delegator.removeAll(values);
+ values = delegator.findList("TestingRemoveAll", null, null, null, null, false);
+ assertEquals("No more TestingRemoveAll: setup", 0, values.size());
+ for (int i = 0; i < 10; i++) {
+ delegator.create("TestingRemoveAll", "testingRemoveAllId", "prefix:" + i);
+ }
+ values = delegator.findList("TestingRemoveAll", null, null, null, null, false);
+ assertEquals("No more TestingRemoveAll: create", 10, values.size());
+
delegator.removeAll(values);
// now make sure there are no more of these
- values = delegator.findList("TestingType", null, null, null, null, false);
- assertEquals("No more TestingTypes after remove all", 0, values.size());
+ values = delegator.findList("TestingRemoveAll", null, null, null, null, false);
+ assertEquals("No more TestingRemoveAll: finish", 0, values.size());
}
/*
* This test will create a large number of unique items and add them to the delegator at once
*/
public void testCreateManyAndStoreAtOnce() throws Exception {
+ EntityCondition condition = EntityCondition.makeCondition("testingId", EntityOperator.LIKE, "T1-%");
try {
List<GenericValue> newValues = new LinkedList<GenericValue>();
for (int i = 0; i < TEST_COUNT; i++) {
newValues.add(delegator.makeValue("Testing", "testingId", getTestId("T1-", i)));
}
delegator.storeAll(newValues);
- List<GenericValue> newlyCreatedValues = delegator.findList("Testing", null, null, UtilMisc.toList("testingId"), null, false);
+ List<GenericValue> newlyCreatedValues = delegator.findList("Testing", condition, null, UtilMisc.toList("testingId"), null, false);
assertEquals("Test to create " + TEST_COUNT + " and store all at once", TEST_COUNT, newlyCreatedValues.size());
} finally {
- List<GenericValue> newlyCreatedValues = delegator.findList("Testing", null, null, UtilMisc.toList("testingId"), null, false);
+ List<GenericValue> newlyCreatedValues = delegator.findList("Testing", condition, null, UtilMisc.toList("testingId"), null, false);
delegator.removeAll(newlyCreatedValues);
}
}
@@ -539,39 +636,56 @@ public class EntityTestSuite extends Ent
* This test will create a large number of unique items and add them to the delegator at once
*/
public void testCreateManyAndStoreOneAtATime() throws Exception {
- for (int i = 0; i < TEST_COUNT; i++) {
- delegator.create(delegator.makeValue("Testing", "testingId", getTestId("T2-", i)));
+ EntityCondition condition = EntityCondition.makeCondition("testingId", EntityOperator.LIKE, "T2-%");
+ try {
+ for (int i = 0; i < TEST_COUNT; i++) {
+ delegator.create(delegator.makeValue("Testing", "testingId", getTestId("T2-", i)));
+ }
+ List<GenericValue> newlyCreatedValues = delegator.findList("Testing", condition, null, UtilMisc.toList("testingId"), null, false);
+ assertEquals("Test to create " + TEST_COUNT + " and store one at a time: ", TEST_COUNT, newlyCreatedValues.size());
+ } finally {
+ List<GenericValue> newlyCreatedValues = delegator.findList("Testing", condition, null, UtilMisc.toList("testingId"), null, false);
+ delegator.removeAll(newlyCreatedValues);
}
- List<GenericValue> newlyCreatedValues = delegator.findList("Testing", null, null, UtilMisc.toList("testingId"), null, false);
- assertEquals("Test to create " + TEST_COUNT + " and store one at a time: ", TEST_COUNT, newlyCreatedValues.size());
}
/*
* This test will use the large number of unique items from above and test the EntityListIterator looping through the list
*/
public void testEntityListIterator() throws Exception {
- boolean beganTransaction = false;
+ EntityCondition condition = EntityCondition.makeCondition("testingId", EntityOperator.LIKE, "T3-%");
try {
- beganTransaction = TransactionUtil.begin();
- EntityListIterator iterator = delegator.find("Testing", EntityCondition.makeCondition("testingId", EntityOperator.LIKE, "T2-%"), null, null, UtilMisc.toList("testingId"), null);
- assertNotNull("Test if EntityListIterator was created: ", iterator);
-
- int i = 0;
- GenericValue item = iterator.next();
- while (item != null) {
- assertEquals("Testing if iterated data matches test data (row " + i + "): ", getTestId("T2-", i), item.getString("testingId"));
- item = iterator.next();
- i++;
+ List<GenericValue> newValues = new LinkedList<GenericValue>();
+ for (int i = 0; i < TEST_COUNT; i++) {
+ newValues.add(delegator.makeValue("Testing", "testingId", getTestId("T3-", i)));
+ }
+ delegator.storeAll(newValues);
+ List<GenericValue> newlyCreatedValues = delegator.findList("Testing", condition, null, UtilMisc.toList("testingId"), null, false);
+ assertEquals("Test to create " + TEST_COUNT + " and store all at once", TEST_COUNT, newlyCreatedValues.size());
+ boolean beganTransaction = false;
+ try {
+ beganTransaction = TransactionUtil.begin();
+ EntityListIterator iterator = delegator.find("Testing", condition, null, null, UtilMisc.toList("testingId"), null);
+ assertNotNull("Test if EntityListIterator was created: ", iterator);
+
+ int i = 0;
+ GenericValue item = iterator.next();
+ while (item != null) {
+ assertEquals("Testing if iterated data matches test data (row " + i + "): ", getTestId("T3-", i), item.getString("testingId"));
+ item = iterator.next();
+ i++;
+ }
+ assertEquals("Test if EntitlyListIterator iterates exactly " + TEST_COUNT + " times: " , TEST_COUNT, i);
+ iterator.close();
+ } catch (GenericEntityException e) {
+ TransactionUtil.rollback(beganTransaction, "GenericEntityException occurred while iterating with EntityListIterator", e);
+ assertTrue("GenericEntityException:" + e.toString(), false);
+ return;
+ } finally {
+ TransactionUtil.commit(beganTransaction);
}
- assertEquals("Test if EntitlyListIterator iterates exactly " + TEST_COUNT + " times: " , TEST_COUNT, i);
- iterator.close();
- } catch (GenericEntityException e) {
- TransactionUtil.rollback(beganTransaction, "GenericEntityException occurred while iterating with EntityListIterator", e);
- assertTrue("GenericEntityException:" + e.toString(), false);
- return;
} finally {
- TransactionUtil.commit(beganTransaction);
- List<GenericValue> entitiesToRemove = delegator.findList("Testing", EntityCondition.makeCondition("testingId", EntityOperator.LIKE, "T2-%"), null, null, null, false);
+ List<GenericValue> entitiesToRemove = delegator.findList("Testing", condition, null, null, null, false);
delegator.removeAll(entitiesToRemove);
}
}
@@ -841,7 +955,7 @@ public class EntityTestSuite extends Ent
"<Testing testingId=\"T2\" testingTypeId=\"JUNIT-TEST2\" testingName=\"Second test\" testingSize=\"20\" testingDate=\"2010-02-01 00:00:00\"/>";
EntitySaxReader reader = new EntitySaxReader(delegator);
long numberLoaded = reader.parse(xmlContentLoad);
- assertEquals("Create Entity loaded ", numberLoaded, 4);
+ assertEquals("Create Entity loaded ", 4, numberLoaded);
GenericValue t1 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T1"), false);
GenericValue t2 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T2"), true);
assertNotNull("Create Testing(T1)", t1);
@@ -859,39 +973,47 @@ public class EntityTestSuite extends Ent
public void testEntitySaxReaderCreateSkip() throws Exception {
String xmlContentLoad =
- "<create>" +
- " <Testing testingId=\"T1\" testingName=\"First test update\" testingSize=\"20\"/>" +
- "</create>";
+ "<TestingType testingTypeId=\"reader-create-skip\" description=\"reader create skip\"/>" +
+ "<Testing testingId=\"reader-create-skip\" testingTypeId=\"reader-create-skip\" testingName=\"reader create skip\" testingSize=\"10\" testingDate=\"2010-01-01 00:00:00\"/>";
EntitySaxReader reader = new EntitySaxReader(delegator);
long numberLoaded = reader.parse(xmlContentLoad);
- assertEquals("Create Skip Entity loaded ", numberLoaded, 1);
- GenericValue t1 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T1"), false);
+ xmlContentLoad =
+ "<create>" +
+ " <Testing testingId=\"reader-create-skip\" testingName=\"reader create skip updated\" testingSize=\"20\" testingDate=\"2012-02-02 02:02:02\"/>" +
+ "</create>";
+ reader = new EntitySaxReader(delegator);
+ numberLoaded += reader.parse(xmlContentLoad);
+ assertEquals("Create Skip Entity loaded ", 3, numberLoaded);
+ GenericValue t1 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "reader-create-skip"), false);
assertNotNull("Create Skip Testing(T1)", t1);
- assertEquals("Create Skip Testing(T1).testingTypeId", "JUNIT-TEST", t1.getString("testingTypeId"));
- assertEquals("Create Skip Testing(T1).testingName", "First test", t1.getString("testingName"));
+ assertEquals("Create Skip Testing(T1).testingTypeId", "reader-create-skip", t1.getString("testingTypeId"));
+ assertEquals("Create Skip Testing(T1).testingName", "reader create skip", t1.getString("testingName"));
assertEquals("Create Skip Testing(T1).testingSize", Long.valueOf(10), t1.getLong("testingSize"));
assertEquals("Create Skip Testing(T1).testingDate", UtilDateTime.toTimestamp("01/01/2010 00:00:00"), t1.getTimestamp("testingDate"));
}
public void testEntitySaxReaderUpdate() throws Exception {
String xmlContentLoad =
+ "<TestingType testingTypeId=\"create-update\" description=\"create update\"/>" +
+ "<TestingType testingTypeId=\"create-updated\" description=\"create update updated\"/>" +
+ "<Testing testingId=\"create-update-T3\" testingTypeId=\"create-update\" testingName=\"Test 3\" testingSize=\"10\" testingDate=\"2010-01-01 00:00:00\"/>" +
"<create-update>" +
- " <Testing testingId=\"T1\" testingName=\"First test update\" testingSize=\"20\"/>" +
- " <Testing testingId=\"T3\" testingTypeId=\"JUNIT-TEST\" testingName=\"Third test\" testingSize=\"30\" testingDate=\"2010-03-01 00:00:00\"/>" +
+ " <Testing testingId=\"create-update-T1\" testingTypeId=\"create-update\" testingName=\"First test update\" testingSize=\"20\" testingDate=\"2010-01-01 00:00:00\"/>" +
+ " <Testing testingId=\"create-update-T3\" testingTypeId=\"create-updated\" testingName=\"Third test\" testingSize=\"30\" testingDate=\"2010-03-01 00:00:00\"/>" +
"</create-update>";
EntitySaxReader reader = new EntitySaxReader(delegator);
long numberLoaded = reader.parse(xmlContentLoad);
- assertEquals("Update Entity loaded ", numberLoaded, 2);
- GenericValue t1 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T1"), false);
- GenericValue t3 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T3"), false);
+ assertEquals("Update Entity loaded ", 5, numberLoaded);
+ GenericValue t1 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "create-update-T1"), false);
+ GenericValue t3 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "create-update-T3"), false);
assertNotNull("Update Testing(T1)", t1);
- assertEquals("Update Testing(T1).testingTypeId", "JUNIT-TEST", t1.getString("testingTypeId"));
+ assertEquals("Update Testing(T1).testingTypeId", "create-update", t1.getString("testingTypeId"));
assertEquals("Update Testing(T1).testingName", "First test update", t1.getString("testingName"));
assertEquals("Update Testing(T1).testingSize", Long.valueOf(20), t1.getLong("testingSize"));
assertEquals("Update Testing(T1).testingDate", UtilDateTime.toTimestamp("01/01/2010 00:00:00"), t1.getTimestamp("testingDate"));
assertNotNull("Update Testing(T3)", t3);
- assertEquals("Update Testing(T3).testingTypeId", "JUNIT-TEST", t3.getString("testingTypeId"));
+ assertEquals("Update Testing(T3).testingTypeId", "create-updated", t3.getString("testingTypeId"));
assertEquals("Update Testing(T3).testingName", "Third test", t3.getString("testingName"));
assertEquals("Update Testing(T3).testingSize", Long.valueOf(30), t3.getLong("testingSize"));
assertEquals("Update Testing(T3).testingDate", UtilDateTime.toTimestamp("03/01/2010 00:00:00"), t3.getTimestamp("testingDate"));
@@ -899,23 +1021,25 @@ public class EntityTestSuite extends Ent
public void testEntitySaxReaderReplace() throws Exception {
String xmlContentLoad =
+ "<TestingType testingTypeId=\"create-replace\" description=\"reader create skip\"/>" +
+ "<Testing testingTypeId=\"create-replace\" testingId=\"create-replace-T1\" testingName=\"First test\" testingSize=\"10\" testingDate=\"2010-01-01 00:00:00\"/>" +
"<create-replace>" +
- " <Testing testingTypeId=\"JUNIT-TEST\" testingId=\"T1\" testingName=\"First test replace\" />" +
+ " <Testing testingTypeId=\"create-replace\" testingId=\"create-replace-T1\" testingName=\"First test replace\" />" +
"</create-replace>" +
- "<Testing testingId=\"T2\" testingName=\"Second test update\"/>";
+ "<Testing testingTypeId=\"create-replace\" testingId=\"create-replace-T2\" testingName=\"Second test update\" testingSize=\"20\" testingDate=\"2010-02-01 00:00:00\"/>";
EntitySaxReader reader = new EntitySaxReader(delegator);
long numberLoaded = reader.parse(xmlContentLoad);
- assertEquals("Replace Entity loaded ", numberLoaded, 2);
- GenericValue t1 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T1"), false);
- GenericValue t2 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T2"), false);
+ assertEquals("Replace Entity loaded ", 4, numberLoaded);
+ GenericValue t1 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "create-replace-T1"), false);
+ GenericValue t2 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "create-replace-T2"), false);
assertNotNull("Replace Testing(T1)", t1);
- assertEquals("Replace Testing(T1).testingTypeId", "JUNIT-TEST", t1.getString("testingTypeId"));
+ assertEquals("Replace Testing(T1).testingTypeId", "create-replace", t1.getString("testingTypeId"));
assertEquals("Replace Testing(T1).testingName", "First test replace", t1.getString("testingName"));
assertNull("Replace Testing(T1).testingSize", t1.getLong("testingSize"));
assertNull("Replace Testing(T1).testingDate", t1.getTimestamp("testingDate"));
assertNotNull("Replace Testing(T2)", t2);
- assertEquals("Replace Testing(T2).testingTypeId", "JUNIT-TEST2", t2.getString("testingTypeId"));
+ assertEquals("Replace Testing(T2).testingTypeId", "create-replace", t2.getString("testingTypeId"));
assertEquals("Replace Testing(T2).testingName", "Second test update", t2.getString("testingName"));
assertEquals("Replace Testing(T2).testingSize", Long.valueOf(20), t2.getLong("testingSize"));
assertEquals("Replace Testing(T2).testingDate", UtilDateTime.toTimestamp("02/01/2010 00:00:00"), t2.getTimestamp("testingDate"));
@@ -932,7 +1056,7 @@ public class EntityTestSuite extends Ent
"</delete>";
EntitySaxReader reader = new EntitySaxReader(delegator);
long numberLoaded = reader.parse(xmlContentLoad);
- assertEquals("Delete Entity loaded ", numberLoaded, 5);
+ assertEquals("Delete Entity loaded ", 5, numberLoaded);
GenericValue t1 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T1"), false);
GenericValue t2 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T2"), false);
GenericValue t3 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T2"), false);
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java Mon Jul 7 06:50:24 2014
@@ -40,6 +40,7 @@ import org.ofbiz.entity.EntityCryptoExce
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.transaction.TransactionUtil;
+import org.ofbiz.entity.model.ModelField.EncryptMethod;
public final class EntityCrypto {
@@ -65,7 +66,13 @@ public final class EntityCrypto {
}
/** Encrypts an Object into an encrypted hex encoded String */
+ @Deprecated
public String encrypt(String keyName, Object obj) throws EntityCryptoException {
+ return encrypt(keyName, EncryptMethod.TRUE, obj);
+ }
+
+ /** Encrypts an Object into an encrypted hex encoded String */
+ public String encrypt(String keyName, EncryptMethod encryptMethod, Object obj) throws EntityCryptoException {
try {
SecretKey key = this.findKey(keyName, handlers[0]);
if (key == null) {
@@ -91,7 +98,7 @@ public final class EntityCrypto {
}
}
}
- return handlers[0].encryptValue(key, UtilObject.getBytes(obj));
+ return handlers[0].encryptValue(encryptMethod, key, UtilObject.getBytes(obj));
} catch (GeneralException e) {
throw new EntityCryptoException(e);
}
@@ -212,7 +219,7 @@ public final class EntityCrypto {
protected abstract String encodeKey(SecretKey key) throws GeneralException;
protected abstract byte[] decryptValue(SecretKey key, String encryptedString) throws GeneralException;
- protected abstract String encryptValue(SecretKey key, byte[] objBytes) throws GeneralException;
+ protected abstract String encryptValue(EncryptMethod encryptMethod, SecretKey key, byte[] objBytes) throws GeneralException;
}
protected static abstract class LegacyStorageHandler extends StorageHandler {
@@ -232,7 +239,7 @@ public final class EntityCrypto {
}
@Override
- protected String encryptValue(SecretKey key, byte[] objBytes) throws GeneralException {
+ protected String encryptValue(EncryptMethod encryptMethod, SecretKey key, byte[] objBytes) throws GeneralException {
return StringUtil.toHexString(DesCrypt.encrypt(key, objBytes));
}
};
@@ -306,11 +313,19 @@ public final class EntityCrypto {
}
@Override
- protected String encryptValue(SecretKey key, byte[] objBytes) throws GeneralException {
- Random random = new Random();
- // random length 5-16
- byte[] saltBytes = new byte[5 + random.nextInt(11)];
- random.nextBytes(saltBytes);
+ protected String encryptValue(EncryptMethod encryptMethod, SecretKey key, byte[] objBytes) throws GeneralException {
+ byte[] saltBytes;
+ switch (encryptMethod) {
+ case SALT:
+ Random random = new Random();
+ // random length 5-16
+ saltBytes = new byte[5 + random.nextInt(11)];
+ random.nextBytes(saltBytes);
+ break;
+ default:
+ saltBytes = new byte[0];
+ break;
+ }
byte[] allBytes = new byte[1 + saltBytes.length + objBytes.length];
allBytes[0] = (byte) saltBytes.length;
System.arraycopy(saltBytes, 0, allBytes, 1, saltBytes.length);
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java Mon Jul 7 06:50:24 2014
@@ -181,9 +181,6 @@ public class EntityListIterator implemen
value.setDelegator(this.delegator);
value.synchronizedWithDatasource();
this.haveMadeValue = true;
- if (delegator != null) {
- delegator.decryptFields(value);
- }
return value;
}
@@ -498,7 +495,7 @@ public class EntityListIterator implemen
efo = new EntityFindOptions();
efo.setDistinct(distinctQuery);
}
- resultSize = (int) genericDAO.selectCountByCondition(modelEntity, whereCondition, havingCondition, selectFields, efo);
+ resultSize = (int) genericDAO.selectCountByCondition(sqlp.getDelegator(), modelEntity, whereCondition, havingCondition, selectFields, efo);
}
return resultSize;
} else if (this.last()) {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/testdef/entitytests.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/testdef/entitytests.xml?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/testdef/entitytests.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/testdef/entitytests.xml Mon Jul 7 06:50:24 2014
@@ -22,6 +22,7 @@ under the License.
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
<test-case case-name="entity-tests"><junit-test-suite class-name="org.ofbiz.entity.test.EntityTestSuite"/></test-case>
+ <test-case case-name="entity-crypto-tests"><junit-test-suite class-name="org.ofbiz.entity.test.EntityCryptoTestSuite"/></test-case>
<test-case case-name="entity-util-properties-tests">
<simple-method-test location="component://entity/script/org/ofbiz/entity/test/EntityUtilPropertiesTests.xml"/>
</test-case>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/sql/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/sql/build.xml?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/sql/build.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/sql/build.xml Mon Jul 7 06:50:24 2014
@@ -33,10 +33,6 @@ under the License.
<fileset dir="../base/lib" includes="*.jar"/>
<fileset dir="../base/build/lib" includes="*.jar"/>
</path>
- <patternset id="src-dirs">
- <include name="build/gen-src/javacc"/>
- <include name="build/gen-src/jjtree"/>
- </patternset>
<path id="test.class.path">
<path refid="local.class.path"/>
<fileset dir="../base/lib" includes="*.jar"/>
@@ -51,6 +47,11 @@ under the License.
<file name="org/ofbiz/sql/test/SelectTest.java"/>
<file name="org/ofbiz/sql/test/SQLTest.java"/>
</filelist>
+ <patternset id="cobertura-src-dirs">
+ <include name="build/gen-src/javacc"/>
+ <include name="build/gen-src/jjtree"/>
+ <include name="src"/>
+ </patternset>
<!-- ================================================================== -->
<!-- Compilation of the source files -->
@@ -61,7 +62,14 @@ under the License.
</target>
<target name="classes" depends="prepare,gen-src">
- <javac16/>
+ <javac17>
+ <sourcepath>
+ <dirset dir="build/gen-src">
+ <include name="javacc"/>
+ <include name="jjtree"/>
+ </dirset>
+ </sourcepath>
+ </javac17>
</target>
<target name="jar" depends="classes">
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/start/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/start/build.xml?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/start/build.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/start/build.xml Mon Jul 7 06:50:24 2014
@@ -34,7 +34,7 @@ under the License.
<target name="classes" depends="prepare">
<!-- compile start -->
- <javac16 destdir="${build.dir}/classes" srcdir="${src.dir}"/>
+ <javac17 destdir="${build.dir}/classes" srcdir="${src.dir}"/>
</target>
<target name="jar" depends="classes">
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/start/src/org/ofbiz/base/start/setup.properties
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/start/src/org/ofbiz/base/start/setup.properties?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/start/src/org/ofbiz/base/start/setup.properties (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/start/src/org/ofbiz/base/start/setup.properties Mon Jul 7 06:50:24 2014
@@ -43,6 +43,7 @@ ofbiz.container.config=specialpurpose/ap
# --- StartupLoader implementations to load (in order)
ofbiz.start.loader1=org.ofbiz.base.container.ContainerLoader
+ofbiz.start.loader1.loaders=setup
# -- Enable the shutdown hook
#ofbiz.enable.hook=false
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/WebAppUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/WebAppUtil.java?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/WebAppUtil.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/WebAppUtil.java Mon Jul 7 06:50:24 2014
@@ -66,7 +66,7 @@ public final class WebAppUtil {
String servletMapping = null;
WebXml webXml = getWebXml(webAppInfo);
for (ServletDef servletDef : webXml.getServlets().values()) {
- if ("org.ofbiz.webapp.control.ControlServlet".equals(servletDef.getServletClass())) {
+ if ("org.ofbiz.webapp.control.ControlServlet".equals(servletDef.getServletClass()) || "org.ofbiz.product.category.SeoControlServlet".equals(servletDef.getServletClass())) {
String servletName = servletDef.getServletName();
// Catalina servlet mappings: key = url-pattern, value = servlet-name.
for (Entry<String, String> entry : webXml.getServletMappings().entrySet()) {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java Mon Jul 7 06:50:24 2014
@@ -711,7 +711,8 @@ public class WebToolsServices {
javaNameMap.put("type", (field.getType()) != null ? field.getType() : null);
javaNameMap.put("javaType", (field.getType() != null && type != null) ? type.getJavaType() : "Undefined");
javaNameMap.put("sqlType", (type != null && type.getSqlType() != null) ? type.getSqlType() : "Undefined");
- javaNameMap.put("encrypted", field.getEncrypt());
+ javaNameMap.put("encrypted", field.getEncryptMethod().isEncrypted());
+ javaNameMap.put("encryptMethod", field.getEncryptMethod());
javaNameList.add(javaNameMap);
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.groovy?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.groovy Mon Jul 7 06:50:24 2014
@@ -34,7 +34,7 @@ mgr = delegator.getModelGroupReader();
groups = mgr.getGroupNames(delegator.getDelegatorName());
if (sqlCommand && selGroup) {
- du = new SQLProcessor(delegator.getGroupHelperInfo(selGroup));
+ du = new SQLProcessor(delegator, delegator.getGroupHelperInfo(selGroup));
try {
if (sqlCommand.toUpperCase().startsWith("SELECT")) {
rs = du.executeQuery(sqlCommand);
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java Mon Jul 7 06:50:24 2014
@@ -49,6 +49,7 @@ import freemarker.template.Template;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
+import freemarker.template.Version;
/**
* Widget Library - Screen model HTML class.
@@ -58,10 +59,14 @@ public class HtmlWidget extends ModelScr
public static final String module = HtmlWidget.class.getName();
private static final UtilCache<String, Template> specialTemplateCache = UtilCache.createUtilCache("widget.screen.template.ftl.general", 0, 0, false);
- protected static Configuration specialConfig = FreeMarkerWorker.makeConfiguration(FreeMarkerWorker.configureBeansWrapper(new ExtendedWrapper()));
+ protected static Configuration specialConfig = FreeMarkerWorker.makeConfiguration(FreeMarkerWorker.configureBeansWrapper(new ExtendedWrapper(FreeMarkerWorker.version)));
// not sure if this is the best way to get FTL to use my fancy MapModel derivative, but should work at least...
public static class ExtendedWrapper extends BeansWrapper {
+ public ExtendedWrapper(Version version) {
+ super(version);
+ }
+
@SuppressWarnings("unchecked")
@Override
public TemplateModel wrap(Object object) throws TemplateModelException {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/macros.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/macros.xml?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/macros.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/macros.xml Mon Jul 7 06:50:24 2014
@@ -23,12 +23,12 @@ under the License.
</condition>
<fail unless="antatleast171" message="Please upgrade ant to at least 1.7.1"/>
- <condition property="javaatleast16">
+ <condition property="javaatleast17">
<not>
- <matches pattern="^1\.[0-5]($|\..*)" string="${ant.java.version}"/>
+ <matches pattern="^1\.[0-6]($|\..*)" string="${ant.java.version}"/>
</not>
</condition>
- <fail unless="javaatleast16" message="Please upgrade java to at least 1.6"/>
+ <fail unless="javaatleast17" message="Please upgrade java to at least 1.7"/>
<dirname property="ofbiz.home.dir" file="${ant.file.Ant - Macros}"/>
<macrodef name="iterate">
@@ -42,12 +42,6 @@ under the License.
</sequential>
</macrodef>
- <path id="src-path">
- <dirset dir=".">
- <patternset refid="src-dirs"/>
- </dirset>
- </path>
- <patternset id="src-dirs"/>
<patternset id="src.inc.set">
<include name="**/*.java"/>
</patternset>
@@ -69,6 +63,13 @@ under the License.
<fileset dir="${ofbiz.home.dir}/framework/base/lib/scripting/" includes="*.jar"/>
<pathelement location="${ofbiz.home.dir}/framework/base/lib/ant/ant-apache-bsf-1.7.1.jar"/>
</path>
+ <path id="cobertura.class.path">
+ <pathelement location="${ofbiz.home.dir}/framework/base/lib/cobertura-1.9.4.1.jar" />
+ <pathelement location="${ofbiz.home.dir}/framework/base/lib/log4j-1.2.17.jar" />
+ <pathelement location="${ofbiz.home.dir}/framework/base/lib/scripting/asm-3.2.jar" />
+ <pathelement location="${ofbiz.home.dir}/framework/base/lib/scripting/asm-tree-3.2.jar" />
+ <pathelement location="${ofbiz.home.dir}/framework/base/lib/scripting/jakarta-oro-2.0.8.jar" />
+ </path>
<path id="local.class.path"/>
<presetdef name="default-javac">
<javac debug="on" deprecation="on" destdir="${build.dir}/classes" srcdir="${src.dir}" classpathref="local.class.path">
@@ -77,8 +78,8 @@ under the License.
</javac>
</presetdef>
- <presetdef name="javac16">
- <default-javac compiler="javac1.6" target="1.6" source="1.6" encoding="UTF-8" sourcepathref="src-path" includeantruntime="false">
+ <presetdef name="javac17">
+ <default-javac compiler="javac1.7" target="1.7" source="1.7" encoding="UTF-8" includeantruntime="false">
<compilerarg value="-Xlint:-path"/>
<!--
Please leave this line here. It makes it easier to enable/disable it.
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/LICENSE
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/LICENSE?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/LICENSE (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/LICENSE Mon Jul 7 06:50:24 2014
@@ -16,9 +16,9 @@ specialpurpose/cmssite/template/docbook/
specialpurpose/cmssite/template/docbook/extensions/xalan27.jar
specialpurpose/cmssite/template/docbook/extensions/webhelpindexer.jar
specialpurpose/googlecheckout/lib/checkout-sdk-0.8.8.jar
-specialpurpose/lucene/lib/lucene-analyzers-common-4.7.0.jar
-specialpurpose/lucene/lib/lucene-core-4.7.0.jar
-specialpurpose/lucene/lib/lucene-queryparser-4.7.0.jar
+specialpurpose/lucene/lib/lucene-analyzers-common-4.9.0.jar
+specialpurpose/lucene/lib/lucene-core-4.9.0.jar
+specialpurpose/lucene/lib/lucene-queryparser-4.9.0.jar
=========================================================================
Apache License
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/appserver/config/ofbiz-containers.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/appserver/config/ofbiz-containers.xml?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/appserver/config/ofbiz-containers.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/appserver/config/ofbiz-containers.xml Mon Jul 7 06:50:24 2014
@@ -20,6 +20,6 @@ under the License.
<ofbiz-containers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd">
- <container name="component-container" class="org.ofbiz.base.container.ComponentContainer"/>
- <container name="generate-container" class="org.ofbiz.appservers.GenerateContainer"/>
+ <container name="component-container" loaders="setup" class="org.ofbiz.base.container.ComponentContainer"/>
+ <container name="generate-container" loaders="setup" class="org.ofbiz.appservers.GenerateContainer"/>
</ofbiz-containers>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/index.jsp
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/index.jsp?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/index.jsp (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/index.jsp Mon Jul 7 06:50:24 2014
@@ -17,4 +17,4 @@ specific language governing permissions
under the License.
--%>
-<%pageContext.forward("control/main");%>
+<%response.sendRedirect("main");%>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/lucene/src/org/ofbiz/content/search/SearchWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/lucene/src/org/ofbiz/content/search/SearchWorker.java?rev=1608347&r1=1608346&r2=1608347&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/lucene/src/org/ofbiz/content/search/SearchWorker.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/lucene/src/org/ofbiz/content/search/SearchWorker.java Mon Jul 7 06:50:24 2014
@@ -42,7 +42,7 @@ public class SearchWorker {
public static final String module = SearchWorker.class.getName();
- public static final Version LUCENE_VERSION = Version.LUCENE_46;
+ public static final Version LUCENE_VERSION = Version.LUCENE_4_9;
public static void indexContentTree(LocalDispatcher dispatcher, Delegator delegator, String siteId) throws Exception {
GenericValue content = delegator.makeValue("Content", UtilMisc.toMap("contentId", siteId));