[portal-commits] JBoss Portal SVN: r11806 - in modules/cms/trunk/cms-jackrabbit/src/test: resources and 1 other directory.
portal-commits at lists.jboss.org
portal-commits at lists.jboss.org
Thu Sep 4 09:31:47 EDT 2008
Author: thomas.heute at jboss.com
Date: 2008-09-04 09:31:47 -0400 (Thu, 04 Sep 2008)
New Revision: 11806
Added:
modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-beans-security-test.xml
Modified:
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestNewReadCommand.java
modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-unit.xml
Log:
Fix test case for JBoss Unit usage
Modified: modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestNewReadCommand.java
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestNewReadCommand.java 2008-09-04 12:33:28 UTC (rev 11805)
+++ modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestNewReadCommand.java 2008-09-04 13:31:47 UTC (rev 11806)
@@ -46,12 +46,16 @@
import org.jboss.portal.server.impl.invocation.JBossInterceptorStack;
import org.jboss.portal.cms.test.commands.AbstractCommandTestCase;
import org.jboss.portal.cms.test.commands.CMSInterceptorStackFactory;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.jboss.unit.mc.api.annotations.Bootstrap;
+import static org.jboss.unit.api.Assert.*;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
* @version $Revision$
*/
-public class TestNewReadCommand extends AbstractCommandTestCase
+ at Bootstrap(beanName = "TestCase", resourceName="/jboss-beans-security-test.xml")
+public class TestNewReadCommand extends SecureCommandTestCase
{
String rejectFolderPath = "/default/private";
String allowedFolderPath = "/default/images";
@@ -71,48 +75,6 @@
super();
}
-
- public static TestSuite suite() throws Exception
- {
- return createTestSuite(TestNewReadCommand.class);
- }
-
- /**
- *
- */
- public void setUp() throws Exception
- {
- //override the configration location to include workflow services
- this.configuration = "org/jboss/portal/cms/jboss-beans-security-test.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.userModule = (UserModule)identityService.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
- }
-
- /**
- *
- */
- public void tearDown() throws Exception
- {
- super.tearDown();
- this.userModule = null;
- }
-
-
/** @return */
protected ACLInterceptor getACLInterceptor() throws Exception
{
@@ -143,6 +105,7 @@
}
/** @throws Exception */
+ @Test
public void testAnonymous() throws Exception
{
try
Added: modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-beans-security-test.xml
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-beans-security-test.xml (rev 0)
+++ modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-beans-security-test.xml 2008-09-04 13:31:47 UTC (rev 11806)
@@ -0,0 +1,184 @@
+<?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="urn:jboss:bean-deployer:2.0">
+
+
+ <bean name="DataSourceConfig" class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <constructor factoryMethod="obtainConfig" factoryClass="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <parameter><inject bean="TestCase" property="datasources" state="Instantiated"/></parameter>
+ <parameter><inject bean="TestCase" property="dataSourceName" state="Instantiated"/></parameter>
+ </constructor>
+ </bean>
+
+ <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getConfig" factoryClass="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <parameter><inject bean="TestCase" property="dataSourceName" state="Instantiated"/></parameter>
+ <parameter><inject bean="TestCase" property="hibernateConfig" state="Instantiated"/></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="IdentityTestServiceLoader" class="org.jboss.portal.cms.test.TestServiceLoader">
+ <depends>JNDISupport</depends>
+ <depends>HibernateSupport</depends>
+ <depends>DataSourceSupport</depends>
+ </bean>
+
+ <bean name="IdentityContext" class="org.jboss.portal.identity.IdentityContext">
+ <constructor factoryMethod="loadServices">
+ <factory bean="IdentityTestServiceLoader"/>
+ <parameter class="java.lang.String"><inject bean="TestCase" property="standardIdentityConfig" state="Instantiated"/></parameter>
+ <parameter class="java.lang.String"><inject bean="TestCase" property="identityConfig" state="Instantiated"/></parameter>
+ </constructor>
+ </bean>
+
+ <bean name="UserModule" class="org.jboss.portal.identity.UserModule">
+ <constructor factoryMethod="getObject">
+ <factory bean="IdentityContext" />
+ <parameter>User</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="RoleModule" class="org.jboss.portal.identity.RoleModule">
+ <constructor factoryMethod="getObject">
+ <factory bean="IdentityContext" />
+ <parameter>Role</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="MembershipModule" class="org.jboss.portal.identity.MembershipModule">
+ <constructor factoryMethod="getObject">
+ <factory bean="IdentityContext" />
+ <parameter>Membership</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="UserProfileModule" class="org.jboss.portal.identity.UserProfileModule">
+ <constructor factoryMethod="getObject">
+ <factory bean="IdentityContext" />
+ <parameter>UserProfile</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="IdentityServiceController" class="org.jboss.portal.core.identity.service.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.cms.test.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>
+ <property name="cmsRootUserName">admin</property>
+ </bean>
+
+ <bean name="AuthorizationManager" class="org.jboss.portal.cms.test.security.TestAuthorizationManagerImpl">
+ <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>
+ <!--
+ permissions on the /default/support.html node used to test atomicity of copy/move operations
+ -->
+ <criteria name="path" value="/default/support.html">
+ <permission name="cms" action="manage">
+ <role name="User"/>
+ </permission>
+ </criteria>
+ </policy>
+ ]]>
+ </property>
+ </bean>
+</deployment>
Modified: modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-unit.xml
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-unit.xml 2008-09-04 12:33:28 UTC (rev 11805)
+++ modules/cms/trunk/cms-jackrabbit/src/test/resources/jboss-unit.xml 2008-09-04 13:31:47 UTC (rev 11806)
@@ -3,6 +3,7 @@
xmlns="urn:jboss:jboss-unit:1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
+ <!--
<pojo>
<parameter name="datasources" value="datasources.xml"/>
<parameter name="dataSourceName" value="hsqldb"/>
@@ -68,7 +69,7 @@
<class name="org.jboss.portal.cms.test.commands.TestSearch"/>
</test>
</pojo>
-
+ -->
<pojo>
<parameter name="datasources" value="datasources.xml"/>
<parameter name="dataSourceName" value="hsqldb"/>
@@ -88,7 +89,7 @@
<class name="org.jboss.portal.cms.test.security.TestNewReadCommand"/>
</test>
</pojo>
-
+ <!--
<pojo>
<parameter name="datasources" value="datasources.xml"/>
<parameter name="dataSourceName" value="hsqldb"/>
@@ -105,4 +106,5 @@
<class name="org.jboss.portal.cms.test.workflow.TestWorkflowEnvironment"/>
</test>
</pojo>
+ -->
</jboss-unit>
More information about the portal-commits
mailing list