Author: areshetnyak
Date: 2009-11-12 06:20:31 -0500 (Thu, 12 Nov 2009)
New Revision: 594
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
Log:
EXOJCR-201 : The JDBCCacheLoaderTest was changed.
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-12
11:14:23 UTC (rev 593)
+++
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-12
11:20:31 UTC (rev 594)
@@ -312,6 +312,26 @@
private TransientPropertyData addDbProperty(WorkspaceStorageConnection conn, QPath
nodePath, String nodeId,
InternalQName propertyName, Object propertyValue, boolean multiValued) throws
Exception
{
+ TransientPropertyData propData = createProperty(nodePath, nodeId, propertyName,
propertyValue, multiValued);
+
+ conn.add(propData);
+
+ return propData;
+ }
+
+ /**
+ * Create Property.
+ *
+ * @param nodePath QPath
+ * @param nodeId String
+ * @param propertyName InternalQName
+ * @param propertyValue Object
+ * @return TransientPropertyData
+ * @throws Exception
+ */
+ private TransientPropertyData createProperty(QPath nodePath, String nodeId,
+ InternalQName propertyName, Object propertyValue, boolean multiValued) throws
Exception
+ {
String propId = IdGenerator.generate();
QPath propPath = QPath.makeChildPath(nodePath, propertyName);
TransientPropertyData propData =
@@ -348,8 +368,6 @@
}
}
- conn.add(propData);
-
return propData;
}
@@ -388,11 +406,8 @@
public void testAddProperty() throws Exception
{
// prepare
- WorkspaceStorageConnection connection = persistentContainer.openConnection();
+ TransientPropertyData propData = createProperty(Constants.ROOT_PATH,
Constants.ROOT_UUID, Constants.JCR_DATA, "JCR DATA VALUE", false);
- TransientPropertyData propData = addDbProperty(connection, Constants.ROOT_PATH,
Constants.ROOT_UUID, Constants.JCR_DATA, "JCR DATA VALUE", false);
- connection.commit();
-
List<Modification> modifications = new ArrayList<Modification>();
modifications.addAll(addProperty(propData));
@@ -400,7 +415,7 @@
loader.put(modifications);
// tests it
- connection = persistentContainer.openConnection();
+ WorkspaceStorageConnection connection = persistentContainer.openConnection();
PropertyData destPropData = (PropertyData)
connection.getItemData(propData.getIdentifier());
@@ -485,26 +500,17 @@
{
// prepare
- initJCRRoot();
+ WorkspaceStorageConnection connection = persistentContainer.openConnection();
- String propId = IdGenerator.generate();
- QPath propPath = QPath.makeChildPath(Constants.ROOT_PATH, Constants.JCR_DATA);
- TransientPropertyData propData = new TransientPropertyData(propPath, propId, 1, 1,
Constants.ROOT_UUID, false);
- String propValue = "JCR DATA VALUE";
- propData.setValue(new TransientValueData(propValue));
+ TransientPropertyData propData = addDbProperty(connection, Constants.ROOT_PATH,
Constants.ROOT_UUID, Constants.JCR_DATA, "JCR DATA VALUE", false);
+ connection.commit();
- List<Modification> modifications = new ArrayList<Modification>();
-
- modifications.addAll(addProperty(propData));
-
- loader.put(modifications);
-
// tests it
- WorkspaceStorageConnection connection = persistentContainer.openConnection();
+ connection = persistentContainer.openConnection();
- PropertyData destPropData = (PropertyData) connection.getItemData(propId);
+ PropertyData destPropData = (PropertyData)
connection.getItemData(propData.getIdentifier());
- Map<Object, Object> attrebutes =
loader.get(Fqn.fromString("/"+JBossCacheStorage.PROPS + "/" +
propId));
+ Map<Object, Object> attrebutes =
loader.get(Fqn.fromString("/"+JBossCacheStorage.PROPS + "/" +
propData.getIdentifier()));
assertNotNull(attrebutes);