exo-jcr SVN: r2217 - jcr/trunk.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-04-07 09:07:13 -0400 (Wed, 07 Apr 2010)
New Revision: 2217
Modified:
jcr/trunk/pom.xml
Log:
EXOJCR-604 deps on doc-style v1
Modified: jcr/trunk/pom.xml
===================================================================
--- jcr/trunk/pom.xml 2010-04-06 07:22:19 UTC (rev 2216)
+++ jcr/trunk/pom.xml 2010-04-07 13:07:13 UTC (rev 2217)
@@ -42,7 +42,7 @@
<org.exoplatform.kernel.version>2.2.1-GA-SNAPSHOT</org.exoplatform.kernel.version>
<org.exoplatform.core.version>2.3.1-GA-SNAPSHOT</org.exoplatform.core.version>
<org.exoplatform.ws.version>2.1.1-GA-SNAPSHOT</org.exoplatform.ws.version>
- <org.exoplatform.doc-style.version>2-SNAPSHOT</org.exoplatform.doc-style.version>
+ <org.exoplatform.doc-style.version>1</org.exoplatform.doc-style.version>
</properties>
<dependencyManagement>
<dependencies>
16 years, 3 months
exo-jcr SVN: r2216 - jcr/branches/1.14.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-04-06 03:22:19 -0400 (Tue, 06 Apr 2010)
New Revision: 2216
Modified:
jcr/branches/1.14.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
Log:
EXOJCR-570: register namespaces before repository start
Modified: jcr/branches/1.14.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
===================================================================
--- jcr/branches/1.14.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2010-04-02 14:06:57 UTC (rev 2215)
+++ jcr/branches/1.14.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2010-04-06 07:22:19 UTC (rev 2216)
@@ -155,6 +155,9 @@
{
repositoryContainers.put(rEntry.getName(), repositoryContainer);
managerStartChanges.registerListeners(repositoryContainer);
+
+ addNamespaces(rEntry.getName());
+
repositoryContainer.start();
}
catch (Throwable t)
@@ -162,8 +165,9 @@
//TODO will be implemented unregistration in managerStartChanges
//managerStartChanges.removeListeners(repositoryContainer);
repositoryContainers.remove(rEntry.getName());
-
- throw new RepositoryConfigurationException("Repository conatainer " + rEntry.getName() + " was not started.", t);
+
+ throw new RepositoryConfigurationException("Repository conatainer " + rEntry.getName() + " was not started.",
+ t);
}
if (!config.getRepositoryConfigurations().contains(rEntry))
@@ -171,7 +175,6 @@
config.getRepositoryConfigurations().add(rEntry);
}
- addNamespaces(rEntry.getName());
registerNodeTypes(rEntry.getName());
// turn on Repository ONLINE
16 years, 3 months
exo-jcr SVN: r2215 - jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-04-02 10:06:57 -0400 (Fri, 02 Apr 2010)
New Revision: 2215
Modified:
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdSize.java
Log:
EXOJCR-633 : The problem with ftp commands CmdSize on "/" was fixed.
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdSize.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdSize.java 2010-04-02 09:41:21 UTC (rev 2214)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdSize.java 2010-04-02 14:06:57 UTC (rev 2215)
@@ -55,8 +55,15 @@
}
String resName = params[1];
-
+
ArrayList<String> newPath = clientSession().getFullPath(resName);
+
+ if (newPath.size() == 0)
+ {
+ reply(String.format(FtpConst.Replyes.REPLY_550_SIZE, resName));
+ return;
+ }
+
String repoPath = clientSession().getRepoPath(newPath);
try
{
16 years, 3 months
exo-jcr SVN: r2214 - core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-04-02 05:41:21 -0400 (Fri, 02 Apr 2010)
New Revision: 2214
Modified:
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java
Log:
EXOJCR-564: open session after preSave()
Modified: core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java
===================================================================
--- core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java 2010-04-02 09:16:53 UTC (rev 2213)
+++ core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java 2010-04-02 09:41:21 UTC (rev 2214)
@@ -112,6 +112,8 @@
if (broadcast)
preSave(child, true);
childImpl.setId(groupId);
+
+ session = service_.openSession();
session.save(childImpl);
if (broadcast)
postSave(child, true);
@@ -120,9 +122,9 @@
public void saveGroup(Group group, boolean broadcast) throws Exception
{
- Session session = service_.openSession();
if (broadcast)
preSave(group, false);
+ Session session = service_.openSession();
session.update(group);
if (broadcast)
postSave(group, false);
@@ -131,9 +133,9 @@
public Group removeGroup(Group group, boolean broadcast) throws Exception
{
- Session session = service_.openSession();
if (broadcast)
preDelete(group);
+ Session session = service_.openSession();
session.delete(group);
List entries = session.createQuery(queryFindGroupByParent).setString(0, group.getId()).list();
for (int i = 0; i < entries.size(); i++)
Modified: core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java
===================================================================
--- core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java 2010-04-02 09:16:53 UTC (rev 2213)
+++ core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java 2010-04-02 09:41:21 UTC (rev 2214)
@@ -82,9 +82,9 @@
public void createMembership(Membership m, boolean broadcast) throws Exception
{
- Session session = service_.openSession();
if (broadcast)
preSave(m, true);
+ Session session = service_.openSession();
session.save(IdentifierUtil.generateUUID(m), m);
if (broadcast)
postSave(m, true);
@@ -114,7 +114,6 @@
+ " because membership type is null");
}
- Session session = service_.openSession();
MembershipImpl membership = new MembershipImpl();
// User user
// =(User)service_.findExactOne(session,UserHandlerImpl.queryFindUserByName,
@@ -130,6 +129,7 @@
if (broadcast)
preSave(membership, true);
membership.setId(id);
+ Session session = service_.openSession();
session.save(membership);
if (broadcast)
postSave(membership, true);
@@ -138,9 +138,9 @@
public void saveMembership(Membership m, boolean broadcast) throws Exception
{
- Session session = service_.openSession();
if (broadcast)
preSave(m, false);
+ Session session = service_.openSession();
session.update(m);
if (broadcast)
postSave(m, false);
@@ -156,6 +156,7 @@
{
if (broadcast)
preDelete(m);
+ session = service_.openSession();
session.delete(m);
if (broadcast)
postDelete(m);
@@ -166,7 +167,6 @@
public Collection removeMembershipByUser(String username, boolean broadcast) throws Exception
{
- Session session = service_.openSession();
Collection collection = findMembershipsByUser(username);
Iterator iter = collection.iterator();
while (iter.hasNext())
@@ -176,6 +176,7 @@
{
if (broadcast)
preDelete(m);
+ Session session = service_.openSession();
session.delete(m);
if (broadcast)
postDelete(m);
Modified: core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
===================================================================
--- core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2010-04-02 09:16:53 UTC (rev 2213)
+++ core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2010-04-02 09:41:21 UTC (rev 2214)
@@ -77,10 +77,11 @@
public void createUser(User user, boolean broadcast) throws Exception
{
+ if (broadcast)
+ preSave(user, true);
Session session = service_.openSession();
Transaction transaction = session.beginTransaction();
- if (broadcast)
- preSave(user, true);
+
UserImpl userImpl = (UserImpl)user;
userImpl.setId(user.getUserName());
session.save(user);
@@ -91,9 +92,9 @@
public void saveUser(User user, boolean broadcast) throws Exception
{
- Session session = service_.openSession();
if (broadcast)
preSave(user, false);
+ Session session = service_.openSession();
session.merge(user);
// session.update(user);
if (broadcast)
@@ -116,6 +117,7 @@
if (broadcast)
preDelete(foundUser);
+ session = service_.openSession();
session.delete(foundUser);
if (broadcast)
postDelete(foundUser);
Modified: core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java
===================================================================
--- core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java 2010-04-02 09:16:53 UTC (rev 2213)
+++ core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java 2010-04-02 09:41:21 UTC (rev 2214)
@@ -92,6 +92,7 @@
upd.setUserProfile(profile);
if (broadcast)
preSave(profile, true);
+ session = service_.openSession();
session.save(profile.getUserName(), upd);
if (broadcast)
postSave(profile, true);
@@ -102,6 +103,7 @@
upd.setUserProfile(profile);
if (broadcast)
preSave(profile, false);
+ session = service_.openSession();
session.update(upd);
if (broadcast)
postSave(profile, false);
@@ -119,6 +121,7 @@
UserProfile profile = upd.getUserProfile();
if (broadcast)
preDelete(profile);
+ session = service_.openSession();
session.delete(upd);
if (broadcast)
postDelete(profile);
16 years, 3 months
exo-jcr SVN: r2213 - in jcr/trunk/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/usecases and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-04-02 05:16:53 -0400 (Fri, 02 Apr 2010)
New Revision: 2213
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestNullACL.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java
Log:
EXOJCR-621: NullPointerException avoided in equal() and dump() methods
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java 2010-04-02 08:42:29 UTC (rev 2212)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java 2010-04-02 09:16:53 UTC (rev 2213)
@@ -184,18 +184,55 @@
if (obj instanceof AccessControlList)
{
AccessControlList another = (AccessControlList)obj;
- return dump().equals(another.dump());
+
+ // check owners, it may be null
+ if (!((owner == null && another.owner == null) || (owner != null && owner.equals(another.owner))))
+ {
+ return false;
+ }
+
+ // check accessList
+ List<AccessControlEntry> anotherAccessList = another.accessList;
+ if (accessList == null && anotherAccessList == null)
+ {
+ return true;
+ }
+ else if (accessList != null && anotherAccessList != null && accessList.size() == anotherAccessList.size())
+ {
+ // check content of both accessLists
+ for (int i = 0; i < accessList.size(); i++)
+ {
+ if (!accessList.get(i).getAsString().equals(anotherAccessList.get(i).getAsString()))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+
+ //return dump().equals(another.dump());
}
return false;
}
public String dump()
{
- String res = "OWNER: " + owner + "\n";
- for (AccessControlEntry a : accessList)
+ String res = "OWNER: " + (owner != null ? owner : "null") + "\n";
+ if (accessList != null)
{
- res += a.getAsString() + "\n";
+ for (AccessControlEntry a : accessList)
+ {
+ res += a.getAsString() + "\n";
+ }
}
+ else
+ {
+ res += "null";
+ }
return res;
}
Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestNullACL.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestNullACL.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestNullACL.java 2010-04-02 09:16:53 UTC (rev 2213)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.usecases;
+
+import org.exoplatform.services.jcr.access.AccessControlList;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: TestNullACL.java 111 2008-11-11 11:11:11Z serg $
+ */
+public class TestNullACL extends BaseUsecasesTest
+{
+
+ public void testNullsInACL() throws Exception
+ {
+
+ AccessControlList one = new AccessControlList(null, null);
+ AccessControlList second = new AccessControlList();
+
+ assertFalse(one.equals(second));
+ assertFalse(second.equals(one));
+
+ AccessControlList third = new AccessControlList(null, null);
+ assertTrue(one.equals(third));
+
+ // just run dumps to check for not Exceptions here
+ one.dump();
+
+ second.dump();
+ }
+}
16 years, 3 months
exo-jcr SVN: r2212 - in ws/branches/2.2.x: exo.ws.commons and 6 other directories.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2010-04-02 04:42:29 -0400 (Fri, 02 Apr 2010)
New Revision: 2212
Modified:
ws/branches/2.2.x/exo.ws.commons/pom.xml
ws/branches/2.2.x/exo.ws.frameworks.json/pom.xml
ws/branches/2.2.x/exo.ws.frameworks.servlet/pom.xml
ws/branches/2.2.x/exo.ws.rest.core/pom.xml
ws/branches/2.2.x/exo.ws.rest.ext/pom.xml
ws/branches/2.2.x/exo.ws.testframework/pom.xml
ws/branches/2.2.x/packaging/module/pom.xml
ws/branches/2.2.x/pom.xml
Log:
EXOJCR-604 version updated
Modified: ws/branches/2.2.x/exo.ws.commons/pom.xml
===================================================================
--- ws/branches/2.2.x/exo.ws.commons/pom.xml 2010-04-02 07:36:35 UTC (rev 2211)
+++ ws/branches/2.2.x/exo.ws.commons/pom.xml 2010-04-02 08:42:29 UTC (rev 2212)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.ws</groupId>
<artifactId>ws-parent</artifactId>
- <version>2.1.1-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta01-SNAPSHOT</version>
</parent>
<artifactId>exo.ws.commons</artifactId>
Modified: ws/branches/2.2.x/exo.ws.frameworks.json/pom.xml
===================================================================
--- ws/branches/2.2.x/exo.ws.frameworks.json/pom.xml 2010-04-02 07:36:35 UTC (rev 2211)
+++ ws/branches/2.2.x/exo.ws.frameworks.json/pom.xml 2010-04-02 08:42:29 UTC (rev 2212)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.ws</groupId>
<artifactId>ws-parent</artifactId>
- <version>2.1.1-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta01-SNAPSHOT</version>
</parent>
<artifactId>exo.ws.frameworks.json</artifactId>
Modified: ws/branches/2.2.x/exo.ws.frameworks.servlet/pom.xml
===================================================================
--- ws/branches/2.2.x/exo.ws.frameworks.servlet/pom.xml 2010-04-02 07:36:35 UTC (rev 2211)
+++ ws/branches/2.2.x/exo.ws.frameworks.servlet/pom.xml 2010-04-02 08:42:29 UTC (rev 2212)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.ws</groupId>
<artifactId>ws-parent</artifactId>
- <version>2.1.1-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta01-SNAPSHOT</version>
</parent>
<artifactId>exo.ws.frameworks.servlet</artifactId>
Modified: ws/branches/2.2.x/exo.ws.rest.core/pom.xml
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/pom.xml 2010-04-02 07:36:35 UTC (rev 2211)
+++ ws/branches/2.2.x/exo.ws.rest.core/pom.xml 2010-04-02 08:42:29 UTC (rev 2212)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.ws</groupId>
<artifactId>ws-parent</artifactId>
- <version>2.1.1-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta01-SNAPSHOT</version>
</parent>
<artifactId>exo.ws.rest.core</artifactId>
Modified: ws/branches/2.2.x/exo.ws.rest.ext/pom.xml
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.ext/pom.xml 2010-04-02 07:36:35 UTC (rev 2211)
+++ ws/branches/2.2.x/exo.ws.rest.ext/pom.xml 2010-04-02 08:42:29 UTC (rev 2212)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.ws</groupId>
<artifactId>ws-parent</artifactId>
- <version>2.1.1-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta01-SNAPSHOT</version>
</parent>
<artifactId>exo.ws.rest.ext</artifactId>
Modified: ws/branches/2.2.x/exo.ws.testframework/pom.xml
===================================================================
--- ws/branches/2.2.x/exo.ws.testframework/pom.xml 2010-04-02 07:36:35 UTC (rev 2211)
+++ ws/branches/2.2.x/exo.ws.testframework/pom.xml 2010-04-02 08:42:29 UTC (rev 2212)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.ws</groupId>
<artifactId>ws-parent</artifactId>
- <version>2.1.1-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta01-SNAPSHOT</version>
</parent>
<artifactId>exo.ws.testframework</artifactId>
Modified: ws/branches/2.2.x/packaging/module/pom.xml
===================================================================
--- ws/branches/2.2.x/packaging/module/pom.xml 2010-04-02 07:36:35 UTC (rev 2211)
+++ ws/branches/2.2.x/packaging/module/pom.xml 2010-04-02 08:42:29 UTC (rev 2212)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.exoplatform.ws</groupId>
<artifactId>ws-parent</artifactId>
- <version>2.1.1-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: ws/branches/2.2.x/pom.xml
===================================================================
--- ws/branches/2.2.x/pom.xml 2010-04-02 07:36:35 UTC (rev 2211)
+++ ws/branches/2.2.x/pom.xml 2010-04-02 08:42:29 UTC (rev 2212)
@@ -30,7 +30,7 @@
<groupId>org.exoplatform.ws</groupId>
<artifactId>ws-parent</artifactId>
- <version>2.1.1-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta01-SNAPSHOT</version>
<packaging>pom</packaging>
<name>eXo WS</name>
@@ -42,10 +42,10 @@
<properties>
<exo.product.name>exo-ws</exo.product.name>
- <exo.product.specification>2.1</exo.product.specification>
+ <exo.product.specification>2.2</exo.product.specification>
<org.exoplatform.kernel.version>2.2.1-GA-SNAPSHOT</org.exoplatform.kernel.version>
- <org.exoplatform.core.version>2.3.1-GA-SNAPSHOT</org.exoplatform.core.version>
+ <org.exoplatform.core.version>2.4.0-Beta01-SNAPSHOT</org.exoplatform.core.version>
</properties>
<modules>
16 years, 3 months
exo-jcr SVN: r2211 - ws/branches.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2010-04-02 03:36:35 -0400 (Fri, 02 Apr 2010)
New Revision: 2211
Added:
ws/branches/2.2.x/
Log:
EXOJCR-604 2.2.x branch added
Copied: ws/branches/2.2.x (from rev 2210, ws/trunk)
16 years, 3 months
exo-jcr SVN: r2210 - ws/branches.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2010-04-02 03:35:14 -0400 (Fri, 02 Apr 2010)
New Revision: 2210
Removed:
ws/branches/2.2.x/
Log:
2.2.x branch removed
16 years, 3 months
exo-jcr SVN: r2209 - ws/branches/2.2.x.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2010-04-02 03:30:34 -0400 (Fri, 02 Apr 2010)
New Revision: 2209
Added:
ws/branches/2.2.x/trunk/
Log:
EXOJCR-604 2.2.x branch added
Copied: ws/branches/2.2.x/trunk (from rev 2208, ws/trunk)
16 years, 3 months
exo-jcr SVN: r2208 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/dataflow/persistent and 2 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-04-01 10:59:21 -0400 (Thu, 01 Apr 2010)
New Revision: 2208
Removed:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
Log:
EXOJCR-609: Changes reverted need to be reviewed
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java 2010-04-01 14:45:41 UTC (rev 2207)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java 2010-04-01 14:59:21 UTC (rev 2208)
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2003-2010 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.services.jcr.datamodel;
-
-import org.exoplatform.services.jcr.access.AccessControlList;
-import org.exoplatform.services.jcr.dataflow.ItemDataVisitor;
-
-import javax.jcr.RepositoryException;
-
-/**
- * This class is used to represent <code>null</code> value, it is designed to be used
- * into the cache to represent missing value.
- *
- * Created by The eXo Platform SAS
- * Author : Nicolas Filotto
- * nicolas.filotto(a)exoplatform.com
- * 31 mars 2010
- */
-public class NullNodeData implements NodeData
-{
- private final String id;
- private final String parentId;
- private final QPath path;
-
- public NullNodeData(String id)
- {
- this.id = id;
- this.path = new QPath(new QPathEntry[]{new QPathEntry(null, null, 0)});
- this.parentId = null;
- }
-
- public NullNodeData(NodeData parentData, QPathEntry name)
- {
- this.parentId = parentData.getIdentifier();
- this.path = QPath.makeChildPath(parentData.getQPath(), name);
- this.id = parentId + "$" + name.asString();
- }
-
- /**
- * {@inheritDoc}
- */
- public void accept(ItemDataVisitor visitor) throws RepositoryException
- {
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIdentifier()
- {
- return id;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getParentIdentifier()
- {
- return parentId;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getPersistedVersion()
- {
- return 0;
- }
-
- /**
- * {@inheritDoc}
- */
- public QPath getQPath()
- {
- return path;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isNode()
- {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- public AccessControlList getACL()
- {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public InternalQName[] getMixinTypeNames()
- {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getOrderNumber()
- {
- return 0;
- }
-
- /**
- * {@inheritDoc}
- */
- public InternalQName getPrimaryTypeName()
- {
- return null;
- }
-}
\ No newline at end of file
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-04-01 14:45:41 UTC (rev 2207)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-04-01 14:59:21 UTC (rev 2208)
@@ -22,7 +22,6 @@
import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.datamodel.NullNodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
@@ -41,7 +40,7 @@
import javax.transaction.TransactionManager;
/**
- * Created by The eXo Platform SAS.
+ * Created by The eXo Platform SAS.
*
* <br/>
* Author : Peter Nedonosko peter.nedonosko(a)exoplatform.com.ua
@@ -95,7 +94,7 @@
* GET_LIST_PROPERTIES type.
*/
static private final int GET_LIST_PROPERTIES = 5;
-
+
/**
* Request type.
*/
@@ -282,7 +281,7 @@
* Items cache
* @param systemDataContainerHolder
* System Workspace data container (persistent level)
- * @param transactionService TransactionService
+ * @param transactionService TransactionService
*/
public CacheableWorkspaceDataManager(WorkspaceDataContainer dataContainer, WorkspaceStorageCache cache,
SystemDataContainerHolder systemDataContainerHolder, TransactionService transactionService)
@@ -338,7 +337,6 @@
/**
* {@inheritDoc}
*/
- @Override
public int getChildNodesCount(NodeData parent) throws RepositoryException
{
if (cache.isEnabled())
@@ -356,7 +354,6 @@
/**
* {@inheritDoc}
*/
- @Override
public List<NodeData> getChildNodesData(NodeData nodeData) throws RepositoryException
{
return getChildNodesData(nodeData, false);
@@ -365,7 +362,6 @@
/**
* {@inheritDoc}
*/
- @Override
public List<PropertyData> getChildPropertiesData(NodeData nodeData) throws RepositoryException
{
List<PropertyData> childs = getChildPropertiesData(nodeData, false);
@@ -380,7 +376,6 @@
/**
* {@inheritDoc}
*/
- @Override
public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
{
@@ -391,7 +386,7 @@
if (data == null)
{
final DataRequest request = new DataRequest(parentData.getIdentifier(), name);
-
+
try
{
request.start();
@@ -400,12 +395,12 @@
data = getCachedItemData(parentData, name);
if (data == null)
{
- data = getPersistedItemData(parentData, name);
+ data = getPersistedItemData(parentData, name);
}
else if (!data.isNode())
{
fixPropertyValues((PropertyData)data);
- }
+ }
}
finally
{
@@ -417,19 +412,14 @@
fixPropertyValues((PropertyData)data);
}
- return data instanceof NullNodeData ? null : data;
+ return data;
}
/**
* {@inheritDoc}
*/
- @Override
public ItemData getItemData(String identifier) throws RepositoryException
{
- if (identifier == null)
- {
- return null;
- }
// 2. Try from cache
ItemData data = getCachedItemData(identifier);
@@ -437,7 +427,7 @@
if (data == null)
{
final DataRequest request = new DataRequest(identifier);
-
+
try
{
request.start();
@@ -446,7 +436,7 @@
data = getCachedItemData(identifier);
if (data == null)
{
- data = getPersistedItemData(identifier);
+ data = getPersistedItemData(identifier);
}
else if (!data.isNode())
{
@@ -463,15 +453,14 @@
fixPropertyValues((PropertyData)data);
}
- return data instanceof NullNodeData ? null : data;
+ return data;
}
/**
* {@inheritDoc}
*/
- @Override
public List<PropertyData> getReferencesData(String identifier, boolean skipVersionStorage)
- throws RepositoryException
+ throws RepositoryException
{
return super.getReferencesData(identifier, skipVersionStorage);
}
@@ -479,7 +468,6 @@
/**
* {@inheritDoc}
*/
- @Override
public List<PropertyData> listChildPropertiesData(NodeData nodeData) throws RepositoryException
{
return listChildPropertiesData(nodeData, false);
@@ -498,7 +486,7 @@
}
else
{
- // save normaly
+ // save normaly
super.save(changesLog);
// notify listeners after storage commit
@@ -548,7 +536,7 @@
* Repository error
*/
protected List<NodeData> getChildNodesData(NodeData nodeData, boolean forcePersistentRead)
- throws RepositoryException
+ throws RepositoryException
{
List<NodeData> childNodes = null;
@@ -605,7 +593,7 @@
* Repository error
*/
protected List<PropertyData> getChildPropertiesData(NodeData nodeData, boolean forcePersistentRead)
- throws RepositoryException
+ throws RepositoryException
{
List<PropertyData> childProperties = null;
@@ -634,7 +622,8 @@
}
childProperties = super.getChildPropertiesData(nodeData);
- if (cache.isEnabled())
+ // TODO childProperties.size() > 0 for SDB
+ if (childProperties.size() > 0 && cache.isEnabled())
{
NodeData parentData = (NodeData)getItemData(nodeData.getIdentifier());
@@ -665,9 +654,9 @@
protected ItemData getPersistedItemData(NodeData parentData, QPathEntry name) throws RepositoryException
{
ItemData data = super.getItemData(parentData, name);
- if (cache.isEnabled())
+ if (data != null && cache.isEnabled())
{
- cache.put(data == null ? new NullNodeData(parentData, name) : data);
+ cache.put(data);
}
return data;
}
@@ -682,9 +671,9 @@
protected ItemData getPersistedItemData(String identifier) throws RepositoryException
{
ItemData data = super.getItemData(identifier);
- if (cache.isEnabled())
+ if (data != null && cache.isEnabled())
{
- cache.put(data == null ? new NullNodeData(identifier) : data);
+ cache.put(data);
}
return data;
}
@@ -701,7 +690,7 @@
* Repository error
*/
protected List<PropertyData> listChildPropertiesData(NodeData nodeData, boolean forcePersistentRead)
- throws RepositoryException
+ throws RepositoryException
{
List<PropertyData> propertiesList;
@@ -729,7 +718,8 @@
}
}
propertiesList = super.listChildPropertiesData(nodeData);
- if (cache.isEnabled())
+ // TODO propertiesList.size() > 0 for SDB
+ if (propertiesList.size() > 0 && cache.isEnabled())
{
NodeData parentData = (NodeData)getItemData(nodeData.getIdentifier());
@@ -743,7 +733,7 @@
finally
{
request.done();
- }
+ }
}
protected boolean isTxAware()
@@ -792,10 +782,10 @@
* @param prop PropertyData, original Property data
* @return PropertyData
* @throws IllegalStateException
- * @throws RepositoryException
+ * @throws RepositoryException
*/
protected ValueData getPropertyValue(String propertyId, int orderNumb, int persistedVersion)
- throws IllegalStateException, RepositoryException
+ throws IllegalStateException, RepositoryException
{
// TODO use interface not JDBC
JDBCStorageConnection conn = (JDBCStorageConnection)dataContainer.openConnection();
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-04-01 14:45:41 UTC (rev 2207)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-04-01 14:59:21 UTC (rev 2208)
@@ -26,7 +26,6 @@
import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.datamodel.NullNodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -905,12 +904,9 @@
protected void putItem(final ItemData data)
{
cache.put(new CacheId(data.getIdentifier()), new CacheValue(data, System.currentTimeMillis() + liveTime));
- if (data.getParentIdentifier() != null || !(data instanceof NullNodeData))
- {
- cache.put(new CacheQPath(data.getParentIdentifier(), data.getQPath()), new CacheValue(data, System
- .currentTimeMillis()
- + liveTime));
- }
+ cache.put(new CacheQPath(data.getParentIdentifier(), data.getQPath()), new CacheValue(data, System
+ .currentTimeMillis()
+ + liveTime));
}
/**
@@ -933,11 +929,6 @@
// add child item data to list of childs of the parent
if (item.isNode())
{
- if (item instanceof NullNodeData)
- {
- // Skip null values
- return;
- }
// add child node
List<NodeData> cachedParentChilds = nodesCache.get(item.getParentIdentifier());
if (cachedParentChilds != null)
@@ -1309,11 +1300,8 @@
{
cache.remove(k);
- if (c.getParentIdentifier() != null || !(c instanceof NullNodeData))
- {
- // remove by parentId + path
- cache.remove(new CacheQPath(c.getParentIdentifier(), c.getQPath()));
- }
+ // remove by parentId + path
+ cache.remove(new CacheQPath(c.getParentIdentifier(), c.getQPath()));
// remove cached child lists
if (c.isNode())
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-04-01 14:45:41 UTC (rev 2207)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-04-01 14:59:21 UTC (rev 2208)
@@ -28,7 +28,6 @@
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.datamodel.NullNodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -53,7 +52,6 @@
import java.util.Set;
import javax.jcr.RepositoryException;
-import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
/**
@@ -372,53 +370,12 @@
cache.setLocal(false);
if (!inTransaction)
{
- dedicatedTxCommit();
+ cache.commitTransaction();
}
}
}
/**
- * Allows to commit the cache changes in a dedicated XA Tx in order to avoid potential
- * deadlocks
- */
- private void dedicatedTxCommit()
- {
- // Ensure that the commit is done in a dedicated tx to avoid deadlock due
- // to global XA Tx
- TransactionManager tm = getTransactionManager();
- Transaction tx = null;
- try
- {
- if (tm != null)
- {
- try
- {
- tx = tm.suspend();
- }
- catch (Exception e)
- {
- LOG.warn("Cannot suspend the current transaction", e);
- }
- }
- cache.commitTransaction();
- }
- finally
- {
- if (tx != null)
- {
- try
- {
- tm.resume(tx);
- }
- catch (Exception e)
- {
- LOG.warn("Cannot resume the current transaction", e);
- }
- }
- }
- }
-
- /**
* {@inheritDoc}
*/
public void remove(ItemData item)
@@ -519,7 +476,7 @@
else
{
// cache fact of empty childs list
- cache.put(makeChildListFqn(childNodesList, parent.getIdentifier()), ITEM_LIST, Collections.EMPTY_SET);
+ cache.put(makeChildListFqn(childNodesList, parent.getIdentifier()), ITEM_LIST, new HashSet<Object>());
}
}
finally
@@ -527,7 +484,7 @@
cache.setLocal(false);
if (!inTransaction)
{
- dedicatedTxCommit();
+ cache.commitTransaction();
}
}
}
@@ -557,10 +514,11 @@
set.add(child.getIdentifier());
}
cache.put(makeChildListFqn(childPropsList, parent.getIdentifier()), ITEM_LIST, set);
+
}
else
{
- cache.put(makeChildListFqn(childPropsList, parent.getIdentifier()), ITEM_LIST, Collections.EMPTY_SET);
+ LOG.warn("Empty properties list cached " + (parent != null ? parent.getQPath().getAsString() : parent));
}
}
finally
@@ -568,7 +526,7 @@
cache.setLocal(false);
if (!inTransaction)
{
- dedicatedTxCommit();
+ cache.commitTransaction();
}
}
}
@@ -821,9 +779,9 @@
cache.put(makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
.getEntries().length - 1]), ITEM_ID, node.getIdentifier());
// if MODIFY and List present OR FORCE_MODIFY, then write
- if (!(node instanceof NullNodeData)
- && ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childNodesList, node
- .getParentIdentifier())) != null) || modifyListsOfChild == ModifyChildOption.FORCE_MODIFY))
+ if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childNodesList, node
+ .getParentIdentifier())) != null)
+ || modifyListsOfChild == ModifyChildOption.FORCE_MODIFY)
{
cache.addToList(makeChildListFqn(childNodesList, node.getParentIdentifier()), ITEM_LIST, node
.getIdentifier());
@@ -872,14 +830,6 @@
{
cache.addToList(makeChildListFqn(childPropsList, prop.getParentIdentifier()), ITEM_LIST, prop.getIdentifier());
}
- ItemData result =
- get(prop.getParentIdentifier(), prop.getQPath().getEntries()[prop.getQPath().getEntries().length - 1]);
- if (result instanceof NullNodeData)
- {
- // Remove null value if exists
- cache.removeNode(makeChildFqn(childNodes, result.getParentIdentifier(), prop.getQPath().getEntries()[prop.getQPath().getEntries().length - 1]));
- cache.removeNode(makeItemFqn(result.getIdentifier()));
- }
// add in ITEMS
return (PropertyData)cache.put(makeItemFqn(prop.getIdentifier()), ITEM_DATA, prop);
}
@@ -934,12 +884,7 @@
*/
protected void updateMixin(NodeData node)
{
- Object oPrevValue = cache.put(makeItemFqn(node.getIdentifier()), ITEM_DATA, node);
- if (oPrevValue instanceof NullNodeData)
- {
- oPrevValue = null;
- }
- NodeData prevData = (NodeData)oPrevValue;
+ NodeData prevData = (NodeData)cache.put(makeItemFqn(node.getIdentifier()), ITEM_DATA, node);
if (prevData != null)
{
// do update ACL if needed
@@ -1078,10 +1023,6 @@
for (Iterator<NodeData> iter = new ChildNodesIterator<NodeData>(parentId); iter.hasNext();)
{
NodeData prevNode = iter.next();
- if (prevNode instanceof NullNodeData)
- {
- continue;
- }
// is ACL changes on this node (i.e. ACL inheritance brokes)
for (InternalQName mixin : prevNode.getMixinTypeNames())
{
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2010-04-01 14:45:41 UTC (rev 2207)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2010-04-01 14:59:21 UTC (rev 2208)
@@ -25,7 +25,6 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
-import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
@@ -54,7 +53,6 @@
{
private static final int READER = 100;
-
private static final int TIMES = 20;
private CacheableWorkspaceDataManager cwdm;
@@ -63,12 +61,6 @@
private MyWorkspaceStorageConnection con;
- private CacheableWorkspaceDataManager cwdmEmpty;
-
- private WorkspaceDataContainer wdcEmpty;
-
- private MyWorkspaceStorageConnection conEmpty;
-
@Override
protected void setUp() throws Exception
{
@@ -77,11 +69,6 @@
this.wdc = new MyWorkspaceDataContainer(con);
this.cwdm =
new CacheableWorkspaceDataManager(wdc, new MyWorkspaceStorageCache(), new SystemDataContainerHolder(wdc));
- this.conEmpty = new MyWorkspaceStorageConnection(true);
- this.wdcEmpty = new MyWorkspaceDataContainer(conEmpty);
- this.cwdmEmpty =
- new CacheableWorkspaceDataManager(wdcEmpty, new MyWorkspaceStorageCache(), new SystemDataContainerHolder(
- wdcEmpty));
}
@Override
@@ -109,7 +96,7 @@
startSignal.await();
for (int i = 0; i < TIMES; i++)
{
- task.execute();
+ task.execute();
}
}
catch (Exception e)
@@ -133,9 +120,9 @@
e.printStackTrace();
}
throw errors.get(0);
- }
+ }
}
-
+
public void testGetItemById() throws Exception
{
assertEquals(0, con.getItemDataByIdCalls.get());
@@ -145,27 +132,15 @@
{
ItemData item = cwdm.getItemData("getItemData");
assertNotNull(item);
- }
+ }
};
multiThreadingTest(task);
assertEquals(1, con.getItemDataByIdCalls.get());
- assertEquals(0, conEmpty.getItemDataByIdCalls.get());
- task = new MyTask()
- {
- public void execute() throws Exception
- {
- ItemData item = cwdmEmpty.getItemData("getItemData");
- assertNull(item);
- }
- };
- multiThreadingTest(task);
- assertEquals(1, conEmpty.getItemDataByIdCalls.get());
}
-
+
public void testGetItemDataByNodeDataNQPathEntry() throws Exception
{
- final NodeData nodeData =
- new PersistedNodeData("getItemData", new QPath(new QPathEntry[]{}), null, 0, 1, null, null, null);
+ final NodeData nodeData = new PersistedNodeData("getItemData", null, null, 0, 1, null, null, null);
assertEquals(0, con.getItemDataByNodeDataNQPathEntryCalls.get());
MyTask task = new MyTask()
{
@@ -173,26 +148,15 @@
{
ItemData item = cwdm.getItemData(nodeData, new QPathEntry("http://www.foo.com", "foo", 0));
assertNotNull(item);
- }
+ }
};
multiThreadingTest(task);
assertEquals(1, con.getItemDataByNodeDataNQPathEntryCalls.get());
- assertEquals(0, conEmpty.getItemDataByNodeDataNQPathEntryCalls.get());
- task = new MyTask()
- {
- public void execute() throws Exception
- {
- ItemData item = cwdmEmpty.getItemData(nodeData, new QPathEntry("http://www.foo.com", "foo", 0));
- assertNull(item);
- }
- };
- multiThreadingTest(task);
- assertEquals(1, conEmpty.getItemDataByNodeDataNQPathEntryCalls.get());
}
-
+
public void testGetChildPropertiesData() throws Exception
{
- final NodeData nodeData = new PersistedNodeData("getChildPropertiesData", null, null, 0, 1, null, null, null);
+ final NodeData nodeData = new PersistedNodeData("getChildPropertiesData", null, null, 0, 1, null, null, null);
assertEquals(0, con.getChildPropertiesDataCalls.get());
MyTask task = new MyTask()
{
@@ -201,7 +165,7 @@
List<PropertyData> properties = cwdm.getChildPropertiesData(nodeData);
assertNotNull(properties);
assertFalse(properties.isEmpty());
- }
+ }
};
multiThreadingTest(task);
assertEquals(1, con.getChildPropertiesDataCalls.get());
@@ -212,38 +176,15 @@
List<PropertyData> properties = cwdm.getChildPropertiesData(nodeData, true);
assertNotNull(properties);
assertFalse(properties.isEmpty());
- }
+ }
};
multiThreadingTest(task);
assertEquals(1 + READER * TIMES, con.getChildPropertiesDataCalls.get());
- assertEquals(0, conEmpty.getChildPropertiesDataCalls.get());
- task = new MyTask()
- {
- public void execute() throws Exception
- {
- List<PropertyData> properties = cwdmEmpty.getChildPropertiesData(nodeData);
- assertNotNull(properties);
- assertTrue(properties.isEmpty());
- }
- };
- multiThreadingTest(task);
- assertEquals(1, conEmpty.getChildPropertiesDataCalls.get());
- task = new MyTask()
- {
- public void execute() throws Exception
- {
- List<PropertyData> properties = cwdmEmpty.getChildPropertiesData(nodeData, true);
- assertNotNull(properties);
- assertTrue(properties.isEmpty());
- }
- };
- multiThreadingTest(task);
- assertEquals(1 + READER * TIMES, conEmpty.getChildPropertiesDataCalls.get());
}
-
+
public void testListChildPropertiesData() throws Exception
{
- final NodeData nodeData = new PersistedNodeData("listChildPropertiesData", null, null, 0, 1, null, null, null);
+ final NodeData nodeData = new PersistedNodeData("listChildPropertiesData", null, null, 0, 1, null, null, null);
assertEquals(0, con.listChildPropertiesDataCalls.get());
MyTask task = new MyTask()
{
@@ -252,7 +193,7 @@
List<PropertyData> properties = cwdm.listChildPropertiesData(nodeData);
assertNotNull(properties);
assertFalse(properties.isEmpty());
- }
+ }
};
multiThreadingTest(task);
assertEquals(1, con.listChildPropertiesDataCalls.get());
@@ -263,38 +204,15 @@
List<PropertyData> properties = cwdm.listChildPropertiesData(nodeData, true);
assertNotNull(properties);
assertFalse(properties.isEmpty());
- }
+ }
};
multiThreadingTest(task);
assertEquals(1 + READER * TIMES, con.listChildPropertiesDataCalls.get());
- assertEquals(0, conEmpty.listChildPropertiesDataCalls.get());
- task = new MyTask()
- {
- public void execute() throws Exception
- {
- List<PropertyData> properties = cwdmEmpty.listChildPropertiesData(nodeData);
- assertNotNull(properties);
- assertTrue(properties.isEmpty());
- }
- };
- multiThreadingTest(task);
- assertEquals(1, conEmpty.listChildPropertiesDataCalls.get());
- task = new MyTask()
- {
- public void execute() throws Exception
- {
- List<PropertyData> properties = cwdmEmpty.listChildPropertiesData(nodeData, true);
- assertNotNull(properties);
- assertTrue(properties.isEmpty());
- }
- };
- multiThreadingTest(task);
- assertEquals(1 + READER * TIMES, conEmpty.listChildPropertiesDataCalls.get());
}
-
+
public void testGetChildNodes() throws Exception
{
- final NodeData nodeData = new PersistedNodeData("getChildNodes", null, null, 0, 1, null, null, null);
+ final NodeData nodeData = new PersistedNodeData("getChildNodes", null, null, 0, 1, null, null, null);
assertEquals(0, con.getChildNodesDataCalls.get());
MyTask task = new MyTask()
{
@@ -303,7 +221,7 @@
List<NodeData> nodes = cwdm.getChildNodesData(nodeData);
assertNotNull(nodes);
assertFalse(nodes.isEmpty());
- }
+ }
};
multiThreadingTest(task);
assertEquals(1, con.getChildNodesDataCalls.get());
@@ -314,38 +232,15 @@
List<NodeData> nodes = cwdm.getChildNodesData(nodeData, true);
assertNotNull(nodes);
assertFalse(nodes.isEmpty());
- }
+ }
};
multiThreadingTest(task);
assertEquals(1 + READER * TIMES, con.getChildNodesDataCalls.get());
- assertEquals(0, conEmpty.getChildNodesDataCalls.get());
- task = new MyTask()
- {
- public void execute() throws Exception
- {
- List<NodeData> nodes = cwdmEmpty.getChildNodesData(nodeData);
- assertNotNull(nodes);
- assertTrue(nodes.isEmpty());
- }
- };
- multiThreadingTest(task);
- assertEquals(1, conEmpty.getChildNodesDataCalls.get());
- task = new MyTask()
- {
- public void execute() throws Exception
- {
- List<NodeData> nodes = cwdmEmpty.getChildNodesData(nodeData, true);
- assertNotNull(nodes);
- assertTrue(nodes.isEmpty());
- }
- };
- multiThreadingTest(task);
- assertEquals(1 + READER * TIMES, conEmpty.getChildNodesDataCalls.get());
}
-
+
public void testGetChildNodesCount() throws Exception
{
- final NodeData nodeData = new PersistedNodeData("getChildNodesCount", null, null, 0, 1, null, null, null);
+ final NodeData nodeData = new PersistedNodeData("getChildNodesCount", null, null, 0, 1, null, null, null);
assertEquals(0, con.getChildNodesCountCalls.get());
MyTask task = new MyTask()
{
@@ -353,7 +248,7 @@
{
int result = cwdm.getChildNodesCount(nodeData);
assertEquals(1, result);
- }
+ }
};
multiThreadingTest(task);
assertEquals(READER * TIMES, con.getChildNodesCountCalls.get());
@@ -365,40 +260,17 @@
{
int result = cwdm.getChildNodesCount(nodeData);
assertEquals(1, result);
- }
+ }
};
multiThreadingTest(task);
assertEquals(READER * TIMES, con.getChildNodesCountCalls.get());
- assertEquals(0, conEmpty.getChildNodesCountCalls.get());
- task = new MyTask()
- {
- public void execute() throws Exception
- {
- int result = cwdmEmpty.getChildNodesCount(nodeData);
- assertEquals(0, result);
- }
- };
- multiThreadingTest(task);
- assertEquals(READER * TIMES, conEmpty.getChildNodesCountCalls.get());
- // Add data to the cache
- cwdmEmpty.getChildNodesData(nodeData);
- task = new MyTask()
- {
- public void execute() throws Exception
- {
- int result = cwdmEmpty.getChildNodesCount(nodeData);
- assertEquals(0, result);
- }
- };
- multiThreadingTest(task);
- assertEquals(READER * TIMES, conEmpty.getChildNodesCountCalls.get());
}
private static interface MyTask
{
void execute() throws Exception;
}
-
+
private static class MyWorkspaceStorageCache implements WorkspaceStorageCache
{
@@ -493,21 +365,9 @@
}
- public static class MyWorkspaceStorageConnection implements WorkspaceStorageConnection
+ private static class MyWorkspaceStorageConnection implements WorkspaceStorageConnection
{
- public final boolean emptyResult;
-
- public MyWorkspaceStorageConnection()
- {
- this(false);
- }
-
- public MyWorkspaceStorageConnection(boolean emptyResult)
- {
- this.emptyResult = emptyResult;
- }
-
public void add(NodeData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
@@ -541,7 +401,7 @@
public int getChildNodesCount(NodeData parent) throws RepositoryException
{
getChildNodesCountCalls.incrementAndGet();
- return emptyResult ? 0 : 1;
+ return 1;
}
public AtomicInteger getChildNodesDataCalls = new AtomicInteger();
@@ -549,8 +409,7 @@
public List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException
{
getChildNodesDataCalls.incrementAndGet();
- return emptyResult ? new ArrayList<NodeData>() : Arrays.asList((NodeData)new PersistedNodeData(
- "getChildNodesData", null, null, 0, 1, null, null, null));
+ return Arrays.asList((NodeData)new PersistedNodeData("getChildNodesData", null, null, 0, 1, null, null, null));
}
public AtomicInteger getChildPropertiesDataCalls = new AtomicInteger();
@@ -559,9 +418,10 @@
IllegalStateException
{
getChildPropertiesDataCalls.incrementAndGet();
- return emptyResult ? new ArrayList<PropertyData>() : Arrays.asList((PropertyData)new PersistedPropertyData(
- "getChildPropertiesData", null, null, 0, PropertyType.STRING, false, Arrays
- .asList((ValueData)new ByteArrayPersistedValueData(1, "foo".getBytes()))));
+ return Arrays
+ .asList((PropertyData)new PersistedPropertyData("getChildPropertiesData", null, null, 0,
+ PropertyType.STRING, false, Arrays
+ .asList((ValueData)new ByteArrayPersistedValueData(1, "foo".getBytes()))));
}
public AtomicInteger getItemDataByNodeDataNQPathEntryCalls = new AtomicInteger();
@@ -570,7 +430,7 @@
IllegalStateException
{
getItemDataByNodeDataNQPathEntryCalls.incrementAndGet();
- return emptyResult ? null : new PersistedNodeData("getItemData", null, null, 0, 1, null, null, null);
+ return new PersistedNodeData("getItemData", null, null, 0, 1, null, null, null);
}
public AtomicInteger getItemDataByIdCalls = new AtomicInteger();
@@ -578,8 +438,7 @@
public ItemData getItemData(String identifier) throws RepositoryException, IllegalStateException
{
getItemDataByIdCalls.incrementAndGet();
- return emptyResult && identifier.equals("getItemData") ? null : new PersistedNodeData("getItemData", null,
- null, 0, 1, null, null, null);
+ return new PersistedNodeData("getItemData", null, null, 0, 1, null, null, null);
}
public AtomicInteger getReferencesDataCalls = new AtomicInteger();
@@ -604,9 +463,8 @@
IllegalStateException
{
listChildPropertiesDataCalls.incrementAndGet();
- return emptyResult ? new ArrayList<PropertyData>() : Arrays.asList((PropertyData)new PersistedPropertyData(
- "listChildPropertiesData", null, null, 0, PropertyType.STRING, false, Arrays
- .asList((ValueData)new ByteArrayPersistedValueData(1, "foo".getBytes()))));
+ return Arrays.asList((PropertyData)new PersistedPropertyData("listChildPropertiesData", null, null, 0, PropertyType.STRING,
+ false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(1, "foo".getBytes()))));
}
public void rename(NodeData data) throws RepositoryException, UnsupportedOperationException,
16 years, 3 months