Author: sohil.shah(a)jboss.com
Date: 2007-04-09 22:44:49 -0400 (Mon, 09 Apr 2007)
New Revision: 6964
Added:
trunk/cms/src/main/org/jboss/portal/test/cms/security/
trunk/cms/src/main/org/jboss/portal/test/cms/security/IdentityDataLoader.java
trunk/cms/src/main/org/jboss/portal/test/cms/security/SecureCommandTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/security/TestManageAccess.java
trunk/cms/src/main/org/jboss/portal/test/cms/security/TestReadAccess.java
trunk/cms/src/main/org/jboss/portal/test/cms/security/TestWriteAccess.java
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/AbstractWorkflowTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestApprovedPublish.java
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestDeniedPublish.java
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestWorkflowEnvironment.java
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml
trunk/cms/src/resources/test/db-config.xml
trunk/cms/src/resources/test/domain-identity.hbm.xml
trunk/cms/src/resources/test/jbpm-ehcache.xml
trunk/cms/src/resources/test/jbpm-hibernate.cfg.xml
trunk/cms/src/resources/test/standardidentity-config.xml
Removed:
trunk/cms/src/main/org/jboss/portal/test/cms/commands/SecureCommandTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestSecureFileGet.java
Modified:
trunk/
trunk/cms/
trunk/cms/build.xml
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ApprovalWorkflowInterceptor.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateNewVersionCommand.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetCommand.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetVersionsCommand.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/util/VersionUtil.java
trunk/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java
trunk/cms/src/main/org/jboss/portal/cms/workflow/PublishAssignmentHandler.java
trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java
trunk/cms/src/resources/hibernate/domain.hbm.xml
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml
trunk/cms/src/resources/test/jcr/repository.xml
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/workflow/src/resources/portal-workflow-sar/META-INF/jboss-service.xml
Log:
[JBPORTAL-1185],[JBPORTAL-1184],[JBPORTAL-1333]- CMS Security Tests, CMS Workflow Tests,
CMS ACL Bug fixes
Property changes on: trunk
___________________________________________________________________
Name: svn:ignore
- .project
.classpath
thirdparty
eclipseBin
myworkspace
bin
+ .project
.classpath
thirdparty
eclipseBin
myworkspace
bin
*.settings
miscellaneous
Property changes on: trunk/cms
___________________________________________________________________
Name: svn:ignore
- output
bin
bin
*.log
+ output
bin
bin
*.log
*.sh
Modified: trunk/cms/build.xml
===================================================================
--- trunk/cms/build.xml 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/build.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -382,13 +382,11 @@
</target>
<target name="tests" depends="init">
<execute-tests>
- <x-sysproperty>
-
-<!--
+ <x-sysproperty>
+ <!--
<jvmarg value="-Xdebug"/>
<jvmarg
value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
--->
-
+ -->
</x-sysproperty>
<x-test>
<!-- general cms setup related tests -->
@@ -416,8 +414,14 @@
<test todir="${test.reports}"
name="org.jboss.portal.test.cms.commands.TestFolderGet"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.cms.commands.TestFolderUpdate"/>
- <!-- cms fine grained security related tests -->
- <!--test todir="${test.reports}"
name="org.jboss.portal.test.cms.commands.TestSecureFileGet"/-->
+ <!-- cms fine grained security related tests -->
+ <test todir="${test.reports}"
name="org.jboss.portal.test.cms.security.TestReadAccess"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.cms.security.TestWriteAccess"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.cms.security.TestManageAccess"/>
+
+ <!-- cms workflow related tests -->
+ <test todir="${test.reports}"
name="org.jboss.portal.test.cms.workflow.TestApprovedPublish"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.cms.workflow.TestDeniedPublish"/>
</x-test>
<x-classpath>
<path refid="apache.logging.classpath"/>
@@ -459,7 +463,12 @@
<path refid="jboss.cache.classpath"/>
<path refid="jgroups.jgroups.classpath"/>
<!-- fine grained security integration -->
- <path refid="jboss.portal-identity.classpath"/>
+ <path refid="jboss.portal-identity.classpath"/>
+ <path refid="jboss.portal-security.classpath"/>
+ <!-- workflow integration -->
+ <path refid="jbpm.jaronly.classpath"/>
+ <path refid="beanshell.beanshell.classpath"/>
+ <path refid="jboss.portal-workflow.classpath"/>
</x-classpath>
</execute-tests>
</target>
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
===================================================================
---
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2007-04-09
20:17:48 UTC (rev 6963)
+++
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -60,6 +60,7 @@
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.Role;
import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.jems.as.JNDI;
import org.apache.log4j.Logger;
/**
@@ -87,11 +88,27 @@
*
*/
private String jndiName = null;
+
+ /**
+ *
+ */
+ private JNDI.Binding jndiBinding = null;
/**
*
*/
private AuthorizationManager authorizationManager = null;
+
+ /**
+ *
+ */
+ private String cmsSessionFactory = null;
+
+
+ /**
+ *
+ */
+ private String identitySessionFactory = null;
/**
@@ -157,8 +174,44 @@
{
this.jndiName = jndiName;
}
+
+ /**
+ *
+ * @return
+ */
+ public String getIdentitySessionFactory()
+ {
+ return this.identitySessionFactory;
+ }
+
+ /**
+ *
+ * @param identitySessionFactory
+ */
+ public void setIdentitySessionFactory(String identitySessionFactory)
+ {
+ this.identitySessionFactory = identitySessionFactory;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getCmsSessionFactory()
+ {
+ return cmsSessionFactory;
+ }
/**
+ *
+ * @param cmsSessionFactory
+ */
+ public void setCmsSessionFactory(String cmsSessionFactory)
+ {
+ this.cmsSessionFactory = cmsSessionFactory;
+ }
+
+ /**
*
*/
protected Object invoke(JCRCommand invocation) throws Exception, InvocationException
@@ -179,10 +232,17 @@
PortalPermission cmsPermission = new CMSPermission(securityContext);
Session session = Tools.getOpenSession();
Transaction tx = session.beginTransaction();
- boolean allowAccess = this.authorizationManager.checkPermission(cmsPermission);
- tx.commit();
- Tools.closeSession(session);
-
+ boolean allowAccess = false;
+ try
+ {
+ allowAccess = this.authorizationManager.checkPermission(cmsPermission);
+ }
+ finally
+ {
+ tx.commit();
+ Tools.closeSession(session);
+ }
+
if (allowAccess)
{
Object response = invocation.invokeNext();
@@ -218,37 +278,41 @@
Object filteredResponse = response;
JCRCommand command =
(JCRCommand)securityContext.getAttribute("command");
-
+ boolean success = true;
try
{
-
-
if (filteredResponse instanceof Folder)
{
Folder folder = (Folder)filteredResponse;
List filteredFolders = new ArrayList();
List filteredFiles = new ArrayList();
securityContext.removeAttribute("command");
- for (Iterator itr = folder.getFolders().iterator(); itr.hasNext();)
+ if(folder.getFolders()!=null)
{
- Folder cour = (Folder)itr.next();
- securityContext.setAttribute("applyFilter",
cour.getBasePath());
- PortalPermission cmsPermission = new CMSPermission(securityContext);
- boolean allow = this.authorizationManager.checkPermission(cmsPermission);
- if (allow)
+ for (Iterator itr = folder.getFolders().iterator(); itr.hasNext();)
{
- filteredFolders.add(cour);
+ Folder cour = (Folder)itr.next();
+ securityContext.setAttribute("applyFilter",
cour.getBasePath());
+ PortalPermission cmsPermission = new CMSPermission(securityContext);
+ boolean allow =
this.authorizationManager.checkPermission(cmsPermission);
+ if (allow)
+ {
+ filteredFolders.add(cour);
+ }
}
}
- for (Iterator itr = folder.getFiles().iterator(); itr.hasNext();)
+ if(folder.getFiles()!=null)
{
- File cour = (File)itr.next();
- securityContext.setAttribute("applyFilter",
cour.getBasePath());
- PortalPermission cmsPermission = new CMSPermission(securityContext);
- boolean allow = this.authorizationManager.checkPermission(cmsPermission);
- if (allow)
+ for (Iterator itr = folder.getFiles().iterator(); itr.hasNext();)
{
- filteredFiles.add(cour);
+ File cour = (File)itr.next();
+ securityContext.setAttribute("applyFilter",
cour.getBasePath());
+ PortalPermission cmsPermission = new CMSPermission(securityContext);
+ boolean allow =
this.authorizationManager.checkPermission(cmsPermission);
+ if (allow)
+ {
+ filteredFiles.add(cour);
+ }
}
}
folder.setFolders(filteredFolders);
@@ -274,11 +338,19 @@
}
catch (Exception e)
{
- tx.rollback();
+ success = false;
+ throw new RuntimeException(e);
}
finally
{
- tx.commit();
+ if(success)
+ {
+ tx.commit();
+ }
+ else
+ {
+ tx.rollback();
+ }
Tools.closeSession(session);
}
@@ -291,8 +363,14 @@
public void start() throws Exception
{
log.info("AuthorizationManager initialized=" +
this.authorizationManager);
+
+ if(this.jndiName != null)
+ {
+ this.jndiBinding = new JNDI.Binding(jndiName, this);
+ this.jndiBinding.bind();
+ }
- Tools.init(this.jndiName);
+ Tools.init(this.cmsSessionFactory);
try
{
@@ -369,6 +447,20 @@
}
}
}
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void stop() throws Exception
+ {
+ if(this.jndiBinding != null)
+ {
+ this.jndiBinding.unbind();
+ this.jndiBinding = null;
+ }
+ Tools.destroy();
+ }
/**
* Parses and produces Permission objects for the default policy
@@ -423,7 +515,7 @@
//since this is at app start up and not on user thread...need to create a
transaction context.
InitialContext context = new InitialContext();
- SessionFactory sessionFactory =
(SessionFactory)context.lookup("java:/portal/IdentitySessionFactory");
+ SessionFactory sessionFactory =
(SessionFactory)context.lookup(this.identitySessionFactory);
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
try
Modified:
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ApprovalWorkflowInterceptor.java
===================================================================
---
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ApprovalWorkflowInterceptor.java 2007-04-09
20:17:48 UTC (rev 6963)
+++
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ApprovalWorkflowInterceptor.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -35,6 +35,7 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.identity.User;
+import org.jboss.portal.jems.as.JNDI;
import org.jboss.portal.workflow.cms.ApprovePublish;
import org.jboss.portal.workflow.cms.Content;
@@ -48,6 +49,34 @@
*/
public class ApprovalWorkflowInterceptor extends CMSInterceptor
{
+ /**
+ *
+ */
+ private String jndiName = null;
+
+ /**
+ *
+ */
+ private JNDI.Binding jndiBinding = null;
+
+ /**
+ *
+ * @return
+ */
+ public String getJNDIName()
+ {
+ return this.jndiName;
+ }
+
+ /**
+ *
+ * @param jndiName
+ */
+ public void setJNDIName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
/**
*
*/
@@ -92,4 +121,30 @@
return returnVal;
}
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void start() throws Exception
+ {
+ if(this.jndiName != null)
+ {
+ this.jndiBinding = new JNDI.Binding(jndiName, this);
+ this.jndiBinding.bind();
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void stop() throws Exception
+ {
+ if(this.jndiBinding != null)
+ {
+ this.jndiBinding.unbind();
+ this.jndiBinding = null;
+ }
+ }
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java 2007-04-09
20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -85,7 +85,6 @@
writeCommands.add(packageName+"FolderCreateCommand");
writeCommands.add(packageName+"FileUpdateCommand");
writeCommands.add(packageName+"StoreArchiveCommand");
- writeCommands.add(packageName+"ContentCreateNewVersionCommand");
writeCommands.add("org.jboss.portal.cms.impl.jcr.composite.NewFileCommand");
writeCommands.add("org.jboss.portal.cms.impl.jcr.composite.UpdateFileCommand");
@@ -94,7 +93,6 @@
manageCommands.add(packageName+"CopyCommand");
manageCommands.add(packageName+"DeleteCommand");
manageCommands.add(packageName+"MoveCommand");
- manageCommands.add(packageName+"RenameCommand");
}
@@ -295,11 +293,7 @@
else if(command instanceof MoveCommand)
{
path = ((MoveCommand)command).msFromPath;
- }
- else if(command instanceof RenameCommand)
- {
- path = ((RenameCommand)command).msPath;
- }
+ }
hasManageAccess = this.computeAccess(user,path,"manage");
Modified:
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateNewVersionCommand.java
===================================================================
---
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateNewVersionCommand.java 2007-04-09
20:17:48 UTC (rev 6963)
+++
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateNewVersionCommand.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -36,7 +36,7 @@
/**
* Creates a new version of the content and labels it "LIVE".
- *
+ *
* @author <a href="mailto:roy@jboss.org">Roy Russo</a>
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @author Sohil Shah - sohil.shah(a)jboss.com
@@ -46,12 +46,15 @@
/** The serialVersionUID */
private static final long serialVersionUID = -4055346144913229565L;
+
List mContents = new ArrayList();
+
boolean bMakeLive;
/**
* @param content
- * @param bMakeLive Whether this updated version should be made "LIVE"
+ * @param bMakeLive
+ * Whether this updated version should be made "LIVE"
*/
public ContentCreateNewVersionCommand(Content content, boolean bMakeLive)
{
@@ -72,57 +75,60 @@
{
try
{
- Scope scope = this.context.scope;
-
+ Scope scope = this.context.scope;
+
// create versions
for (int i = 0; i < mContents.size(); i++)
{
- Content content = (Content)mContents.get(i);
- Node contentNode =
(Node)context.getSession().getItem(content.getBasePath());
-
- //if the creator of this content is known, record it
- User user = (User)this.context.getAttribute(scope,"user");
- if(user != null)
+ Content content = (Content) mContents.get(i);
+ Node contentNode = (Node) context.getSession().getItem(
+ content.getBasePath());
+
+ // if the creator of this content is known, record it
+ User user = (User) this.context.getAttribute(scope, "user");
+ if (user != null)
{
- contentNode.setProperty("portalcms:user", user.getUserName());
+ contentNode.setProperty("portalcms:user", user.getUserName());
}
-
- contentNode.setProperty("portalcms:size", new
StringValue(String.valueOf(content.getBytes().length)));
+
+ contentNode.setProperty("portalcms:size", new StringValue(String
+ .valueOf(content.getBytes().length)));
context.getSession().save();
-
- String processId = (String)context.getAttribute(scope,
"processid");
-
- //integration of publish/approval workflow
- if(this.bMakeLive && processId != null &&
processId.trim().length() != 0)
- {
- //now save workflow related meta data on this version
- //so that this version can be processed later in the execution
- //of the workflow
- contentNode.setProperty("portalcms:processid",processId);
-
- //save
- context.getSession().save();
-
- //create a new version, but dont make it live
- VersionUtil.createVersion(contentNode,false);
+
+ String processId = (String) context
+ .getAttribute(scope, "processid");
+
+ // integration of publish/approval workflow
+ if (this.bMakeLive && processId != null
+ && processId.trim().length() != 0)
+ {
+ // now save workflow related meta data on this version
+ // so that this version can be processed later in the execution
+ // of the workflow
+ contentNode.setProperty("portalcms:processid", processId);
+
+ // save
+ context.getSession().save();
+
+ // create a new version, but dont make it live
+ VersionUtil.createVersion(contentNode, false);
}
else
{
- //remove any processid if they are present on the node
- contentNode.setProperty("portalcms:processid",(String)null);
- contentNode.save();
-
- //not asking to publish the content...no workflow needed
- //even if its activated
- VersionUtil.createVersion(contentNode, this.bMakeLive);
+ // remove any processid if they are present on the node
+ contentNode.setProperty("portalcms:processid", (String) null);
+ contentNode.save();
+
+ // not asking to publish the content...no workflow needed
+ // even if its activated
+ VersionUtil.createVersion(contentNode, this.bMakeLive);
}
}
-
-
+
context.getSession().save();
}
catch (Exception e)
- {
+ {
e.printStackTrace();
throw new RuntimeException(e);
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetCommand.java
===================================================================
---
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetCommand.java 2007-04-09
20:17:48 UTC (rev 6963)
+++
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetCommand.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -27,6 +27,7 @@
import org.jboss.portal.cms.model.Content;
import org.jboss.portal.cms.util.FileUtil;
import org.jboss.logging.Logger;
+import org.jboss.portal.cms.impl.jcr.util.VersionUtil;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
@@ -106,7 +107,13 @@
{
contentNode = (Node)session.getItem(content.getBasePath());
VersionHistory vh = contentNode.getVersionHistory();
- Version version = vh.getVersionByLabel("LIVE");
+ Version version = VersionUtil.getLiveVersion(vh);
+
+ if(version == null)
+ {
+ return null;
+ }
+
NodeIterator ni = version.getNodes();
contentNode = ni.nextNode();
content.setCreationDate(version.getCreated().getTime());
@@ -118,7 +125,7 @@
else // get version #(?)
{
VersionHistory vh = contentNode.getVersionHistory();
- Version liveVersion = vh.getVersionByLabel("LIVE");
+ Version liveVersion = VersionUtil.getLiveVersion(vh);
VersionIterator vi = vh.getAllVersions();
while (vi.hasNext())
@@ -132,7 +139,7 @@
content.setVersionNumber(version.getName());
content.setVersionPath(version.getPath());
content.setVersionUUID(version.getUUID());
- if (liveVersion.getName().equals(version.getName())) // check if this
version is the live one.
+ if(liveVersion != null &&
liveVersion.getName().equals(version.getName())) // check if this version is the live
one.
{
content.setLive(true);
}
Modified:
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetVersionsCommand.java
===================================================================
---
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetVersionsCommand.java 2007-04-09
20:17:48 UTC (rev 6963)
+++
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetVersionsCommand.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -25,6 +25,7 @@
import org.jboss.portal.cms.impl.ContentImpl;
import org.jboss.portal.cms.impl.jcr.JCRCommand;
import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.impl.jcr.util.VersionUtil;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
@@ -64,7 +65,10 @@
Node fileNode = (Node)session.getItem(this.msFilePath);
VersionHistory vh = fileNode.getVersionHistory();
- Version liveVersion = vh.getVersionByLabel("LIVE");
+
+ Version liveVersion = VersionUtil.getLiveVersion(vh);
+
+
Version rootVersion = vh.getRootVersion();
@@ -104,7 +108,7 @@
content.setCreationDate(version.getCreated().getTime());
content.setVersionNumber(version.getName());
- if (liveVersion.getName().equals(version.getName())) // check if this
version is the live one.
+ if (liveVersion != null &&
liveVersion.getName().equals(version.getName())) // check if this version is the live
one.
{
content.setLive(true);
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/util/VersionUtil.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/util/VersionUtil.java 2007-04-09
20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/util/VersionUtil.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -216,4 +216,25 @@
e.printStackTrace();
}
}
+
+ /**
+ *
+ * @param history
+ * @return
+ */
+ public static Version getLiveVersion(VersionHistory history)
+ {
+ Version liveVersion = null;
+
+ try
+ {
+ liveVersion = history.getVersionByLabel("LIVE");
+ }
+ catch(Exception e)
+ {
+ liveVersion = null;
+ }
+
+ return liveVersion;
+ }
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java 2007-04-09
20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -51,22 +51,8 @@
/**
*
*/
- private static Logger log = Logger.getLogger(FinalizePublish.class);
- private static CMS cms = null;
+ private static Logger log = Logger.getLogger(FinalizePublish.class);
- static
- {
- try
- {
- cms = (CMS)new InitialContext().lookup("java:portal/CMS");
- }
- catch (NamingException e)
- {
- log.error("Cannot obtain CMS from JNDI: ", e);
- cms = null;
- }
- }
-
/**
*
*/
@@ -75,6 +61,7 @@
Content content =
(Content)executionContext.getContextInstance().getVariable("content");
boolean approved =
((Boolean)executionContext.getContextInstance().getVariable("approved")).booleanValue();
long processId = executionContext.getProcessInstance().getId();
+ CMS cms = this.getCMSService();
if(approved)
{
@@ -144,4 +131,20 @@
return content;
}
+
+ /**
+ *
+ * @return
+ */
+ private CMS getCMSService()
+ {
+ try
+ {
+ return (CMS)new InitialContext().lookup("java:/portal/CMS");
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/workflow/PublishAssignmentHandler.java
===================================================================
---
trunk/cms/src/main/org/jboss/portal/cms/workflow/PublishAssignmentHandler.java 2007-04-09
20:17:48 UTC (rev 6963)
+++
trunk/cms/src/main/org/jboss/portal/cms/workflow/PublishAssignmentHandler.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -60,38 +60,6 @@
{
private static Logger log = Logger.getLogger(PublishAssignmentHandler.class);
- /*private static MailModule mailModule = null;
-
- private static IdentityServiceController identityServiceController = null;
- private static MembershipModule membershipModule = null;
- private static UserModule userModule = null;
- private static RoleModule roleModule = null;
- private static UserProfileModule profileModule = null;
- static
- {
- try
- {
- InitialContext context = new InitialContext();
- mailModule = (MailModule)context.lookup("java:portal/MailModule");
-
- identityServiceController = (IdentityServiceController)context.
- lookup("java:/portal/IdentityServiceController");
- membershipModule =
(MembershipModule)identityServiceController.getIdentityContext().
- getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE);
- userModule = (UserModule)identityServiceController.getIdentityContext().
- getObject(IdentityContext.TYPE_USER_MODULE);
- roleModule = (RoleModule)identityServiceController.getIdentityContext().
- getObject(IdentityContext.TYPE_ROLE_MODULE);
- profileModule = (UserProfileModule)identityServiceController.getIdentityContext().
- getObject(IdentityContext.TYPE_USER_PROFILE_MODULE);
- }
- catch(Exception e)
- {
- //mailModule = null;
- throw new RuntimeException(e);
- }
- }*/
-
/**
*
*/
@@ -121,58 +89,5 @@
}
}
}
- }
-
- //Now that the Manager Approval/Denial GUI is integrated..no need to use the email
- //as the Manager screen
- /**
- *
- * @param email
- */
- /*private void notifyManagers(ExecutionContext executionContext,String managerRole)
- {
- try
- {
- Set users = membershipModule.getUsers(roleModule.findRoleByName(managerRole));
- if(users != null)
- {
- for(Iterator itr=users.iterator();itr.hasNext();)
- {
- User user = (User)itr.next();
- String email = (String)profileModule.getProperty(user, User.INFO_USER_EMAIL_REAL);
- long processId = executionContext.getProcessInstance().getId();
- String from =
(String)executionContext.getContextInstance().getVariable("from");
- String to = email;
- String subject =
(String)executionContext.getContextInstance().getVariable("subject");
- String body =
(String)executionContext.getContextInstance().getVariable("body");
- Content content =
(Content)executionContext.getContextInstance().getVariable("content");
-
- Object[] arguments =
- {
- content.getPath(),
- content.getMimeType(),
- content.getSizeStr(),
- content.getCreationDateStr(),
- content.getUserName(),
- String.valueOf(processId),
- URLEncoder.encode(email, "UTF-8"),
- String.valueOf(processId),
- URLEncoder.encode(email, "UTF-8")
- };
- body = MessageFormat.format(body, arguments);
-
- System.out.println("----------------------------------------");
- System.out.println("Notification being sent to----->"+to);
- System.out.println("----------------------------------------");
-
- //mailModule.send(from,to,subject,body);
- }
- }
- }
- catch(Exception e)
- {
- //eat it for now
- log.error(this, e);
- }
- }*/
+ }
}
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2007-04-09
20:17:48 UTC (rev 6963)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -47,6 +47,12 @@
/** . */
protected TestRuntimeContext runtimeContext;
+
+ /**
+ *
+ *
+ */
+ protected String configuration = "org/jboss/portal/cms/jboss-beans.xml";
public AbstractCMSTestCase()
{
@@ -64,10 +70,12 @@
public void setUp() throws Exception
{
- runtimeContext = new
TestRuntimeContext("org/jboss/portal/cms/jboss-beans.xml");
- runtimeContext.addBean("TestBean", this);
+ //Bootstrapping low-level services needed by PortalCMS
+ runtimeContext = new TestRuntimeContext(this.configuration);
runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
runtimeContext.addBean("HibernateConfig",
HibernateSupport.getConfig(dataSourceConfigParameter.getName()));
+
+ //Start the context
runtimeContext.start();
}
Modified:
trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java
===================================================================
---
trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java 2007-04-09
20:17:48 UTC (rev 6963)
+++
trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -36,12 +36,12 @@
*
* @author <a href="mailto:sohil.shah@jboss.com">Sohil Shah</a>
*/
-public class AbstractCommandTestCase extends AbstractCMSTestCase
+public abstract class AbstractCommandTestCase extends AbstractCMSTestCase
{
/**
*
*/
- protected JCRCMS service;
+ protected JCRCMS service = null;
public AbstractCommandTestCase()
{
@@ -65,6 +65,7 @@
service.setConfig(config.getDocumentElement());
service.setRepositoryName("repo");
service.setHomeDir("repotest-" + dataSourceConfigParameter.getName());
+ service.setJNDIName("java:portal/CMS");
service.startService();
}
Deleted: trunk/cms/src/main/org/jboss/portal/test/cms/commands/SecureCommandTestCase.java
===================================================================
---
trunk/cms/src/main/org/jboss/portal/test/cms/commands/SecureCommandTestCase.java 2007-04-09
20:17:48 UTC (rev 6963)
+++
trunk/cms/src/main/org/jboss/portal/test/cms/commands/SecureCommandTestCase.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -1,61 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* 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.jboss.portal.test.cms.commands;
-
-import org.jboss.portal.cms.impl.interceptors.ACLInterceptor;
-import org.jboss.portal.common.invocation.Interceptor;
-import org.jboss.portal.server.impl.invocation.JBossInterceptorStack;
-
-/**
- *
- * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
- *
- */
-public class SecureCommandTestCase extends AbstractCommandTestCase
-{
- /**
- *
- *
- */
- public SecureCommandTestCase()
- {
- super();
- }
-
- /**
- *
- */
- public void setUp() throws Exception
- {
- super.setUp();
-
- //setup the interceptor stack
- CMSInterceptorStackFactory stackFactory = new CMSInterceptorStackFactory();
- ACLInterceptor aclInterceptor = new ACLInterceptor();
- Interceptor[] interceptors = new Interceptor[1];
- interceptors[0] = aclInterceptor;
- JBossInterceptorStack stack = new JBossInterceptorStack(interceptors);
- stackFactory.setInterceptorStack(stack);
-
- service.setStackFactory(stackFactory);
- }
-}
Deleted: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestSecureFileGet.java
===================================================================
---
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestSecureFileGet.java 2007-04-09
20:17:48 UTC (rev 6963)
+++
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestSecureFileGet.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -1,104 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * 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.jboss.portal.test.cms.commands;
-
-import junit.framework.TestSuite;
-import org.jboss.portal.cms.CMSException;
-import org.jboss.portal.cms.Command;
-import org.jboss.portal.cms.impl.ContentImpl;
-import org.jboss.portal.cms.impl.FileImpl;
-import org.jboss.portal.cms.model.Content;
-import org.jboss.portal.cms.model.File;
-
-import java.util.Locale;
-import java.util.Map;
-
-
-/**
- *
- * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
- *
- */
-public class TestSecureFileGet extends SecureCommandTestCase
-{
- String rejectPath = "/default/private/license.html";
- String allowedPath = "/default/images/check.gif";
-
-
- /**
- *
- *
- */
- public TestSecureFileGet()
- {
- }
-
- /**
- *
- *
- */
- public static TestSuite suite() throws Exception
- {
- return createTestSuite(TestSecureFileGet.class);
- }
-
- /** Tests retrieval of the version labeled LIVE. */
- public void testFileGet() throws CMSException
- {
- //first run against non-access scenario
- try
- {
- Command getCMD =
service.getCommandFactory().createFileGetCommand(rejectPath,Locale.ENGLISH);
- File newfile = (File)service.execute(getCMD);
- }
- catch(CMSException cme)
- {
- //assert and make sure access was not granted
- String cmeMessage = cme.toString();
- boolean accessGranted = true;
- if(cmeMessage.indexOf("Access to this resource is denied")!=-1)
- {
- accessGranted = false;
- }
- this.assertEquals(false,accessGranted);
- }
-
- //now run against scenario where access should be granted
- try
- {
- Command getCMD =
service.getCommandFactory().createFileGetCommand(allowedPath,Locale.ENGLISH);
- File newfile = (File)service.execute(getCMD);
- }
- catch(CMSException cme)
- {
- //assert and make sure access was granted
- String cmeMessage = cme.toString();
- boolean accessGranted = true;
- if(cmeMessage.indexOf("Access to this resource is denied")!=-1)
- {
- accessGranted = false;
- }
- this.assertEquals(true,accessGranted);
- }
- }
-}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/security/IdentityDataLoader.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/security/IdentityDataLoader.java
(rev 0)
+++
trunk/cms/src/main/org/jboss/portal/test/cms/security/IdentityDataLoader.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -0,0 +1,178 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * 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.jboss.portal.test.cms.security;
+
+import javax.naming.InitialContext;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityServiceController;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.db.HibernateRoleImpl;
+import org.jboss.portal.identity.db.HibernateUserImpl;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class IdentityDataLoader
+{
+ /**
+ *
+ */
+ private IdentityServiceController identityServiceController = null;
+
+ /**
+ *
+ */
+ private String identitySessionFactory = null;
+
+ /**
+ *
+ * @return
+ */
+ public IdentityServiceController getIdentityServiceController()
+ {
+ return this.identityServiceController;
+ }
+
+ public void setIdentityServiceController(IdentityServiceController
identityServiceController)
+ {
+ this.identityServiceController = identityServiceController;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getIdentitySessionFactory()
+ {
+ return identitySessionFactory;
+ }
+
+ /**
+ *
+ * @param identitySessionFactory
+ */
+ public void setIdentitySessionFactory(String identitySessionFactory)
+ {
+ this.identitySessionFactory = identitySessionFactory;
+ }
+
+ /**
+ *
+ *
+ */
+ public IdentityDataLoader()
+ {
+
+ }
+
+ /**
+ *
+ *
+ */
+ public void start() throws Exception
+ {
+ SessionFactory sessionFactory = (SessionFactory)new
InitialContext().lookup(this.identitySessionFactory);
+ this.loadData(sessionFactory,this.identityServiceController);
+ }
+
+ /**
+ *
+ */
+ public void stop() throws Exception
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ private void loadData(SessionFactory sessionFactory,IdentityServiceController service)
throws Exception
+ {
+ UserModule userModule =
(UserModule)service.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+
+ Session session = sessionFactory.openSession();
+ Transaction tx = session.beginTransaction();
+ boolean success = false;
+ try
+ {
+ if(userModule.getUserCount()==0)
+ {
+ //
+ HibernateRoleImpl adminRole = new HibernateRoleImpl("Admin",
"Administrators");
+ HibernateRoleImpl userRole = new HibernateRoleImpl("User",
"Users");
+
+ //
+ HibernateUserImpl admin = new HibernateUserImpl("admin");
+
admin.setPassword(org.jboss.portal.common.util.Tools.md5AsHexString("admin"));
+ admin.setRealEmail("admin(a)portal.com");
+ admin.setViewRealEmail(true);
+ admin.setEnabled(true);
+
+ //
+ admin.getRoles().add(adminRole);
+ adminRole.getUsers().add(admin);
+
+ //
+ HibernateUserImpl user = new HibernateUserImpl("user");
+
user.setPassword(org.jboss.portal.common.util.Tools.md5AsHexString("user"));
+ user.setRealEmail("user(a)portal.com");
+ user.setViewRealEmail(true);
+ user.setEnabled(true);
+
+ //
+ user.getRoles().add(userRole);
+ userRole.getUsers().add(user);
+
+ //
+ session.save(adminRole);
+ session.save(userRole);
+ session.save(admin);
+ session.save(user);
+
+ success = true;
+ }
+ }
+ finally
+ {
+ if(tx != null)
+ {
+ if(success)
+ {
+ tx.commit();
+ }
+ else
+ {
+ tx.rollback();
+ }
+ }
+ if(session != null)
+ {
+ session.close();
+ }
+ }
+ }
+}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/security/SecureCommandTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/security/SecureCommandTestCase.java
(rev 0)
+++
trunk/cms/src/main/org/jboss/portal/test/cms/security/SecureCommandTestCase.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.jboss.portal.test.cms.security;
+
+import javax.naming.InitialContext;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.jboss.portal.cms.impl.interceptors.ACLInterceptor;
+import org.jboss.portal.cms.impl.jcr.JCRCMS;
+import org.jboss.portal.cms.security.AuthorizationProviderImpl;
+import org.jboss.portal.common.invocation.Interceptor;
+import org.jboss.portal.identity.IdentityServiceController;
+import org.jboss.portal.server.impl.invocation.JBossInterceptorStack;
+
+import org.jboss.portal.test.cms.commands.AbstractCommandTestCase;
+import org.jboss.portal.test.cms.commands.CMSInterceptorStackFactory;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public abstract class SecureCommandTestCase extends AbstractCommandTestCase
+{
+ /**
+ *
+ */
+ public SecureCommandTestCase()
+ {
+ super();
+ }
+
+ /**
+ *
+ */
+ public void setUp() throws Exception
+ {
+ //override the configration location to include workflow services
+ this.configuration = "org/jboss/portal/cms/jboss-beans-security.xml";
+ super.setUp();
+
+ ACLInterceptor aclInterceptor = this.getACLInterceptor();
+
+ //Setup the interceptor stack
+ CMSInterceptorStackFactory stackFactory = new CMSInterceptorStackFactory();
+ Interceptor[] interceptors = new Interceptor[1];
+ interceptors[0] = aclInterceptor;
+ JBossInterceptorStack stack = new JBossInterceptorStack(interceptors);
+ stackFactory.setInterceptorStack(stack);
+
+ this.service.setStackFactory(stackFactory);
+
+ //Register the IdentityService with the JCR service
+ IdentityServiceController identityService =
((AuthorizationProviderImpl)aclInterceptor.getAuthorizationManager().getProvider()).
+ getIdentityServiceController();
+ this.service.setIdentityServiceController(identityService);
+ }
+
+ /**
+ *
+ */
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ protected ACLInterceptor getACLInterceptor() throws Exception
+ {
+ ACLInterceptor aclInterceptor = (ACLInterceptor)new
InitialContext().lookup("java:/portal/cms/ACLInterceptor");
+ return aclInterceptor;
+ }
+
+ /**
+ *
+ * @param username
+ */
+ protected void runAs(String username) throws Exception
+ {
+ SessionFactory sessionFactory = (SessionFactory)new
InitialContext().lookup("java:/SessionFactory");
+ Session session = sessionFactory.openSession();
+ Transaction tx = session.beginTransaction();
+
JCRCMS.getUserInfo().set(this.service.getUserModule().findUserByUserName(username));
+ tx.commit();
+ session.close();
+ }
+}
\ No newline at end of file
Added: trunk/cms/src/main/org/jboss/portal/test/cms/security/TestManageAccess.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/security/TestManageAccess.java
(rev 0)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/security/TestManageAccess.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -0,0 +1,249 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * 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.jboss.portal.test.cms.security;
+
+import junit.framework.TestSuite;
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.cms.impl.FolderImpl;
+
+
+import java.util.Date;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public class TestManageAccess extends SecureCommandTestCase
+{
+ String rejectPath = "/default/private";
+ String allowedPath = "/default/images";
+
+ /**
+ *
+ *
+ */
+ public TestManageAccess()
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestManageAccess.class);
+ }
+
+ /**
+ *
+ * @return
+ */
+ private Folder getNewPublicFolder()
+ {
+ //create folder object
+ Folder folder = new FolderImpl();
+ folder.setCreationDate(new Date());
+ folder.setDescription("Folder Description");
+ folder.setTitle("Folder Title");
+ folder.setLastModified(new Date());
+ folder.setName("images");
+ folder.setBasePath(this.allowedPath);
+
+ return folder;
+ }
+
+ /**
+ *
+ * @return
+ */
+ private Folder getNewProtectedFolder()
+ {
+ //create folder object
+ Folder folder = new FolderImpl();
+ folder.setCreationDate(new Date());
+ folder.setDescription("Folder Description");
+ folder.setTitle("Folder Title");
+ folder.setLastModified(new Date());
+ folder.setName("private");
+ folder.setBasePath(this.rejectPath);
+
+ return folder;
+ }
+
+
+ /**
+ *
+ *
+ */
+ private void runManageScenario(Folder folder) throws CMSException
+ {
+ //Copy the specified folder
+ String copySrc = folder.getBasePath();
+ String copyDest = folder.getBasePath() + "/" + "copy";
+ Command copyCommand =
this.service.getCommandFactory().createCopyCommand(copySrc,copyDest);
+ this.service.execute(copyCommand);
+
+ //Assert the copy execution
+ Command get = this.service.getCommandFactory().createFolderGetCommand(copySrc);
+ Folder copyFrom = (Folder)this.service.execute(get);
+ get = this.service.getCommandFactory().createFolderGetCommand(copyDest);
+ Folder copyTo = (Folder)this.service.execute(get);
+ assertNotNull(copyFrom);
+ assertNotNull(copyTo);
+
+ //Move a folder
+ String moveSrc = copyDest;
+ String moveDest = folder.getBasePath() + "/" + "move";
+ Command moveCommand =
this.service.getCommandFactory().createMoveCommand(moveSrc,moveDest);
+ this.service.execute(moveCommand);
+
+ //Assert the move execution
+ get = this.service.getCommandFactory().createFolderGetCommand(moveSrc);
+ Folder moveFrom = (Folder)this.service.execute(get);
+ get = this.service.getCommandFactory().createFolderGetCommand(moveDest);
+ Folder moveTo = (Folder)this.service.execute(get);
+ assertNull(moveFrom);
+ assertNotNull(moveTo);
+
+ //Delete the folder
+ String delete = moveDest;
+ Command deleteCommand =
this.service.getCommandFactory().createDeleteCommand(delete);
+ this.service.execute(deleteCommand);
+
+ //Assert delete execution
+ get = this.service.getCommandFactory().createFolderGetCommand(delete);
+ Folder deletedFolder = (Folder)this.service.execute(get);
+ assertNull(deletedFolder);
+ }
+
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testAnonymous() throws Exception
+ {
+ // first run against non-access scenario
+ try
+ {
+ this.runManageScenario(this.getNewProtectedFolder());
+ assertTrue("Access should not have been granted to" +
this.rejectPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") !=
-1);
+ }
+
+ // now run against scenario where access should be granted for a registered user
+ //for anonymous, this should still result in an access denied
+ try
+ {
+ this.runManageScenario(this.getNewPublicFolder());
+ assertTrue("Access should not have been granted to" + this.rejectPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") !=
-1);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testUser() throws Exception
+ {
+ this.runAs("user");
+
+ // first run against non-access scenario
+ try
+ {
+ this.runManageScenario(this.getNewProtectedFolder());
+ assertTrue("Access should not have been granted to" +
this.rejectPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") !=
-1);
+ }
+
+ // now run against scenario where access should be granted for a registered user
+ //for anonymous, this should still result in an access denied
+ try
+ {
+ this.runManageScenario(this.getNewPublicFolder());
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") !=
-1);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testAdmin() throws Exception
+ {
+ this.runAs("admin");
+
+ // first run against non-access scenario
+ try
+ {
+ this.runManageScenario(this.getNewProtectedFolder());
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") ==
-1);
+ }
+
+ // now run against scenario where access should be granted for a registered user
+ //for anonymous, this should still result in an access denied
+ try
+ {
+ this.runManageScenario(this.getNewPublicFolder());
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") ==
-1);
+ }
+ }
+}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/security/TestReadAccess.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/security/TestReadAccess.java
(rev 0)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/security/TestReadAccess.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -0,0 +1,269 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * 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.jboss.portal.test.cms.security;
+
+import java.util.List;
+import junit.framework.TestSuite;
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.cms.model.File;
+
+import java.util.Locale;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public class TestReadAccess extends SecureCommandTestCase
+{
+ String rejectFolderPath = "/default/private";
+ String allowedFolderPath = "/default/images";
+ String rejectFilePath = "/default/private/license.html";
+ String allowedFilePath = "/default/images/check.gif";
+
+ /**
+ *
+ *
+ */
+ public TestReadAccess()
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestReadAccess.class);
+ }
+
+
+ /**
+ *
+ *
+ */
+ private void runFileScenario(String filePath) throws CMSException
+ {
+ //Get the specified file
+ Command get = this.service.getCommandFactory().createFileGetCommand(filePath,new
Locale(this.service.getDefaultLocale()));
+ File file = (File)this.service.execute(get);
+ assertNotNull(file);
+ assertEquals(file.getBasePath(),filePath);
+
+ //Get a list of file versions
+ get = this.service.getCommandFactory()
+ .createFileGetListCommand(filePath);
+ List versions = (List)this.service.execute(get);
+ assertNotNull(versions);
+ assertTrue(versions.size()>0);
+ }
+
+ /**
+ *
+ * @param folderPath
+ * @throws CMSException
+ */
+ private void runFolderScenario(String folderPath) throws CMSException
+ {
+ //Get the specified folder
+ Command get = this.service.getCommandFactory().createFolderGetCommand(folderPath);
+ Folder folder = (Folder)this.service.execute(get);
+ assertNotNull(folder);
+ assertEquals(folder.getBasePath(),folderPath);
+
+ //Get the specified folder list
+ get = this.service.getCommandFactory().createFolderGetListCommand(folderPath);
+ Folder folderList = (Folder)this.service.execute(get);
+ assertNotNull(folderList);
+ assertTrue(folderList.getFolders()!=null || folderList.getFiles()!=null);
+ }
+
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testAnonymous() throws Exception
+ {
+ try
+ {
+ this.runFileScenario(this.rejectFilePath);
+ assertTrue("Access should not have been granted to" +
this.rejectFilePath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") !=
-1);
+ }
+
+ try
+ {
+ this.runFolderScenario(this.rejectFolderPath);
+ assertTrue("Access should not have been granted to" +
this.rejectFolderPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") !=
-1);
+ }
+
+ try
+ {
+ this.runFileScenario(this.allowedFilePath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") ==
-1);
+ }
+
+ try
+ {
+ this.runFolderScenario(this.allowedFolderPath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") ==
-1);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testUser() throws Exception
+ {
+ this.runAs("user");
+
+ try
+ {
+ this.runFileScenario(this.rejectFilePath);
+ assertTrue("Access should not have been granted to" +
this.rejectFilePath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") !=
-1);
+ }
+
+ try
+ {
+ this.runFolderScenario(this.rejectFolderPath);
+ assertTrue("Access should not have been granted to" +
this.rejectFolderPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") !=
-1);
+ }
+
+ try
+ {
+ this.runFileScenario(this.allowedFilePath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") ==
-1);
+ }
+
+ try
+ {
+ this.runFolderScenario(this.allowedFolderPath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") ==
-1);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testAdmin() throws Exception
+ {
+ this.runAs("admin");
+
+ try
+ {
+ this.runFileScenario(this.rejectFilePath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") ==
-1);
+ }
+
+ try
+ {
+ this.runFolderScenario(this.rejectFolderPath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") ==
-1);
+ }
+
+ try
+ {
+ this.runFileScenario(this.allowedFilePath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") ==
-1);
+ }
+
+ try
+ {
+ this.runFolderScenario(this.allowedFolderPath);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") ==
-1);
+ }
+ }
+}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/security/TestWriteAccess.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/security/TestWriteAccess.java
(rev 0)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/security/TestWriteAccess.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -0,0 +1,297 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * 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.jboss.portal.test.cms.security;
+
+import java.util.List;
+import junit.framework.TestSuite;
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.cms.impl.FolderImpl;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.model.Content;
+
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public class TestWriteAccess extends SecureCommandTestCase
+{
+ String rejectPath = "/default/private";
+ String allowedPath = "/default/images";
+
+ /**
+ *
+ *
+ */
+ public TestWriteAccess()
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestWriteAccess.class);
+ }
+
+ /**
+ *
+ * @return
+ */
+ private Folder getNewPublicFolder()
+ {
+ //create folder object
+ Folder folder = new FolderImpl();
+ folder.setCreationDate(new Date());
+ folder.setDescription("Folder Description");
+ folder.setTitle("Folder Title");
+ folder.setLastModified(new Date());
+ folder.setName("Unit Test");
+ folder.setBasePath(this.allowedPath+"/"+folder.getName());
+
+ return folder;
+ }
+
+ /**
+ *
+ * @return
+ */
+ private Folder getNewProtectedFolder()
+ {
+ //create folder object
+ Folder folder = new FolderImpl();
+ folder.setCreationDate(new Date());
+ folder.setDescription("Folder Description");
+ folder.setTitle("Folder Title");
+ folder.setLastModified(new Date());
+ folder.setName("Unit Test");
+ folder.setBasePath(this.rejectPath+"/"+folder.getName());
+
+ return folder;
+ }
+
+ /**
+ *
+ * @param folder
+ * @return
+ */
+ private File getFile(Folder folder,String fileName,String data)
+ {
+ File file = new FileImpl();
+ file.setBasePath(folder.getBasePath()+"/"+fileName);
+
+ Content content = new ContentImpl();
+ content.setEncoding("UTF-8");
+ content.setTitle("English Title");
+ content.setDescription("English Description");
+ content.setBasePath(file.getBasePath() + "/" +
Locale.ENGLISH.getLanguage());
+ content.setBytes(data.getBytes());
+ content.setMimeType("text/html");
+ file.setContent(Locale.ENGLISH, content);
+
+ return file;
+ }
+
+ /**
+ *
+ *
+ */
+ private void runWriteScenario(Folder folder) throws CMSException
+ {
+ //Create a new folder
+ Command newFolder =
this.service.getCommandFactory().createFolderSaveCommand(folder);
+ this.service.execute(newFolder);
+
+ //Assert the successfull creation of the folder
+ Command get =
service.getCommandFactory().createFolderGetCommand(folder.getBasePath());
+ Folder assertFolder = (Folder) service.execute(get);
+ assertNotNull(assertFolder);
+ assertEquals(folder.getDescription(),assertFolder.getDescription());
+ assertEquals(folder.getName(),assertFolder.getName());
+ assertEquals(folder.getBasePath(),assertFolder.getBasePath());
+
+ //Create a new file into the newly created folder
+ File file =
this.getFile(assertFolder,"testFile.html","newdata");
+ Command newFile =
this.service.getCommandFactory().createNewFileCommand(file,file.getContent());
+ this.service.execute(newFile);
+
+ //Assert the creation of the new file
+ get =
this.service.getCommandFactory().createFileGetCommand(file.getBasePath(),file.getContent().getLocale());
+ File assertFile = (File)this.service.execute(get);
+ assertNotNull(assertFile);
+ assertEquals(file.getBasePath(),assertFile.getBasePath());
+ assertEquals(new String(file.getContent().getBytes()),new
String(assertFile.getContent().getBytes()));
+
+ //Update the newly created file
+ file = assertFile;
+ file.getContent().setBytes(new String("updateddata").getBytes());
+ Command updateFile =
this.service.getCommandFactory().createUpdateFileCommand(file,file.getContent(),true);
+ this.service.execute(updateFile);
+
+ //Assert the updated file
+ get =
this.service.getCommandFactory().createFileGetCommand(file.getBasePath(),file.getContent().getLocale());
+ assertFile = (File)this.service.execute(get);
+ assertNotNull(assertFile);
+ assertEquals(file.getBasePath(),assertFile.getBasePath());
+ assertEquals(new String(file.getContent().getBytes()),new
String(assertFile.getContent().getBytes()));
+
+ //Get the versions of the file
+ get =
this.service.getCommandFactory().createContentGetVersionsCommand(file.getContent().getBasePath());
+ List before = (List)this.service.execute(get);
+
+ //Create a new version of this file
+ file = this.getFile(folder,"testFile.html","newversion");
+ Command fileUpdate =
this.service.getCommandFactory().createFileUpdateCommand(file);
+ Command createNewVersion =
this.service.getCommandFactory().createContentCreateNewVersionCommand(file.getContent(),true);
+ this.service.execute(fileUpdate);
+ this.service.execute(createNewVersion);
+
+ //Assert new version creation
+ get =
this.service.getCommandFactory().createFileGetCommand(file.getBasePath(),file.getContent().getLocale());
+ assertFile = (File)this.service.execute(get);
+ assertNotNull(assertFile);
+ assertEquals(file.getBasePath(),assertFile.getBasePath());
+ assertEquals(new String(file.getContent().getBytes()),new
String(assertFile.getContent().getBytes()));
+
+ //Assert number of versions after
+ get =
this.service.getCommandFactory().createContentGetVersionsCommand(file.getContent().getBasePath());
+ List after = (List)this.service.execute(get);
+ assertEquals(before.size()+1,after.size());
+ }
+
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testAnonymous() throws Exception
+ {
+ // first run against non-access scenario
+ try
+ {
+ this.runWriteScenario(this.getNewProtectedFolder());
+ assertTrue("Access should not have been granted to" +
this.rejectPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") !=
-1);
+ }
+
+ // now run against scenario where access should be granted for a registered user
+ //for anonymous, this should still result in an access denied
+ try
+ {
+ this.runWriteScenario(this.getNewPublicFolder());
+ assertTrue("Access should not have been granted to" + this.rejectPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") !=
-1);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testUser() throws Exception
+ {
+ this.runAs("user");
+
+ // first run against non-access scenario
+ try
+ {
+ this.runWriteScenario(this.getNewProtectedFolder());
+ assertTrue("Access should not have been granted to" +
this.rejectPath,
+ false);
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") !=
-1);
+ }
+
+ // now run against scenario where access should be granted for a registered user
+ //for anonymous, this should still result in an access denied
+ try
+ {
+ this.runWriteScenario(this.getNewPublicFolder());
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") ==
-1);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testAdmin() throws Exception
+ {
+ this.runAs("admin");
+
+ // first run against non-access scenario
+ try
+ {
+ this.runWriteScenario(this.getNewProtectedFolder());
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was not granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") ==
-1);
+ }
+
+ // now run against scenario where access should be granted for a registered user
+ //for anonymous, this should still result in an access denied
+ try
+ {
+ this.runWriteScenario(this.getNewPublicFolder());
+ }
+ catch (CMSException cme)
+ {
+ // assert and make sure access was granted
+ String cmeMessage = cme.toString();
+ assertTrue(cmeMessage.indexOf("Access to this resource is denied") ==
-1);
+ }
+ }
+}
Added:
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/AbstractWorkflowTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/workflow/AbstractWorkflowTestCase.java
(rev 0)
+++
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/AbstractWorkflowTestCase.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -0,0 +1,185 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.jboss.portal.test.cms.workflow;
+
+import javax.naming.InitialContext;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.jboss.portal.cms.impl.interceptors.ApprovalWorkflowInterceptor;
+import org.jboss.portal.common.invocation.Interceptor;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityServiceController;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.db.HibernateRoleImpl;
+import org.jboss.portal.identity.db.HibernateUserImpl;
+import org.jboss.portal.server.impl.invocation.JBossInterceptorStack;
+import org.jboss.portal.workflow.cms.ApprovePublish;
+import org.jboss.portal.workflow.cms.ApprovePublishImpl;
+
+import org.jboss.portal.test.cms.commands.AbstractCommandTestCase;
+import org.jboss.portal.test.cms.commands.CMSInterceptorStackFactory;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public abstract class AbstractWorkflowTestCase extends AbstractCommandTestCase
+{
+ /**
+ *
+ */
+ public AbstractWorkflowTestCase()
+ {
+ super();
+ }
+
+ /**
+ *
+ */
+ public void setUp() throws Exception
+ {
+ //override the configration location to include workflow services
+ this.configuration = "org/jboss/portal/cms/jboss-beans-workflow.xml";
+ super.setUp();
+
+ ApprovalWorkflowInterceptor workflowInterceptor =
this.getApprovalWorkflowInterceptor();
+ ApprovePublish approvePublish = this.getApprovePublish();
+ IdentityServiceController identityService =
((ApprovePublishImpl)approvePublish).getIdentityServiceController();
+
+ //Setup bootstrapped Identity data into the Identity store
+ SessionFactory sessionFactory = (SessionFactory)new
InitialContext().lookup("java:/SessionFactory");
+ this.loadData(sessionFactory,identityService);
+
+ //Setup the interceptor stack
+ CMSInterceptorStackFactory stackFactory = new CMSInterceptorStackFactory();
+ Interceptor[] interceptors = new Interceptor[1];
+ interceptors[0] = workflowInterceptor;
+ JBossInterceptorStack stack = new JBossInterceptorStack(interceptors);
+ stackFactory.setInterceptorStack(stack);
+
+ this.service.setStackFactory(stackFactory);
+ this.service.setApprovePublishWorkflow(approvePublish);
+ this.service.setIdentityServiceController(identityService);
+ }
+
+ /**
+ *
+ */
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ protected ApprovalWorkflowInterceptor getApprovalWorkflowInterceptor() throws
Exception
+ {
+ ApprovalWorkflowInterceptor approvalWorkflowInterceptor =
(ApprovalWorkflowInterceptor)new
InitialContext().lookup("java:/portal/cms/ApprovalWorkflowInterceptor");
+ return approvalWorkflowInterceptor;
+ }
+
+ /**
+ *
+ * @return
+ * @throws Exception
+ */
+ protected ApprovePublish getApprovePublish() throws Exception
+ {
+ return (ApprovePublish)new
InitialContext().lookup("java:/portal/ApprovePublishWorkflow");
+ }
+
+ /**
+ *
+ *
+ */
+ private void loadData(SessionFactory sessionFactory,IdentityServiceController service)
throws Exception
+ {
+ UserModule userModule =
(UserModule)service.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+
+ Session session = sessionFactory.openSession();
+ Transaction tx = session.beginTransaction();
+ boolean success = false;
+ try
+ {
+ if(userModule.getUserCount()==0)
+ {
+ //
+ HibernateRoleImpl adminRole = new HibernateRoleImpl("Admin",
"Administrators");
+ HibernateRoleImpl userRole = new HibernateRoleImpl("User",
"Users");
+
+ //
+ HibernateUserImpl admin = new HibernateUserImpl("admin");
+
admin.setPassword(org.jboss.portal.common.util.Tools.md5AsHexString("admin"));
+ admin.setRealEmail("admin(a)portal.com");
+ admin.setViewRealEmail(true);
+ admin.setEnabled(true);
+
+ //
+ admin.getRoles().add(adminRole);
+ adminRole.getUsers().add(admin);
+
+ //
+ HibernateUserImpl user = new HibernateUserImpl("user");
+
user.setPassword(org.jboss.portal.common.util.Tools.md5AsHexString("user"));
+ user.setRealEmail("user(a)portal.com");
+ user.setViewRealEmail(true);
+ user.setEnabled(true);
+
+ //
+ user.getRoles().add(userRole);
+ userRole.getUsers().add(user);
+
+ //
+ session.save(adminRole);
+ session.save(userRole);
+ session.save(admin);
+ session.save(user);
+
+ success = true;
+ }
+ }
+ finally
+ {
+ if(tx != null)
+ {
+ if(success)
+ {
+ tx.commit();
+ }
+ else
+ {
+ tx.rollback();
+ }
+ }
+ if(session != null)
+ {
+ session.close();
+ }
+ }
+ }
+}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestApprovedPublish.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestApprovedPublish.java
(rev 0)
+++
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestApprovedPublish.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -0,0 +1,194 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * 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.jboss.portal.test.cms.workflow;
+
+import java.util.Locale;
+import java.util.Collection;
+import java.util.Set;
+import javax.naming.InitialContext;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.workflow.cms.ApprovePublish;
+import org.jboss.portal.cms.impl.jcr.JCRCMS;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public class TestApprovedPublish extends AbstractWorkflowTestCase
+{
+ private String file = "/default/workflow.html";
+ private Transaction tx = null;
+ private Session session = null;
+
+ /**
+ *
+ *
+ */
+ public TestApprovedPublish()
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestApprovedPublish.class);
+ }
+
+ /**
+ *
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ JCRCMS.turnOnWorkflow();
+
+ SessionFactory sessionFactory = (SessionFactory)new
InitialContext().lookup("java:/SessionFactory");
+ this.session = sessionFactory.openSession();
+ this.tx = session.beginTransaction();
+ }
+
+ /**
+ *
+ */
+ public void tearDown() throws Exception
+ {
+ this.tx.commit();
+ this.session.close();
+
+ super.tearDown();
+ }
+
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void test() throws Exception
+ {
+ //Execute file creation as a regular user/non-manager
+ this.runAs("user");
+
+ //Add a new file to the CMS
+ File file = new FileImpl();
+ file.setBasePath(this.file);
+
+ Content content = new ContentImpl();
+ content.setEncoding("UTF-8");
+ content.setTitle("English Title");
+ content.setDescription("English Description");
+ content.setBasePath(this.file + "/" + Locale.ENGLISH.getLanguage());
+ content.setBytes("newdata".getBytes());
+ content.setMimeType("text/html");
+ file.setContent(Locale.ENGLISH, content);
+
+ Command newFileCommand =
this.service.getCommandFactory().createNewFileCommand(file, content);
+ this.service.execute(newFileCommand);
+
+ //Make sure this resource is not published into the CMS yet
+ Command fileGet = this.service.getCommandFactory().createFileGetCommand(this.file,
Locale.ENGLISH);
+ File assertFile = (File)this.service.execute(fileGet);
+ assertNull(assertFile.getContent());
+
+ //Check the pending queue for this file
+ ApprovePublish approvePublish = this.service.getApprovePublishWorkflow();
+ Collection queueItems = approvePublish.getPendingQueue(this.file);
+ assertNotNull(queueItems);
+ assertEquals(1,queueItems.size());
+
+ //Approve and publish this file into the CMS
+ Set managers = approvePublish.getManagers();
+ String manager = (String)managers.iterator().next();
+ org.jboss.portal.workflow.cms.Content pendingItem =
(org.jboss.portal.workflow.cms.Content)queueItems.iterator().next();
+ approvePublish.processManagerResponse(Long.parseLong(pendingItem.getProcessId()),
manager.toLowerCase(), true);
+
+ //Make sure this resource is successfully published into the CMS, and removed from
the pending queue
+ assertFile = (File)this.service.execute(fileGet);
+ assertNotNull(assertFile.getContent());
+ assertTrue(assertFile.getContent().isLive());
+ assertFalse(assertFile.getContent().isWaitingForPublishApproval());
+ assertEquals(new String(assertFile.getContent().getBytes()),"newdata");
+ queueItems = approvePublish.getPendingQueue(this.file);
+ if(queueItems != null)
+ {
+ assertTrue(queueItems.isEmpty());
+ }
+
+
+ String currentLiveVersion = assertFile.getContent().getVersionNumber();
+
+
+ //Now testing the update side of it
+ //modify this file
+ file.getContent().setBytes("updateddata".getBytes());
+ Command updateFileCommand =
this.service.getCommandFactory().createUpdateFileCommand(file,content,true);
+ this.service.execute(updateFileCommand);
+
+ //Make sure a new LIVE version of this resource is not published into the CMS
+ assertFile = (File)this.service.execute(fileGet);
+ assertEquals(new String(assertFile.getContent().getBytes()),"newdata");
+ assertEquals(assertFile.getContent().getVersionNumber(),currentLiveVersion);
+
+ //Checking pending queue for a version of this file to be approved
+ queueItems = approvePublish.getPendingQueue(this.file);
+ assertNotNull(queueItems);
+ assertEquals(1,queueItems.size());
+
+ //Approve and publish this new version into the CMS
+ pendingItem = (org.jboss.portal.workflow.cms.Content)queueItems.iterator().next();
+ approvePublish.processManagerResponse(Long.parseLong(pendingItem.getProcessId()),
manager.toLowerCase(),true);
+
+ //Check for the success of this publish, and removal from the pending queue
+ assertFile = (File)this.service.execute(fileGet);
+ assertFalse(assertFile.getContent().isWaitingForPublishApproval());
+ assertEquals(new
String(assertFile.getContent().getBytes()),"updateddata");
+ assertTrue(assertFile.getContent().getVersionNumber() != currentLiveVersion);
+ queueItems = approvePublish.getPendingQueue(this.file);
+ if(queueItems != null)
+ {
+ assertTrue(queueItems.isEmpty());
+ }
+ }
+
+ /**
+ *
+ * @param username
+ */
+ private void runAs(String username) throws Exception
+ {
+
JCRCMS.getUserInfo().set(this.service.getUserModule().findUserByUserName(username));
+ }
+}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestDeniedPublish.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestDeniedPublish.java
(rev 0)
+++
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestDeniedPublish.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -0,0 +1,214 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * 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.jboss.portal.test.cms.workflow;
+
+import java.util.Locale;
+import java.util.Collection;
+import java.util.Set;
+import java.util.List;
+import javax.naming.InitialContext;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.workflow.cms.ApprovePublish;
+import org.jboss.portal.cms.impl.jcr.JCRCMS;
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public class TestDeniedPublish extends AbstractWorkflowTestCase
+{
+ private String newFile = "/default/workflow.html";
+ private String updateFile = "/default/index.html";
+ private Transaction tx = null;
+ private Session session = null;
+
+ /**
+ *
+ *
+ */
+ public TestDeniedPublish()
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestDeniedPublish.class);
+ }
+
+ /**
+ *
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ JCRCMS.turnOnWorkflow();
+
+ SessionFactory sessionFactory = (SessionFactory)new
InitialContext().lookup("java:/SessionFactory");
+ this.session = sessionFactory.openSession();
+ this.tx = session.beginTransaction();
+ }
+
+ /**
+ *
+ */
+ public void tearDown() throws Exception
+ {
+ this.tx.commit();
+ this.session.close();
+
+ super.tearDown();
+ }
+
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void test() throws Exception
+ {
+ //Execute file creation as a regular user/non-manager
+ this.runAs("user");
+
+ //Add a new file to the CMS
+ File file = new FileImpl();
+ file.setBasePath(this.newFile);
+
+ Content content = new ContentImpl();
+ content.setEncoding("UTF-8");
+ content.setTitle("English Title");
+ content.setDescription("English Description");
+ content.setBasePath(this.newFile + "/" + Locale.ENGLISH.getLanguage());
+ content.setBytes("newdata".getBytes());
+ content.setMimeType("text/html");
+ file.setContent(Locale.ENGLISH, content);
+
+ Command newFileCommand =
this.service.getCommandFactory().createNewFileCommand(file, content);
+ this.service.execute(newFileCommand);
+
+ //Make sure this resource is not published into the CMS yet
+ Command fileGet =
this.service.getCommandFactory().createFileGetCommand(this.newFile, Locale.ENGLISH);
+ File assertFile = (File)this.service.execute(fileGet);
+ assertNull(assertFile.getContent());
+
+ //Check the pending queue for this file
+ ApprovePublish approvePublish = this.service.getApprovePublishWorkflow();
+ Collection queueItems = approvePublish.getPendingQueue(this.newFile);
+ assertNotNull(queueItems);
+ assertEquals(1,queueItems.size());
+
+ //Deny the publish of this file into the CMS
+ Set managers = approvePublish.getManagers();
+ String manager = (String)managers.iterator().next();
+ org.jboss.portal.workflow.cms.Content pendingItem =
(org.jboss.portal.workflow.cms.Content)queueItems.iterator().next();
+ approvePublish.processManagerResponse(Long.parseLong(pendingItem.getProcessId()),
manager.toLowerCase(), false);
+
+ //Make sure this resource is not published into the CMS, and removed from the
pending queue
+ assertFile = (File)this.service.execute(fileGet);
+ assertNull(assertFile.getContent());
+ queueItems = approvePublish.getPendingQueue(this.newFile);
+ if(queueItems != null)
+ {
+ assertTrue(queueItems.isEmpty());
+ }
+
+
+ //Check for the existence of a file to be updated first
+ Command existsCommand =
this.service.getCommandFactory().createItemExistsCommand(this.updateFile);
+ Boolean exists = (Boolean)this.service.execute(existsCommand);
+ assertTrue(exists.booleanValue());
+
+
+ //Get the file to be updated
+ fileGet = this.service.getCommandFactory().createFileGetCommand(this.updateFile,new
Locale(this.service.getDefaultLocale()));
+ File updateFile = (File)this.service.execute(fileGet);
+ assertNotNull(updateFile);
+ assertNotNull(updateFile.getContent());
+ assertTrue(updateFile.getContent().isLive());
+
+ //Get some data related to this CMS in the file before sending in an update
+ Command getVersions =
this.service.getCommandFactory().createContentGetVersionsCommand(updateFile.getContent().getBasePath());
+ List versions = (List)this.service.execute(getVersions);
+ String oldLiveVersion = updateFile.getContent().getVersionNumber();
+ String oldContent = new String(updateFile.getContent().getBytes());
+ assertEquals(1,versions.size());
+
+ //Peform the file update
+ updateFile.getContent().setBytes("updateddata".getBytes());
+ Command updateFileCommand =
this.service.getCommandFactory().createUpdateFileCommand(updateFile,updateFile.getContent(),true);
+ this.service.execute(updateFileCommand);
+
+
+ //Make sure a new LIVE version of this resource is not published into the CMS
+ assertFile = (File)this.service.execute(fileGet);
+ versions = (List)this.service.execute(getVersions);
+ assertEquals(new String(assertFile.getContent().getBytes()),oldContent);
+ assertEquals(assertFile.getContent().getVersionNumber(),oldLiveVersion);
+ assertEquals(2,versions.size());
+
+ //Checking pending queue for a version of this file to be approved
+ queueItems = approvePublish.getPendingQueue(this.updateFile);
+ assertNotNull(queueItems);
+ assertEquals(1,queueItems.size());
+
+ //Deny publishing of this new version into the CMS
+ pendingItem = (org.jboss.portal.workflow.cms.Content)queueItems.iterator().next();
+ approvePublish.processManagerResponse(Long.parseLong(pendingItem.getProcessId()),
manager.toLowerCase(),false);
+
+ //Check for the success of this denial, and removal from the pending queue
+ assertFile = (File)this.service.execute(fileGet);
+ versions = (List)this.service.execute(getVersions);
+ assertEquals(new String(assertFile.getContent().getBytes()),oldContent);
+ assertEquals(assertFile.getContent().getVersionNumber(),oldLiveVersion);
+ assertEquals(2,versions.size());
+ queueItems = approvePublish.getPendingQueue(this.updateFile);
+ if(queueItems != null)
+ {
+ assertTrue(queueItems.isEmpty());
+ }
+ }
+
+ /**
+ *
+ * @param username
+ */
+ private void runAs(String username) throws Exception
+ {
+
JCRCMS.getUserInfo().set(this.service.getUserModule().findUserByUserName(username));
+ }
+}
Added: trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestWorkflowEnvironment.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestWorkflowEnvironment.java
(rev 0)
+++
trunk/cms/src/main/org/jboss/portal/test/cms/workflow/TestWorkflowEnvironment.java 2007-04-10
02:44:49 UTC (rev 6964)
@@ -0,0 +1,77 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * 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.jboss.portal.test.cms.workflow;
+
+import java.util.Set;
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.workflow.cms.ApprovePublish;
+
+
+/**
+ *
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 30, 2006
+ *
+ */
+public class TestWorkflowEnvironment extends AbstractWorkflowTestCase
+{
+ String rejectPath = "/default/private/license.html";
+ String allowedPath = "/default/images/check.gif";
+
+
+ /**
+ *
+ *
+ */
+ public TestWorkflowEnvironment()
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestWorkflowEnvironment.class);
+ }
+
+ /**
+ *
+ * @throws CMSException
+ */
+ public void test() throws Exception
+ {
+ //Get the ApprovePublish service
+ ApprovePublish service = this.getApprovePublish();
+
+ //Get the list of managers allowed to approve content
+ Set managers = service.getManagers();
+
+ //Assert and make sure there is atleast one portal role that is allowed
+ //to function of content manager
+ this.assertNotNull(managers);
+ this.assertTrue(managers.size()>0);
+ }
+}
Modified: trunk/cms/src/resources/hibernate/domain.hbm.xml
===================================================================
--- trunk/cms/src/resources/hibernate/domain.hbm.xml 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/resources/hibernate/domain.hbm.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -287,7 +287,7 @@
<property
name="roleId"
column="ROLE_ID"
- type="long"
+ type="string"
not-null="true"
/>
</class>
@@ -302,7 +302,7 @@
<property
name="userId"
column="USER_ID"
- type="long"
+ type="string"
not-null="true"
/>
</class>
Added:
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml
===================================================================
--- trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml
(rev 0)
+++
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml 2007-04-10
02:44:49 UTC (rev 6964)
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<deployment
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer">
+
+ <bean name="DataSourceConfig"
class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>DataSourceConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="HibernateConfig"
class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JNDISupport"
class="org.jboss.portal.test.framework.embedded.JNDISupport">
+ </bean>
+
+ <bean name="TransactionManagerSupport"
class="org.jboss.portal.test.framework.embedded.TransactionManagerSupport">
+ </bean>
+
+ <bean name="ConnectionManagerSupport"
class="org.jboss.portal.test.framework.embedded.ConnectionManagerSupport">
+ <property name="transactionManager"><inject
bean="TransactionManagerSupport"
property="transactionManager"/></property>
+ </bean>
+
+ <bean name="DataSourceSupport"
class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
+ <property name="transactionManager"><inject
bean="TransactionManagerSupport"
property="transactionManager"/></property>
+ <property name="connectionManagerReference"><inject
bean="ConnectionManagerSupport"
+
property="connectionManagerReference"/></property>
+ <property name="config"><inject
bean="DataSourceConfig"/></property>
+ </bean>
+
+ <bean name="HibernateSupport"
class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject
bean="HibernateConfig"/></property>
+ <property name="jNDIName">java:/SessionFactory</property>
+ <property name="mappings">
+ <list elementClass="java.lang.String">
+ <value>domain.hbm.xml</value>
+ <value>domain-identity.hbm.xml</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean name="IdentityServiceController"
class="org.jboss.portal.identity.IdentityServiceControllerImpl">
+ <property name="configFile">db-config.xml</property>
+ <property
name="defaultConfigFile">standardidentity-config.xml</property>
+ <property name="registerMBeans">false</property>
+ </bean>
+
+ <bean name="IdentityDataLoader"
class="org.jboss.portal.test.cms.security.IdentityDataLoader">
+ <property name="identityServiceController"><inject
bean="IdentityServiceController"/></property>
+ <property
name="identitySessionFactory">java:/SessionFactory</property>
+ </bean>
+
+ <!-- setup for cms security testing -->
+ <bean name="AuthorizationProvider"
class="org.jboss.portal.cms.security.AuthorizationProviderImpl">
+ <property name="identityServiceController"><inject
bean="IdentityServiceController"/></property>
+ </bean>
+
+ <bean name="AuthorizationManager"
class="org.jboss.portal.cms.security.AuthorizationManagerImpl">
+ <property name="provider"><inject
bean="AuthorizationProvider"/></property>
+ <property
name="jNDIName">java:portal/cms/AuthorizationManager</property>
+ </bean>
+
+ <bean name="ACLInterceptor"
class="org.jboss.portal.cms.impl.interceptors.ACLInterceptor">
+ <property name="authorizationManager"><inject
bean="AuthorizationManager"/></property>
+ <property
name="jNDIName">java:/portal/cms/ACLInterceptor</property>
+ <property
name="cmsSessionFactory">java:/SessionFactory</property>
+ <property
name="identitySessionFactory">java:/SessionFactory</property>
+ <property name="defaultPolicy">
+ <![CDATA[
+ <policy>
+ <!-- permissions on the root cms node -->
+ <criteria name="path" value="/">
+ <permission name="cms" action="read">
+ <role name="Anonymous"/>
+ </permission>
+ <permission name="cms" action="write">
+ <role name="User"/>
+ </permission>
+ <permission name="cms" action="manage">
+ <role name="Admin"/>
+ </permission>
+ </criteria>
+ <!-- permissions on the default cms node -->
+ <criteria name="path" value="/default">
+ <permission name="cms" action="read">
+ <role name="Anonymous"/>
+ </permission>
+ <permission name="cms" action="write">
+ <role name="User"/>
+ </permission>
+ <permission name="cms" action="manage">
+ <role name="Admin"/>
+ </permission>
+ </criteria>
+ <!-- permissions on the private/protected node -->
+ <criteria name="path" value="/default/private">
+ <permission name="cms" action="manage">
+ <role name="Admin"/>
+ </permission>
+ </criteria>
+ </policy>
+ ]]>
+ </property>
+ </bean>
+</deployment>
Property changes on:
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml
===================================================================
--- trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml
(rev 0)
+++
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml 2007-04-10
02:44:49 UTC (rev 6964)
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<deployment
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer">
+
+ <bean name="DataSourceConfig"
class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>DataSourceConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="HibernateConfig"
class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JNDISupport"
class="org.jboss.portal.test.framework.embedded.JNDISupport">
+ </bean>
+
+ <bean name="TransactionManagerSupport"
class="org.jboss.portal.test.framework.embedded.TransactionManagerSupport">
+ </bean>
+
+ <bean name="ConnectionManagerSupport"
class="org.jboss.portal.test.framework.embedded.ConnectionManagerSupport">
+ <property name="transactionManager"><inject
bean="TransactionManagerSupport"
property="transactionManager"/></property>
+ </bean>
+
+ <bean name="DataSourceSupport"
class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
+ <property name="transactionManager"><inject
bean="TransactionManagerSupport"
property="transactionManager"/></property>
+ <property name="connectionManagerReference"><inject
bean="ConnectionManagerSupport"
+
property="connectionManagerReference"/></property>
+ <property name="config"><inject
bean="DataSourceConfig"/></property>
+ </bean>
+
+ <bean name="HibernateSupport"
class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject
bean="HibernateConfig"/></property>
+ <property name="jNDIName">java:/SessionFactory</property>
+ <property name="mappings">
+ <list elementClass="java.lang.String">
+ <value>domain.hbm.xml</value>
+ <value>domain-identity.hbm.xml</value>
+ <value>org/jbpm/graph/action/Script.hbm.xml</value>
+ <value>org/jbpm/identity/User.hbm.xml</value>
+ <value>org/jbpm/identity/Group.hbm.xml</value>
+ <value>org/jbpm/identity/Membership.hbm.xml</value>
+ <value>org/jbpm/db/hibernate.queries.hbm.xml</value>
+ <value>org/jbpm/graph/def/ProcessDefinition.hbm.xml</value>
+ <value>org/jbpm/graph/def/Node.hbm.xml</value>
+ <value>org/jbpm/graph/def/Transition.hbm.xml</value>
+ <value>org/jbpm/graph/def/Event.hbm.xml</value>
+ <value>org/jbpm/graph/def/Action.hbm.xml</value>
+ <value>org/jbpm/graph/def/SuperState.hbm.xml</value>
+ <value>org/jbpm/graph/def/ExceptionHandler.hbm.xml</value>
+ <value>org/jbpm/instantiation/Delegation.hbm.xml</value>
+ <value>org/jbpm/graph/node/StartState.hbm.xml</value>
+ <value>org/jbpm/graph/node/EndState.hbm.xml</value>
+ <value>org/jbpm/graph/node/ProcessState.hbm.xml</value>
+ <value>org/jbpm/graph/node/Decision.hbm.xml</value>
+ <value>org/jbpm/graph/node/Fork.hbm.xml</value>
+ <value>org/jbpm/graph/node/Join.hbm.xml</value>
+ <value>org/jbpm/graph/node/State.hbm.xml</value>
+ <value>org/jbpm/graph/node/TaskNode.hbm.xml</value>
+ <value>org/jbpm/context/def/ContextDefinition.hbm.xml</value>
+ <value>org/jbpm/context/def/VariableAccess.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/def/Swimlane.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/def/Task.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/def/TaskController.hbm.xml</value>
+ <value>org/jbpm/module/def/ModuleDefinition.hbm.xml</value>
+ <value>org/jbpm/bytes/ByteArray.hbm.xml</value>
+ <value>org/jbpm/file/def/FileDefinition.hbm.xml</value>
+ <value>org/jbpm/scheduler/def/CreateTimerAction.hbm.xml</value>
+ <value>org/jbpm/scheduler/def/CancelTimerAction.hbm.xml</value>
+ <value>org/jbpm/graph/exe/Comment.hbm.xml</value>
+ <value>org/jbpm/graph/exe/ProcessInstance.hbm.xml</value>
+ <value>org/jbpm/graph/exe/Token.hbm.xml</value>
+ <value>org/jbpm/graph/exe/RuntimeAction.hbm.xml</value>
+ <value>org/jbpm/module/exe/ModuleInstance.hbm.xml</value>
+ <value>org/jbpm/context/exe/ContextInstance.hbm.xml</value>
+ <value>org/jbpm/context/exe/TokenVariableMap.hbm.xml</value>
+ <value>org/jbpm/context/exe/VariableInstance.hbm.xml</value>
+
<value>org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml</value>
+
<value>org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml</value>
+
<value>org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml</value>
+
<value>org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml</value>
+
<value>org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml</value>
+
<value>org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml</value>
+
<value>org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml</value>
+
<value>org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml</value>
+ <value>org/jbpm/msg/Message.hbm.xml</value>
+ <value>org/jbpm/msg/db/TextMessage.hbm.xml</value>
+ <value>org/jbpm/command/ExecuteActionCommand.hbm.xml</value>
+ <value>org/jbpm/command/ExecuteNodeCommand.hbm.xml</value>
+ <value>org/jbpm/command/SignalCommand.hbm.xml</value>
+ <value>org/jbpm/command/TaskInstanceEndCommand.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/exe/PooledActor.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml</value>
+ <value>org/jbpm/scheduler/exe/Timer.hbm.xml</value>
+ <value>org/jbpm/logging/log/ProcessLog.hbm.xml</value>
+ <value>org/jbpm/logging/log/MessageLog.hbm.xml</value>
+ <value>org/jbpm/logging/log/CompositeLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/ActionLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/NodeLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/ProcessStateLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/SignalLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/TokenCreateLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/TokenEndLog.hbm.xml</value>
+ <value>org/jbpm/graph/log/TransitionLog.hbm.xml</value>
+ <value>org/jbpm/context/log/VariableLog.hbm.xml</value>
+ <value>org/jbpm/context/log/VariableCreateLog.hbm.xml</value>
+ <value>org/jbpm/context/log/VariableDeleteLog.hbm.xml</value>
+ <value>org/jbpm/context/log/VariableUpdateLog.hbm.xml</value>
+
<value>org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml</value>
+
<value>org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml</value>
+
<value>org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml</value>
+
<value>org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml</value>
+
<value>org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml</value>
+
<value>org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml</value>
+
<value>org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/TaskLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml</value>
+ <value>org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean name="IdentityServiceController"
class="org.jboss.portal.identity.IdentityServiceControllerImpl">
+ <property name="configFile">db-config.xml</property>
+ <property
name="defaultConfigFile">standardidentity-config.xml</property>
+ <property name="registerMBeans">false</property>
+ </bean>
+
+
+ <!-- setup for cms workflow testing -->
+ <bean name="WorkflowService"
class="org.jboss.portal.workflow.service.WorkflowServiceImpl">
+ <property name="jbpmConfigurationXml">
+ <![CDATA[
+ <jbpm-configuration>
+ <jbpm-context>
+ <service name="persistence"
factory="org.jbpm.persistence.db.DbPersistenceServiceFactory"/>
+ </jbpm-context>
+ <string name="resource.hibernate.cfg.xml"
value="jbpm-hibernate.cfg.xml"/>
+ <string name="resource.business.calendar"
value="org/jbpm/calendar/jbpm.business.calendar.properties"/>
+ <string name="resource.default.modules"
value="org/jbpm/graph/def/jbpm.default.modules.properties"/>
+ <string name="resource.converter"
value="org/jbpm/db/hibernate/jbpm.converter.properties"/>
+ <string name="resource.action.types"
value="org/jbpm/graph/action/action.types.xml"/>
+ <string name="resource.node.types"
value="org/jbpm/graph/node/node.types.xml"/>
+ <string name="resource.varmapping"
value="org/jbpm/context/exe/jbpm.varmapping.xml"/>
+ </jbpm-configuration>
+ ]]>
+ </property>
+ </bean>
+
+ <bean name="ApprovePublish"
class="org.jboss.portal.workflow.cms.ApprovePublishImpl">
+ <property name="workflowService"><inject
bean="WorkflowService"/></property>
+ <property name="identityServiceController"><inject
bean="IdentityServiceController"/></property>
+ <property name="overwrite">false</property>
+ <property name="managerRoles">Admin</property>
+ <property
name="jNDIName">java:/portal/ApprovePublishWorkflow</property>
+ <property name="process">
+ <![CDATA[
+ <!-- cms approval workflow -->
+ <process-definition name="approval_workflow">
+ <start-state>
+ <transition to="request_approval"/>
+ </start-state>
+ <task-node name="request_approval" signal="first">
+ <task name="approve_publish">
+ <assignment
class="org.jboss.portal.cms.workflow.PublishAssignmentHandler"/>
+ <event type="task-start">
+ <action
class="org.jboss.portal.cms.workflow.FinalizePublish"/>
+ </event>
+ <exception-handler>
+ <action
class="org.jboss.portal.workflow.cms.TaskExceptionHandler"/>
+ </exception-handler>
+ </task>
+ <transition name="approval" to="end"/>
+ <transition name="rejection" to="end"/>
+ </task-node>
+ <end-state name="end"/>
+ </process-definition>
+ ]]>
+ </property>
+ </bean>
+
+ <bean
class="org.jboss.portal.cms.impl.interceptors.ApprovalWorkflowInterceptor"
name="ApprovalWorkflowInterceptor">
+ <property
name="jNDIName">java:/portal/cms/ApprovalWorkflowInterceptor</property>
+ </bean>
+</deployment>
Property changes on:
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml
===================================================================
--- trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml 2007-04-09
20:17:48 UTC (rev 6963)
+++ trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml 2007-04-10
02:44:49 UTC (rev 6964)
@@ -63,18 +63,8 @@
<property name="jNDIName">java:/SessionFactory</property>
<property name="mappings">
<list elementClass="java.lang.String">
- <value>domain.hbm.xml</value>
+ <value>domain.hbm.xml</value>
</list>
</property>
- </bean>
-
- <!--
- <bean name="TestBean"
class="org.jboss.portal.test.identity.db.DBUserTestCase">
- <constructor factoryMethod="getBean">
- <factory bean="BeanFactory"/>
- <parameter>TestBean</parameter>
- </constructor>
- <property name="hibernate"><inject
bean="HibernateSupport"/></property>
- </bean>
- -->
+ </bean>
</deployment>
Added: trunk/cms/src/resources/test/db-config.xml
===================================================================
--- trunk/cms/src/resources/test/db-config.xml (rev 0)
+++ trunk/cms/src/resources/test/db-config.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+ <!--<!DOCTYPE identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
+
+
+<identity-configuration>
+ <datasources/>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Role</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Membership</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ </modules>
+ <options/>
+</identity-configuration>
Added: trunk/cms/src/resources/test/domain-identity.hbm.xml
===================================================================
--- trunk/cms/src/resources/test/domain-identity.hbm.xml (rev 0)
+++ trunk/cms/src/resources/test/domain-identity.hbm.xml 2007-04-10 02:44:49 UTC (rev
6964)
@@ -0,0 +1,177 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
+ name="org.jboss.portal.identity.db.HibernateUserImpl"
+ table="jbp_users">
+ <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
+ <id
+ name="key"
+ column="jbp_uid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="userName"
+ column="jbp_uname"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <map
+ name="dynamic"
+ table="jbp_user_prop"
+ lazy="false"
+ sort="unsorted"
+ cascade="all">
+ <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
+ <key column="jbp_uid"/>
+ <index
+ column="jbp_name"
+ type="java.lang.String"/>
+ <element
+ column="jbp_value"
+ type="java.lang.String"
+ not-null="false"
+ unique="false"/>
+ </map>
+ <property
+ name="givenName"
+ column="jbp_givenname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="familyName"
+ column="jbp_familyname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="password"
+ column="jbp_password"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="realEmail"
+ column="jbp_realemail"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="fakeEmail"
+ column="jbp_fakeemail"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="registrationDate"
+ column="jbp_regdate"
+ type="java.util.Date"
+ update="false"
+ insert="true"
+ unique="false"/>
+ <property
+ name="viewRealEmail"
+ column="jbp_viewrealemail"
+ type="boolean"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="enabled"
+ column="jbp_enabled"
+ type="boolean"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <set
+ name="roles"
+ table="jbp_role_membership"
+ lazy="false"
+ inverse="false"
+ cascade="none"
+ sort="unsorted">
+ <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
+ <key column="jbp_uid"/>
+ <many-to-many
+ class="org.jboss.portal.identity.db.HibernateRoleImpl"
+ column="jbp_rid"
+ outer-join="true"/>
+ </set>
+ </class>
+ <class
+ name="org.jboss.portal.identity.db.HibernateRoleImpl"
+ table="jbp_roles">
+ <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
+ <id
+ name="key"
+ column="jbp_rid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="name"
+ column="jbp_name"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <property
+ name="displayName"
+ column="jbp_displayname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="true"/>
+ <set
+ name="users"
+ table="jbp_role_membership"
+ lazy="true"
+ inverse="true"
+ cascade="none"
+ sort="unsorted">
+ <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
+ <key column="jbp_rid"/>
+ <many-to-many
+ class="org.jboss.portal.identity.db.HibernateUserImpl"
+ column="jbp_uid"
+ outer-join="false"/>
+ </set>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/cms/src/resources/test/jbpm-ehcache.xml
===================================================================
--- trunk/cms/src/resources/test/jbpm-ehcache.xml (rev 0)
+++ trunk/cms/src/resources/test/jbpm-ehcache.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -0,0 +1,61 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<ehcache>
+
+ <!-- Sets the path to the directory where cache .data files are created.
+
+ If the path is a Java System Property it is replaced by
+ its value in the running VM.
+
+ The following properties are translated:
+ user.home - User's home directory
+ user.dir - User's current working directory
+ java.io.tmpdir - Default temp file path -->
+ <diskStore path="java.io.tmpdir/workflow"/>
+
+
+ <!--Default Cache configuration. These will applied to caches programmatically
created through
+ the CacheManager.
+
+ The following attributes are required for defaultCache:
+
+ maxInMemory - Sets the maximum number of objects that will be created in memory
+ eternal - Sets whether elements are eternal. If eternal, timeouts are
ignored and the element
+ is never expired.
+ timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only
used
+ if the element is not eternal. Idle time is now - last accessed
time
+ timeToLiveSeconds - Sets the time to live for an element before it expires. Is only
used
+ if the element is not eternal. TTL is now - creation time
+ overflowToDisk - Sets whether elements can overflow to disk when the in-memory
cache
+ has reached the maxInMemory limit.
+
+ -->
+ <defaultCache
+ maxElementsInMemory="10000"
+ eternal="false"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
+ overflowToDisk="false"
+ />
+</ehcache>
Added: trunk/cms/src/resources/test/jbpm-hibernate.cfg.xml
===================================================================
--- trunk/cms/src/resources/test/jbpm-hibernate.cfg.xml (rev 0)
+++ trunk/cms/src/resources/test/jbpm-hibernate.cfg.xml 2007-04-10 02:44:49 UTC (rev
6964)
@@ -0,0 +1,168 @@
+<?xml version='1.0' encoding='utf-8'?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+ <!-- jdbc connection properties -->
+ <property
name="connection.datasource">java:/DefaultDS</property>
+
+ <!-- other hibernate properties -->
+ <property name="show_sql">false</property>
+ <property name="hibernate.format_sql">true</property>
+ <property name="hibernate.use_sql_comments">true</property>
+
+ <!-- caching properties -->
+ <property name="cache.use_second_level_cache">true</property>
+ <property name="cache.use_query_cache">true</property>
+ <property
name="cache.provider_configuration_file_resource_path">jbpm-ehcache.xml</property>
+ <property
name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
+
+ <!-- managed environment transaction configuration -->
+ <property
name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ <property
name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+
+ <!-- ############################################ -->
+ <!-- # mapping files with external dependencies # -->
+ <!-- ############################################ -->
+
+ <!-- following mapping file has a dependendy on -->
+ <!-- 'bsh-{version}.jar'. -->
+ <!-- uncomment this if you don't have bsh on your -->
+ <!-- classpath. you won't be able to use the -->
+ <!-- script element in process definition files -->
+ <mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
+
+ <!-- following mapping files have a dependendy on -->
+ <!-- 'jbpm-identity-{version}.jar', mapping files -->
+ <!-- of the pluggable jbpm identity component. -->
+ <!-- comment out the following 3 lines if you don't-->
+ <!-- want to use the default jBPM identity mgmgt -->
+ <!-- component -->
+ <mapping resource="org/jbpm/identity/User.hbm.xml"/>
+ <mapping resource="org/jbpm/identity/Group.hbm.xml"/>
+ <mapping resource="org/jbpm/identity/Membership.hbm.xml"/>
+
+ <!-- ###################### -->
+ <!-- # jbpm mapping files # -->
+ <!-- ###################### -->
+
+ <!-- hql queries and type defs -->
+ <mapping resource="org/jbpm/db/hibernate.queries.hbm.xml"/>
+
+ <!-- graph.def mapping files -->
+ <mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
+ <mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
+
+ <!-- graph.node mapping files -->
+ <mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Join.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/State.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/>
+
+ <!-- context.def mapping files -->
+ <mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/>
+
+ <!-- taskmgmt.def mapping files -->
+ <mapping
resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/>
+
+ <!-- module.def mapping files -->
+ <mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/>
+
+ <!-- bytes mapping files -->
+ <mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/>
+
+ <!-- file.def mapping files -->
+ <mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/>
+
+ <!-- scheduler.def mapping files -->
+ <mapping
resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/>
+ <mapping
resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/>
+
+ <!-- graph.exe mapping files -->
+ <mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/>
+
+ <!-- module.exe mapping files -->
+ <mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/>
+
+ <!-- context.exe mapping files -->
+ <mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/VariableInstance.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>
+
+ <!-- msg.db mapping files -->
+ <mapping resource="org/jbpm/msg/Message.hbm.xml"/>
+ <mapping resource="org/jbpm/msg/db/TextMessage.hbm.xml"/>
+ <mapping resource="org/jbpm/command/ExecuteActionCommand.hbm.xml"/>
+ <mapping resource="org/jbpm/command/ExecuteNodeCommand.hbm.xml"/>
+ <mapping resource="org/jbpm/command/SignalCommand.hbm.xml"/>
+ <mapping
resource="org/jbpm/command/TaskInstanceEndCommand.hbm.xml"/>
+
+ <!-- taskmgmt.exe mapping files -->
+ <mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/>
+
+ <!-- scheduler.exe mapping files -->
+ <mapping resource="org/jbpm/scheduler/exe/Timer.hbm.xml"/>
+
+ <!-- logging mapping files -->
+ <mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/>
+ <mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/>
+ <mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/>
+ <mapping
resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/>
+ <mapping
resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/>
+ <mapping
resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/>
+ </session-factory>
+</hibernate-configuration>
Modified: trunk/cms/src/resources/test/jcr/repository.xml
===================================================================
--- trunk/cms/src/resources/test/jcr/repository.xml 2007-04-09 20:17:48 UTC (rev 6963)
+++ trunk/cms/src/resources/test/jcr/repository.xml 2007-04-10 02:44:49 UTC (rev 6964)
@@ -62,11 +62,11 @@
<!--
persistence manager of the workspace.
- Use XMLPersistenceManager for LocalFileSystem Store and
HibernatePersistenceManager .
+ Use XMLPersistenceManager for LocalFileSystem Store and
HibernatePersistenceManager/JBossCachePersistenceManager .
-->
<!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage -->
- <PersistenceManager
class="org.jboss.portal.cms.hibernate.state.HibernatePersistenceManager">
+ <PersistenceManager
class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
<param name="schemaObjectPrefix" value="WSP"/>
<param name="JNDIName"
value="java:/SessionFactory"/>
<param name="externalBLOBs" value="false"/>
@@ -110,11 +110,11 @@
<!--
Configures the persistence manager to be used for persisting version state.
- Use XMLPersistenceManager for LocalFileSystem Store and
HibernatePersistenceManager for HibernateStore.
+ Use XMLPersistenceManager for LocalFileSystem Store and
HibernatePersistenceManager/JBossCachePersistenceManager for HibernateStore.
-->
<!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage -->
- <PersistenceManager
class="org.jboss.portal.cms.hibernate.state.HibernatePersistenceManager">
+ <PersistenceManager
class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
<param name="schemaObjectPrefix" value="Version"/>
<param name="JNDIName"
value="java:/SessionFactory"/>
<param name="externalBLOBs" value="false"/>
Added: trunk/cms/src/resources/test/standardidentity-config.xml
===================================================================
--- trunk/cms/src/resources/test/standardidentity-config.xml (rev
0)
+++ trunk/cms/src/resources/test/standardidentity-config.xml 2007-04-10 02:44:49 UTC (rev
6964)
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+
+<!--<!DOCTYPE identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
+
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <!--name of service and class for creating mbean-->
+
<service-name>portal:service=Module,type=LDAPConnectionContext</service-name>
+ <class>org.jboss.portal.identity.ldap.LDAPConnectionContext</class>
+ <config>
+ <option>
+ <name>host</name>
+ <value>jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>389</value>
+ </option>
+ <option>
+ <name>contextFactory</name>
+ <value>com.sun.jndi.ldap.LdapCtxFactory</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>jNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>DB</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=User</service-name>
+ <class>org.jboss.portal.identity.db.HibernateUserModuleImpl</class>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>sessionFactoryJNDIName</name>
+ <value>java:/SessionFactory</value>
+ </option>
+ <option>
+ <name>jNDIName</name>
+ <value>java:/portal/UserModule</value>
+ </option>
+ </config>
+ </module>
+
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Role</type>
+ <implementation>DB</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=Role</service-name>
+ <class>org.jboss.portal.identity.db.HibernateRoleModuleImpl</class>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>sessionFactoryJNDIName</name>
+ <value>java:/SessionFactory</value>
+ </option>
+ <option>
+ <name>jNDIName</name>
+ <value>java:/portal/RoleModule</value>
+ </option>
+ </config>
+ </module>
+
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Membership</type>
+ <implementation>DB</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=Membership</service-name>
+
<class>org.jboss.portal.identity.db.HibernateMembershipModuleImpl</class>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>sessionFactoryJNDIName</name>
+ <value>java:/SessionFactory</value>
+ </option>
+ <option>
+ <name>jNDIName</name>
+ <value>java:/portal/MembershipModule</value>
+ </option>
+ </config>
+ </module>
+ </modules>
+
+ <options>
+ <!--Common options section-->
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userCtxDN</name>
+ <value>ou=People,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>uidAttributeID</name>
+ <value>uid</value>
+ </option>
+ <option>
+ <name>passwordAttributeID</name>
+ <value>userPassword</value>
+ </option>
+ <option>
+ <name>roleCtxDN</name>
+ <value>ou=Roles,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>ridAttributeID</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>roleDisplayNameAttributeID</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>membershipAttributeID</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>membershipAttributeIsDN</name>
+ <value>true</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>userCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <value>top</value>
+ <value>uidObject</value>
+ <value>person</value>
+ <value>inetUser</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <!--<option>
+ <name>cn</name>
+ <value>none</value>
+ </option>-->
+ <option>
+ <name>sn</name>
+ <value>none</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>roleCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <value>top</value>
+ <value>groupOfNames</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <!--<option>
+ <name>cn</name>
+ <value>none</value>
+ </option>-->
+ <!--Some directory servers require this attribute to be valid DN-->
+ <!--For safety reasons point to the admin user here-->
+ <!--<option>
+ <name>member</name>
+
<value>uid=dummynonexistinguser,ou=People,dc=jboss,dc=org</value>
+ </option>-->
+ </option-group>
+ </options>
+</identity-configuration>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modified: trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-04-09
20:17:48 UTC (rev 6963)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-04-10
02:44:49 UTC (rev 6964)
@@ -58,10 +58,12 @@
<depends>portal:service=JAASLoginModule</depends>
<depends>portal:service=Hibernate,type=CMS</depends>
<depends optional-attribute-name="IdentityServiceController"
proxy-type="attribute">portal:service=Module,type=IdentityServiceController</depends>
+
<!-- Add this to activate publish/approval workflow integration -->
<!--
<depends optional-attribute-name="ApprovePublishWorkflow"
proxy-type="attribute">portal:service=ApprovePublish,type=Workflow</depends>
-->
+
<depends optional-attribute-name="StackFactory"
proxy-type="attribute">portal:service=InterceptorStackFactory,type=Cms</depends>
<attribute name="DoChecking">true</attribute>
<attribute
name="DefaultContentLocation">portal/cms/conf/default-content/default/</attribute>
@@ -101,7 +103,7 @@
<!-- HibernateStore: uses RDBMS + Hibernate for storage -->
<FileSystem
class="org.jboss.portal.cms.hibernate.HibernateStore">
<param name="schemaObjectPrefix"
value="CMSEntry"/>
- <param name="JNDIName"
value="java:portal/cms/CMSSessionFactory"/>
+ <param name="JNDIName"
value="java:/portal/cms/CMSSessionFactory"/>
</FileSystem>
<!-- LocalFileSystem: uses FileSystem for storage. -->
<!--<FileSystem
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
@@ -116,7 +118,7 @@
<!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage
-->
<PersistenceManager
class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
<param name="schemaObjectPrefix"
value="WSP"/>
- <param name="JNDIName"
value="java:portal/cms/CMSSessionFactory"/>
+ <param name="JNDIName"
value="java:/portal/cms/CMSSessionFactory"/>
<param name="externalBLOBs" value="false"/>
</PersistenceManager>
@@ -146,7 +148,7 @@
<!-- HibernateStore: uses RDBMS + Hibernate for storage -->
<FileSystem
class="org.jboss.portal.cms.hibernate.HibernateStore">
<param name="schemaObjectPrefix"
value="VersionEntry"/>
- <param name="JNDIName"
value="java:portal/cms/CMSSessionFactory"/>
+ <param name="JNDIName"
value="java:/portal/cms/CMSSessionFactory"/>
</FileSystem>
<!-- LocalFileSystem: uses FileSystem for storage. -->
@@ -164,7 +166,7 @@
<!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage
-->
<PersistenceManager
class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
<param name="schemaObjectPrefix"
value="Version"/>
- <param name="JNDIName"
value="java:portal/cms/CMSSessionFactory"/>
+ <param name="JNDIName"
value="java:/portal/cms/CMSSessionFactory"/>
<param name="externalBLOBs" value="false"/>
</PersistenceManager>
@@ -472,7 +474,9 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <attribute
name="JNDIName">java:portal/cms/CMSSessionFactory</attribute>
+ <attribute
name="JNDIName">java:/portal/cms/ACLInterceptor</attribute>
+ <attribute
name="CmsSessionFactory">java:/portal/cms/CMSSessionFactory</attribute>
+ <attribute
name="IdentitySessionFactory">java:/portal/IdentitySessionFactory</attribute>
<attribute name="DefaultPolicy">
<![CDATA[
<policy>
@@ -522,7 +526,8 @@
name="portal:service=Interceptor,type=Cms,name=ApprovalWorkflow"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
+ <xmbean/>
+ <attribute
name="JNDIName">java:/portal/cms/ApprovalWorkflowInterceptor</attribute>
<depends>portal:service=Hibernate,type=CMS</depends>
</mbean>
Modified: trunk/workflow/src/resources/portal-workflow-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/workflow/src/resources/portal-workflow-sar/META-INF/jboss-service.xml 2007-04-09
20:17:48 UTC (rev 6963)
+++ trunk/workflow/src/resources/portal-workflow-sar/META-INF/jboss-service.xml 2007-04-10
02:44:49 UTC (rev 6964)
@@ -119,9 +119,11 @@
approve/reject content publish requests
-->
<attribute name="ManagerRoles">Admin</attribute>
+ <attribute
name="JNDIName">java:portal/ApprovePublishWorkflow</attribute>
<!-- Now that a manager GUI is integrated..no need for email based manager
screen -->
- <!--attribute name="From">do-not-reply(a)jboss.com</attribute>
+<!--
+ <attribute name="From">do-not-reply(a)jboss.com</attribute>
<attribute name="Subject">Content Approval
Requested</attribute>
<attribute name="Body">
<![CDATA[
@@ -143,7 +145,7 @@
<a
href="http://localhost/workflow/reject?pId={7}&manager={8}">Reject</a>
]]>
- </attribute-->
- <attribute
name="JNDIName">java:portal/ApprovePublishWorkflow</attribute>
+ </attribute>
+-->
</mbean>
</server>