exo-jcr SVN: r5437 - in jcr/branches/1.15.x/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-11 04:17:07 -0500 (Wed, 11 Jan 2012)
New Revision: 5437
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java
Log:
EXOJCR-1697: Improve SQL access
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java 2012-01-11 09:16:01 UTC (rev 5436)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java 2012-01-11 09:17:07 UTC (rev 5437)
@@ -128,6 +128,7 @@
+ "' and NOT EXISTS(select * from JCR_SITEM P where P.ID = I.PARENT_ID)", new String[]{
DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME, DBConstants.COLUMN_CLASS},
"Items that do not have parent nodes", InspectionStatus.ERR));
+
queries.add(new InspectionQuery(jdbcDataContainer.multiDb
? "select * from JCR_MITEM N where N.I_CLASS=1 and NOT EXISTS "
+ "(select * from JCR_MITEM P where P.I_CLASS=2 and P.PARENT_ID=N.ID)"
@@ -136,6 +137,7 @@
+ "where P.I_CLASS=2 and P.PARENT_ID=N.ID and P.CONTAINER_NAME='" + jdbcDataContainer.containerName + "')",
new String[]{DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME},
"Nodes that do not have at least one property", InspectionStatus.ERR));
+
queries.add(new InspectionQuery(jdbcDataContainer.multiDb
? "select * from JCR_MVALUE V where NOT EXISTS(select * from JCR_MITEM P "
+ "where V.PROPERTY_ID = P.ID and P.I_CLASS=2)"
@@ -144,6 +146,7 @@
+ jdbcDataContainer.containerName + "' and V.PROPERTY_ID = P.ID and P.I_CLASS=2)", new String[]{
DBConstants.COLUMN_ID, DBConstants.COLUMN_VPROPERTY_ID},
"All value records that has not owner-property record", InspectionStatus.ERR));
+
queries.add(new InspectionQuery(jdbcDataContainer.multiDb
? "select * from JCR_MITEM P where P.I_CLASS=2 and NOT EXISTS( select * from JCR_MVALUE V "
+ "where V.PROPERTY_ID=P.ID)" : "select * from JCR_SITEM P where P.CONTAINER_NAME='"
@@ -184,6 +187,7 @@
}
queries.add(new InspectionQuery(statement, new String[]{DBConstants.COLUMN_ID}, "Incorrect JCR_VALUE records",
InspectionStatus.ERR));
+
queries.add(new InspectionQuery(jdbcDataContainer.multiDb
? "select * from JCR_MITEM P where P.P_TYPE=9 and NOT EXISTS "
+ "(select * from JCR_MREF R where P.ID=R.PROPERTY_ID)"
@@ -210,6 +214,21 @@
DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME}, "An item is its own parent.",
InspectionStatus.ERR));
+ // Several versions of same item
+ queries
+ .add(new InspectionQuery(
+ jdbcDataContainer.multiDb
+ ? "select * from JCR_MITEM I where EXISTS (select count(VERSION) from JCR_MITEM J"
+ + " WHERE I.PARENT_ID = J.PARENT_ID AND I.NAME = J.NAME and I.I_INDEX = J.I_INDEX and I.I_CLASS = J.I_CLASS"
+ + " GROUP BY PARENT_ID, NAME, I_INDEX, I_CLASS HAVING count(VERSION) > 1)"
+ : "select * from JCR_SITEM I where I.CONTAINER_NAME='" + jdbcDataContainer.containerName + "' and"
+ + " EXISTS (select count(VERSION) from JCR_SITEM J WHERE I.CONTAINER_NAME = J.CONTAINER_NAME and"
+ + " I.PARENT_ID = J.PARENT_ID AND I.NAME = J.NAME and I.I_INDEX = J.I_INDEX and I.I_CLASS = J.I_CLASS"
+ + " GROUP BY CONTAINER_NAME, PARENT_ID, NAME, I_INDEX, I_CLASS HAVING count(VERSION) > 1)", new String[]{
+ DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME, DBConstants.COLUMN_VERSION,
+ DBConstants.COLUMN_CLASS, DBConstants.COLUMN_INDEX}, "Several versions of same item.",
+ InspectionStatus.ERR));
+
// using existing DataSource to get a JDBC Connection.
Connection jdbcConn = jdbcDataContainer.getConnectionFactory().getJdbcConnection();
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java 2012-01-11 09:16:01 UTC (rev 5436)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java 2012-01-11 09:17:07 UTC (rev 5437)
@@ -84,6 +84,8 @@
+ " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_MITEM I force index(PRIMARY)"
+ " where I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ? OFFSET ?) J on P.PARENT_ID = J.ID"
+ " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
+
+ FIND_ITEM_BY_NAME = "select * from JCR_MITEM where PARENT_ID=? and NAME=? and I_INDEX=? order by I_CLASS";
}
/**
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java 2012-01-11 09:16:01 UTC (rev 5436)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java 2012-01-11 09:17:07 UTC (rev 5437)
@@ -84,6 +84,11 @@
+ " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_SITEM I force index(PRIMARY)"
+ " where I.CONTAINER_NAME=? AND I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ? OFFSET ?) J on P.PARENT_ID = J.ID"
+ " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by J.ID";
+
+ FIND_ITEM_BY_NAME =
+ "select * from JCR_SITEM"
+ + " where CONTAINER_NAME=? and PARENT_ID=? and NAME=? and I_INDEX=?"
+ + " order by I_CLASS";
}
/**
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java 2012-01-11 09:16:01 UTC (rev 5436)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java 2012-01-11 09:17:07 UTC (rev 5437)
@@ -365,6 +365,73 @@
/**
* Usecase: property doens't have have parent node.
*/
+ public void testDBUsecasesSeveralVersionsOfSameItemSingleDB() throws Exception
+ {
+ checkSeveralVersionsOfSameItem(helper.createRepository(container, false, false));
+ }
+
+ /**
+ * Usecase: property doens't have have parent node.
+ */
+ public void testDBUsecasesSeveralVersionsOfSameItemMultiDB() throws Exception
+ {
+ checkSeveralVersionsOfSameItem(helper.createRepository(container, true, false));
+ }
+
+ private void checkSeveralVersionsOfSameItem(ManageableRepository repository) throws Exception
+ {
+ // create repository and add property
+ SessionImpl session =
+ (SessionImpl)repository.login(credentials, repository.getConfiguration().getSystemWorkspaceName());
+ NodeImpl node = (NodeImpl)session.getRootNode().addNode("testNode");
+ PropertyImpl prop = (PropertyImpl)node.setProperty("prop", "test");
+ session.save();
+ session.logout();
+
+ // repository is consistent
+ checkController = new RepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController.getLastLogFile().delete();
+
+ WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
+ boolean isMultiDb = wsEntry.getContainer().getParameterBoolean(JDBCWorkspaceDataContainer.MULTIDB);
+
+ // change ITEM table
+ String sourceName = wsEntry.getContainer().getParameterValue(JDBCWorkspaceDataContainer.SOURCE_NAME);
+
+ Connection conn = ((DataSource)new InitialContext().lookup(sourceName)).getConnection();
+
+ // add another item with new persisted version
+ if (isMultiDb)
+ {
+ String propId = IdGenerator.generate();
+ conn.prepareStatement(
+ "INSERT INTO JCR_MITEM VALUES ('" + propId + "','" + prop.getParentIdentifier()
+ + "','[]prop',1,2,1,NULL,1,FALSE)").execute();
+ conn.prepareStatement("ALTER TABLE JCR_MVALUE DROP CONSTRAINT JCR_PK_MVALUE").execute();
+ conn.prepareStatement("INSERT INTO JCR_MVALUE VALUES ('100','data','1','" + propId + "',NULL)").execute();
+ }
+ else
+ {
+ String propId = wsEntry.getName() + IdGenerator.generate();
+ conn.prepareStatement(
+ "INSERT INTO JCR_SITEM VALUES ('" + propId + "','" + wsEntry.getName() + prop.getParentIdentifier()
+ + "','[]prop',1,'" + wsEntry.getName() + "',2,1,NULL,1,FALSE)").execute();
+ conn.prepareStatement("ALTER TABLE JCR_SVALUE DROP CONSTRAINT JCR_PK_SVALUE").execute();
+ conn.prepareStatement("INSERT INTO JCR_SVALUE VALUES ('100','data','1','" + propId + "',NULL)").execute();
+ }
+
+ conn.commit();
+ conn.close();
+
+ // repository is inconsistent
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ checkController.getLastLogFile().delete();
+ }
+
+ /**
+ * Usecase: property doens't have have parent node.
+ */
public void testDBUsecasesPropertyWithoutParentSingleDB() throws Exception
{
checkDBUsecasesPropertyWithoutParent(helper.createRepository(container, false, false));
14 years, 3 months
exo-jcr SVN: r5436 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-11 04:16:01 -0500 (Wed, 11 Jan 2012)
New Revision: 5436
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java
Log:
EXOJCR-1697: Improve SQL access
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java 2012-01-10 17:39:28 UTC (rev 5435)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java 2012-01-11 09:16:01 UTC (rev 5436)
@@ -128,6 +128,7 @@
+ "' and NOT EXISTS(select * from JCR_SITEM P where P.ID = I.PARENT_ID)", new String[]{
DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME, DBConstants.COLUMN_CLASS},
"Items that do not have parent nodes", InspectionStatus.ERR));
+
queries.add(new InspectionQuery(jdbcDataContainer.multiDb
? "select * from JCR_MITEM N where N.I_CLASS=1 and NOT EXISTS "
+ "(select * from JCR_MITEM P where P.I_CLASS=2 and P.PARENT_ID=N.ID)"
@@ -136,6 +137,7 @@
+ "where P.I_CLASS=2 and P.PARENT_ID=N.ID and P.CONTAINER_NAME='" + jdbcDataContainer.containerName + "')",
new String[]{DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME},
"Nodes that do not have at least one property", InspectionStatus.ERR));
+
queries.add(new InspectionQuery(jdbcDataContainer.multiDb
? "select * from JCR_MVALUE V where NOT EXISTS(select * from JCR_MITEM P "
+ "where V.PROPERTY_ID = P.ID and P.I_CLASS=2)"
@@ -144,6 +146,7 @@
+ jdbcDataContainer.containerName + "' and V.PROPERTY_ID = P.ID and P.I_CLASS=2)", new String[]{
DBConstants.COLUMN_ID, DBConstants.COLUMN_VPROPERTY_ID},
"All value records that has not owner-property record", InspectionStatus.ERR));
+
queries.add(new InspectionQuery(jdbcDataContainer.multiDb
? "select * from JCR_MITEM P where P.I_CLASS=2 and NOT EXISTS( select * from JCR_MVALUE V "
+ "where V.PROPERTY_ID=P.ID)" : "select * from JCR_SITEM P where P.CONTAINER_NAME='"
@@ -184,6 +187,7 @@
}
queries.add(new InspectionQuery(statement, new String[]{DBConstants.COLUMN_ID}, "Incorrect JCR_VALUE records",
InspectionStatus.ERR));
+
queries.add(new InspectionQuery(jdbcDataContainer.multiDb
? "select * from JCR_MITEM P where P.P_TYPE=9 and NOT EXISTS "
+ "(select * from JCR_MREF R where P.ID=R.PROPERTY_ID)"
@@ -210,6 +214,22 @@
DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME}, "An item is its own parent.",
InspectionStatus.ERR));
+ // Several versions of same item
+ queries
+ .add(new InspectionQuery(
+ jdbcDataContainer.multiDb
+ ? "select * from JCR_MITEM I where EXISTS (select count(VERSION) from JCR_MITEM J"
+ + " WHERE I.PARENT_ID = J.PARENT_ID AND I.NAME = J.NAME and I.I_INDEX = J.I_INDEX and I.I_CLASS = J.I_CLASS"
+ + " GROUP BY PARENT_ID, NAME, I_INDEX, I_CLASS HAVING count(VERSION) > 1)"
+ : "select * from JCR_SITEM I where I.CONTAINER_NAME='" + jdbcDataContainer.containerName + "' and"
+ + " EXISTS (select count(VERSION) from JCR_SITEM J WHERE I.CONTAINER_NAME = J.CONTAINER_NAME and"
+ + " I.PARENT_ID = J.PARENT_ID AND I.NAME = J.NAME and I.I_INDEX = J.I_INDEX and I.I_CLASS = J.I_CLASS"
+ + " GROUP BY CONTAINER_NAME, PARENT_ID, NAME, I_INDEX, I_CLASS HAVING count(VERSION) > 1)",
+ new String[]{
+ DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME, DBConstants.COLUMN_VERSION,
+ DBConstants.COLUMN_CLASS, DBConstants.COLUMN_INDEX}, "Several versions of same item.",
+ InspectionStatus.ERR));
+
// using existing DataSource to get a JDBC Connection.
Connection jdbcConn = jdbcDataContainer.getConnectionFactory().getJdbcConnection();
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java 2012-01-10 17:39:28 UTC (rev 5435)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java 2012-01-11 09:16:01 UTC (rev 5436)
@@ -84,6 +84,8 @@
+ " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_MITEM I force index(PRIMARY)"
+ " where I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ? OFFSET ?) J on P.PARENT_ID = J.ID"
+ " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
+
+ FIND_ITEM_BY_NAME = "select * from JCR_MITEM where PARENT_ID=? and NAME=? and I_INDEX=? order by I_CLASS";
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java 2012-01-10 17:39:28 UTC (rev 5435)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java 2012-01-11 09:16:01 UTC (rev 5436)
@@ -84,6 +84,11 @@
+ " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_SITEM I force index(PRIMARY)"
+ " where I.CONTAINER_NAME=? AND I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ? OFFSET ?) J on P.PARENT_ID = J.ID"
+ " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by J.ID";
+
+ FIND_ITEM_BY_NAME =
+ "select * from JCR_SITEM"
+ + " where CONTAINER_NAME=? and PARENT_ID=? and NAME=? and I_INDEX=?"
+ + " order by I_CLASS";
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java 2012-01-10 17:39:28 UTC (rev 5435)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java 2012-01-11 09:16:01 UTC (rev 5436)
@@ -366,6 +366,73 @@
/**
* Usecase: property doens't have have parent node.
*/
+ public void testDBUsecasesSeveralVersionsOfSameItemSingleDB() throws Exception
+ {
+ checkSeveralVersionsOfSameItem(helper.createRepository(container, false, false));
+ }
+
+ /**
+ * Usecase: property doens't have have parent node.
+ */
+ public void testDBUsecasesSeveralVersionsOfSameItemMultiDB() throws Exception
+ {
+ checkSeveralVersionsOfSameItem(helper.createRepository(container, true, false));
+ }
+
+ private void checkSeveralVersionsOfSameItem(ManageableRepository repository) throws Exception
+ {
+ // create repository and add property
+ SessionImpl session =
+ (SessionImpl)repository.login(credentials, repository.getConfiguration().getSystemWorkspaceName());
+ NodeImpl node = (NodeImpl)session.getRootNode().addNode("testNode");
+ PropertyImpl prop = (PropertyImpl)node.setProperty("prop", "test");
+ session.save();
+ session.logout();
+
+ // repository is consistent
+ checkController = new RepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController.getLastLogFile().delete();
+
+ WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
+ boolean isMultiDb = wsEntry.getContainer().getParameterBoolean(JDBCWorkspaceDataContainer.MULTIDB);
+
+ // change ITEM table
+ String sourceName = wsEntry.getContainer().getParameterValue(JDBCWorkspaceDataContainer.SOURCE_NAME);
+
+ Connection conn = ((DataSource)new InitialContext().lookup(sourceName)).getConnection();
+
+ // add another item with new persisted version
+ if (isMultiDb)
+ {
+ String propId = IdGenerator.generate();
+ conn.prepareStatement(
+ "INSERT INTO JCR_MITEM VALUES ('" + propId + "','" + prop.getParentIdentifier()
+ + "','[]prop',1,2,1,NULL,1,FALSE)").execute();
+ conn.prepareStatement("ALTER TABLE JCR_MVALUE DROP CONSTRAINT JCR_PK_MVALUE").execute();
+ conn.prepareStatement("INSERT INTO JCR_MVALUE VALUES ('100','data','1','" + propId + "',NULL)").execute();
+ }
+ else
+ {
+ String propId = wsEntry.getName() + IdGenerator.generate();
+ conn.prepareStatement(
+ "INSERT INTO JCR_SITEM VALUES ('" + propId + "','" + wsEntry.getName() + prop.getParentIdentifier()
+ + "','[]prop',1,'" + wsEntry.getName() + "',2,1,NULL,1,FALSE)").execute();
+ conn.prepareStatement("ALTER TABLE JCR_SVALUE DROP CONSTRAINT JCR_PK_SVALUE").execute();
+ conn.prepareStatement("INSERT INTO JCR_SVALUE VALUES ('100','data','1','" + propId + "',NULL)").execute();
+ }
+
+ conn.commit();
+ conn.close();
+
+ // repository is inconsistent
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ checkController.getLastLogFile().delete();
+ }
+
+ /**
+ * Usecase: property doens't have have parent node.
+ */
public void testDBUsecasesPropertyWithoutParentSingleDB() throws Exception
{
checkDBUsecasesPropertyWithoutParent(helper.createRepository(container, false, false));
14 years, 3 months
exo-jcr SVN: r5435 - in kernel/trunk: exo.kernel.component.ext.cache.impl.infinispan.v5 and 5 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2012-01-10 12:39:28 -0500 (Tue, 10 Jan 2012)
New Revision: 5435
Modified:
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/pom.xml
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/java/org/exoplatform/services/cache/impl/infinispan/TestAbstractExoCache.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/resources/conf/portal/test-configuration.xml
kernel/trunk/exo.kernel.component.ext.rpc.impl.jgroups.v3/pom.xml
kernel/trunk/pom.xml
Log:
EXOJCR-1682: Kernel part has been upgraded to ISPN 5.1.0.CR3 and JGroups 3.0.2.Final
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/pom.xml 2012-01-10 14:36:40 UTC (rev 5434)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/pom.xml 2012-01-10 17:39:28 UTC (rev 5435)
@@ -34,7 +34,7 @@
<dependency>
<groupId>org.jgroups</groupId>
<artifactId>jgroups</artifactId>
- <version>3.0.0.Final</version>
+ <version>3.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java 2012-01-10 14:36:40 UTC (rev 5434)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java 2012-01-10 17:39:28 UTC (rev 5435)
@@ -227,6 +227,11 @@
{
throw new NullPointerException("No null cache key accepted");
}
+ else if (value == null)
+ {
+ // ignore null values
+ return;
+ }
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
{
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2012-01-10 14:36:40 UTC (rev 5434)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2012-01-10 17:39:28 UTC (rev 5435)
@@ -372,7 +372,6 @@
confBuilder.read(cacheManager.getDefaultCacheConfiguration());
//TODO remove it once ISPN-1687 will be fixed
confBuilder.storeAsBinary().enabled(false);
- confBuilder.jmxStatistics().enable();
//TODO remove it once ISPN-1689 will be fixed
confBuilder
.clustering()
@@ -401,7 +400,6 @@
confBuilder.read(cacheManager.getDefaultCacheConfiguration());
//TODO remove it once ISPN-1687 will be fixed
confBuilder.storeAsBinary().enabled(false);
- confBuilder.jmxStatistics().enable();
//TODO remove it once ISPN-1689 will be fixed
confBuilder
.clustering()
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java 2012-01-10 14:36:40 UTC (rev 5434)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java 2012-01-10 17:39:28 UTC (rev 5435)
@@ -366,6 +366,11 @@
{
throw new NullPointerException("No null cache key accepted");
}
+ else if (value == null)
+ {
+ // ignore null values
+ return;
+ }
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
{
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/java/org/exoplatform/services/cache/impl/infinispan/TestAbstractExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/java/org/exoplatform/services/cache/impl/infinispan/TestAbstractExoCache.java 2012-01-10 14:36:40 UTC (rev 5434)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/java/org/exoplatform/services/cache/impl/infinispan/TestAbstractExoCache.java 2012-01-10 17:39:28 UTC (rev 5435)
@@ -519,7 +519,7 @@
@Override
public boolean equals(Object paramObject)
{
- return paramObject instanceof MyKey && ((MyKey)paramObject).value.endsWith(value);
+ return paramObject instanceof MyKey && ((MyKey)paramObject).value.equals(value);
}
@Override
@@ -546,13 +546,13 @@
+ System.getProperty("java.net.preferIPv4Stack"));
ExoCacheConfig config = new ExoCacheConfig();
config.setName("MyCacheDistributed");
- config.setMaxSize(5);
+ config.setMaxSize(8);
config.setLiveTime(1);
config.setImplementation("LRU");
config.setReplicated(true);
ExoCacheConfig config2 = new ExoCacheConfig();
config2.setName("MyCacheDistributed2");
- config2.setMaxSize(5);
+ config2.setMaxSize(8);
config2.setLiveTime(1);
config2.setImplementation("LRU");
config2.setReplicated(true);
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/resources/conf/portal/test-configuration.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/resources/conf/portal/test-configuration.xml 2012-01-10 14:36:40 UTC (rev 5434)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/resources/conf/portal/test-configuration.xml 2012-01-10 17:39:28 UTC (rev 5435)
@@ -32,7 +32,7 @@
<description>The default cache configuration</description>
<object type="org.exoplatform.services.cache.ExoCacheConfig">
<field name="name"><string>default</string></field>
- <field name="maxSize"><int>5</int></field>
+ <field name="maxSize"><int>10</int></field>
<field name="liveTime"><long>2</long></field>
</object>
</object-param>
@@ -223,9 +223,6 @@
<string>LRU</string>
</value>
<value>
- <string>LRU_OLD</string>
- </value>
- <value>
<string>UNORDERED</string>
</value>
<value>
Modified: kernel/trunk/exo.kernel.component.ext.rpc.impl.jgroups.v3/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.rpc.impl.jgroups.v3/pom.xml 2012-01-10 14:36:40 UTC (rev 5434)
+++ kernel/trunk/exo.kernel.component.ext.rpc.impl.jgroups.v3/pom.xml 2012-01-10 17:39:28 UTC (rev 5435)
@@ -40,7 +40,7 @@
<dependency>
<groupId>org.jgroups</groupId>
<artifactId>jgroups</artifactId>
- <version>3.0.0.Final</version>
+ <version>3.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Modified: kernel/trunk/pom.xml
===================================================================
--- kernel/trunk/pom.xml 2012-01-10 14:36:40 UTC (rev 5434)
+++ kernel/trunk/pom.xml 2012-01-10 17:39:28 UTC (rev 5435)
@@ -213,7 +213,7 @@
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
- <version>5.1.0.CR2</version>
+ <version>5.1.0.CR3</version>
</dependency>
<dependency>
<groupId>org.jibx</groupId>
14 years, 3 months
exo-jcr SVN: r5434 - jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-10 09:36:40 -0500 (Tue, 10 Jan 2012)
New Revision: 5434
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestWorkspace.java
Log:
EXOJCR-1703: Writed tests to class WorkspaceImpl
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestWorkspace.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestWorkspace.java 2012-01-10 13:39:25 UTC (rev 5433)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestWorkspace.java 2012-01-10 14:36:40 UTC (rev 5434)
@@ -19,7 +19,27 @@
package org.exoplatform.services.jcr.api.reading;
import org.exoplatform.services.jcr.JcrAPIBaseTest;
+import org.exoplatform.services.jcr.core.CredentialsImpl;
+import org.exoplatform.services.jcr.impl.core.WorkspaceImpl;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.jcr.ImportUUIDBehavior;
+import javax.jcr.ItemExistsException;
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionException;
+
/**
* Created by The eXo Platform SAS.
*
@@ -61,4 +81,228 @@
assertNotNull(workspace.getAccessibleWorkspaceNames());
}
+ public void testCannotGetImportContentHandlerWhenNodeIsProtected() throws ItemExistsException,
+ PathNotFoundException, NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException,
+ RepositoryException
+ {
+ workspace.getSession().getRootNode().addNode("someNode", "exo:myTypeJCR1703");
+
+ try
+ {
+ workspace.getImportContentHandler("/someNode/exo:myChildNode", 0);
+ fail();
+ }
+ catch (ConstraintViolationException e)
+ {
+ }
+ }
+
+ public void testCannotGetImportContentHandlerWhenNodeIsLocked() throws ItemExistsException, PathNotFoundException,
+ VersionException, ConstraintViolationException, RepositoryException
+ {
+ Node someNode = workspace.getSession().getRootNode().addNode("someNode");
+ someNode.addMixin("mix:lockable");
+ session.save();
+
+ someNode.lock(true, false);
+
+ Session session2 =
+ repository.login(new CredentialsImpl("admin", "admin".toCharArray()), session.getWorkspace().getName());
+
+ try
+ {
+ session2.getWorkspace().getImportContentHandler("/someNode", 0);
+ fail();
+ }
+ catch (LockException e)
+ {
+ }
+ finally
+ {
+ session2.logout();
+ someNode.unlock();
+ }
+ }
+
+ public void testImportXML() throws ItemExistsException, PathNotFoundException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException, IOException
+ {
+ Node folder = root.addNode("folder");
+ Node file = folder.addNode("file");
+ session.save();
+
+ File destFile = File.createTempFile("testExportImportValuesSysView", ".xml");
+ destFile.deleteOnExit();
+ OutputStream outStream = new FileOutputStream(destFile);
+ session.exportSystemView(file.getPath(), outStream, false, false);
+ outStream.close();
+
+ folder.remove();
+ session.save();
+
+ ((WorkspaceImpl)workspace).importXML(root.getPath(), new FileInputStream(destFile),
+ ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW, false);
+
+ session.save();
+
+ assertNotNull(root.getNode("file"));
+ }
+
+ public void testImportXMLInProtectedNode() throws ItemExistsException, PathNotFoundException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException, IOException
+ {
+ Node folder = workspace.getSession().getRootNode().addNode("folder");
+ Node file = folder.addNode("file");
+ Node protectedNode = folder.addNode("someNode", "exo:myTypeJCR1703").getNode("exo:myChildNode");
+ session.save();
+
+ File destFile = File.createTempFile("testExportImportValuesSysView", ".xml");
+ destFile.deleteOnExit();
+ OutputStream outStream = new FileOutputStream(destFile);
+ session.exportSystemView(file.getPath(), outStream, false, false);
+ outStream.close();
+ file.remove();
+ session.save();
+
+ try
+ {
+ ((WorkspaceImpl)workspace).importXML(protectedNode.getPath(), new FileInputStream(destFile),
+ ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW, false);
+ fail();
+ }
+ catch (ConstraintViolationException e)
+ {
+ }
+ }
+
+ public void testImportXMLInLockedNode() throws ItemExistsException, PathNotFoundException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException, IOException
+ {
+ Node folder = workspace.getSession().getRootNode().addNode("folder");
+ Node file = folder.addNode("file");
+ Node lockedNode = folder.addNode("someNode");
+ lockedNode.addMixin("mix:lockable");
+ session.save();
+
+ lockedNode.lock(true, false);
+
+ File destFile = File.createTempFile("testExportImportValuesSysView", ".xml");
+ destFile.deleteOnExit();
+ OutputStream outStream = new FileOutputStream(destFile);
+ session.exportSystemView(file.getPath(), outStream, false, false);
+ outStream.close();
+ file.remove();
+ session.save();
+
+ Session session2 =
+ repository.login(new CredentialsImpl("admin", "admin".toCharArray()), session.getWorkspace().getName());
+
+ try
+ {
+ ((WorkspaceImpl)session2.getWorkspace()).importXML(lockedNode.getPath(), new FileInputStream(destFile),
+ ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW, false);
+ fail();
+ }
+ catch (LockException e)
+ {
+ }
+ finally
+ {
+ session2.logout();
+ lockedNode.unlock();
+ }
+ }
+
+ public void testMoveNodeWhenParentNodeIsLocked() throws ItemExistsException, PathNotFoundException,
+ VersionException, ConstraintViolationException, LockException, RepositoryException
+ {
+ Node folder = workspace.getSession().getRootNode().addNode("folder");
+ Node file = folder.addNode("file");
+ Node lockedNode = folder.addNode("someNode");
+ lockedNode.addMixin("mix:lockable");
+ session.save();
+
+ lockedNode.lock(true, false);
+
+ Session session2 =
+ repository.login(new CredentialsImpl("admin", "admin".toCharArray()), session.getWorkspace().getName());
+
+ try
+ {
+ ((WorkspaceImpl)session2.getWorkspace()).move(lockedNode.getPath(), file.getPath());
+ }
+ catch (LockException e)
+ {
+ }
+ }
+
+ public void testCloneNodeWhenClonedInTheSameNode() throws ItemExistsException, PathNotFoundException,
+ VersionException, ConstraintViolationException, LockException, RepositoryException
+ {
+ Node testNode = workspace.getSession().getRootNode().addNode("testNode");
+ session.save();
+
+ try
+ {
+ ((WorkspaceImpl)workspace).clone(workspace.getName(), testNode.getPath(), testNode.getPath(), false);
+ }
+ catch (RepositoryException e)
+ {
+ }
+ }
+
+ public void testResotoreVersionWhenArrayVersionsHaventSomeVersion() throws ItemExistsException,
+ PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException
+ {
+ Node nodeA = workspace.getSession().getRootNode().addNode("versionableNodeA");
+ nodeA.addMixin("mix:versionable");
+ root.save();
+ nodeA.checkin();// v.1
+ nodeA.checkout();
+
+ Node nodeB = nodeA.addNode("Subnode B");
+ nodeA.save();
+ nodeB.addMixin("mix:versionable");
+ nodeA.save();
+ nodeB.checkin();
+
+ Node nodeC = nodeA.addNode("Subnode C");
+ nodeA.save();
+ nodeC.addMixin("mix:versionable");
+ nodeA.save();
+ nodeC.checkin();
+ nodeC.checkout();
+ nodeC.setProperty("Property Y", nodeB);
+ nodeC.save();
+ Version vC = nodeC.checkin();
+ nodeC.checkout();
+
+ nodeB.checkout();
+ nodeB.setProperty("Property X", nodeC);
+ nodeB.save();
+ Version vB = nodeB.checkin();
+ nodeB.checkout();
+
+ nodeA.setProperty("Property", "property of subnode");
+ nodeA.save();
+ Version vA = nodeA.checkin();
+ nodeA.checkout();
+
+ nodeB.remove();
+ nodeC.remove();
+ nodeA.save();
+
+ session.save();
+
+ Version[] vs = new Version[]{vB, vC};
+
+ try
+ {
+ ((WorkspaceImpl)session.getWorkspace()).restore(vs, true);
+ fail();
+ }
+ catch (VersionException e)
+ {
+ }
+ }
}
14 years, 3 months
exo-jcr SVN: r5433 - in jcr/branches/1.15.x: exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext and 5 other directories.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2012-01-10 08:39:25 -0500 (Tue, 10 Jan 2012)
New Revision: 5433
Added:
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/FixupStream.java
Removed:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryChangesListenerRegisterPlugin.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/initializer/
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/replication/
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/BaseReplicationTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationCopyMoveNodeTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationDocumentViewImportTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationEditDataTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationExternalizableTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationLockTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationStreamTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationSysViewImportTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationVersionRestoreTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/AddNTFileCheckerTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/BaseTestCaseChecker.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/BasicAuthenticationHttpClient.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/CopyMoveCheckerTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/LockCheckerTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/MemberInfo.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/VersionCheckerTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/bandwidth/
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/concurrent/
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/priority/
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-replication.xml
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config-replication.xml
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/PendingChangesLog.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java
Log:
EXOJCR-1701 : Old replication way and support of AsyncReplication was removed.
Deleted: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryChangesListenerRegisterPlugin.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryChangesListenerRegisterPlugin.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryChangesListenerRegisterPlugin.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl;
-
-import org.exoplatform.container.component.BaseComponentPlugin;
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.container.xml.ValueParam;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
- * @version $Id: StoreChangesPlugin.java 111 2008-11-11 11:11:11Z $
- */
-public class RepositoryChangesListenerRegisterPlugin extends BaseComponentPlugin
-{
-
- private String repositoryName = null;
-
- private String workspaces = null;
-
- private String listenerClassName = null;
-
- /**
- * StoreChangesPlugin constructor.
- *
- * @param params
- */
- public RepositoryChangesListenerRegisterPlugin(InitParams params)
- {
- if (params != null)
- {
- ValueParam valueParam = params.getValueParam("repository-name");
- if (valueParam != null)
- {
- repositoryName = valueParam.getValue();
- }
-
- valueParam = params.getValueParam("workspaces");
- if (valueParam != null)
- {
- workspaces = valueParam.getValue();
- }
-
- valueParam = params.getValueParam("component-class-name");
- if (valueParam != null)
- {
- listenerClassName = valueParam.getValue();
- }
- }
- }
-
- /**
- * Return repository name.
- *
- * @return The repository name
- */
- public String getRepositoryName()
- {
- return repositoryName;
- }
-
- /**
- * Return workspaces.
- *
- * @return The workspaces
- */
- public String getWorkspaces()
- {
- return workspaces;
- }
-
- /**
- * Return listenerClassName.
- *
- * @return The listenerClassName.
- */
- public String getListenerClassName()
- {
- return listenerClassName;
- }
-
-}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -19,7 +19,6 @@
package org.exoplatform.services.jcr.impl;
import org.exoplatform.commons.utils.SecurityHelper;
-import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.PortalContainer;
@@ -33,7 +32,6 @@
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
-import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
import org.exoplatform.services.jcr.impl.core.SessionRegistry;
import org.exoplatform.services.log.ExoLogger;
@@ -43,12 +41,8 @@
import java.io.InputStream;
import java.security.PrivilegedAction;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Map.Entry;
-import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
import javax.jcr.RepositoryException;
@@ -76,8 +70,6 @@
private final List<ComponentPlugin> addNamespacesPlugins;
- private final ManagerStartChanges managerStartChanges;
-
private final ExoContainerContext containerContext;
private ExoContainer parentContainer;
@@ -106,7 +98,6 @@
addNamespacesPlugins = new ArrayList<ComponentPlugin>();
containerContext = context;
currentRepositoryName.set(config.getDefaultRepositoryName());
- managerStartChanges = new ManagerStartChanges();
}
public void addPlugin(ComponentPlugin plugin)
@@ -115,10 +106,6 @@
addNodeTypePlugins.add(plugin);
else if (plugin instanceof AddNamespacesPlugin)
addNamespacesPlugins.add(plugin);
- else if (plugin instanceof RepositoryChangesListenerRegisterPlugin)
- {
- managerStartChanges.addPlugin((RepositoryChangesListenerRegisterPlugin)plugin);
- }
}
/**
@@ -154,7 +141,6 @@
{
public Void run()
{
- managerStartChanges.registerListeners(repositoryContainer);
repositoryContainer.start();
return null;
}
@@ -308,7 +294,6 @@
repositoryContainers.clear();
addNamespacesPlugins.clear();
addNodeTypePlugins.clear();
- managerStartChanges.cleanup();
}
private void init(ExoContainer container) throws RepositoryConfigurationException, RepositoryException
@@ -469,157 +454,4 @@
return true;
}
-
- /**
- * Manager start changes plugins.
- */
- public class ManagerStartChanges
- {
-
- private Map<StorageKey, ItemsPersistenceListener> startChangesListeners =
- new HashMap<StorageKey, ItemsPersistenceListener>();
-
- /**
- * Add new StartChangesPlugin to manager.
- *
- * @param plugin
- * The StartChangesPlugin
- */
- public void addPlugin(RepositoryChangesListenerRegisterPlugin plugin)
- {
- String repositoryName = plugin.getRepositoryName();
- String workspaces = plugin.getWorkspaces();
- String listenerClassName = plugin.getListenerClassName();
-
- if (repositoryName != null && workspaces != null && listenerClassName != null)
- {
- StringTokenizer listTokenizer = new StringTokenizer(workspaces, ",");
- while (listTokenizer.hasMoreTokens())
- {
- String wsName = listTokenizer.nextToken();
- startChangesListeners.put(new StorageKey(repositoryName, wsName, listenerClassName), null);
- }
- }
- }
-
- /**
- * Register listeners.
- *
- * @param repositoryContainer
- * @throws ClassNotFoundException
- */
- public void registerListeners(RepositoryContainer repositoryContainer)
- {
- Iterator<StorageKey> storageKeys = startChangesListeners.keySet().iterator();
- while (storageKeys.hasNext())
- {
- StorageKey sk = storageKeys.next();
- if (sk.getRepositoryName().equals(repositoryContainer.getName()))
- {
- WorkspaceContainer wc = repositoryContainer.getWorkspaceContainer(sk.getWorkspaceName());
-
- try
- {
- Class<?> listenerType = ClassLoading.forName(sk.getListenerClassName(), this);
- wc.registerComponentImplementation(listenerType);
- ItemsPersistenceListener listener =
- (ItemsPersistenceListener)wc.getComponentInstanceOfType(listenerType);
- startChangesListeners.put(sk, listener);
- }
- catch (ClassNotFoundException e)
- {
- log.error("Can not register listener " + e.getMessage());
- }
- }
- }
- }
-
- /**
- * Cleanup changes.
- *
- */
- public void cleanup()
- {
- startChangesListeners.clear();
- }
-
- /**
- * Will be used as key for startChangesListeners.
- *
- */
- private class StorageKey
- {
- private final String repositoryName;
-
- private final String workspaceName;
-
- private final String listenerClassName;
-
- /**
- * StorageKey constructor.
- *
- * @param repositoryName
- * The repository name
- * @param workspaceName
- * The workspace name
- */
- public StorageKey(String repositoryName, String workspaceName, String listenerClassName)
- {
- this.repositoryName = repositoryName;
- this.workspaceName = workspaceName;
- this.listenerClassName = listenerClassName;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object o)
- {
- StorageKey k = (StorageKey)o;
-
- return repositoryName.equals(k.repositoryName) && workspaceName.equals(k.workspaceName)
- && listenerClassName.equals(k.listenerClassName);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode()
- {
- return repositoryName.hashCode() ^ workspaceName.hashCode() ^ listenerClassName.hashCode();
- }
-
- /**
- * Return repository name.
- *
- * @return The repository name
- */
- public String getRepositoryName()
- {
- return repositoryName;
- }
-
- /**
- * Return workspace name.
- *
- * @return The workspace name
- */
- public String getWorkspaceName()
- {
- return workspaceName;
- }
-
- /**
- * Return listener class name.
- *
- * @return The listener class name
- */
- public String getListenerClassName()
- {
- return listenerClassName;
- }
- }
- }
}
Copied: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/FixupStream.java (from rev 5413, jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/replication/FixupStream.java)
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/FixupStream.java (rev 0)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/FixupStream.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.ext.backup.impl;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id: FixupStream.java 34445 2009-07-24 07:51:18Z dkatayev $
+ */
+
+public class FixupStream implements Externalizable
+{
+
+ /**
+ * serialVersionUID. Determinate the version of serialization.
+ */
+ private static final long serialVersionUID = 6453641729031051616L;
+
+ /**
+ * iItemStateId. Index of ItemState in ChangesLog.
+ */
+ private int iItemStateId = -1;
+
+ /**
+ * iValueDataId. Index of ValueData in ItemState.
+ */
+ private int iValueDataId = -1;
+
+ /**
+ * FixupStream constructor. Empty constructor is necessary to Externalizable.
+ */
+ public FixupStream()
+ {
+ }
+
+ /**
+ * FixupStream constructor.
+ *
+ * @param itemState
+ * index of ItemState in ChangesLog
+ * @param valueData
+ * index of ValueData in ItemState
+ */
+ public FixupStream(int itemState, int valueData)
+ {
+ this.iItemStateId = itemState;
+ this.iValueDataId = valueData;
+ }
+
+ /**
+ * getItemSateId.
+ *
+ * @return int return the iItemStateId
+ */
+ public int getItemSateId()
+ {
+ return iItemStateId;
+ }
+
+ /**
+ * getValueDataId.
+ *
+ * @return int return the iValueDataId
+ */
+ public int getValueDataId()
+ {
+ return iValueDataId;
+ }
+
+ /**
+ * compare.
+ *
+ * @param fs
+ * FixupStream.
+ * @return boolean return 'true' if this == fs
+ */
+ public boolean compare(FixupStream fs)
+ {
+ boolean b = true;
+ if (fs.getItemSateId() != this.getItemSateId())
+ b = false;
+ if (fs.getValueDataId() != this.getValueDataId())
+ b = false;
+ return b;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ iItemStateId = in.readInt();
+ iValueDataId = in.readInt();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeInt(iItemStateId);
+ out.writeInt(iValueDataId);
+ }
+}
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/PendingChangesLog.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/PendingChangesLog.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/PendingChangesLog.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -25,7 +25,6 @@
import org.exoplatform.services.jcr.dataflow.persistent.PersistedPropertyData;
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.ValueData;
-import org.exoplatform.services.jcr.ext.replication.FixupStream;
import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.impl.util.io.SpoolFile;
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -26,8 +26,8 @@
import org.exoplatform.services.jcr.ext.backup.BackupConfig;
import org.exoplatform.services.jcr.ext.backup.impl.AbstractIncrementalBackupJob;
import org.exoplatform.services.jcr.ext.backup.impl.FileNameProducer;
+import org.exoplatform.services.jcr.ext.backup.impl.FixupStream;
import org.exoplatform.services.jcr.ext.backup.impl.PendingChangesLog;
-import org.exoplatform.services.jcr.ext.replication.FixupStream;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.log.ExoLogger;
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/BaseReplicationTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/BaseReplicationTest.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/BaseReplicationTest.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication;
-
-import org.exoplatform.container.StandaloneContainer;
-import org.exoplatform.services.jcr.RepositoryService;
-import org.exoplatform.services.jcr.core.CredentialsImpl;
-import org.exoplatform.services.jcr.ext.BaseStandaloneTest;
-import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
-import org.exoplatform.services.jcr.impl.core.SessionImpl;
-
-import java.io.File;
-
-import javax.jcr.Node;
-import javax.jcr.ValueFactory;
-import javax.jcr.Workspace;
-
-/**
- * Created by The eXo Platform SAS Author : Alex Reshetnyak alex.reshetnyak(a)exoplatform.com.ua
- * 20.02.2007 17:10:01
- *
- * @version $Id: BaseReplicationTest.java 20.02.2007 17:10:01 rainfox
- */
-public abstract class BaseReplicationTest extends BaseStandaloneTest
-{
-
- protected RepositoryImpl repository2;
-
- protected SessionImpl session2;
-
- protected Workspace workspace2;
-
- protected Node root2;
-
- protected ValueFactory valueFactory2;
-
- public void setUp() throws Exception
- {
-
- String containerConf = "src/test/resources/conf/standalone/test-configuration-replication.xml";
- String loginConf = Thread.currentThread().getContextClassLoader().getResource("login.conf").toString();
-
- if (!new File(containerConf).exists())
- {
- containerConf = "component/ext/" + containerConf;
- }
-
- StandaloneContainer.addConfigurationPath(containerConf);
-
- container = StandaloneContainer.getInstance();
-
- if (System.getProperty("java.security.auth.login.config") == null)
- System.setProperty("java.security.auth.login.config", loginConf);
-
- credentials = new CredentialsImpl("admin", "admin".toCharArray());
-
- repositoryService = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
-
- repository = (RepositoryImpl)repositoryService.getRepository("db1");
- repository2 = (RepositoryImpl)repositoryService.getRepository("db2");
-
- session = (SessionImpl)repository.login(credentials, "ws");
- session2 = (SessionImpl)repository2.login(credentials, "ws");
-
- workspace = session.getWorkspace();
- workspace2 = session2.getWorkspace();
-
- root = session.getRootNode();
- root2 = session2.getRootNode();
-
- valueFactory = session.getValueFactory();
- valueFactory2 = session2.getValueFactory();
-
- Thread.sleep(10000);
- }
-
- protected void tearDown() throws Exception
- {
- }
-
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationCopyMoveNodeTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationCopyMoveNodeTest.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationCopyMoveNodeTest.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,188 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication;
-
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.util.Calendar;
-
-import javax.jcr.Node;
-
-/**
- * Created by The eXo Platform SAS Author : Alex Reshetnyak alex.reshetnyak(a)exoplatform.com.ua
- * 28.02.2007 10:59:36
- *
- * @version $Id: TestReplicationCopyNode.java 28.02.2007 10:59:36 rainfox
- */
-
-public class ReplicationCopyMoveNodeTest extends BaseReplicationTest
-{
-
- private static final Log log = ExoLogger.getLogger("exo.jcr.component.ext.ReplicationCopyMoveNodeTest");
-
- public void testSessionMove() throws Exception
- {
-
- Node file = root.addNode("testSessionMove", "nt:folder").addNode("childNode2", "nt:file");
- Node contentNode = file.addNode("jcr:content", "nt:resource");
- contentNode.setProperty("jcr:data", "this is the content");
- contentNode.setProperty("jcr:mimeType", "text/html");
- contentNode.setProperty("jcr:lastModified", session.getValueFactory().createValue(Calendar.getInstance()));
-
- session.save();
-
- session.move("/testSessionMove", "/testSessionMove1");
-
- session.save();
-
- assertNotNull(session.getItem("/testSessionMove1"));
- assertNotNull(session.getItem("/testSessionMove1/childNode2/jcr:content"));
-
- Thread.sleep(7 * 1000);
-
- // COMPARE REPLICATION DATA
- assertNotNull(session2.getItem("/testSessionMove1"));
- assertNotNull(session2.getItem("/testSessionMove1/childNode2/jcr:content"));
-
- Node srcNode = root.getNode("testSessionMove1").getNode("childNode2").getNode("jcr:content");
- Node destNode = root2.getNode("testSessionMove1").getNode("childNode2").getNode("jcr:content");
-
- assertEquals(srcNode.getProperty("jcr:data").getString(), destNode.getProperty("jcr:data").getString());
- assertEquals(srcNode.getProperty("jcr:mimeType").getString(), destNode.getProperty("jcr:mimeType").getString());
- assertEquals(srcNode.getProperty("jcr:lastModified").getString(), destNode.getProperty("jcr:lastModified")
- .getString());
- }
-
- public void testCopy() throws Exception
- {
-
- Node file = root.addNode("testCopy", "nt:folder").addNode("childNode2", "nt:file");
- Node contentNode = file.addNode("jcr:content", "nt:resource");
- contentNode.setProperty("jcr:data", "this is the content");
- contentNode.setProperty("jcr:mimeType", "text/html");
- contentNode.setProperty("jcr:lastModified", session.getValueFactory().createValue(Calendar.getInstance()));
-
- session.save();
-
- workspace.copy("/testCopy", "/testCopy1");
-
- Thread.sleep(7 * 1000);
-
- // COMPARE REPLICATION DATA
- assertNotNull(session2.getItem("/testCopy1"));
- assertNotNull(session2.getItem("/testCopy1/childNode2"));
- assertNotNull(session2.getItem("/testCopy1/childNode2/jcr:content"));
- assertNotNull(session2.getItem("/testCopy"));
-
- Node srcNode = root.getNode("testCopy1").getNode("childNode2").getNode("jcr:content");
- Node destNode = root2.getNode("testCopy1").getNode("childNode2").getNode("jcr:content");
-
- assertEquals(srcNode.getProperty("jcr:data").getString(), destNode.getProperty("jcr:data").getString());
- assertEquals(srcNode.getProperty("jcr:mimeType").getString(), destNode.getProperty("jcr:mimeType").getString());
- assertEquals(srcNode.getProperty("jcr:lastModified").getString(), destNode.getProperty("jcr:lastModified")
- .getString());
- }
-
- public void testMove() throws Exception
- {
-
- Node file = root.addNode("testMove", "nt:folder").addNode("childNode2", "nt:file");
- Node contentNode = file.addNode("jcr:content", "nt:resource");
- contentNode.setProperty("jcr:data", "this is the content");
- contentNode.setProperty("jcr:mimeType", "text/html");
- contentNode.setProperty("jcr:lastModified", session.getValueFactory().createValue(Calendar.getInstance()));
-
- session.save();
-
- workspace.move("/testMove", "/testMove1");
-
- Thread.sleep(7 * 1000);
-
- // COMPARE REPLICATION DATA
- assertNotNull(session2.getItem("/testMove1"));
- assertNotNull(session2.getItem("/testMove1/childNode2"));
- assertNotNull(session2.getItem("/testMove1/childNode2/jcr:content"));
-
- Node srcNode = root.getNode("testMove1").getNode("childNode2").getNode("jcr:content");
- Node destNode = root2.getNode("testMove1").getNode("childNode2").getNode("jcr:content");
-
- assertEquals(srcNode.getProperty("jcr:data").getString(), destNode.getProperty("jcr:data").getString());
- assertEquals(srcNode.getProperty("jcr:mimeType").getString(), destNode.getProperty("jcr:mimeType").getString());
- assertEquals(srcNode.getProperty("jcr:lastModified").getString(), destNode.getProperty("jcr:lastModified")
- .getString());
- }
-
- public void testBigDataMove() throws Exception
- {
-
- File tempFile = File.createTempFile("tempFile", "doc");
- tempFile.deleteOnExit();
-
- FileOutputStream fos = new FileOutputStream(tempFile);
-
- String content = "this is the content";
-
- for (int i = 0; i < 15000; i++)
- fos.write((i + " " + content).getBytes());
-
- fos.close();
-
- log.info("MOVE: file size = " + tempFile.length() + " bytes");
-
- Node file = root.addNode("testMove_", "nt:folder").addNode("childNode2", "nt:file");
- Node contentNode = file.addNode("jcr:content", "nt:resource");
- contentNode.setProperty("jcr:data", new FileInputStream(tempFile));
- contentNode.setProperty("jcr:mimeType", "text/plain");
- contentNode.setProperty("jcr:lastModified", session.getValueFactory().createValue(Calendar.getInstance()));
-
- session.save();
- log.info("FIRST");
-
- workspace.move("/testMove_", "/testMove_dest");
-
- session.save();
- log.info("MOVED");
-
- log.info("Sleep 15 seconds");
- Thread.yield();
- Thread.sleep(15 * 1000);
-
- // COMPARE REPLICATION DATA
- assertNotNull(session2.getItem("/testMove_dest"));
- assertNotNull(session2.getItem("/testMove_dest/childNode2"));
- assertNotNull(session2.getItem("/testMove_dest/childNode2/jcr:content"));
-
- Node srcNode = root.getNode("testMove_dest").getNode("childNode2").getNode("jcr:content");
- Node destNode = root2.getNode("testMove_dest").getNode("childNode2").getNode("jcr:content");
-
- log.info("source data size = " + srcNode.getProperty("jcr:data").getStream().available());
- log.info("destination data size = " + destNode.getProperty("jcr:data").getStream().available());
-
- assertEquals(srcNode.getProperty("jcr:data").getStream().available(), destNode.getProperty("jcr:data")
- .getStream().available());
- assertEquals(srcNode.getProperty("jcr:mimeType").getString(), destNode.getProperty("jcr:mimeType").getString());
- assertEquals(srcNode.getProperty("jcr:lastModified").getString(), destNode.getProperty("jcr:lastModified")
- .getString());
- }
-
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationDocumentViewImportTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationDocumentViewImportTest.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationDocumentViewImportTest.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-
-import javax.jcr.Node;
-
-/**
- * Created by The eXo Platform SAS Author : Alex Reshetnyak alex.reshetnyak(a)exoplatform.com.ua
- * 21.08.2009 10:59:36
- *
- * @version $Id: ReplicationDocumentViewImportTest.java 25.08.2009 10:49:36 rainfox
- */
-
-public class ReplicationDocumentViewImportTest
- extends BaseReplicationTest
-{
- public void testDocumentViewImportOverSession() throws Exception
- {
- Node nl1 = root.addNode("s_doc_view_node_l1");
- nl1.addNode("s_doc_view_node_l2");
- root.save();
-
- File f = File.createTempFile("s_doc_view", ".xml");
- f.deleteOnExit();
-
- // export
- session.exportDocumentView(nl1.getPath(), new FileOutputStream(f), false, false);
-
- Node parentImportPath = root.addNode("s_imported_doc_view_node");
- root.save();
-
- //import
- session.importXML(parentImportPath.getPath(), new FileInputStream(f), 0);
- session.save();
-
- Thread.sleep(5 * 1000);
-
- // check
- root.getNode("s_imported_doc_view_node").getNode("s_doc_view_node_l1").getNode("s_doc_view_node_l2");
- root2.getNode("s_imported_doc_view_node").getNode("s_doc_view_node_l1").getNode("s_doc_view_node_l2");
- }
-
- public void testDocumentViewImportOverWorksapce() throws Exception
- {
- Node nl1 = root.addNode("w_doc_view_node_l1");
- nl1.addNode("w_doc_view_node_l2");
- root.save();
-
- File f = File.createTempFile("w_doc_view", ".xml");
- f.deleteOnExit();
-
- // export
- session.exportDocumentView(nl1.getPath(), new FileOutputStream(f), false, false);
-
- Node parentImportPath = root.addNode("w_imported_doc_view_node");
- root.save();
-
- //import
- session.getWorkspace().importXML(parentImportPath.getPath(), new FileInputStream(f), 0);
- session.save();
-
- Thread.sleep(5 * 1000);
-
- // check
- root.getNode("w_imported_doc_view_node").getNode("w_doc_view_node_l1").getNode("w_doc_view_node_l2");
- root2.getNode("w_imported_doc_view_node").getNode("w_doc_view_node_l1").getNode("w_doc_view_node_l2");
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationEditDataTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationEditDataTest.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationEditDataTest.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication;
-
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-
-import java.util.Calendar;
-
-import javax.jcr.Node;
-
-/**
- * Created by The eXo Platform SAS Author : Alex Reshetnyak alex.reshetnyak(a)exoplatform.com.ua
- * 25.07.2007 17:48:00
- *
- * @version $Id: TestReplicationEditData.java 25.07.2007 17:48:00 rainfox
- */
-
-public class ReplicationEditDataTest extends BaseReplicationTest
-{
-
- private static final Log log = ExoLogger.getLogger("exo.jcr.component.ext.ReplicationEditDataTest");
-
- public void testAddNode() throws Exception
- {
-
- Node test = root.addNode("cms3").addNode("test");
-
- Node cool = test.addNode("nnn", "nt:file");
- Node contentNode = cool.addNode("jcr:content", "nt:resource");
- contentNode.setProperty("jcr:encoding", "UTF-8");
- contentNode.setProperty("jcr:data", "_______________silple data________________");
- contentNode.setProperty("jcr:mimeType", "plain/text");
- contentNode.setProperty("jcr:lastModified", session.getValueFactory().createValue(Calendar.getInstance()));
-
- try
- {
- session.save();
- }
- catch (Exception e)
- {
- log.error(e);
- fail("Error Save!!!");
- }
-
- // COMPARE REPLICATION DATA
- String sourceData =
- root.getNode("cms3").getNode("test").getNode("nnn").getNode("jcr:content").getProperty("jcr:data").getString();
- Thread.sleep(5 * 1000);
- String desinationData =
- root2.getNode("cms3").getNode("test").getNode("nnn").getNode("jcr:content").getProperty("jcr:data")
- .getString();
-
- log.info("Compare 1 data: \n" + sourceData + "\n" + desinationData);
- assertEquals(sourceData, desinationData);
-
- String newData = "____________simple_data_2____________";
-
- root2.getNode("cms3").getNode("test").getNode("nnn").getNode("jcr:content").setProperty("jcr:data", newData);
- session2.save();
-
- Thread.sleep(5 * 1000);
-
- sourceData =
- root.getNode("cms3").getNode("test").getNode("nnn").getNode("jcr:content").getProperty("jcr:data").getString();
- desinationData =
- root2.getNode("cms3").getNode("test").getNode("nnn").getNode("jcr:content").getProperty("jcr:data")
- .getString();
-
- log.info("Compare 2 data: \n" + sourceData + "\n" + desinationData);
- assertEquals(sourceData, desinationData);
- }
-
- public void tearDown() throws Exception
- {
- Thread.sleep(10 * 1000);
- log.info("Sleep 10 sec");
- super.tearDown();
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationExternalizableTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationExternalizableTest.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationExternalizableTest.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication;
-
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
- * @version $Id: ReplicationExternalizableTest.java 111 2008-11-11 11:11:11Z rainf0x $
- */
-public class ReplicationExternalizableTest extends BaseReplicationTest
-{
-
- private static final Log log = ExoLogger.getLogger("exo.jcr.component.ext.ReplicationExternalizableTest");
-
- private static final int BUFFER_SIZE = 1024;
-
- private Node rootNode;
-
- public void testname() throws Exception
- {
- rootNode = root;
- int folders = 20;
- int files = 10;
-
- Long size = Long.valueOf(1024 * 1024);
-
- String[] relPath = new String[folders];
-
- for (int i = 0; i < folders; i++)
- {
- relPath[i] = createRelPath(5);
- addBinaryPropertyOnly(relPath[i], "n_", size, files);
- }
-
- Thread.sleep(20000);
-
- }
-
- private StringBuffer addBinaryPropertyOnly(String repoPath, String nodeName, Long size, long iterations)
- throws Exception
- {
- StringBuffer sb = new StringBuffer();
-
- long start, end;
- byte[] buf = new byte[BUFFER_SIZE];
-
- File tempFile = null;
- try
- {
- tempFile = File.createTempFile("tempF", "_");
- FileOutputStream fos = new FileOutputStream(tempFile);
-
- for (int i = 0; i < buf.length; i++)
- buf[i] = (byte)(i % 255);
-
- for (long i = 0; i < size / BUFFER_SIZE; i++)
- fos.write(buf);
- fos.write(buf, 0, (int)(size % BUFFER_SIZE));
- fos.close();
-
- start = System.currentTimeMillis(); // to get the time of start
- for (int i = 0; i < iterations; i++)
- {
- Node baseNode = addNodePath(repoPath);
- baseNode.setProperty("d", new FileInputStream(tempFile));
-
- session.save();
-
- // Thread.sleep(10);
- }
-
- end = System.currentTimeMillis();
-
- log.info("The time of the adding of nt:file + " + iterations + "( " + tempFile.length() + " B ) : "
- + ((end - start) / 1000) + " sec");
-
- sb.append("ok");
- }
- catch (Exception e)
- {
- sb.append("fail");
- throw new Exception("Can't save the binary value : ", e);
- }
- finally
- {
- tempFile.delete();
- }
-
- return sb;
- }
-
- protected Node addNodePath(String repoPath) throws RepositoryException
- {
- Node resultNode = rootNode;
- String[] sArray = repoPath.split("[::]");
-
- for (String nodeName : sArray)
- if(!nodeName.equals(""))
- if (resultNode.hasNode(nodeName))
- resultNode = resultNode.getNode(nodeName);
- else
- resultNode = resultNode.addNode(nodeName, "nt:unstructured");
-
- return resultNode;
- }
-
- protected String createRelPath(long fSize)
- {
- String alphabet = "abcdefghijklmnopqrstuvwxyz";
- String relPath = "";
- long pathDepth = (fSize % 7) + 5;
-
- for (long i = 0; i < pathDepth; i++)
- {
- int index1 = (int)(Math.random() * 1000) % alphabet.length();
- int index2 = (int)(Math.random() * 1000) % alphabet.length();
- String s = alphabet.substring(index1, index1 + 1) + alphabet.substring(index2, index2 + 1);
- // s+=(int) (Math.random() * 100000);
-
- relPath += ("::" + s);
- }
-
- return relPath;
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationLockTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationLockTest.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationLockTest.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication;
-
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-
-import javax.jcr.Node;
-import javax.jcr.lock.Lock;
-import javax.jcr.lock.LockException;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
- * @version $Id: ReplicationLockTest.java 34445 2009-07-24 07:51:18Z dkatayev $
- */
-
-public class ReplicationLockTest extends BaseReplicationTest
-{
-
- private static final Log log = ExoLogger.getLogger("exo.jcr.component.ext.ReplicationLockTest");
-
- public void testLock() throws Exception
- {
- Node nodeLocked = root.addNode("Node Locked");
- nodeLocked.setProperty("jcr:data", "node data");
- nodeLocked.addMixin("mix:lockable");
- session.save();
-
- Thread.sleep(4 * 1000);
-
- Node destNodeLocked = root2.getNode("Node Locked");
- assertEquals("node data", destNodeLocked.getProperty("jcr:data").getString());
- assertEquals("mix:lockable", destNodeLocked.getMixinNodeTypes()[0].getName());
- assertEquals(false, destNodeLocked.isLocked());
-
- Lock lock = nodeLocked.lock(false, false);
- session.save();
-
- Thread.sleep(8 * 1000);
-
- assertEquals(true, destNodeLocked.isLocked());
-
- try
- {
- destNodeLocked.setProperty("jcr:data", "dd");
- session2.save();
- fail("Errore: Node is not locked");
- }
- catch (LockException e)
- {
- // ok
- }
-
- // unlock source node
- nodeLocked.unlock();
-
- Thread.sleep(8 * 1000);
-
- assertEquals(false, destNodeLocked.isLocked());
-
- // TODO
- // unlock destination node
- // lock = nodeLocked.lock(false, false);
- // session.save();
- //
- // Thread.sleep(4 * 1000);
- //
- // assertEquals(true, destNodeLocked.isLocked());
- //
- // destNodeLocked.unlock();
- //
- // Thread.sleep(4 * 1000);
- //
- // assertEquals(false, nodeLocked.isLocked());
- }
-
- public void test10Lock() throws Exception
- {
- for (int i = 0; i < 10; i++)
- {
- log.info("Lock node #" + i + " ...");
- String lockName = "Node Locked";
-
- Node nodeLocked = root.addNode(lockName + i);
- nodeLocked.setProperty("jcr:data", "node data");
- nodeLocked.addMixin("mix:lockable");
- session.save();
-
- Thread.sleep(2 * 1000);
-
- Node destNodeLocked = root2.getNode(lockName + i);
- assertEquals("node data", destNodeLocked.getProperty("jcr:data").getString());
- assertEquals("mix:lockable", destNodeLocked.getMixinNodeTypes()[0].getName());
- assertEquals(false, destNodeLocked.isLocked());
-
- log.info("Set lock");
- Lock lock = nodeLocked.lock(false, false);
- session.save();
-
- Thread.sleep(2 * 1000);
-
- assertEquals(true, destNodeLocked.isLocked());
-
- try
- {
- destNodeLocked.setProperty("jcr:data", "dd");
- session2.save();
- fail("Errore: Node is not locked");
- }
- catch (LockException e)
- {
- // ok
- }
-
- log.info("Set unlock");
- // unlock source node
- nodeLocked.unlock();
-
- Thread.sleep(2 * 1000);
-
- assertEquals(false, destNodeLocked.isLocked());
- }
- }
-
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationStreamTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationStreamTest.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationStreamTest.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication;
-
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.util.Calendar;
-
-import javax.jcr.Node;
-import javax.jcr.PathNotFoundException;
-
-/**
- * Created by The eXo Platform SAS Author : Alex Reshetnyak alex.reshetnyak(a)exoplatform.com.ua
- * 16.01.2007 15:21:45
- *
- * @version $Id: TestReplicationStream.java 16.01.2007 15:21:45 rainf0x
- */
-
-public class ReplicationStreamTest extends BaseReplicationTest
-{
-
- private static final Log log = ExoLogger.getLogger("exo.jcr.component.ext.ReplicationStreamTest");
-
- public void testAddNode() throws Exception
- {
- long start, end;
- byte[] buf = new byte[1024];
- int fileSize = 50000; // KB
-
- File tempFile = File.createTempFile("tempF", "_");
- FileOutputStream fos = new FileOutputStream(tempFile);
-
- for (int i = 0; i < buf.length; i++)
- buf[i] = (byte)(i % 255);
-
- for (int i = 0; i < fileSize; i++)
- fos.write(buf);
- fos.close();
-
- Node test = root.addNode("cms2").addNode("test");
- start = System.currentTimeMillis(); // to get the time of start
-
- Node cool = test.addNode("nnn", "nt:file");
- Node contentNode = cool.addNode("jcr:content", "nt:resource");
- contentNode.setProperty("jcr:encoding", "UTF-8");
- contentNode.setProperty("jcr:data", new FileInputStream(tempFile));
- contentNode.setProperty("jcr:mimeType", "application/octet-stream");
- contentNode.setProperty("jcr:lastModified", session.getValueFactory().createValue(Calendar.getInstance()));
-
- try
- {
- session.save();
- }
- catch (Exception e)
- {
- log.error(e);
- fail("Error Save!!!");
- }
-
- end = System.currentTimeMillis();
-
- System.out.println("The time of the adding of nt:file : " + ((end - start) / 1000) + " sec");
-
- // COMPARE REPLICATION DATA
- Node sourceNode = root.getNode("cms2").getNode("test").getNode("nnn").getNode("jcr:content");
- InputStream fis = sourceNode.getProperty("jcr:data").getStream();
-
- Thread.sleep(25 * 1000);
-
- Node desinationNode = root2.getNode("cms2").getNode("test").getNode("nnn").getNode("jcr:content");
- InputStream fis2 = desinationNode.getProperty("jcr:data").getStream();
-
- compareStream(fis, fis2);
-
- assertEquals(sourceNode.getProperty("jcr:encoding").getString(), desinationNode.getProperty("jcr:encoding")
- .getString());
-
- assertEquals(sourceNode.getProperty("jcr:lastModified").getString(), desinationNode.getProperty(
- "jcr:lastModified").getString());
-
- // delete
-
- Node srcParent = sourceNode.getParent();
- srcParent.remove();
- session.save();
-
- Thread.sleep(5 * 1000);
-
- try
- {
- Node destinationRemovablesNode = (Node)session2.getItem("/cms2/test/nnn");
- fail("The node " + destinationRemovablesNode.getPath() + "must be removed");
- }
- catch (PathNotFoundException pe)
- {
- // ok
- }
- }
-
- public void tearDown() throws Exception
- {
- Thread.sleep(10 * 1000);
- log.info("Sleep 10 sec");
- super.tearDown();
- }
-
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationSysViewImportTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationSysViewImportTest.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationSysViewImportTest.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-
-import javax.jcr.Node;
-
-/**
- * Created by The eXo Platform SAS Author : Alex Reshetnyak alex.reshetnyak(a)exoplatform.com.ua
- * 21.08.2009 10:59:36
- *
- * @version $Id: ReplicationSysViewImportTest.java 25.08.2009 10:49:36 rainfox
- */
-
-public class ReplicationSysViewImportTest
- extends BaseReplicationTest
-{
-
- public void testSysViewImportOverSession() throws Exception
- {
- Node nl1 = root.addNode("s_sys_view_node_l1");
- nl1.addNode("s_sys_view_node_l2");
- root.save();
-
- File f = File.createTempFile("s_sys_view", ".xml");
- f.deleteOnExit();
-
- // export
- session.exportSystemView(nl1.getPath(), new FileOutputStream(f), false, false);
-
- Node parentImportPath = root.addNode("s_imported_sys_view_node");
- root.save();
-
- //import
- session.importXML(parentImportPath.getPath(), new FileInputStream(f), 0);
- root.save();
-
- Thread.sleep(5 * 1000);
-
- // check
- root.getNode("s_imported_sys_view_node").getNode("s_sys_view_node_l1").getNode("s_sys_view_node_l2");
- root2.getNode("s_imported_sys_view_node").getNode("s_sys_view_node_l1").getNode("s_sys_view_node_l2");
- }
-
- public void testSysViewImportOverWorkspace() throws Exception
- {
- Node nl1 = root.addNode("w_sys_view_node_l1");
- nl1.addNode("w_sys_view_node_l2");
- root.save();
-
- File f = File.createTempFile("w_sys_view", ".xml");
- f.deleteOnExit();
-
- // export
- session.exportSystemView(nl1.getPath(), new FileOutputStream(f), false, false);
-
- Node parentImportPath = root.addNode("w_imported_sys_view_node");
- root.save();
-
- //import
- session.getWorkspace().importXML(parentImportPath.getPath(), new FileInputStream(f), 0);
- root.save();
-
- Thread.sleep(5 * 1000);
-
- // check
- root.getNode("w_imported_sys_view_node").getNode("w_sys_view_node_l1").getNode("w_sys_view_node_l2");
- root2.getNode("w_imported_sys_view_node").getNode("w_sys_view_node_l1").getNode("w_sys_view_node_l2");
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationVersionRestoreTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationVersionRestoreTest.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/ReplicationVersionRestoreTest.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,216 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication;
-
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.util.Calendar;
-
-import javax.jcr.Node;
-import javax.jcr.version.Version;
-
-/**
- * Created by The eXo Platform SAS Author : Alex Reshetnyak alex.reshetnyak(a)exoplatform.com.ua
- * 02.03.2007 14:31:17
- *
- * @version $Id: TestReplicationVersionRestore.java 02.03.2007 14:31:17 rainfox
- */
-
-public class ReplicationVersionRestoreTest extends BaseReplicationTest
-{
-
- private static final Log log = ExoLogger.getLogger("exo.jcr.component.ext.ReplicationVersionRestoreTest");
-
- public void testRestore() throws Exception
- {
- Node srcVersionNode = root.addNode("Version node 1");
- srcVersionNode.setProperty("jcr:data", "Base version");
- srcVersionNode.addMixin("mix:versionable");
- session.save();
-
- Thread.sleep(5 * 1000);
-
- Node destVersionNode = root2.getNode("Version node 1");
- assertEquals("Base version", destVersionNode.getProperty("jcr:data").getString());
-
- srcVersionNode.checkin();
- session.save();
-
- srcVersionNode.checkout();
- srcVersionNode.setProperty("jcr:data", "version 1");
- session.save();
-
- Thread.sleep(5 * 1000);
-
- assertEquals("version 1", destVersionNode.getProperty("jcr:data").getString());
-
- srcVersionNode.checkin();
- session.save();
-
- srcVersionNode.checkout();
- srcVersionNode.setProperty("jcr:data", "version 2");
- session.save();
-
- Thread.sleep(5 * 1000);
-
- assertEquals("version 2", destVersionNode.getProperty("jcr:data").getString());
-
- Version baseVersion = srcVersionNode.getBaseVersion();
- srcVersionNode.restore(baseVersion, true);
- session.save();
-
- Thread.sleep(5 * 1000);
-
- assertEquals("version 1", destVersionNode.getProperty("jcr:data").getString());
-
- Version baseVersion1 = srcVersionNode.getBaseVersion();
- Version[] predesessors = baseVersion1.getPredecessors();
- Version restoreToBaseVersion = predesessors[0];
-
- srcVersionNode.restore(restoreToBaseVersion, true);
- session.save();
-
- Thread.sleep(5 * 1000);
-
- assertEquals("Base version", destVersionNode.getProperty("jcr:data").getString());
- }
-
- public void testBigFileRestore() throws Exception
- {
-
- File tempFile = File.createTempFile("tempFile", "doc");
- File tempFile2 = File.createTempFile("tempFile", "doc");
- File tempFile3 = File.createTempFile("tempFile", "doc");
- tempFile.deleteOnExit();
- tempFile2.deleteOnExit();
- tempFile3.deleteOnExit();
-
- FileOutputStream fos = new FileOutputStream(tempFile);
- FileOutputStream fos2 = new FileOutputStream(tempFile2);
- FileOutputStream fos3 = new FileOutputStream(tempFile3);
-
- String content = "this is the content #1";
- String content2 = "this is the content #2_";
- String content3 = "this is the content #3__";
-
- for (int i = 0; i < 15000; i++)
- {
- fos.write((i + " " + content).getBytes());
- fos2.write((i + " " + content2).getBytes());
- fos3.write((i + " " + content3).getBytes());
- }
-
- fos.close();
- fos2.close();
- fos3.close();
-
- log.info("FILE for VERSION #1 : file size = " + tempFile.length() + " bytes");
- log.info("FILE for VERSION #2 : file size = " + tempFile2.length() + " bytes");
- log.info("FILE for VERSION #3 : file size = " + tempFile3.length() + " bytes");
-
- Node srcVersionNode = root.addNode("nt_file_node", "nt:file");
- Node contentNode = srcVersionNode.addNode("jcr:content", "nt:resource");
- contentNode.setProperty("jcr:data", new FileInputStream(tempFile));
- contentNode.setProperty("jcr:mimeType", "text/plain");
- contentNode.setProperty("jcr:lastModified", session.getValueFactory().createValue(Calendar.getInstance()));
- srcVersionNode.addMixin("mix:versionable");
-
- session.save();
-
- log.info("SAVED");
-
- Node srcVersion = root.getNode("nt_file_node");
- log.info("GET");
-
- long time = 10 * 1000;
-
- Thread.sleep(time);
-
- Node destVersionNode = root2.getNode("nt_file_node").getNode("jcr:content");
- log.info("ADD VERSION #1 : file size = " + destVersionNode.getProperty("jcr:data").getStream().available()
- + " bytes");
- compareStream(new FileInputStream(tempFile), destVersionNode.getProperty("jcr:data").getStream());
-
- srcVersion.checkin();
- session.save();
-
- srcVersion.checkout();
- srcVersionNode.getNode("jcr:content").setProperty("jcr:data", new FileInputStream(tempFile2));
- session.save();
-
- Thread.sleep(time);
-
- log.info("ADD VERSION #2 : file size = " + destVersionNode.getProperty("jcr:data").getStream().available()
- + " bytes");
- compareStream(new FileInputStream(tempFile2), destVersionNode.getProperty("jcr:data").getStream());
-
- srcVersion.checkin();
- session.save();
-
- Thread.sleep(time);
-
- srcVersion.checkout();
- srcVersionNode.getNode("jcr:content").setProperty("jcr:data", new FileInputStream(tempFile3));
- session.save();
-
- Thread.sleep(time);
-
- log.info("ADD VERSION #3 : file size = " + destVersionNode.getProperty("jcr:data").getStream().available()
- + " bytes");
- compareStream(new FileInputStream(tempFile3), destVersionNode.getProperty("jcr:data").getStream());
-
- Version baseVersion = srcVersion.getBaseVersion();
- srcVersion.restore(baseVersion, true);
- session.save();
-
- Thread.sleep(time);
-
- compareStream(new FileInputStream(tempFile2), destVersionNode.getProperty("jcr:data").getStream());
-
- Version baseVersion1 = srcVersion.getBaseVersion();
- Version[] predesessors = baseVersion1.getPredecessors();
- Version restoreToBaseVersion = predesessors[0];
-
- srcVersion.restore(restoreToBaseVersion, true); // HERE
- session.save();
-
- Thread.sleep(time);
-
- compareStream(new FileInputStream(tempFile), destVersionNode.getProperty("jcr:data").getStream());
-
- // restore from destination node
- Node destVersion = destVersionNode.getParent();
-
- Version baseVersion2 = destVersion.getBaseVersion();
- Version[] predesessors2 = baseVersion2.getSuccessors();
- Version restoreToBaseVersion_2 = predesessors2[0];
-
- destVersion.restore(restoreToBaseVersion_2, true);
- session.save();
-
- Thread.sleep(time);
-
- compareStream(new FileInputStream(tempFile2), srcVersionNode.getNode("jcr:content").getProperty("jcr:data")
- .getStream());
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/AddNTFileCheckerTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/AddNTFileCheckerTest.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/AddNTFileCheckerTest.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication.external;
-
-import org.exoplatform.services.jcr.ext.replication.test.ReplicationTestService;
-
-/**
- * Created by The eXo Platform SAS
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
- * @version $Id: AddNTFileCheckerTest.java 34445 2009-07-24 07:51:18Z dkatayev $
- */
-public class AddNTFileCheckerTest extends BaseTestCaseChecker
-{
- public void testAddNTFile() throws Exception
- {
-
- long[] filesSize = new long[]{12314, 652125, 5212358, 2106584, 305682};
- String relPathArray[] = new String[filesSize.length];
- String fileNameArray[] = new String[filesSize.length];
-
- // add nt:file to masterMember
- randomizeMembers();
- MemberInfo masterMember = getCurrentMasterMember();
-
- for (int i = 0; i < filesSize.length; i++)
- {
- long fSize = filesSize[i];
- String relPath = createRelPath(fSize);
- relPathArray[i] = relPath;
- fileNameArray[i] = "nt_file_" + fSize + "_" + (int)(Math.random() * MAX_RANDOM_VALUE);
-
- String url =
- "http://" + masterMember.getIpAddress() + ":" + masterMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + masterMember.getLogin() + "/" + masterMember.getPassword() + "/" + relPath + "/" + fileNameArray[i]
- + "/" + fSize + "/" + ReplicationTestService.Constants.OperationType.ADD_NT_FILE;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(masterMember);
- String result = client.execute(url);
- System.out.println(url);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
-
- // check nt:file in slaveMember
-
- for (int i = 0; i < filesSize.length; i++)
- {
- long fSize = filesSize[i];
- String relPath = relPathArray[i];
-
- for (MemberInfo slaveMember : getCurrentSlaveMembers())
- {
- String checkUrl =
- "http://" + slaveMember.getIpAddress() + ":" + slaveMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + slaveMember.getLogin() + "/" + slaveMember.getPassword() + "/" + relPath + "/" + fileNameArray[i]
- + "/" + fSize + "/" + ReplicationTestService.Constants.OperationType.CHECK_NT_FILE;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(slaveMember, 4000);
- String result = client.execute(checkUrl);
- System.out.println(checkUrl);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
- }
-
- // delete nt:file from masterMember
-
- for (int i = 0; i < filesSize.length; i++)
- {
- String relPath = relPathArray[i];
-
- String url =
- "http://" + masterMember.getIpAddress() + ":" + masterMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + masterMember.getLogin() + "/" + masterMember.getPassword() + "/" + relPath + "/" + fileNameArray[i]
- + "/" + ReplicationTestService.Constants.OperationType.DELETE;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(masterMember);
- String result = client.execute(url);
- System.out.println(url);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
-
- // check deleted node in slaveMember
-
- for (int i = 0; i < filesSize.length; i++)
- {
- long fSize = filesSize[i];
- String relPath = relPathArray[i];
-
- for (MemberInfo slaveMember : getCurrentSlaveMembers())
- {
- String checkUrl =
- "http://" + slaveMember.getIpAddress() + ":" + slaveMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + slaveMember.getLogin() + "/" + slaveMember.getPassword() + "/" + relPath + "/" + fileNameArray[i]
- + "/" + ReplicationTestService.Constants.OperationType.CHECK_DELETE;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(slaveMember, 4000);
- String result = client.execute(checkUrl);
- System.out.println(checkUrl);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
- }
-
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/BaseTestCaseChecker.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/BaseTestCaseChecker.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/BaseTestCaseChecker.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication.external;
-
-import junit.framework.TestCase;
-
-/**
- * Created by The eXo Platform SAS
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
- * @version $Id: BaseTestCaseChecker.java 34445 2009-07-24 07:51:18Z dkatayev $
- */
-public abstract class BaseTestCaseChecker extends TestCase
-{
-
- // for exo-application
- public final static String TEST_REALM = "eXo REST services";
-
- // for ECM
- // public final static String TEST_REALM = "exo-domain";
-
- protected static int MAX_RANDOM_VALUE = 1000000;
-
- protected final String workingRepository = "repository";
-
- protected final String workingWorkspace = "production";
-
- private final MemberInfo[] members =
- new MemberInfo[]{new MemberInfo("192.168.0.102", 8080, "root", "exo", 100),
- new MemberInfo("192.168.0.102", 8080, "root", "exo", 50),
- new MemberInfo("192.168.0.102", 8080, "root", "exo", 30)};
-
- private int maxPriorityMemberIndex;
-
- private int minPriorityMemberIndex;
-
- private MemberInfo masterMember;
-
- private MemberInfo[] slaveMembers;
-
- protected void setUp() throws Exception
- {
- // check max and min priority members;
- int min = Integer.MAX_VALUE;
- int max = Integer.MIN_VALUE;
- int minIndex = -1, maxIndex = -1;
-
- for (int mIndex = 0; mIndex < members.length; mIndex++)
- {
- MemberInfo memberInfo = members[mIndex];
-
- if (min > memberInfo.getPriority())
- {
- min = memberInfo.getPriority();
- minIndex = mIndex;
- }
-
- if (max < memberInfo.getPriority())
- {
- max = memberInfo.getPriority();
- maxIndex = mIndex;
- }
- }
-
- minPriorityMemberIndex = minIndex;
- maxPriorityMemberIndex = maxIndex;
- }
-
- protected String createRelPath(long fSize)
- {
- String alphabet = "abcdefghijklmnopqrstuvwxyz";
- String relPath = "";
- long pathDepth = (fSize % 7) + 5;
-
- for (long i = 0; i < pathDepth; i++)
- {
- int index1 = (int)(Math.random() * 1000) % alphabet.length();
- int index2 = (int)(Math.random() * 1000) % alphabet.length();
- String s = alphabet.substring(index1, index1 + 1) + alphabet.substring(index2, index2 + 1);
- // s+=(int) (Math.random() * 100000);
-
- relPath += ("::" + s);
- }
-
- return relPath;
- }
-
- public MemberInfo getCurrentMasterMember()
- {
- return masterMember;
- }
-
- public MemberInfo getMaxPriorityMember()
- {
- return members[maxPriorityMemberIndex];
- }
-
- public MemberInfo getMinPriorityMember()
- {
- return members[minPriorityMemberIndex];
- }
-
- public MemberInfo getMiddlePriorityMember()
- {
- for (MemberInfo memberInfo : members)
- if (!memberInfo.equals(members[maxPriorityMemberIndex]) && !memberInfo.equals(members[minPriorityMemberIndex]))
- {
- return memberInfo;
- }
- return members[minPriorityMemberIndex];
- }
-
- public MemberInfo[] getCurrentSlaveMembers()
- {
- return slaveMembers;
- }
-
- public MemberInfo[] getAllMembers()
- {
- return members;
- }
-
- public void randomizeMembers()
- {
- int masterIndex = (int)(Math.random() * 1000) % members.length;
-
- masterMember = members[masterIndex];
-
- slaveMembers = new MemberInfo[members.length - 1];
-
- int slaveMembersIndex = 0;
-
- for (int i = 0; i < members.length; i++)
- if (i != masterIndex)
- slaveMembers[slaveMembersIndex++] = members[i];
- }
-
- public long getRandomLong()
- {
- return (long)(Math.random() * MAX_RANDOM_VALUE);
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/BasicAuthenticationHttpClient.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/BasicAuthenticationHttpClient.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/BasicAuthenticationHttpClient.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication.external;
-
-import org.exoplatform.common.http.client.CookieModule;
-import org.exoplatform.common.http.client.HTTPConnection;
-import org.exoplatform.common.http.client.HTTPResponse;
-
-import java.net.URL;
-
-/**
- * Created by The eXo Platform SAS
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
- * @version $Id: BasicAuthenticationHttpClient.java 34445 2009-07-24 07:51:18Z dkatayev $
- */
-public class BasicAuthenticationHttpClient
-{
- private HTTPConnection connection;
-
- private long waitTime = 0;
-
- private final String ipAdress;
-
- private final int port;
-
- private final String login;
-
- private final String password;
-
- public BasicAuthenticationHttpClient(String ipAdress, int port, String login, String password)
- {
- this.ipAdress = ipAdress;
- this.port = port;
- this.login = login;
- this.password = password;
- }
-
- public BasicAuthenticationHttpClient(MemberInfo info)
- {
- this(info.getIpAddress(), info.getPort(), info.getLogin(), info.getPassword());
- }
-
- public BasicAuthenticationHttpClient(MemberInfo info, long waitTime)
- {
- this(info.getIpAddress(), info.getPort(), info.getLogin(), info.getPassword());
- this.waitTime = waitTime;
- }
-
- public String execute(String sURL)
- {
- String result = "fail";
-
- try
- {
- Thread.sleep(waitTime);
-
- // execute the GET
- URL url = new URL(sURL);
- connection = new HTTPConnection(url);
- connection.removeModule(CookieModule.class);
-
- connection.addBasicAuthorization(BaseTestCaseChecker.TEST_REALM, login, password);
-
- HTTPResponse resp = connection.Get(url.getFile());
-
- // print the status and response
- if (resp.getStatusCode() != 200)
- System.out.println(resp.getStatusCode() + "\n" + resp.getText());
-
- result = resp.getText();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- return result;
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/CopyMoveCheckerTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/CopyMoveCheckerTest.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/CopyMoveCheckerTest.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication.external;
-
-import org.exoplatform.services.jcr.ext.replication.test.ReplicationTestService;
-
-/**
- * Created by The eXo Platform SAS
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
- * @version $Id: CopyMoveCheckerTest.java 34445 2009-07-24 07:51:18Z dkatayev $
- */
-public class CopyMoveCheckerTest extends BaseTestCaseChecker
-{
-
- static long[] filesSize = new long[]{12314, 2106584, 305682};
-
- public void testWorkspaceCopy() throws Exception
- {
- String srcRepoPathArray[] = new String[filesSize.length];
- String nodeNameArray[] = new String[filesSize.length];
- String destNodeNameArray[] = new String[filesSize.length];
-
- // copy nt:file in masterMember
- randomizeMembers();
- MemberInfo masterMember = getCurrentMasterMember();
-
- for (int i = 0; i < filesSize.length; i++)
- {
- long contentSize = filesSize[i];
- String srcRepoPath = createRelPath(contentSize);
- srcRepoPathArray[i] = srcRepoPath;
- nodeNameArray[i] = "source_nt_file_" + contentSize + "_" + (int)(Math.random() * MAX_RANDOM_VALUE);
- destNodeNameArray[i] = "destination_nt_file_" + contentSize + "_" + (int)(Math.random() * MAX_RANDOM_VALUE);
-
- String url =
- "http://" + masterMember.getIpAddress() + ":" + masterMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + masterMember.getLogin() + "/" + masterMember.getPassword() + "/" + srcRepoPath + "/"
- + nodeNameArray[i] + "/" + destNodeNameArray[i] + "/" + contentSize + "/"
- + ReplicationTestService.Constants.OperationType.WORKSPACE_COPY;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(masterMember, 4000);
- String result = client.execute(url);
- System.out.println(url);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
-
- // check copy node in slaveMember
-
- for (int i = 0; i < filesSize.length; i++)
- {
- long contentSize = filesSize[i];
- String srcRepoPath = srcRepoPathArray[i];
-
- for (MemberInfo slaveMember : getCurrentSlaveMembers())
- {
- String checkUrl =
- "http://" + slaveMember.getIpAddress() + ":" + slaveMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + slaveMember.getLogin() + "/" + slaveMember.getPassword() + "/" + srcRepoPath + "/"
- + nodeNameArray[i] + "/" + destNodeNameArray[i] + "/" + contentSize + "/"
- + ReplicationTestService.Constants.OperationType.CHECK_COPY_MOVE_NODE;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(slaveMember, 4000);
- String result = client.execute(checkUrl);
- System.out.println(checkUrl);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
- }
- }
-
- public void testSessionMove() throws Exception
- {
- String srcRepoPathArray[] = new String[filesSize.length];
- String nodeNameArray[] = new String[filesSize.length];
- String destNodeNameArray[] = new String[filesSize.length];
-
- // move nt:file in masterMember
- randomizeMembers();
- MemberInfo masterMember = getCurrentMasterMember();
-
- for (int i = 0; i < filesSize.length; i++)
- {
- long contentSize = filesSize[i];
- String srcRepoPath = createRelPath(contentSize);
- srcRepoPathArray[i] = srcRepoPath;
- nodeNameArray[i] = "source_nt_file_" + contentSize + "_" + (int)(Math.random() * MAX_RANDOM_VALUE);
- destNodeNameArray[i] = "destination_nt_file_" + contentSize + "_" + (int)(Math.random() * MAX_RANDOM_VALUE);
-
- String url =
- "http://" + masterMember.getIpAddress() + ":" + masterMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + masterMember.getLogin() + "/" + masterMember.getPassword() + "/" + srcRepoPath + "/"
- + nodeNameArray[i] + "/" + destNodeNameArray[i] + "/" + contentSize + "/"
- + ReplicationTestService.Constants.OperationType.SESSION_MOVE;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(masterMember, 4000);
- String result = client.execute(url);
- System.out.println(url);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
-
- // check moved node in slaveMember
-
- for (int i = 0; i < filesSize.length; i++)
- {
- long contentSize = filesSize[i];
- String srcRepoPath = srcRepoPathArray[i];
-
- for (MemberInfo slaveMember : getCurrentSlaveMembers())
- {
- String checkUrl =
- "http://" + slaveMember.getIpAddress() + ":" + slaveMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + slaveMember.getLogin() + "/" + slaveMember.getPassword() + "/" + srcRepoPath + "/"
- + nodeNameArray[i] + "/" + destNodeNameArray[i] + "/" + contentSize + "/"
- + ReplicationTestService.Constants.OperationType.CHECK_COPY_MOVE_NODE;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(slaveMember, 4000);
- String result = client.execute(checkUrl);
- System.out.println(checkUrl);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
- }
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/LockCheckerTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/LockCheckerTest.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/LockCheckerTest.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication.external;
-
-import org.exoplatform.services.jcr.ext.replication.test.ReplicationTestService;
-
-/**
- * Created by The eXo Platform SAS
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
- * @version $Id: LockCheckerTest.java 34445 2009-07-24 07:51:18Z dkatayev $
- */
-public class LockCheckerTest extends BaseTestCaseChecker
-{
- public void testLock() throws Exception
- {
- int MANY_TEST = 2;
- String relPathArray[] = new String[MANY_TEST];
-
- // set lock to masterMember
- randomizeMembers();
- MemberInfo masterMember = getCurrentMasterMember();
-
- for (int i = 0; i < relPathArray.length; i++)
- {
- int rendomValue = (int)(Math.random() * MAX_RANDOM_VALUE);
- String relPath = createRelPath(rendomValue) + "::" + "locked_node" + rendomValue;
- relPathArray[i] = relPath;
-
- String url =
- "http://" + masterMember.getIpAddress() + ":" + masterMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + masterMember.getLogin() + "/" + masterMember.getPassword() + "/" + relPath + "/"
- + ReplicationTestService.Constants.OperationType.SET_LOCK;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(masterMember, 500);
- String result = client.execute(url);
- System.out.println(url);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
-
- // check lock in slaveMember
-
- for (int i = 0; i < relPathArray.length; i++)
- {
- String relPath = relPathArray[i];
-
- for (MemberInfo slaveMember : getCurrentSlaveMembers())
- {
- String checkUrl =
- "http://" + slaveMember.getIpAddress() + ":" + slaveMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + slaveMember.getLogin() + "/" + slaveMember.getPassword() + "/" + relPath + "/"
- + ReplicationTestService.Constants.OperationType.CECK_LOCK;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(slaveMember, 500);
- String result = client.execute(checkUrl);
- System.out.println(checkUrl);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
- }
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/MemberInfo.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/MemberInfo.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/MemberInfo.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication.external;
-
-/**
- * Created by The eXo Platform SAS
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
- * @version $Id: MemberInfo.java 34445 2009-07-24 07:51:18Z dkatayev $
- */
-public class MemberInfo
-{
- private final String ipAddress;
-
- private final int port;
-
- private final String login;
-
- private final String password;
-
- private final int priority;
-
- public MemberInfo(String ipAddress, int port, String login, String password, int priority)
- {
- this.ipAddress = ipAddress;
- this.port = port;
- this.login = login;
- this.password = password;
- this.priority = priority;
- }
-
- public String getIpAddress()
- {
- return ipAddress;
- }
-
- public int getPort()
- {
- return port;
- }
-
- public String getLogin()
- {
- return login;
- }
-
- public String getPassword()
- {
- return password;
- }
-
- public int getPriority()
- {
- return priority;
- }
-
- public boolean equals(MemberInfo memberInfo)
- {
- return (ipAddress.equals(memberInfo.getIpAddress()) && port == memberInfo.getPort() && priority == memberInfo
- .getPriority());
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/VersionCheckerTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/VersionCheckerTest.java 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/replication/external/VersionCheckerTest.java 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,282 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.replication.external;
-
-import org.exoplatform.services.jcr.ext.replication.test.ReplicationTestService;
-
-/**
- * Created by The eXo Platform SAS
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
- * @version $Id: VersionCheckerTest.java 34445 2009-07-24 07:51:18Z dkatayev $
- */
-public class VersionCheckerTest extends BaseTestCaseChecker
-{
- private static int MANY_TEST = 5;
-
- private static String relPathArray[] = new String[MANY_TEST];
-
- private static String baseVersionValue[] = new String[MANY_TEST];
-
- private static String versionValue_1[] = new String[MANY_TEST];
-
- private static String versionValue_2[] = new String[MANY_TEST];
-
- public void testCreateVersionNode() throws Exception
- {
- randomizeMembers();
- MemberInfo masterMember = getCurrentMasterMember();
-
- // create version node in masterMember
-
- for (int i = 0; i < relPathArray.length; i++)
- {
- int rendomValue = (int)(Math.random() * MAX_RANDOM_VALUE);
- String relPath = createRelPath(rendomValue) + "::" + "version_node" + rendomValue;
- relPathArray[i] = relPath;
- baseVersionValue[i] = "base_version_value" + (int)(Math.random() * MAX_RANDOM_VALUE);
-
- String url =
- "http://" + masterMember.getIpAddress() + ":" + masterMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + masterMember.getLogin() + "/" + masterMember.getPassword() + "/" + relPath + "/" + baseVersionValue[i]
- + "/" + ReplicationTestService.Constants.OperationType.ADD_VERSIONODE;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(masterMember);
- String result = client.execute(url);
- System.out.println(url);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
-
- // check version value in slaveMember
-
- for (int i = 0; i < relPathArray.length; i++)
- {
- String relPath = relPathArray[i];
-
- for (MemberInfo slaveMember : getCurrentSlaveMembers())
- {
- String checkUrl =
- "http://" + slaveMember.getIpAddress() + ":" + slaveMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + slaveMember.getLogin() + "/" + slaveMember.getPassword() + "/" + relPath + "/"
- + baseVersionValue[i] + "/" + ReplicationTestService.Constants.OperationType.CHECK_VERSION_NODE;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(slaveMember, 500);
- String result = client.execute(checkUrl);
- System.out.println(checkUrl);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
- }
- }
-
- public void testAddNewVersionValue() throws Exception
- {
- randomizeMembers();
- MemberInfo masterMember = getCurrentMasterMember();
- // create version node in masterMember
-
- for (int i = 0; i < relPathArray.length; i++)
- {
- versionValue_1[i] = "version_value_1_" + (int)(Math.random() * MAX_RANDOM_VALUE);
-
- String url =
- "http://" + masterMember.getIpAddress() + ":" + masterMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + masterMember.getLogin() + "/" + masterMember.getPassword() + "/" + relPathArray[i] + "/"
- + versionValue_1[i] + "/" + ReplicationTestService.Constants.OperationType.ADD_NEW_VERSION;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(masterMember);
- String result = client.execute(url);
- System.out.println(url);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
-
- // check version value in slaveMember
-
- for (int i = 0; i < relPathArray.length; i++)
- {
- String relPath = relPathArray[i];
-
- for (MemberInfo slaveMember : getCurrentSlaveMembers())
- {
- String checkUrl =
- "http://" + slaveMember.getIpAddress() + ":" + slaveMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + slaveMember.getLogin() + "/" + slaveMember.getPassword() + "/" + relPath + "/" + versionValue_1[i]
- + "/" + ReplicationTestService.Constants.OperationType.CHECK_VERSION_NODE;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(slaveMember, 500);
- String result = client.execute(checkUrl);
- System.out.println(checkUrl);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
- }
- }
-
- public void testAddNewVersionValue2() throws Exception
- {
- randomizeMembers();
- MemberInfo masterMember = getCurrentMasterMember();
-
- // create version node in masterMember
-
- for (int i = 0; i < relPathArray.length; i++)
- {
- versionValue_2[i] = "version_value_2_" + (int)(Math.random() * MAX_RANDOM_VALUE);
-
- String url =
- "http://" + masterMember.getIpAddress() + ":" + masterMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + masterMember.getLogin() + "/" + masterMember.getPassword() + "/" + relPathArray[i] + "/"
- + versionValue_2[i] + "/" + ReplicationTestService.Constants.OperationType.ADD_NEW_VERSION;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(masterMember);
- String result = client.execute(url);
- System.out.println(url);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
-
- // check version value in slaveMember
-
- for (int i = 0; i < relPathArray.length; i++)
- {
- String relPath = relPathArray[i];
-
- for (MemberInfo slaveMember : getCurrentSlaveMembers())
- {
- String checkUrl =
- "http://" + slaveMember.getIpAddress() + ":" + slaveMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + slaveMember.getLogin() + "/" + slaveMember.getPassword() + "/" + relPath + "/" + versionValue_2[i]
- + "/" + ReplicationTestService.Constants.OperationType.CHECK_VERSION_NODE;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(slaveMember, 500);
- String result = client.execute(checkUrl);
- System.out.println(checkUrl);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
- }
- }
-
- public void testRestorePreviousVersion() throws Exception
- {
- randomizeMembers();
- MemberInfo masterMember = getCurrentMasterMember();
-
- // create version node in masterMember
-
- for (int i = 0; i < relPathArray.length; i++)
- {
- String url =
- "http://" + masterMember.getIpAddress() + ":" + masterMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + masterMember.getLogin() + "/" + masterMember.getPassword() + "/" + relPathArray[i] + "/"
- + ReplicationTestService.Constants.OperationType.RESTORE_RPEVIOUS_VERSION;
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(masterMember);
- String result = client.execute(url);
- System.out.println(url);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
-
- // check version value in slaveMember
-
- for (int i = 0; i < relPathArray.length; i++)
- {
- String relPath = relPathArray[i];
-
- for (MemberInfo slaveMember : getCurrentSlaveMembers())
- {
- String checkUrl =
- "http://" + slaveMember.getIpAddress() + ":" + slaveMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + slaveMember.getLogin() + "/" + slaveMember.getPassword() + "/" + relPath + "/" + versionValue_1[i]
- + "/" + ReplicationTestService.Constants.OperationType.CHECK_VERSION_NODE;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(slaveMember, 500);
- String result = client.execute(checkUrl);
- System.out.println(checkUrl);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
- }
- }
-
- public void testRestoreBaseVersion() throws Exception
- {
- randomizeMembers();
- MemberInfo masterMember = getCurrentMasterMember();
-
- // create version node in masterMember
-
- for (int i = 0; i < relPathArray.length; i++)
- {
- String url =
- "http://" + masterMember.getIpAddress() + ":" + masterMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + masterMember.getLogin() + "/" + masterMember.getPassword() + "/" + relPathArray[i] + "/"
- + ReplicationTestService.Constants.OperationType.RESTORE_BASE_VERSION;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(masterMember);
- String result = client.execute(url);
- System.out.println(url);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
-
- // check version value in slaveMember
-
- for (int i = 0; i < relPathArray.length; i++)
- {
- String relPath = relPathArray[i];
-
- for (MemberInfo slaveMember : getCurrentSlaveMembers())
- {
- String checkUrl =
- "http://" + slaveMember.getIpAddress() + ":" + slaveMember.getPort()
- + ReplicationTestService.Constants.BASE_URL + "/" + workingRepository + "/" + workingWorkspace + "/"
- + slaveMember.getLogin() + "/" + slaveMember.getPassword() + "/" + relPath + "/"
- + baseVersionValue[i] + "/" + ReplicationTestService.Constants.OperationType.CHECK_VERSION_NODE;
-
- BasicAuthenticationHttpClient client = new BasicAuthenticationHttpClient(slaveMember, 500);
- String result = client.execute(checkUrl);
- System.out.println(checkUrl);
- System.out.println(result);
-
- assertEquals(result, "ok");
- }
- }
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-replication.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-replication.xml 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-replication.xml 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,355 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- Copyright (C) 2009 eXo Platform SAS.
-
- This is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this software; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-
--->
-<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd http://www.exoplatform.org/xml/ns/kernel_1_2.xsd"
- xmlns="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd">
-
- <!-- config replication for IPv4 -->
- <!-- for persistent mode -->
- <component>
- <type>org.exoplatform.services.jcr.ext.replication.ReplicationService</type>
- <init-params>
- <values-param>
- <name>repositories</name>
- <value>db1</value>
- <value>db2</value>
- </values-param>
- <properties-param>
- <name>replication-properties</name>
- <property name="test-mode" value="true" />
- <property name="enabled" value="true" />
- <property name="mode" value="persistent" />
- <property name="bind-ip-address" value="127.0.0.1" />
- <property name="channel-config"
- value="TCP(start_port=7700;oob_thread_pool.queue_max_size=100;thread_naming_pattern=cl;use_concurrent_stack=true;oob_thread_pool.rejection_policy=Run;discard_incompatible_packets=true;thread_pool.max_threads=40;oob_thread_pool.enabled=true;oob_thread_pool.max_threads=20;loopback=false;oob_thread_pool.keep_alive_time=5000;thread_pool.queue_enabled=false;oob_thread_pool.queue_enabled=false;max_bundle_size=64000;thread_pool.queue_max_size=100;thread_pool.enabled=true;enable_diagnostics=true;max_bundle_timeout=30;oob_thread_pool.min_threads=8;use_incoming_packet_handler=true;thread_pool.rejection_policy=Run;bind_addr=$bind-ip-address;thread_pool.min_threads=8;thread_pool.keep_alive_time=5000;enable_bundling=true):MPING(timeout=2000;num_initial_members=8;mcast_port=34526;mcast_addr=224.0.0.1;bind_addr=$bind-ip-address):FD_SOCK:VERIFY_SUSPECT(timeout=1500):pbcast.NAKACK(max_xmit_size=60000;print_stability_history_on_failed_xmit=true;use_mcast_xmit=false;gc_lag=0;di!
scard_delivered_msgs=true;retransmit_timeout=300,600,1200,2400,4800):pbcast.STABLE(stability_delay=1000;desired_avg_gossip=50000;max_bytes=8000000):pbcast.GMS(print_local_addr=true;join_timeout=3000;view_bundling=true;join_retry_timeout=2000;shun=false)" />
- <property name="recovery-dir" value="target/replication/recovery" />
- <property name="node-name" value="cluster_node1" />
- <property name="other-participants" value="cluster_node2" />
- <property name="wait-confirmation" value="2000" />
- </properties-param>
- <properties-param>
- <name>replication-priority-properties</name>
- <property name="priority-type" value="static" /><!-- {static, dynamic} -->
- <property name="node-priority" value="100" /><!-- max == 100 -->
- </properties-param>
- </init-params>
- </component>
-
- <!-- for proxy mode -->
- <!-- component>
- <type>org.exoplatform.services.jcr.ext.replication.ReplicationService</type>
- <init-params>
- <values-param>
- <name>repositories</name>
- <value>db1</value>
- <value>db2</value>
- </values-param>
- <properties-param>
- <name>replication-properties</name>
- <property name="test-mode" value="true" />
- <property name="enabled" value="true" />
- <property name="mode" value="proxy" />
- <property name="bind-ip-address" value="192.168.0.15" />
- <property name="channel-config"
- value="TCP(start_port=7700;oob_thread_pool.queue_max_size=100;thread_naming_pattern=cl;use_concurrent_stack=true;oob_thread_pool.rejection_policy=Run;discard_incompatible_packets=true;thread_pool.max_threads=40;oob_thread_pool.enabled=true;oob_thread_pool.max_threads=20;loopback=false;oob_thread_pool.keep_alive_time=5000;thread_pool.queue_enabled=false;oob_thread_pool.queue_enabled=false;max_bundle_size=64000;thread_pool.queue_max_size=100;thread_pool.enabled=true;enable_diagnostics=true;max_bundle_timeout=30;oob_thread_pool.min_threads=8;use_incoming_packet_handler=true;thread_pool.rejection_policy=Run;bind_addr=$bind-ip-address;thread_pool.min_threads=8;thread_pool.keep_alive_time=5000;enable_bundling=true):MPING(timeout=2000;num_initial_members=8;mcast_port=34526;mcast_addr=224.0.0.1;bind_addr=$bind-ip-address):FD_SOCK:VERIFY_SUSPECT(timeout=1500):pbcast.NAKACK(max_xmit_size=60000;print_stability_history_on_failed_xmit=true;use_mcast_xmit=false;gc_lag=0;di!
scard_delivered_msgs=true;retransmit_timeout=300,600,1200,2400,4800):pbcast.STABLE(stability_delay=1000;desired_avg_gossip=50000;max_bytes=8000000):pbcast.GMS(print_local_addr=true;join_timeout=3000;view_bundling=true;join_retry_timeout=2000;shun=false)" />
- <property name="recovery-dir" value="target/replication/recovery" />
- <property name="node-name" value="cluster_node1" />
- <property name="other-participants" value="cluster_node2" />
- <property name="wait-confirmation" value="2000" />
- </properties-param>
- <properties-param>
- <name>replication-priority-properties</name>
- <property name="priority-type" value="static" />
- <property name="node-priority" value="100" />
- </properties-param>
- </init-params>
- </component -->
-
- <!-- config replication for IPv6 -->
- <!-- component>
- <type>org.exoplatform.services.jcr.ext.replication.ReplicationService</type>
- <init-params>
- <values-param>
- <name>repositories</name>
- <value>db1</value>
- <value>db2</value>
- </values-param>
- <properties-param>
- <name>replication-properties</name>
- <property name="test-mode" value="true" />
- <property name="enabled" value="true" />
- <property name="mode" value="persistent" />
- <property name="bind-ip-address" value="fe80::215:f2ff:febe:3343%4" />
- <property name="channel-config"
- value="TCP(start_port=7700;oob_thread_pool.queue_max_size=100;thread_naming_pattern=cl;use_concurrent_stack=true;oob_thread_pool.rejection_policy=Run;discard_incompatible_packets=true;thread_pool.max_threads=40;oob_thread_pool.enabled=true;oob_thread_pool.max_threads=20;loopback=false;oob_thread_pool.keep_alive_time=5000;thread_pool.queue_enabled=false;oob_thread_pool.queue_enabled=false;max_bundle_size=64000;thread_pool.queue_max_size=100;thread_pool.enabled=true;enable_diagnostics=true;max_bundle_timeout=30;oob_thread_pool.min_threads=8;use_incoming_packet_handler=true;thread_pool.rejection_policy=Run;bind_addr=$bind-ip-address;thread_pool.min_threads=8;thread_pool.keep_alive_time=5000;enable_bundling=true):MPING(timeout=2000;num_initial_members=8;mcast_port=34526;mcast_addr=ff18:eb72:479f::2:3;bind_addr=$bind-ip-address):FD_SOCK:VERIFY_SUSPECT(timeout=1500):pbcast.NAKACK(max_xmit_size=60000;print_stability_history_on_failed_xmit=true;use_mcast_xmit=false;g!
c_lag=0;discard_delivered_msgs=true;retransmit_timeout=300,600,1200,2400,4800):pbcast.STABLE(stability_delay=1000;desired_avg_gossip=50000;max_bytes=8000000):pbcast.GMS(print_local_addr=true;join_timeout=3000;view_bundling=true;join_retry_timeout=2000;shun=false)" />
- <property name="recovery-dir" value="target/replication/recovery" />
- <property name="node-name" value="cluster_node1" />
- <property name="other-participants" value="cluster_node2" />
- <property name="wait-confirmation" value="2000" />
- </properties-param>
- <properties-param>
- <name>replication-priority-properties</name>
- <property name="priority-type" value="static" />
- <property name="node-priority" value="100" />
- </properties-param>
- </component -->
-
- <component>
- <key>org.exoplatform.services.log.LogConfigurationInitializer</key>
- <type>org.exoplatform.services.log.LogConfigurationInitializer</type>
- <init-params>
- <value-param>
- <name>logger</name>
- <value>org.exoplatform.services.log.impl.BufferedLog4JLogger</value>
- </value-param>
- <value-param>
- <name>configurator</name>
- <value>org.exoplatform.services.log.impl.Log4JConfigurator</value>
- </value-param>
- <properties-param>
- <name>properties</name>
- <description>Log4J properties</description>
- <property name="log4j.rootLogger" value="INFO, stdout, file" />
-
- <property name="log4j.appender.stdout" value="org.apache.log4j.ConsoleAppender" />
- <property name="log4j.appender.stdout.threshold" value="DEBUG" />
-
- <property name="log4j.appender.stdout.layout" value="org.apache.log4j.PatternLayout" />
- <property name="log4j.appender.stdout.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
-
- <property name="log4j.appender.file" value="org.apache.log4j.FileAppender" />
- <property name="log4j.appender.file.File" value="target/jcr.log" />
-
- <property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout" />
- <property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
-
- <!-- property name="log4j.category.jcr.DBInitializer" value="DEBUG"/ -->
- <!-- property name="log4j.category.ext.AbstractWorkspaceDataReceiver" value="DEBUG"/ -->
-
- </properties-param>
- </init-params>
- </component>
-
- <component>
- <key>org.exoplatform.services.jcr.RepositoryService</key>
- <type>org.exoplatform.services.jcr.impl.RepositoryServiceImpl</type>
- <component-plugins>
- <component-plugin>
- <name>add.namespaces</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
- <init-params>
- <properties-param>
- <name>namespaces</name>
- <property name="test" value="http://www.apache.org/jackrabbit/test" />
- <property name="exojcrtest" value="http://www.exoplatform.org/jcr/test/1.0" />
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>add.nodeType</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
- <init-params>
- <values-param>
- <name>autoCreatedInNewRepository</name>
- <description>Node types configuration file</description>
- <!-- value>jar:/conf/test/nodetypes-impl.xml</value -->
- </values-param>
- </init-params>
- </component-plugin>
- </component-plugins>
- </component>
-
- <component>
- <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
- <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
- <init-params>
- <value-param>
- <name>conf-path</name>
- <description>JCR configuration file</description>
- <value>file:src/test/resources/conf/standalone/test-jcr-ext-config-replication.xml</value>
- </value-param>
- </init-params>
- </component>
-
- <component>
- <type>org.exoplatform.services.organization.impl.mock.DummyOrganizationService</type>
- </component>
-
- <external-component-plugins>
- <target-component>org.exoplatform.services.naming.InitialContextInitializer</target-component>
- <component-plugin>
- <name>bind.datasource</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>jdbcjcr</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.sql.DataSource</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal1" />
- <property name="username" value="sa" />
- <property name="password" value="" />
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>bind.datasource</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>jdbcjcr1</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.sql.DataSource</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
- <property name="url" value="jdbc:hsqldb:file:target/temp2/data/portal2" />
- <property name="username" value="sa" />
- <property name="password" value="" />
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>bind.datasource</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>jdbcjcr2</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.sql.DataSource</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
- <property name="url" value="jdbc:hsqldb:file:target/temp1/data/portal1" />
- <property name="username" value="sa" />
- <property name="password" value="" />
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>jotm.tx</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>UserTransaction</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.transaction.UserTransaction</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.objectweb.jotm.UserTransactionFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="jotm.timeout" value="60" />
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>bind.jcr</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>repo</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.jcr.Repository</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.exoplatform.services.jcr.impl.jndi.BindableRepositoryFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="repositoryName" value="db1" />
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>rmi.jcr</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>rmirepository</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.jcr.Repository</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.exoplatform.services.jcr.rmi.RepositoryFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="url" value="//localhost:9999/repository" />
- </properties-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-
-</configuration>
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config-replication.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config-replication.xml 2012-01-10 12:39:15 UTC (rev 5432)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config-replication.xml 2012-01-10 13:39:25 UTC (rev 5433)
@@ -1,200 +0,0 @@
-<!--
-
- Copyright (C) 2009 eXo Platform SAS.
-
- This is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this software; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-
--->
-<!-- for persistent mode -->
-
-<repository-service default-repository="db1">
- <repositories>
-
- <repository name="db1" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <access-control>optional</access-control>
-
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="ws" auto-init-root-nodetype="nt:unstructured" auto-init-permissions="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr2" />
- <property name="dialect" value="generic" />
- <property name="multi-db" value="true" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp1/swap/ws" />
- </properties>
- <value-storages>
- <value-storage id="Storage #1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp1/values/ws" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100000" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <cache enabled="true">
- <properties>
- <property name="max-size" value="1000" />
- <property name="live-time" value="1800" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp1/index" />
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
-
- <repository name="db2" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <access-control>optional</access-control>
-
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="ws" auto-init-root-nodetype="nt:unstructured" auto-init-permissions="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr1" />
- <property name="dialect" value="generic" />
- <property name="multi-db" value="true" />
- <property name="max-buffer-size" value="204800" />
- <property name="swap-directory" value="target/temp2/swap/ws" />
- </properties>
- <value-storages>
- <value-storage id="Storage #1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp2/values/ws" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100000" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <cache enabled="true">
- <properties>
- <property name="max-size" value="1000" />
- <property name="live-time" value="1800" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp2/index" />
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
-
- </repositories>
-</repository-service>
-
-
-<!-- for proxy mode -->
-
-<!-- repository-service default-repository="db1">
- <repositories>
-
- <repository name="db1" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <access-control>optional</access-control>
-
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="ws" auto-init-root-nodetype="nt:unstructured" auto-init-permissions="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr1" />
- <property name="dialect" value="generic" />
- <property name="multi-db" value="true" />
- <property name="max-buffer-size" value="204800" />
- <property name="swap-directory" value="target/temp1/swap/ws" />
- </properties>
- <value-storages>
- <value-storage id="Storage #1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp1/values/ws" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100000" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <cache enabled="true">
- <properties>
- <property name="max-size" value="1000" />
- <property name="live-time" value="1800" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp1/index" />
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
-
- <repository name="db2" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <access-control>optional</access-control>
-
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="ws" auto-init-root-nodetype="nt:unstructured" auto-init-permissions="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr1" />
- <property name="dialect" value="generic" />
- <property name="multi-db" value="true" />
- <property name="max-buffer-size" value="204800" />
- <property name="swap-directory" value="target/temp1/swap/ws" />
- </properties>
- <value-storages>
- <value-storage id="Storage #1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp1/values/ws" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100000" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <cache enabled="true">
- <properties>
- <property name="max-size" value="1000" />
- <property name="live-time" value="1800" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp2/index" />
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
-
- </repositories>
-</repository-service -->
\ No newline at end of file
14 years, 3 months
exo-jcr SVN: r5432 - in jcr/branches/1.15.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent and 12 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-10 07:39:15 -0500 (Tue, 10 Jan 2012)
New Revision: 5432
Modified:
jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ShareableSupportedWorkspaceDataManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestJBossCacheWorkspaceStorageCache.java
Log:
EXOJCR-978: Removed deprecated methods from ItemDataConsumer, WorkspaceStorageConnection and WorkspaceStorageCache interfaces
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -44,19 +44,6 @@
{
/**
- * Find Item by parent (id) and name (with path index).
- *
- * @param parent
- * NodeData
- * @param name
- * item name
- * @return ItemData, data by parent and name
- * @throws RepositoryException
- */
- @Deprecated
- ItemData getItemData(NodeData parent, QPathEntry name) throws RepositoryException;
-
- /**
* Find Item by parent (id) and name (with path index) of define type.
*
* @param parent
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -49,18 +49,6 @@
public static final String LIVE_TIME_PARAMETER_NAME = "live-time";
/**
- * Get item by parent identifier and name +index.
- *
- * @param parentIdentifier
- * parent identifier
- * @param name
- * item name
- * @return itemData by parent Identifier and item name with index or null in other case
- */
- @Deprecated
- ItemData get(String parentIdentifier, QPathEntry name);
-
- /**
* Get item by parent identifier and name +index of define type.
*
* @param parentIdentifier
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -169,22 +169,6 @@
* @param parent
* @param relPath
* - array of QPathEntry which represents the relation path to the searched item
- * @return existed item data or null if not found
- * @throws RepositoryException
- */
- @Deprecated
- public ItemData getItemData(NodeData parent, QPathEntry[] relPathEntries) throws RepositoryException
- {
- return getItemData(parent, relPathEntries, ItemType.UNKNOWN);
- }
-
- /**
- * Return item data by parent NodeDada and relPathEntries If relpath is JCRPath.THIS_RELPATH = '.'
- * it return itself
- *
- * @param parent
- * @param relPath
- * - array of QPathEntry which represents the relation path to the searched item
* @param itemType
* - item type
* @return existed item data or null if not found
@@ -225,14 +209,6 @@
/**
* {@inheritDoc}
*/
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
- {
- return getItemData(parentData, name, ItemType.UNKNOWN);
- }
-
- /**
- * {@inheritDoc}
- */
public ItemData getItemData(NodeData parent, QPathEntry name, ItemType itemType) throws RepositoryException
{
return getItemData(parent, name, false, itemType, true);
@@ -328,26 +304,6 @@
* @return existed item or null if not found
* @throws RepositoryException
*/
- @Deprecated
- public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool) throws RepositoryException
- {
- return getItem(parent, name, pool, ItemType.UNKNOWN);
- }
-
- /**
- * Return Item by parent NodeDada and the name of searched item.
- *
- * @param parent
- * - parent of the searched item
- * @param name
- * - item name
- * @param itemType
- * - item type
- * @param pool
- * - indicates does the item fall in pool
- * @return existed item or null if not found
- * @throws RepositoryException
- */
public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, ItemType itemType)
throws RepositoryException
{
@@ -422,27 +378,6 @@
}
}
- /**
- * Return Item by parent NodeDada and the name of searched item.
- *
- * @param parent
- * - parent of the searched item
- * @param name
- * - item name
- * @param pool
- * - indicates does the item fall in pool
- * @param skipCheckInPersistence
- * - skip getting Item from persistence if need
- * @return existed item or null if not found
- * @throws RepositoryException
- */
- @Deprecated
- public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, boolean skipCheckInPersistence)
- throws RepositoryException
- {
- return getItem(parent, name, pool, skipCheckInPersistence, ItemType.UNKNOWN, true);
- }
-
public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, boolean skipCheckInPersistence,
ItemType itemType) throws RepositoryException
{
@@ -503,25 +438,6 @@
* - array of QPathEntry which represents the relation path to the searched item
* @param pool
* - indicates does the item fall in pool
- * @return existed item or null if not found
- * @throws RepositoryException
- */
- @Deprecated
- public ItemImpl getItem(NodeData parent, QPathEntry[] relPath, boolean pool) throws RepositoryException
- {
- return getItem(parent, relPath, pool, ItemType.UNKNOWN);
- }
-
- /**
- * Return Item by parent NodeDada and array of QPathEntry which represent a relative path to the
- * searched item
- *
- * @param parent
- * - parent of the searched item
- * @param relPath
- * - array of QPathEntry which represents the relation path to the searched item
- * @param pool
- * - indicates does the item fall in pool
* @param itemType
* - item type
* @return existed item or null if not found
@@ -882,111 +798,6 @@
}
/**
- * Return list with properties, for the parent node, for which user have access permeations.
- *
- * @param parent
- * NodeData
- * @param pool
- * boolean, if true list of childs will be refreshed in Items pool
- * @return List of NodeImpl
- * @throws RepositoryException
- * if error occurs
- * @throws AccessDeniedException
- * if it's no permissions for childs listing
- */
- @Deprecated
- public List<NodeImpl> getChildNodes(NodeData parent, boolean pool) throws RepositoryException, AccessDeniedException
- {
-
- long start = 0;
- if (log.isDebugEnabled())
- {
- start = System.currentTimeMillis();
- log.debug("getChildNodes(" + parent.getQPath().getAsString() + ") >>>>>");
- }
-
- try
- {
- // merge data from changesLog with data from txManager
- List<NodeData> nodeDatas = getChildNodesData(parent);
- List<NodeImpl> nodes = new ArrayList<NodeImpl>(nodeDatas.size());
-
- for (int i = 0, length = nodeDatas.size(); i < length; i++)
- {
- NodeData data = nodeDatas.get(i);
- if (accessManager.hasPermission(data.getACL(), new String[]{PermissionType.READ}, session.getUserState()
- .getIdentity()))
- {
- NodeImpl item = (NodeImpl)readItem(data, parent, pool, false);
- session.getActionHandler().postRead(item);
- nodes.add(item);
- }
- }
- return nodes;
- }
- finally
- {
- if (log.isDebugEnabled())
- {
- log.debug("getChildNodes(" + parent.getQPath().getAsString() + ") <<<<< "
- + ((System.currentTimeMillis() - start) / 1000d) + "sec");
- }
- }
- }
-
- /**
- * Return list with properties, for the parent node, for which user have access permeations.
- *
- * @param parent
- * NodeData
- * @param pool
- * boolean, if true list of childs will be refreshed in Items pool
- * @return List of PropertyImpl
- * @throws RepositoryException
- * if error occurs
- * @throws AccessDeniedException
- * if it's no permissions for childs listing
- */
- @Deprecated
- public List<PropertyImpl> getChildProperties(NodeData parent, boolean pool) throws RepositoryException,
- AccessDeniedException
- {
-
- long start = 0;
- if (log.isDebugEnabled())
- {
- start = System.currentTimeMillis();
- log.debug("getChildProperties(" + parent.getQPath().getAsString() + ") >>>>>");
- }
-
- try
- {
- List<PropertyData> propDatas = getChildPropertiesData(parent);
- List<PropertyImpl> props = new ArrayList<PropertyImpl>(propDatas.size());
- for (int i = 0, length = propDatas.size(); i < length; i++)
- {
- PropertyData data = propDatas.get(i);
- if (accessManager.hasPermission(parent.getACL(), new String[]{PermissionType.READ}, session.getUserState()
- .getIdentity()))
- {
- ItemImpl item = readItem(data, parent, pool, false);
- session.getActionHandler().postRead(item);
- props.add((PropertyImpl)item);
- }
- }
- return props;
- }
- finally
- {
- if (log.isDebugEnabled())
- {
- log.debug("getChildProperties(" + parent.getQPath().getAsString() + ") <<<<< "
- + ((System.currentTimeMillis() - start) / 1000d) + "sec");
- }
- }
- }
-
- /**
* {@inheritDoc}
*/
public boolean getChildNodesDataByPage(final NodeData parent, int fromOrderNum, int toOrderNum, List<NodeData> childs)
@@ -2615,70 +2426,6 @@
}
/**
- * Load nodes ti the pool USED FOR TEST PURPOSE ONLY
- *
- * @param nodes
- * @return child nodes
- * @throws RepositoryException
- */
- @Deprecated
- List<NodeImpl> getNodes(List<NodeImpl> nodes) throws RepositoryException
- {
- List<NodeImpl> children = new ArrayList<NodeImpl>();
- for (NodeImpl node : nodes)
- {
- String id = node.getInternalIdentifier();
-
- WeakReference<ItemImpl> weakItem = items.get(id);
- NodeImpl pooled = weakItem != null ? (NodeImpl)weakItem.get() : null;
-
- if (pooled == null)
- {
- items.put(id, new WeakReference<ItemImpl>(node));
- children.add(node);
- }
- else
- {
- pooled.loadData(node.getData());
- children.add(pooled);
- }
- }
- return children;
- }
-
- /**
- * Load properties to the pool USED FOR TEST PURPOSE ONLY
- *
- * @param props
- * @return child properties
- * @throws RepositoryException
- */
- @Deprecated
- List<PropertyImpl> getProperties(List<PropertyImpl> props) throws RepositoryException
- {
- List<PropertyImpl> children = new ArrayList<PropertyImpl>();
- for (PropertyImpl prop : props)
- {
- String id = prop.getInternalIdentifier();
-
- WeakReference<ItemImpl> weakItem = items.get(id);
- PropertyImpl pooled = weakItem != null ? (PropertyImpl)weakItem.get() : null;
-
- if (pooled == null)
- {
- items.put(id, new WeakReference<ItemImpl>(prop));
- children.add(prop);
- }
- else
- {
- pooled.loadData(prop.getData());
- children.add(pooled);
- }
- }
- return children;
- }
-
- /**
* Search for all descendants of given parent path.
*
* @parentPath parent path
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -98,14 +98,6 @@
/**
* {@inheritDoc}
*/
- public ItemData getItemData(NodeData parent, QPathEntry name) throws RepositoryException
- {
- return getItemData(parent, name, ItemType.UNKNOWN);
- }
-
- /**
- * {@inheritDoc}
- */
public ItemData getItemData(NodeData parent, QPathEntry name, ItemType itemType) throws RepositoryException
{
return getItemData(parent, name, itemType, true);
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -718,15 +718,6 @@
* {@inheritDoc}
*/
@Override
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
- {
- return getItemData(parentData, name, ItemType.UNKNOWN);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public ItemData getItemData(final NodeData parentData, final QPathEntry name, final ItemType itemType)
throws RepositoryException
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -884,14 +884,6 @@
/**
* {@inheritDoc}
*/
- public ItemData get(String parentIdentifier, QPathEntry name)
- {
- return get(parentIdentifier, name, ItemType.UNKNOWN);
- }
-
- /**
- * {@inheritDoc}
- */
public ItemData get(final String parentId, final QPathEntry name, ItemType itemType)
{
if (enabled && parentId != null && name != null)
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ShareableSupportedWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ShareableSupportedWorkspaceDataManager.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ShareableSupportedWorkspaceDataManager.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -98,14 +98,6 @@
/**
* {@inheritDoc}
*/
- public ItemData getItemData(NodeData parent, QPathEntry name) throws RepositoryException
- {
- return getItemData(parent, name, ItemType.UNKNOWN);
- }
-
- /**
- * {@inheritDoc}
- */
public ItemData getItemData(NodeData parent, QPathEntry name, ItemType itemType) throws RepositoryException
{
return getItemData(parent, name, itemType, true);
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -172,15 +172,6 @@
* {@inheritDoc}
*/
@Override
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
- {
- return getItemData(parentData, name, ItemType.UNKNOWN);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException
{
return getItemData(parentData, name, itemType, true);
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -1035,14 +1035,6 @@
/**
* {@inheritDoc}
*/
- public ItemData getItemData(final NodeData parentData, final QPathEntry name) throws RepositoryException
- {
- return getItemData(parentData, name, ItemType.UNKNOWN);
- }
-
- /**
- * {@inheritDoc}
- */
public ItemData getItemData(final NodeData parentData, final QPathEntry name, ItemType itemType)
throws RepositoryException
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -1107,14 +1107,6 @@
/**
* {@inheritDoc}
*/
- public ItemData get(String parentId, QPathEntry name)
- {
- return get(parentId, name, ItemType.UNKNOWN);
- }
-
- /**
- * {@inheritDoc}
- */
public ItemData get(String parentId, QPathEntry name, ItemType itemType)
{
return getFromCacheByPath.run(parentId, name, itemType);
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -338,14 +338,6 @@
/**
* {@inheritDoc}
*/
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
- {
- return getItemData(parentData, name, ItemType.UNKNOWN);
- }
-
- /**
- * {@inheritDoc}
- */
public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException
{
return getItemData(parentData, name, itemType, true);
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -1250,14 +1250,6 @@
/**
* {@inheritDoc}
*/
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException
- {
- return getItemData(parentData, name, ItemType.UNKNOWN);
- }
-
- /**
- * {@inheritDoc}
- */
public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
IllegalStateException
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -480,14 +480,6 @@
/**
* {@inheritDoc}
*/
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException
- {
- return getItemData(parentData, name, ItemType.UNKNOWN);
- }
-
- /**
- * {@inheritDoc}
- */
public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
IllegalStateException
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -54,24 +54,6 @@
/**
* Reads <code>ItemData</code> from the storage using item's parent and name relative the parent
- * location.
- *
- * @param parentData
- * - the item's parent NodeData
- * @param name
- * - item's path entry (QName + index)
- * @return - stored ItemData which has exact the same path Entry (name+index) inside the parent; or
- * null if not such an item data found
- * @throws RepositoryException
- * if some exception occurred
- * @throws IllegalStateException
- * if connection is closed
- */
- @Deprecated
- ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException;
-
- /**
- * Reads <code>ItemData</code> from the storage using item's parent and name relative the parent
* location of define type.
*
* @param parentData
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -602,13 +602,6 @@
{
@Override
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException,
- IllegalStateException
- {
- throw new UnsupportedOperationException("TestWorkspaceStorageConnection: operation is unsupported.");
- }
-
- @Override
public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
IllegalStateException
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -121,7 +121,8 @@
List<NodeImpl> nodes = new ArrayList<NodeImpl>();
nodes.add(node1);
nodes.add(node2);
- List<NodeImpl> testNodes = pool.getNodes(nodes);
+
+ List<NodeImpl> testNodes = getNodes(pool, nodes);
assertEquals(2, testNodes.size());
assertEquals(node1, testNodes.get(0));
assertEquals(node2, testNodes.get(1));
@@ -133,7 +134,7 @@
PropertyImpl prop1 = (PropertyImpl)modificationManager.update(ItemState.createAddedState(prop), true);
List<PropertyImpl> props = new ArrayList<PropertyImpl>();
props.add(prop1);
- List<PropertyImpl> testProps = pool.getProperties(props);
+ List<PropertyImpl> testProps = getProperties(pool, props);
assertEquals(1, testProps.size());
assertEquals(prop1, testProps.get(0));
@@ -151,6 +152,70 @@
assertEquals(3, pool.size());
}
+ private List<NodeImpl> getNodes(SessionDataManager.ItemReferencePool pool, List<NodeImpl> nodes)
+ throws RepositoryException
+ {
+ List<ItemImpl> items = (List<ItemImpl>)pool.getAll();
+ List<NodeImpl> children = new ArrayList<NodeImpl>();
+ for (NodeImpl node : nodes)
+ {
+ String id = node.getInternalIdentifier();
+
+ NodeImpl pooled = null;
+ for (ItemImpl item : items)
+ {
+ if (items.get(0).getData().getIdentifier().equals(id))
+ {
+ pooled = (NodeImpl)item;
+ break;
+ }
+ }
+
+ if (pooled == null)
+ {
+ children.add(node);
+ }
+ else
+ {
+ pooled.loadData(node.getData());
+ children.add(pooled);
+ }
+ }
+ return children;
+ }
+
+ private List<PropertyImpl> getProperties(SessionDataManager.ItemReferencePool pool, List<PropertyImpl> props)
+ throws RepositoryException
+ {
+ List<ItemImpl> items = (List<ItemImpl>)pool.getAll();
+ List<PropertyImpl> children = new ArrayList<PropertyImpl>();
+ for (PropertyImpl prop : props)
+ {
+ String id = prop.getInternalIdentifier();
+
+ PropertyImpl pooled = null;
+ for (ItemImpl item : items)
+ {
+ if (items.get(0).getData().getIdentifier().equals(id))
+ {
+ pooled = (PropertyImpl)item;
+ break;
+ }
+ }
+
+ if (pooled == null)
+ {
+ children.add(prop);
+ }
+ else
+ {
+ pooled.loadData(prop.getData());
+ children.add(pooled);
+ }
+ }
+ return children;
+ }
+
public void testSessionChangesLog() throws Exception
{
SessionChangesLog changesLog = modificationManager.getChangesLog();
@@ -252,12 +317,12 @@
assertEquals(1, modificationManager.getChildNodesData(parent).size());
assertEquals(2, modificationManager.getChildPropertiesData(parent).size());
- assertEquals(1, modificationManager.getChildNodes(parent, true).size());
+ assertEquals(1, modificationManager.getChildNodesData(parent).size());
// List <PropertyImpl> props =
// modificationManager.getChildProperties(parent, true);
// for(PropertyImpl p: props)
// System.out.println(">>>>>>>>>>>>>>>> "+p.getPath());
- assertEquals(2, modificationManager.getChildProperties(parent, true).size());
+ assertEquals(2, modificationManager.getChildPropertiesData(parent).size());
// Collections.copy(dest, src);
@@ -283,9 +348,9 @@
assertEquals(0, modificationManager.getChangesLog().getSize());
assertNotNull(modificationManager.getItem(data1.getQPath(), true));
+
+ assertEquals(1, modificationManager.getChildPropertiesData(parent).size());
- assertEquals(1, modificationManager.getChildProperties(data1, true).size());
-
// ... add property
TransientPropertyData prop =
TransientPropertyData.createPropertyData(parent, new InternalQName(null, "testCommitAndRefreshP1"),
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -316,14 +316,6 @@
private volatile ItemData itemData;
- /**
- * {@inheritDoc}
- */
- public ItemData get(String parentIdentifier, QPathEntry name)
- {
- return get(parentIdentifier, name, ItemType.UNKNOWN);
- }
-
public ItemData get(String parentIdentifier, QPathEntry name, ItemType itemType)
{
if (itemData != null && itemType.isSuitableFor(itemData))
@@ -531,15 +523,6 @@
public AtomicInteger getItemDataByNodeDataNQPathEntryCalls = new AtomicInteger();
- /**
- * {@inheritDoc}
- */
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException,
- IllegalStateException
- {
- return getItemData(parentData, name, ItemType.UNKNOWN);
- }
-
public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
IllegalStateException
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -779,15 +779,6 @@
return children;
}
- /**
- * {@inheritDoc}
- */
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException,
- IllegalStateException
- {
- return getItemData(parentData, name, ItemType.UNKNOWN);
- }
-
public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
IllegalStateException
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestJBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestJBossCacheWorkspaceStorageCache.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestJBossCacheWorkspaceStorageCache.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -242,15 +242,6 @@
return null;
}
- /**
- * {@inheritDoc}
- */
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException,
- IllegalStateException
- {
- return getItemData(parentData, name, ItemType.UNKNOWN);
- }
-
public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
IllegalStateException
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2012-01-06 19:23:09 UTC (rev 5431)
+++ jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2012-01-10 12:39:15 UTC (rev 5432)
@@ -826,14 +826,6 @@
/**
* {@inheritDoc}
*/
- public ItemData get(String parentId, QPathEntry name)
- {
- return get(parentId, name, ItemType.UNKNOWN);
- }
-
- /**
- * {@inheritDoc}
- */
public ItemData get(String parentIdentifier, QPathEntry name, ItemType itemType)
{
return getFromCacheByPath.run(parentIdentifier, name, itemType);
14 years, 3 months
exo-jcr SVN: r5431 - kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2012-01-06 14:23:09 -0500 (Fri, 06 Jan 2012)
New Revision: 5431
Modified:
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java
Log:
EXOJCR-1682: Add the transaction manager in the configuration only if it is not null
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java 2012-01-06 16:47:45 UTC (rev 5430)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java 2012-01-06 19:23:09 UTC (rev 5431)
@@ -170,7 +170,10 @@
};
for (ConfigurationBuilder b : holder.getConfigurationBuilders())
{
- b.transaction().transactionManagerLookup(tml);
+ if (tm != null)
+ {
+ b.transaction().transactionManagerLookup(tml);
+ }
//TODO remove it once ISPN-1689 will be fixed
b.clustering()
.hash()
14 years, 3 months
exo-jcr SVN: r5430 - in kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src: main/java/org/exoplatform/services/cache/impl/infinispan/distributed and 5 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2012-01-06 11:47:45 -0500 (Fri, 06 Jan 2012)
New Revision: 5430
Modified:
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheCreator.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/generic/GenericExoCacheCreator.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/Utils.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/resources/conf/portal/cache-configuration-template.xml
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/java/org/exoplatform/services/cache/impl/infinispan/TestExoCacheCreator.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/java/org/exoplatform/services/cache/impl/infinispan/TestExoCacheFactoryImpl.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/resources/conf/portal/cache-configuration-template.xml
Log:
EXOJCR-1682: Improve ISPN integration to support properly the distribution mode (kernel)
* Got rid of all deprecated code but due to some bugs in ISPN we have some workarounds to remove later
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheCreator.java 2012-01-06 10:43:05 UTC (rev 5429)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheCreator.java 2012-01-06 16:47:45 UTC (rev 5430)
@@ -22,7 +22,7 @@
import org.exoplatform.services.cache.ExoCacheConfig;
import org.exoplatform.services.cache.ExoCacheInitException;
import org.infinispan.Cache;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import java.io.Serializable;
import java.util.Set;
@@ -41,11 +41,11 @@
/**
* Creates an eXo cache according to the given configuration {@link org.exoplatform.services.cache.ExoCacheConfig}
* @param config the configuration of the cache to apply
- * @param cacheConfig the configuration of the infinispan cache
+ * @param confBuilder the configuration builder of the infinispan cache
* @param cacheGetter a {@link Callable} instance from which we can get the cache
* @exception ExoCacheInitException if an exception happens while initializing the cache
*/
- public ExoCache<Serializable, Object> create(ExoCacheConfig config, Configuration cacheConfig,
+ public ExoCache<Serializable, Object> create(ExoCacheConfig config, ConfigurationBuilder confBuilder,
Callable<Cache<Serializable, Object>> cacheGetter) throws ExoCacheInitException;
/**
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2012-01-06 10:43:05 UTC (rev 5429)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2012-01-06 16:47:45 UTC (rev 5430)
@@ -34,12 +34,19 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.infinispan.Cache;
-import org.infinispan.config.Configuration;
-import org.infinispan.config.Configuration.CacheMode;
-import org.infinispan.config.GlobalConfiguration;
+import org.infinispan.configuration.cache.CacheMode;
+import org.infinispan.configuration.cache.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
+import org.infinispan.configuration.global.GlobalConfiguration;
+import org.infinispan.configuration.global.GlobalConfigurationBuilder;
+import org.infinispan.configuration.parsing.ConfigurationBuilderHolder;
+import org.infinispan.configuration.parsing.Parser;
+import org.infinispan.distribution.ch.ConsistentHash;
+import org.infinispan.distribution.ch.DefaultConsistentHash;
import org.infinispan.eviction.EvictionStrategy;
import org.infinispan.jmx.MBeanServerLookup;
import org.infinispan.manager.DefaultCacheManager;
+import org.infinispan.util.Util;
import java.io.InputStream;
import java.io.Serializable;
@@ -113,10 +120,10 @@
private final Map<String, String> mappingCacheNameConfig = new HashMap<String, String>();
/**
- * The mapping between the global configuration and the cache managers
+ * The mapping between the cluster name and the cache managers
*/
- private final Map<GlobalConfiguration, DefaultCacheManager> mappingGlobalConfigCacheManager =
- new HashMap<GlobalConfiguration, DefaultCacheManager>();
+ private final Map<String, DefaultCacheManager> mappingGlobalConfigCacheManager =
+ new HashMap<String, DefaultCacheManager>();
/**
* The default creator
@@ -162,7 +169,8 @@
// Initialize the main cache manager
this.cacheManager = initCacheManager(cacheConfigTemplate);
// Register the main cache manager
- mappingGlobalConfigCacheManager.put(cacheManager.getGlobalConfiguration(), cacheManager);
+ mappingGlobalConfigCacheManager.put(cacheManager.getCacheManagerConfiguration().transport().clusterName(),
+ cacheManager);
}
/**
@@ -193,24 +201,32 @@
throw new ExoCacheInitException("The configuration of the CacheManager cannot be found at '"
+ cacheConfigTemplate + "'");
}
- DefaultCacheManager cacheManager = null;
+ GlobalConfigurationBuilder configBuilder;
+ Configuration config;
try
{
- // Create the CacheManager from the input stream
- cacheManager = new DefaultCacheManager(is, false);
+ Parser parser = new Parser(Thread.currentThread().getContextClassLoader());
+ // Loads the configuration from the input stream
+ ConfigurationBuilderHolder holder = parser.parse(is);
+ configBuilder = holder.getGlobalConfigurationBuilder();
+ config = holder.getDefaultConfigurationBuilder().build();
}
catch (Exception e)
{
+ throw new ExoCacheInitException("Cannot parse the configuration '" + cacheConfigTemplate + "'", e);
+ }
+ configureCacheManager(configBuilder);
+ try
+ {
+ // Create the CacheManager from the new configuration
+ return new DefaultCacheManager(configBuilder.build(), config);
+ }
+ catch (Exception e)
+ {
throw new ExoCacheInitException(
"Cannot initialize the CacheManager corresponding to the configuration '" + cacheConfigTemplate
+ "'", e);
}
-
- GlobalConfiguration config = cacheManager.getGlobalConfiguration();
-
- configureCacheManager(config);
- cacheManager.start();
- return cacheManager;
}
});
}
@@ -231,16 +247,18 @@
/**
* Configure the cache manager
*
- * @param config
+ * @param configBuilder the configuration builder on which we applied all the required changes
* @throws ExoCacheInitException
*/
- private void configureCacheManager(GlobalConfiguration config) throws ExoCacheInitException
+ private void configureCacheManager(GlobalConfigurationBuilder configBuilder) throws ExoCacheInitException
{
+ GlobalConfiguration config = configBuilder.build();
// Configure JGroups
- configureJGroups(config);
+ configureJGroups(config, configBuilder);
// Configure the name of the cache manager
- config.fluent().globalJmxStatistics().cacheManagerName(config.getCacheManagerName() + "_" + ctx.getName()).
- // Configure the MBeanServerLookup
+ configBuilder.globalJmxStatistics().enable()
+ .cacheManagerName(config.globalJmxStatistics().cacheManagerName() + "_" + ctx.getName()).
+ // Configure the MBeanServerLookup
mBeanServerLookup(MBEAN_SERVER_LOOKUP);
}
@@ -249,27 +267,31 @@
* the cluster name by adding as suffix the name of the {@link ExoContainerContext}
*
* @param config the global configuration from which the JGroups config will be extracted
+ * @param configBuilder the related configuration builder
* @throws ExoCacheInitException if any exception occurs while configuring JGroups
*/
- private void configureJGroups(GlobalConfiguration config) throws ExoCacheInitException
+ private void configureJGroups(GlobalConfiguration config, GlobalConfigurationBuilder configBuilder)
+ throws ExoCacheInitException
{
- if (loadJGroupsConfig(config))
+ if (loadJGroupsConfig(config, configBuilder))
{
// The JGroups Config could be loaded which means that the configuration is for a cluster
- config.fluent().transport().clusterName(config.getClusterName() + "-" + ctx.getName());
+ configBuilder.transport().clusterName(config.transport().clusterName() + "-" + ctx.getName());
}
}
/**
* Load the JGroups configuration file thanks to the {@link ConfigurationManager}
* @param config the global configuration from which the JGroups config will be extracted
+ * @param configBuilder the related configuration builder
* @return <code>true</code> if the JGoups config could be loaded successfully,
* <code>false</code> if there were no JGroups config to load
* @throws ExoCacheInitException if the JGroups config could not be loaded
*/
- private boolean loadJGroupsConfig(GlobalConfiguration config) throws ExoCacheInitException
+ private boolean loadJGroupsConfig(GlobalConfiguration config, GlobalConfigurationBuilder configBuilder)
+ throws ExoCacheInitException
{
- return Utils.loadJGroupsConfig(configManager, config);
+ return Utils.loadJGroupsConfig(configManager, config, configBuilder);
}
/**
@@ -289,7 +311,7 @@
final DefaultCacheManager cacheManager;
try
{
- final Configuration conf;
+ final ConfigurationBuilder confBuilder = new ConfigurationBuilder();
if (customConfig != null)
{
try
@@ -302,24 +324,34 @@
// A custom configuration has been set
if (LOG.isInfoEnabled())
LOG.info("A custom configuration has been set for the cache '" + region + "'.");
- // Create the CacheManager by loading the configuration
- DefaultCacheManager customCacheManager =
- new DefaultCacheManager(configManager.getInputStream(customConfig), false);
- GlobalConfiguration gc = customCacheManager.getGlobalConfiguration();
+ Parser parser = new Parser(Thread.currentThread().getContextClassLoader());
+ // Load the configuration
+ ConfigurationBuilderHolder holder = parser.parse(configManager.getInputStream(customConfig));
+ GlobalConfigurationBuilder configBuilder = holder.getGlobalConfigurationBuilder();
// Configure JGroups and JMX since it could affect the state of the Global Config
- configureCacheManager(gc);
+ configureCacheManager(configBuilder);
+ GlobalConfiguration gc = configBuilder.build();
+
// Check if a CacheManager with the same GlobalConfiguration exists
- DefaultCacheManager currentCacheManager = mappingGlobalConfigCacheManager.get(gc);
+ DefaultCacheManager currentCacheManager =
+ mappingGlobalConfigCacheManager.get(gc.transport().clusterName());
if (currentCacheManager == null)
{
+ // Use a different cache manager name to prevent naming conflict
+ configBuilder.globalJmxStatistics().cacheManagerName(
+ gc.globalJmxStatistics().cacheManagerName() + "_" + region + "_" + ctx.getName());
// No cache manager has been defined so far for this Cache Configuration
- currentCacheManager = customCacheManager;
- // Use a different cache manager name to prevent naming conflict
- gc.fluent().globalJmxStatistics()
- .cacheManagerName(gc.getCacheManagerName() + "_" + region + "_" + ctx.getName());
+ currentCacheManager =
+ new DefaultCacheManager(configBuilder.build(), holder.getDefaultConfigurationBuilder()
+ .build(), false);
+ for (ConfigurationBuilder b : holder.getConfigurationBuilders())
+ {
+ Configuration c = b.build();
+ currentCacheManager.defineConfiguration(c.name(), c);
+ }
currentCacheManager.start();
// We register this new cache manager
- mappingGlobalConfigCacheManager.put(gc, customCacheManager);
+ mappingGlobalConfigCacheManager.put(gc.transport().clusterName(), currentCacheManager);
}
return currentCacheManager;
}
@@ -337,7 +369,17 @@
throw new Exception(e);
}
}
- conf = cacheManager.getDefaultConfiguration().clone();
+ confBuilder.read(cacheManager.getDefaultCacheConfiguration());
+ //TODO remove it once ISPN-1687 will be fixed
+ confBuilder.storeAsBinary().enabled(false);
+ confBuilder.jmxStatistics().enable();
+ //TODO remove it once ISPN-1689 will be fixed
+ confBuilder
+ .clustering()
+ .hash()
+ .consistentHash(
+ Util.<ConsistentHash> getInstance(DefaultConsistentHash.class.getName(), Thread.currentThread()
+ .getContextClassLoader()));
}
else if (config.isDistributed())
{
@@ -356,20 +398,29 @@
// No custom configuration has been found, a configuration template will be used
if (LOG.isInfoEnabled())
LOG.info("The configuration template will be used for the the cache '" + region + "'.");
- conf = cacheManager.getDefaultConfiguration().clone();
+ confBuilder.read(cacheManager.getDefaultCacheConfiguration());
+ //TODO remove it once ISPN-1687 will be fixed
+ confBuilder.storeAsBinary().enabled(false);
+ confBuilder.jmxStatistics().enable();
+ //TODO remove it once ISPN-1689 will be fixed
+ confBuilder
+ .clustering()
+ .hash()
+ .consistentHash(
+ Util.<ConsistentHash> getInstance(DefaultConsistentHash.class.getName(), Thread.currentThread()
+ .getContextClassLoader()));
if (!config.isRepicated())
{
// The cache is local
- conf.fluent().clustering().mode(CacheMode.LOCAL);
+ confBuilder.clustering().cacheMode(CacheMode.LOCAL);
}
}
// Reset the configuration to avoid conflicts
- resetConfiguration(conf);
+ resetConfiguration(confBuilder);
final ExoCacheCreator creator = getExoCacheCreator(config);
// Create the cache
- eXoCache = creator.create(config, conf, new Callable<Cache<Serializable, Object>>()
+ eXoCache = creator.create(config, confBuilder, new Callable<Cache<Serializable, Object>>()
{
- @Override
public Cache<Serializable, Object> call() throws Exception
{
try
@@ -380,7 +431,7 @@
public Cache<Serializable, Object> run() throws Exception
{
// Define the configuration
- cacheManager.defineConfiguration(region, conf);
+ cacheManager.defineConfiguration(region, confBuilder.build());
// create and start the cache
return cacheManager.getCache(region);
}
@@ -485,9 +536,9 @@
/**
* Clean the configuration template to prevent conflicts
*/
- protected void resetConfiguration(Configuration config)
+ protected void resetConfiguration(ConfigurationBuilder confBuilder)
{
- config.fluent().invocationBatching().eviction().strategy(EvictionStrategy.NONE).maxEntries(-1).expiration()
+ confBuilder.invocationBatching().enable().eviction().strategy(EvictionStrategy.NONE).maxEntries(-1).expiration()
.lifespan(-1L).maxIdle(-1L).wakeUpInterval(60000L);
}
}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java 2012-01-06 10:43:05 UTC (rev 5429)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java 2012-01-06 16:47:45 UTC (rev 5430)
@@ -794,7 +794,7 @@
@ManagedDescription("Maximum number of entries in a cache instance. -1 means no limit.")
public int getMaxSize()
{
- return cache.getConfiguration().getEvictionMaxEntries();
+ return cache.getCacheConfiguration().eviction().maxEntries();
}
@ManagedName("Lifespan")
@@ -802,7 +802,7 @@
+ " -1 means the entries never expire.")
public long getLiveTime()
{
- return cache.getConfiguration().getExpirationLifespan();
+ return cache.getCacheConfiguration().expiration().lifespan();
}
@Managed
@@ -811,7 +811,7 @@
+ "If the idle time is exceeded, the entry will be expired cluster-wide. -1 means the entries never expire.")
public long getMaxIdle()
{
- return cache.getConfiguration().getExpirationMaxIdle();
+ return cache.getCacheConfiguration().expiration().maxIdle();
}
@Managed
@@ -820,7 +820,7 @@
+ "process altogether, set wakeupInterval to -1.")
public long getWakeUpInterval()
{
- return cache.getConfiguration().getExpirationWakeUpInterval();
+ return cache.getCacheConfiguration().expiration().wakeUpInterval();
}
public static class CacheKey<K> implements Externalizable
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/generic/GenericExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/generic/GenericExoCacheCreator.java 2012-01-06 10:43:05 UTC (rev 5429)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/generic/GenericExoCacheCreator.java 2012-01-06 16:47:45 UTC (rev 5430)
@@ -27,7 +27,7 @@
import org.exoplatform.services.cache.impl.infinispan.AbstractExoCache;
import org.exoplatform.services.cache.impl.infinispan.ExoCacheCreator;
import org.infinispan.Cache;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.eviction.EvictionStrategy;
import java.io.Serializable;
@@ -84,20 +84,20 @@
/**
* {@inheritDoc}
*/
- public ExoCache<Serializable, Object> create(ExoCacheConfig config, Configuration cacheConfig,
+ public ExoCache<Serializable, Object> create(ExoCacheConfig config, ConfigurationBuilder confBuilder,
Callable<Cache<Serializable, Object>> cacheGetter) throws ExoCacheInitException
{
if (config instanceof GenericExoCacheConfig)
{
final GenericExoCacheConfig gConfig = (GenericExoCacheConfig)config;
- return create(config, cacheConfig, cacheGetter, gConfig.getStrategy(), gConfig.getMaxEntries(),
+ return create(config, confBuilder, cacheGetter, gConfig.getStrategy(), gConfig.getMaxEntries(),
gConfig.getLifespan(), gConfig.getMaxIdle() == 0 ? defaultMaxIdle : gConfig.getMaxIdle(),
gConfig.getWakeUpInterval() == 0 ? defaultWakeUpInterval : gConfig.getWakeUpInterval());
}
else
{
final long period = config.getLiveTime();
- return create(config, cacheConfig, cacheGetter,
+ return create(config, confBuilder, cacheGetter,
config.getImplementation() == null ? defaultStrategy : config.getImplementation(), config.getMaxSize(),
period > 0 ? period * 1000 : -1, defaultMaxIdle, defaultWakeUpInterval);
}
@@ -107,7 +107,7 @@
* Creates a new ExoCache instance with the relevant parameters
* @throws ExoCacheInitException If any exception occurs while creating the cache
*/
- private ExoCache<Serializable, Object> create(ExoCacheConfig config, Configuration cacheConfig,
+ private ExoCache<Serializable, Object> create(ExoCacheConfig config, ConfigurationBuilder confBuilder,
Callable<Cache<Serializable, Object>> cacheGetter, String strategy, int maxEntries, long lifespan, long maxIdle,
long wakeUpInterval) throws ExoCacheInitException
{
@@ -118,11 +118,11 @@
{
es = EvictionStrategy.LRU;
}
- cacheConfig.fluent().eviction().strategy(EvictionStrategy.valueOf(strategy)).maxEntries(maxEntries).expiration()
+ confBuilder.eviction().strategy(EvictionStrategy.valueOf(strategy)).maxEntries(maxEntries).expiration()
.lifespan(lifespan).maxIdle(maxIdle).wakeUpInterval(wakeUpInterval);
try
{
- return new GenericExoCache(cacheConfig, config, cacheGetter.call());
+ return new GenericExoCache(config, cacheGetter.call());
}
catch (Exception e)
{
@@ -136,41 +136,26 @@
public static class GenericExoCache extends AbstractExoCache<Serializable, Object>
{
- private final Configuration cacheConfig;
-
- public GenericExoCache(Configuration cacheConfig, ExoCacheConfig config, Cache<Serializable, Object> cache)
+ public GenericExoCache(ExoCacheConfig config, Cache<Serializable, Object> cache)
{
super(config, cache);
- this.cacheConfig = cacheConfig;
}
public void setMaxSize(int max)
{
- cacheConfig.fluent().eviction().maxEntries(max);
+ throw new UnsupportedOperationException("The configuration of the cache cannot not be modified");
}
public void setLiveTime(long period)
{
- cacheConfig.fluent().expiration().lifespan(period);
+ throw new UnsupportedOperationException("The configuration of the cache cannot not be modified");
}
- @Managed
- public void setMaxIdle(long maxIdle)
- {
- cacheConfig.fluent().expiration().maxIdle(maxIdle);
- }
-
- @Managed
- public void setWakeUpInterval(long wakeUpInterval)
- {
- cacheConfig.fluent().expiration().wakeUpInterval(wakeUpInterval);
- }
-
@ManagedName("MaxEntries")
@ManagedDescription("Maximum number of entries in a cache instance. -1 means no limit.")
public int getMaxSize()
{
- return cacheConfig.getEvictionMaxEntries();
+ return cache.getCacheConfiguration().eviction().maxEntries();
}
@ManagedName("Lifespan")
@@ -178,7 +163,7 @@
+ " -1 means the entries never expire.")
public long getLiveTime()
{
- return cacheConfig.getExpirationLifespan();
+ return cache.getCacheConfiguration().expiration().lifespan();
}
@Managed
@@ -187,7 +172,7 @@
+ "If the idle time is exceeded, the entry will be expired cluster-wide. -1 means the entries never expire.")
public long getMaxIdle()
{
- return cacheConfig.getExpirationMaxIdle();
+ return cache.getCacheConfiguration().expiration().maxIdle();
}
@Managed
@@ -196,7 +181,7 @@
+ "process altogether, set wakeupInterval to -1.")
public long getWakeUpInterval()
{
- return cacheConfig.getExpirationWakeUpInterval();
+ return cache.getCacheConfiguration().expiration().wakeUpInterval();
}
}
}
\ No newline at end of file
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java 2012-01-06 10:43:05 UTC (rev 5429)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java 2012-01-06 16:47:45 UTC (rev 5430)
@@ -29,9 +29,17 @@
import org.exoplatform.services.log.Log;
import org.exoplatform.services.transaction.TransactionService;
import org.infinispan.Cache;
-import org.infinispan.factories.ComponentRegistry;
+import org.infinispan.configuration.cache.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
+import org.infinispan.configuration.global.GlobalConfigurationBuilder;
+import org.infinispan.configuration.parsing.ConfigurationBuilderHolder;
+import org.infinispan.configuration.parsing.Parser;
+import org.infinispan.distribution.ch.ConsistentHash;
+import org.infinispan.distribution.ch.DefaultConsistentHash;
import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.manager.EmbeddedCacheManager;
+import org.infinispan.transaction.lookup.TransactionManagerLookup;
+import org.infinispan.util.Util;
import org.picocontainer.Startable;
import java.security.PrivilegedExceptionAction;
@@ -143,24 +151,35 @@
}
return SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<EmbeddedCacheManager>()
{
-
- @Override
public EmbeddedCacheManager run() throws Exception
{
+ Parser parser = new Parser(Thread.currentThread().getContextClassLoader());
+ // Load the configuration
+ ConfigurationBuilderHolder holder = parser.parse(helper.fillTemplate(configurationFile, parameters));
+ GlobalConfigurationBuilder configBuilder = holder.getGlobalConfigurationBuilder();
+ Utils.loadJGroupsConfig(configManager, configBuilder.build(), configBuilder);
+ // Create the CacheManager from the new configuration
EmbeddedCacheManager manager =
- new DefaultCacheManager(helper.fillTemplate(configurationFile, parameters), false);
- Utils.loadJGroupsConfig(configManager, manager.getGlobalConfiguration());
- manager.start();
- for (String cacheName : manager.getCacheNames())
+ new DefaultCacheManager(configBuilder.build(), holder.getDefaultConfigurationBuilder().build());
+ TransactionManagerLookup tml = new TransactionManagerLookup()
{
- Cache cache = manager.getCache(cacheName);
- if (tm != null)
+ public TransactionManager getTransactionManager() throws Exception
{
- // We inject the transaction manager
- ComponentRegistry cr = cache.getAdvancedCache().getComponentRegistry();
- cr.registerComponent(tm, TransactionManager.class);
- cr.rewire();
- }
+ return tm;
+ }
+ };
+ for (ConfigurationBuilder b : holder.getConfigurationBuilders())
+ {
+ b.transaction().transactionManagerLookup(tml);
+ //TODO remove it once ISPN-1689 will be fixed
+ b.clustering()
+ .hash()
+ .consistentHash(
+ Util.<ConsistentHash> getInstance(DefaultConsistentHash.class.getName(), Thread.currentThread()
+ .getContextClassLoader()));
+ Configuration c = b.build();
+ manager.defineConfiguration(c.name(), c);
+ manager.getCache(c.name());
}
return manager;
}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/Utils.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/Utils.java 2012-01-06 10:43:05 UTC (rev 5429)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/Utils.java 2012-01-06 16:47:45 UTC (rev 5430)
@@ -23,7 +23,8 @@
import org.exoplatform.services.cache.ExoCacheInitException;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import org.infinispan.config.GlobalConfiguration;
+import org.infinispan.configuration.global.GlobalConfiguration;
+import org.infinispan.configuration.global.GlobalConfigurationBuilder;
import org.infinispan.remoting.transport.jgroups.JGroupsTransport;
import java.io.IOException;
@@ -41,22 +42,24 @@
/**
* The logger
*/
- private static final Log LOG = ExoLogger
- .getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.Utils");
-
- private Utils() {}
-
+ private static final Log LOG = ExoLogger.getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.Utils");
+ private Utils()
+ {
+ }
+
/**
* Load the JGroups configuration file thanks to the {@link ConfigurationManager}
* @param config the global configuration from which the JGroups config will be extracted
+ * @param configBuilder the related configuration builder
* @return <code>true</code> if the JGoups config could be loaded successfully,
* <code>false</code> if there were no JGroups config to load
* @throws IllegalStateException if the JGroups config could not be loaded
*/
- public static boolean loadJGroupsConfig(ConfigurationManager cfm, GlobalConfiguration config) throws ExoCacheInitException
+ public static boolean loadJGroupsConfig(ConfigurationManager cfm, GlobalConfiguration config,
+ GlobalConfigurationBuilder configBuilder) throws ExoCacheInitException
{
- Properties properties = config.getTransportProperties();
+ Properties properties = config.transport().properties();
if (properties == null || !properties.containsKey(JGroupsTransport.CONFIGURATION_FILE))
{
return false;
@@ -67,9 +70,8 @@
// inputStream still remains null, so file was not opened
if (inputStream == null)
{
- throw new IllegalStateException("The jgroups configuration cannot be loaded from '" + filename
- + "'");
- }
+ throw new IllegalStateException("The jgroups configuration cannot be loaded from '" + filename + "'");
+ }
try
{
// Set the jgroups configuration as XML
@@ -77,15 +79,14 @@
}
catch (IOException e)
{
- throw new IllegalStateException("The jgroups configuration cannot be read from '" + filename
- + "'");
+ throw new IllegalStateException("The jgroups configuration cannot be read from '" + filename + "'");
}
// Remove the property corresponding to the configuration file
properties.remove(JGroupsTransport.CONFIGURATION_FILE);
+ configBuilder.transport().withProperties(properties);
return true;
}
-
/**
* Reads bytes from input stream and builds a string from them
*
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/resources/conf/portal/cache-configuration-template.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/resources/conf/portal/cache-configuration-template.xml 2012-01-06 10:43:05 UTC (rev 5429)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/resources/conf/portal/cache-configuration-template.xml 2012-01-06 16:47:45 UTC (rev 5430)
@@ -53,7 +53,7 @@
<shutdown hookBehavior="DEFAULT"/>
</global>
<default>
- <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="10000" writeSkewCheck="false" concurrencyLevel="500"/>
+ <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="10000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="true"/>
<transaction transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" transactionMode="TRANSACTIONAL"/>
<jmxStatistics enabled="true"/>
<invocationBatching enabled="true"/>
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/java/org/exoplatform/services/cache/impl/infinispan/TestExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/java/org/exoplatform/services/cache/impl/infinispan/TestExoCacheCreator.java 2012-01-06 10:43:05 UTC (rev 5429)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/java/org/exoplatform/services/cache/impl/infinispan/TestExoCacheCreator.java 2012-01-06 16:47:45 UTC (rev 5430)
@@ -24,7 +24,7 @@
import org.exoplatform.services.cache.ExoCacheConfig;
import org.exoplatform.services.cache.ExoCacheInitException;
import org.infinispan.Cache;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import java.io.Serializable;
import java.util.Collections;
@@ -42,10 +42,10 @@
{
/**
- * @see org.exoplatform.services.cache.impl.infinispan.ExoCacheCreator#create(org.exoplatform.services.cache.ExoCacheConfig, org.infinispan.config.Configuration, java.util.concurrent.Callable)
+ * {@inheritDoc}
*/
@Override
- public ExoCache<Serializable, Object> create(ExoCacheConfig config, Configuration cacheConfig,
+ public ExoCache<Serializable, Object> create(ExoCacheConfig config, ConfigurationBuilder confBuilder,
Callable<Cache<Serializable, Object>> cacheGetter) throws ExoCacheInitException
{
return new TestExoCache();
@@ -61,55 +61,46 @@
return Collections.singleton("TEST");
}
+ @SuppressWarnings({"rawtypes", "unchecked"})
public static class TestExoCache implements ExoCache<Serializable, Object>
{
public void addCacheListener(CacheListener listener)
{
- // TODO Auto-generated method stub
-
}
-
public int getCacheHit()
{
- // TODO Auto-generated method stub
return 0;
}
public int getCacheMiss()
{
- // TODO Auto-generated method stub
return 0;
}
public int getCacheSize()
{
- // TODO Auto-generated method stub
return 0;
}
public List getCachedObjects()
{
- // TODO Auto-generated method stub
return null;
}
public String getLabel()
{
- // TODO Auto-generated method stub
return null;
}
public long getLiveTime()
{
- // TODO Auto-generated method stub
return 0;
}
public int getMaxSize()
{
- // TODO Auto-generated method stub
return 0;
}
@@ -120,104 +111,86 @@
public boolean isDistributed()
{
- // TODO Auto-generated method stub
return false;
}
public boolean isLogEnabled()
{
- // TODO Auto-generated method stub
return false;
}
public boolean isReplicated()
{
- // TODO Auto-generated method stub
return false;
}
-
public void select(CachedObjectSelector selector) throws Exception
{
- // TODO Auto-generated method stub
}
public void setDistributed(boolean b)
{
- // TODO Auto-generated method stub
}
public void setLabel(String s)
{
- // TODO Auto-generated method stub
}
public void setLiveTime(long period)
{
- // TODO Auto-generated method stub
}
public void setLogEnabled(boolean b)
{
- // TODO Auto-generated method stub
}
public void setMaxSize(int max)
{
- // TODO Auto-generated method stub
}
public void setName(String name)
{
- // TODO Auto-generated method stub
}
public void setReplicated(boolean b)
{
- // TODO Auto-generated method stub
}
public void clearCache()
{
- // TODO Auto-generated method stub
-
+
}
public Object get(Serializable key)
{
- // TODO Auto-generated method stub
return null;
}
public void put(Serializable key, Object value) throws NullPointerException
{
- // TODO Auto-generated method stub
-
+
}
public void putMap(Map objs) throws NullPointerException, IllegalArgumentException
{
- // TODO Auto-generated method stub
-
+
}
public Object remove(Serializable key) throws NullPointerException
{
- // TODO Auto-generated method stub
return null;
}
public List removeCachedObjects()
{
- // TODO Auto-generated method stub
return null;
}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/java/org/exoplatform/services/cache/impl/infinispan/TestExoCacheFactoryImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/java/org/exoplatform/services/cache/impl/infinispan/TestExoCacheFactoryImpl.java 2012-01-06 10:43:05 UTC (rev 5429)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/java/org/exoplatform/services/cache/impl/infinispan/TestExoCacheFactoryImpl.java 2012-01-06 16:47:45 UTC (rev 5430)
@@ -23,7 +23,7 @@
import org.exoplatform.services.cache.ExoCache;
import org.exoplatform.services.cache.impl.infinispan.TestExoCacheCreator.TestExoCache;
import org.exoplatform.test.BasicTestCase;
-import org.infinispan.config.Configuration.CacheMode;
+import org.infinispan.configuration.cache.CacheMode;
import org.infinispan.manager.CacheContainer;
/**
@@ -31,6 +31,7 @@
* @version $Id$
*
*/
+@SuppressWarnings("rawtypes")
public class TestExoCacheFactoryImpl extends BasicTestCase
{
@@ -51,17 +52,20 @@
ExoCache cache = service_.getCacheInstance("myCache");
assertTrue("expect an instance of AbstractExoCache", cache instanceof AbstractExoCache);
AbstractExoCache aCache = (AbstractExoCache)cache;
- assertTrue("expect a local cache", aCache.cache.getConfiguration().getCacheMode() == CacheMode.LOCAL);
+ assertTrue("expect a local cache",
+ aCache.cache.getCacheConfiguration().clustering().cacheMode() == CacheMode.LOCAL);
aCache.cache.stop();
cache = service_.getCacheInstance("cacheDistributed");
assertTrue("expect an instance of AbstractExoCache", cache instanceof AbstractExoCache);
aCache = (AbstractExoCache)cache;
- assertTrue("expect a distributed cache", aCache.cache.getConfiguration().getCacheMode() == CacheMode.REPL_SYNC);
+ assertTrue("expect a distributed cache",
+ aCache.cache.getCacheConfiguration().clustering().cacheMode() == CacheMode.REPL_SYNC);
aCache.cache.stop();
cache = service_.getCacheInstance("myCustomCache");
assertTrue("expect an instance of AbstractExoCache", cache instanceof AbstractExoCache);
aCache = (AbstractExoCache)cache;
- assertTrue("expect a distributed cache", aCache.cache.getConfiguration().getCacheMode() == CacheMode.REPL_SYNC);
+ assertTrue("expect a distributed cache",
+ aCache.cache.getCacheConfiguration().clustering().cacheMode() == CacheMode.REPL_SYNC);
aCache.cache.stop();
}
@@ -76,27 +80,27 @@
cache = service_.getCacheInstance("test-custom-impl-with-new-config");
assertTrue("expect an instance of TestExoCache", cache instanceof TestExoCache);
}
-
+
public void testSameCacheManager()
{
ExoCache cache1 = service_.getCacheInstance("myCustomCache");
assertTrue("expect an instance of AbstractExoCache", cache1 instanceof AbstractExoCache);
AbstractExoCache aCache1 = (AbstractExoCache)cache1;
CacheContainer cacheContainer1 = aCache1.cache.getCacheManager();
-
+
ExoCache cache2 = service_.getCacheInstance("myCustomCache-Bis");
assertTrue("expect an instance of AbstractExoCache", cache2 instanceof AbstractExoCache);
AbstractExoCache aCache2 = (AbstractExoCache)cache2;
CacheContainer cacheContainer2 = aCache2.cache.getCacheManager();
assertTrue("The CacheContainer should be the same", cacheContainer1 == cacheContainer2);
-
+
ExoCache cache3 = service_.getCacheInstance("myCustomCache-Bis2");
assertTrue("expect an instance of AbstractExoCache", cache3 instanceof AbstractExoCache);
AbstractExoCache aCache3 = (AbstractExoCache)cache3;
CacheContainer cacheContainer3 = aCache3.cache.getCacheManager();
assertTrue("The CacheContainer should be the same", cacheContainer1 == cacheContainer3);
-
+
aCache1.cache.stop();
- aCache2.cache.stop();
+ aCache2.cache.stop();
}
}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/resources/conf/portal/cache-configuration-template.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/resources/conf/portal/cache-configuration-template.xml 2012-01-06 10:43:05 UTC (rev 5429)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/test/resources/conf/portal/cache-configuration-template.xml 2012-01-06 16:47:45 UTC (rev 5430)
@@ -53,7 +53,7 @@
<shutdown hookBehavior="DEFAULT"/>
</global>
<default>
- <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="10000" writeSkewCheck="false" concurrencyLevel="500"/>
+ <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="10000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="true"/>
<transaction transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" transactionMode="TRANSACTIONAL"/>
<jmxStatistics enabled="true"/>
<clustering mode="replication">
14 years, 3 months
exo-jcr SVN: r5429 - in jcr/branches/1.15.x/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/api/reading and 1 other directory.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-06 05:43:05 -0500 (Fri, 06 Jan 2012)
New Revision: 5429
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestItem.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestNode.java
Log:
EXOJCR-1703: Writed tests to classes NodeImpl and ItemImpl
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2012-01-06 09:58:57 UTC (rev 5428)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2012-01-06 10:43:05 UTC (rev 5429)
@@ -219,13 +219,6 @@
throw new NoSuchNodeTypeException("Nodetype " + mixinName + " not found or not mixin type.");
}
- // Validate
- if (session.getWorkspace().getNodeTypesHolder().isNodeType(type.getName(), nodeData().getPrimaryTypeName(),
- nodeData().getMixinTypeNames()))
- {
- throw new ConstraintViolationException("Can not add mixin type " + mixinName + " to " + getPath());
- }
-
if (definition.isProtected())
{
throw new ConstraintViolationException("Can not add mixin type. Node is protected " + getPath());
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestItem.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestItem.java 2012-01-06 09:58:57 UTC (rev 5428)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestItem.java 2012-01-06 10:43:05 UTC (rev 5429)
@@ -19,16 +19,22 @@
package org.exoplatform.services.jcr.api.reading;
import org.exoplatform.services.jcr.JcrAPIBaseTest;
+import org.exoplatform.services.jcr.impl.core.ItemImpl;
import java.util.Calendar;
import javax.jcr.Item;
+import javax.jcr.ItemExistsException;
import javax.jcr.ItemNotFoundException;
import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
import javax.jcr.Property;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.version.VersionException;
/**
* Created by The eXo Platform SAS.
@@ -171,6 +177,43 @@
assertTrue(contentNode.isSame(contentNode));
assertFalse(contentNode2.isSame(root));
assertFalse(contentNode2.isSame(contentNode.getProperty("jcr:data")));
+ assertFalse(contentNode2.isSame(null));
}
-}
+ public void testRemoveRootNode()
+ {
+ try
+ {
+ root.remove();
+ fail();
+ }
+ catch (RepositoryException e)
+ {
+ }
+ }
+
+ public void testGetParentDataWhenNodeIsRoot() throws RepositoryException
+ {
+ ItemImpl node = (ItemImpl)root;
+
+ try
+ {
+ node.parentData();
+ fail();
+ }
+ catch (ItemNotFoundException e)
+ {
+ }
+ }
+
+ public void testEquals() throws ItemExistsException, PathNotFoundException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException
+ {
+ ItemImpl testNode1 = (ItemImpl)root.addNode("testNode1");
+ ItemImpl testNode2 = (ItemImpl)root.addNode("testNode2");
+
+ assertFalse(testNode1.equals(new Object()));
+ assertFalse(testNode1.equals(testNode2));
+ }
+
+}
\ No newline at end of file
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestNode.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestNode.java 2012-01-06 09:58:57 UTC (rev 5428)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestNode.java 2012-01-06 10:43:05 UTC (rev 5429)
@@ -19,16 +19,27 @@
package org.exoplatform.services.jcr.api.reading;
import org.exoplatform.services.jcr.JcrAPIBaseTest;
+import org.exoplatform.services.jcr.access.PermissionType;
+import org.exoplatform.services.jcr.core.CredentialsImpl;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeImpl;
import org.exoplatform.services.jcr.impl.core.value.BinaryValue;
import org.exoplatform.services.jcr.impl.core.value.StringValue;
+import java.security.AccessControlException;
import java.util.Calendar;
+import java.util.HashMap;
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
import javax.jcr.Item;
+import javax.jcr.ItemExistsException;
import javax.jcr.ItemNotFoundException;
+import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
+import javax.jcr.PathNotFoundException;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
import javax.jcr.PropertyType;
@@ -36,6 +47,10 @@
import javax.jcr.Session;
import javax.jcr.UnsupportedRepositoryOperationException;
import javax.jcr.Value;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.version.VersionException;
/**
* Created by The eXo Platform SAS.
@@ -539,4 +554,374 @@
assertEquals(3l, i.getSize());
}
+ public void testAddMixinWhenNodeIsProtected() throws NoSuchNodeTypeException, VersionException,
+ LockException, ItemExistsException, PathNotFoundException, RepositoryException
+ {
+ try
+ {
+ root.addNode("someNode", "exo:myTypeJCR1703").getNode("exo:myChildNode").addMixin("mix:lockable");
+ fail();
+ }
+ catch (ConstraintViolationException e)
+ {
+ }
+ }
+
+ public void testCannotAddNodeWithThisRelPath()
+ {
+ try
+ {
+ root.addNode(".");
+ fail();
+ }
+ catch (RepositoryException e)
+ {
+ }
+ }
+
+ public void testCanAddMixinWhenNodeIsProtected() throws NoSuchNodeTypeException, PathNotFoundException,
+ ItemExistsException, LockException, VersionException, ConstraintViolationException, RepositoryException
+ {
+ Node node = root.addNode("someNode", "exo:myTypeJCR1703").getNode("exo:myChildNode");
+ assertFalse(node.canAddMixin("mix:lockable"));
+ }
+
+ public void testCannotDoCheckinWhenMergeFailedIsSet() throws ItemExistsException, PathNotFoundException,
+ VersionException, ConstraintViolationException, LockException, RepositoryException
+ {
+ Node testNode = root.addNode("testNode");
+ testNode.setProperty("jcr:mergeFailed", "");
+ testNode.addMixin("mix:versionable");
+ session.save();
+
+ try
+ {
+ testNode.checkin();
+ fail();
+ }
+ catch (VersionException e)
+ {
+ }
+ }
+
+ public void testCannotDoCheckinWhenNodeIsLocked() throws ItemExistsException, PathNotFoundException,
+ VersionException, ConstraintViolationException, LockException, RepositoryException
+ {
+ Node testNode = root.addNode("test");
+ testNode.addMixin("mix:lockable");
+ testNode.addMixin("mix:versionable");
+ session.save();
+ testNode.lock(true, true);
+
+ Session session2 =
+ repository.login(new CredentialsImpl("admin", "admin".toCharArray()), session.getWorkspace().getName());
+
+ try
+ {
+ session2.getRootNode().getNode("test").checkin();
+ fail();
+ }
+ catch (LockException e)
+ {
+ }
+ finally
+ {
+ session2.logout();
+ testNode.unlock();
+ }
+ }
+
+ public void testCannotClearACLForNotExoPrivilegeableNode() throws ItemExistsException, PathNotFoundException,
+ VersionException, ConstraintViolationException, LockException, RepositoryException
+ {
+ try
+ {
+ ((NodeImpl)root.addNode("testNode")).clearACL();
+ fail();
+ }
+ catch (AccessControlException e)
+ {
+ }
+ }
+
+ public void testEquals() throws ItemExistsException, PathNotFoundException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException
+ {
+ assertFalse(root.addNode("testNode").equals(new Object()));
+ }
+
+ public void testCannotGetBaseVersionForNotVersionableNode() throws Exception
+ {
+ try
+ {
+ root.addNode("testNode").getBaseVersion();
+ fail();
+ }
+ catch (UnsupportedRepositoryOperationException e)
+ {
+ }
+ }
+
+ public void testLockWithIsSessionScopedWhenUnsavedChanges() throws UnsupportedRepositoryOperationException,
+ LockException, AccessDeniedException, ItemExistsException, PathNotFoundException, VersionException,
+ ConstraintViolationException, RepositoryException
+ {
+ NodeImpl testNode = (NodeImpl)root.addNode("testNode");
+ testNode.addMixin("mix:lockable");
+
+ try
+ {
+ testNode.lock(true, false);
+ fail();
+ }
+ catch (InvalidItemStateException e)
+ {
+ }
+ }
+
+ public void testLockWithTimeOutScopedWhenUnsavedChanges() throws ItemExistsException, PathNotFoundException,
+ VersionException, ConstraintViolationException, LockException, RepositoryException
+ {
+ NodeImpl testNode = (NodeImpl)root.addNode("testNode");
+ testNode.addMixin("mix:lockable");
+
+ try
+ {
+ testNode.lock(true, 10L);
+ fail();
+ }
+ catch (InvalidItemStateException e)
+ {
+ }
+ }
+
+ public void testLockWithTimeOutScopedWhenLockException() throws ItemExistsException, PathNotFoundException,
+ VersionException, ConstraintViolationException, LockException, RepositoryException
+ {
+ NodeImpl testNode = (NodeImpl)root.addNode("testNode");
+ testNode.addMixin("mix:lockable");
+ session.save();
+
+ testNode.lock(true, false);
+
+ try
+ {
+ testNode.lock(true, 10L);
+ fail();
+ }
+ catch (LockException e)
+ {
+ }
+ }
+
+ public void testCannotRemovePermissionForNotExoPrivileageableNode() throws ItemExistsException,
+ PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException
+ {
+ NodeImpl testNode = (NodeImpl)root.addNode("testNode");
+ NodeImpl testChildNode = (NodeImpl)testNode.addNode("testChildNode");
+
+ try
+ {
+ testNode.removePermission(testChildNode.getIdentifier());
+ fail();
+ }
+ catch (AccessControlException e)
+ {
+ }
+
+ try
+ {
+ testNode.removePermission(testChildNode.getIdentifier(), "jonh");
+ fail();
+ }
+ catch (AccessControlException e)
+ {
+ }
+ }
+
+ public void testSetPermission() throws ItemExistsException, PathNotFoundException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException
+ {
+ NodeImpl testNode = (NodeImpl)root.addNode("testNode");
+
+ try
+ {
+ testNode.setPermission("john", PermissionType.ALL);
+ fail();
+ }
+ catch (AccessControlException e)
+ {
+ }
+
+ testNode.addMixin("exo:privilegeable");
+ session.save();
+
+ try
+ {
+ testNode.setPermission(null, PermissionType.ALL);
+ fail();
+ }
+ catch (RepositoryException e)
+ {
+ }
+
+ try
+ {
+ testNode.setPermission("john", null);
+ fail();
+ }
+ catch (RepositoryException e)
+ {
+ }
+ }
+
+ public void testSetPermissions() throws ItemExistsException, PathNotFoundException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException
+ {
+ NodeImpl testNode = (NodeImpl)root.addNode("testNode");
+ HashMap<String, String[]> permissions = new HashMap<String, String[]>();
+
+ try
+ {
+ testNode.setPermissions(permissions);
+ fail();
+ }
+ catch (AccessControlException e)
+ {
+ }
+
+ testNode.addMixin("exo:privilegeable");
+ session.save();
+
+ permissions.put(null, PermissionType.ALL);
+
+ try
+ {
+ testNode.setPermissions(permissions);
+ fail();
+ }
+ catch (RepositoryException e)
+ {
+ }
+
+ permissions.remove(null);
+ permissions.put("jonh", null);
+
+ try
+ {
+ testNode.setPermissions(permissions);
+ fail();
+ }
+ catch (RepositoryException e)
+ {
+ }
+ }
+
+ public void testUnlockWhenUnsavedChanges() throws ItemExistsException, PathNotFoundException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException
+ {
+ Node someNode = root.addNode("someNode");
+ someNode.addMixin("mix:lockable");
+ session.save();
+
+ someNode.lock(true, false);
+ someNode.addNode("temp");
+
+ try
+ {
+ someNode.unlock();
+ fail();
+ }
+ catch (InvalidItemStateException e)
+ {
+ }
+ }
+
+ public void testUpdateNodeIsLocked() throws NoSuchWorkspaceException, AccessDeniedException,
+ InvalidItemStateException, PathNotFoundException, ItemExistsException, NoSuchNodeTypeException, VersionException,
+ ConstraintViolationException, RepositoryException
+ {
+ Node someNode = root.addNode("someNode");
+ someNode.addMixin("mix:lockable");
+ session.save();
+
+ someNode.lock(true, false);
+
+ Session session2 =
+ repository.login(new CredentialsImpl("admin", "admin".toCharArray()), session.getWorkspace().getName());
+
+
+ try
+ {
+ session2.getRootNode().getNode("someNode").update("/");
+ fail();
+ }
+ catch (LockException e)
+ {
+ }
+ finally
+ {
+ session2.logout();
+ someNode.unlock();
+ }
+ }
+
+ public void testValidateChildNodeWhenNodeIsProtected() throws PathNotFoundException, ItemExistsException,
+ NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException, RepositoryException
+ {
+ NodeImpl testNode = (NodeImpl)root.addNode("someNode", "exo:myTypeJCR1703").getNode("exo:myChildNode");
+
+ try
+ {
+ ((NodeImpl)root.getNode("someNode")).validateChildNode(testNode.getInternalName(),
+ ((NodeTypeImpl)testNode.getPrimaryNodeType()).getQName());
+ fail();
+ }
+ catch (ConstraintViolationException e)
+ {
+ }
+ }
+
+ public void testVersionHistoryWhenNodeHaventVersionHistory() throws ItemExistsException, PathNotFoundException,
+ VersionException, ConstraintViolationException, LockException, RepositoryException
+ {
+ NodeImpl testNode = (NodeImpl)root.addNode("someNode");
+
+ try
+ {
+ testNode.versionHistory(false);
+ fail();
+ }
+ catch (UnsupportedRepositoryOperationException e)
+ {
+ }
+ }
+
+ public void testRemoveMixinWhenRemovedLockableMixin() throws ItemExistsException, PathNotFoundException,
+ VersionException,
+ ConstraintViolationException, LockException, RepositoryException
+ {
+ Node someNode = root.addNode("someNode");
+ someNode.addMixin("mix:lockable");
+ session.save();
+
+ someNode.lock(true, false);
+
+ Session session2 =
+ repository.login(new CredentialsImpl("admin", "admin".toCharArray()), session.getWorkspace().getName());
+
+ try
+ {
+ session2.getRootNode().getNode("someNode").removeMixin("mix:lockable");
+ fail();
+ }
+ catch (LockException e)
+ {
+ }
+ finally
+ {
+ session2.logout();
+ someNode.unlock();
+ }
+ }
}
14 years, 3 months
exo-jcr SVN: r5428 - jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-06 04:58:57 -0500 (Fri, 06 Jan 2012)
New Revision: 5428
Modified:
jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
Log:
EXOJCR-968: Move DBInitalizer and DBCleaner common code into separated class
Modified: jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java 2012-01-06 09:44:12 UTC (rev 5427)
+++ jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java 2012-01-06 09:58:57 UTC (rev 5428)
@@ -22,6 +22,7 @@
import org.exoplatform.management.annotations.Managed;
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
+import org.exoplatform.services.database.utils.DialectDetecter;
import org.exoplatform.services.jcr.config.MappedParametrizedObjectEntry;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
@@ -31,7 +32,6 @@
import org.exoplatform.services.jcr.impl.core.lock.cacheable.LockData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
import org.exoplatform.services.jcr.impl.storage.jdbc.DBConstants;
-import org.exoplatform.services.jcr.impl.storage.jdbc.DialectDetecter;
import org.exoplatform.services.jcr.infinispan.ISPNCacheFactory;
import org.exoplatform.services.jcr.infinispan.PrivilegedISPNCacheHelper;
import org.exoplatform.services.log.ExoLogger;
14 years, 3 months