Author: sohil.shah(a)jboss.com
Date: 2008-08-28 16:52:43 -0400 (Thu, 28 Aug 2008)
New Revision: 11764
Removed:
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/TestJackRabbitFirstHop.java
modules/cms/trunk/cms-jackrabbit/src/test/resources/jcr/fs-repository.xml
Modified:
modules/cms/trunk/cms-jackrabbit/pom.xml
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/commands/AbstractCommandTestCase.java
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/commands/TestSearch.java
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/SecureCommandTestCase.java
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestManageAccess.java
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestReadAccess.java
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestWriteAccess.java
modules/cms/trunk/cms-jackrabbit/src/test/resources/hibernates.xml
modules/cms/trunk/cms-jackrabbit/src/test/resources/jcr/repository.xml
Log:
fixing the security test cases
Modified: modules/cms/trunk/cms-jackrabbit/pom.xml
===================================================================
--- modules/cms/trunk/cms-jackrabbit/pom.xml 2008-08-28 18:54:44 UTC (rev 11763)
+++ modules/cms/trunk/cms-jackrabbit/pom.xml 2008-08-28 20:52:43 UTC (rev 11764)
@@ -270,30 +270,27 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <skip>false</skip>
- <excludes>
- <exclude>**/TestJackRabbitFirstHop.java</exclude>
+ <skip>false</skip>
+ <excludes>
<exclude>**/TestFileCreateFailed$1TestCommand.java</exclude>
- <exclude>**/TestSearch.java</exclude>
- <exclude>**/TestReadAccess.java</exclude>
- <exclude>**/TestWriteAccess.java</exclude>
- <exclude>**/TestManageAccess.java</exclude>
- </excludes>
- <!--
+ <exclude>**/TestSearch.java</exclude>
+ </excludes>
+ <!--
<includes>
- <include>**/TestSearch.java</include>
- </includes>
+ <include>**/TestReadAccess.java</include>
+ <include>**/TestWriteAccess.java</include>
+ <include>**/TestManageAccess.java</include>
+ </includes>
-->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <!-- put your configurations here -->
+ <configuration>
<compilerArgument>-nowarn</compilerArgument>
</configuration>
- </plugin>
+ </plugin>
</plugins>
</build>
</project>
Deleted:
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/TestJackRabbitFirstHop.java
===================================================================
---
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/TestJackRabbitFirstHop.java 2008-08-28
18:54:44 UTC (rev 11763)
+++
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/TestJackRabbitFirstHop.java 2008-08-28
20:52:43 UTC (rev 11764)
@@ -1,68 +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.cms.test;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-
-import javax.jcr.Repository;
-import javax.jcr.Session;
-import org.apache.jackrabbit.core.TransientRepository;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class TestJackRabbitFirstHop extends TestCase
-{
- /**
- *
- */
- private static Logger log = Logger.getLogger(TestJackRabbitFirstHop.class);
-
- /**
- *
- * @throws Exception
- */
- public void testFirstHop() throws Exception
- {
- Repository repository = new TransientRepository();
- Session session = repository.login();
- try
- {
- String user = session.getUserID();
- String name = repository.getDescriptor(Repository.REP_NAME_DESC);
- log.info("-------------------------------------------------------");
- log.info("Logged in as " + user + " to a " + name + "
repository.");
- log.info("-------------------------------------------------------");
- }
- finally
- {
- if(session != null)
- {
- session.logout();
- }
- }
- }
-}
Modified:
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/commands/AbstractCommandTestCase.java
===================================================================
---
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/commands/AbstractCommandTestCase.java 2008-08-28
18:54:44 UTC (rev 11763)
+++
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/commands/AbstractCommandTestCase.java 2008-08-28
20:52:43 UTC (rev 11764)
@@ -61,7 +61,7 @@
service = new JCRCMS();
service.setDoChecking(true);
- service.setDefaultLocale(Locale.ENGLISH.getDisplayName());
+ service.setDefaultLocale(Locale.ENGLISH.getLanguage());
service.setDefaultContentLocation("default-content/default");
service.setConfig(config.getDocumentElement());
Modified:
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/commands/TestSearch.java
===================================================================
---
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/commands/TestSearch.java 2008-08-28
18:54:44 UTC (rev 11763)
+++
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/commands/TestSearch.java 2008-08-28
20:52:43 UTC (rev 11764)
@@ -48,8 +48,7 @@
/** Tests retrieval of the version labeled LIVE. */
public void testFileGet() throws CMSException, QueryConversionException
- {
- /*
+ {
FederatedQuery query = new FederatedQuery("risks");
JCRQueryConverter converter = new JCRQueryConverter();
@@ -61,11 +60,6 @@
File file = (File)list.get(0);
assertEquals("/default/private/license.html", file.getBasePath());
file = (File)list.get(1);
- assertEquals("/default/support.html", file.getBasePath());
- */
-
- Command getCMD =
service.getCommandFactory().createFileGetCommand("/default/index.html",
Locale.ENGLISH);
- File newfile = (File)service.execute(getCMD);
- assertNotNull("/default/index.html Not Found", newfile);
+ assertEquals("/default/support.html", file.getBasePath());
}
}
Modified:
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/SecureCommandTestCase.java
===================================================================
---
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/SecureCommandTestCase.java 2008-08-28
18:54:44 UTC (rev 11763)
+++
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/SecureCommandTestCase.java 2008-08-28
20:52:43 UTC (rev 11764)
@@ -80,6 +80,8 @@
IdentityServiceController identityService =
((AuthorizationProviderImpl)aclInterceptor.getAuthorizationManager().getProvider()).
getIdentityServiceController();
this.userModule =
(UserModule)identityService.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+
+ JCRCMS.getUserInfo().set(null);
}
/**
Modified:
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestManageAccess.java
===================================================================
---
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestManageAccess.java 2008-08-28
18:54:44 UTC (rev 11763)
+++
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestManageAccess.java 2008-08-28
20:52:43 UTC (rev 11764)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.cms.test.security;
-import junit.framework.TestSuite;
import org.jboss.portal.cms.CMSException;
import org.jboss.portal.cms.Command;
import org.jboss.portal.cms.impl.FolderImpl;
@@ -47,15 +46,7 @@
{
}
- /**
- *
- *
- */
- public static TestSuite suite() throws Exception
- {
- return createTestSuite(TestManageAccess.class);
- }
-
+
/** @return */
private Folder getNewPublicFolder()
{
Modified:
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestReadAccess.java
===================================================================
---
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestReadAccess.java 2008-08-28
18:54:44 UTC (rev 11763)
+++
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestReadAccess.java 2008-08-28
20:52:43 UTC (rev 11764)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.cms.test.security;
-import junit.framework.TestSuite;
import org.jboss.portal.cms.CMSException;
import org.jboss.portal.cms.Command;
import org.jboss.portal.cms.model.File;
@@ -45,18 +44,9 @@
*/
public TestReadAccess()
{
- }
+ }
- /**
- *
- *
- */
- public static TestSuite suite() throws Exception
- {
- return createTestSuite(TestReadAccess.class);
- }
-
/**
*
*
Modified:
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestWriteAccess.java
===================================================================
---
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestWriteAccess.java 2008-08-28
18:54:44 UTC (rev 11763)
+++
modules/cms/trunk/cms-jackrabbit/src/test/java/org/jboss/portal/cms/test/security/TestWriteAccess.java 2008-08-28
20:52:43 UTC (rev 11764)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.cms.test.security;
-import junit.framework.TestSuite;
import org.jboss.portal.cms.CMSException;
import org.jboss.portal.cms.Command;
import org.jboss.portal.cms.impl.ContentImpl;
@@ -51,14 +50,6 @@
{
}
- /**
- *
- *
- */
- public static TestSuite suite() throws Exception
- {
- return createTestSuite(TestWriteAccess.class);
- }
/** @return */
private Folder getNewPublicFolder()
Modified: modules/cms/trunk/cms-jackrabbit/src/test/resources/hibernates.xml
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/test/resources/hibernates.xml 2008-08-28 18:54:44
UTC (rev 11763)
+++ modules/cms/trunk/cms-jackrabbit/src/test/resources/hibernates.xml 2008-08-28 20:52:43
UTC (rev 11764)
@@ -35,6 +35,10 @@
<name>hibernate.cache.use_query_cache</name>
<value>true</value>
</property>
+ <property>
+ <name>hbm2ddl.auto</name>
+ <value>create-drop</value>
+ </property>
</properties>
</configuration>
<!-- The hsqldb configuration -->
Deleted: modules/cms/trunk/cms-jackrabbit/src/test/resources/jcr/fs-repository.xml
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/test/resources/jcr/fs-repository.xml 2008-08-28
18:54:44 UTC (rev 11763)
+++ modules/cms/trunk/cms-jackrabbit/src/test/resources/jcr/fs-repository.xml 2008-08-28
20:52:43 UTC (rev 11764)
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<Repository>
- <FileSystem
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${rep.home}/repository"/>
- </FileSystem>
- <Security appName="Jackrabbit">
- <AccessManager
class="org.apache.jackrabbit.core.security.SimpleAccessManager"/>
- <LoginModule
class="org.apache.jackrabbit.core.security.SimpleLoginModule">
- <!-- anonymous user name ('anonymous' is the default value) -->
- <param name="anonid" value="anonymous"/>
- </LoginModule>
- </Security>
- <Workspaces rootPath="${rep.home}/workspaces"
defaultWorkspace="default"/>
- <Workspace name="${wsp.name}">
- <PersistenceManager
class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager"/>
- <FileSystem
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}s"/>
- </FileSystem>
- <SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="path"
value="${wsp.home}/index"/>
- <param name="textFilterClasses"
value="org.apache.jackrabbit.core.query.HTMLTextFilter"/>
- <param name="useCompoundFile" value="true"/>
- <param name="minMergeDocs" value="100"/>
- <param name="volatileIdleTime" value="3"/>
- <param name="maxMergeDocs" value="100000"/>
- <param name="mergeFactor" value="10"/>
- <param name="bufferSize" value="10"/>
- <param name="cacheSize" value="1000"/>
- <param name="forceConsistencyCheck"
value="false"/>
- <param name="autoRepair" value="true"/>
- </SearchIndex>
- </Workspace>
- <Versioning rootPath="${rep.home}/versions">
- <PersistenceManager
class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager"/>
- <FileSystem
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${rep.home}/versions"/>
- </FileSystem>
- </Versioning>
-</Repository>
Modified: modules/cms/trunk/cms-jackrabbit/src/test/resources/jcr/repository.xml
===================================================================
--- modules/cms/trunk/cms-jackrabbit/src/test/resources/jcr/repository.xml 2008-08-28
18:54:44 UTC (rev 11763)
+++ modules/cms/trunk/cms-jackrabbit/src/test/resources/jcr/repository.xml 2008-08-28
20:52:43 UTC (rev 11764)
@@ -26,19 +26,12 @@
| virtual file system where the repository stores global state (e.g. registered
namespaces, custom node types, etc.)
| Configure to use FS or RDBMS.
-->
-
- <!-- HibernateStore: uses RDBMS + Hibernate for storage -->
+
<FileSystem class="org.jboss.portal.cms.hibernate.HibernateStore">
<param name="schemaObjectPrefix" value="CMSEntry"/>
<param name="JNDIName" value="java:/SessionFactory"/>
</FileSystem>
-
- <!-- LocalFileSystem: uses FileSystem for storage. -->
- <!--
- <FileSystem
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${rep.home}/repository"/>
- </FileSystem>
- -->
+
<Security appName="Jackrabbit">
<AccessManager
class="org.apache.jackrabbit.core.security.SimpleAccessManager"/>
<LoginModule
class="org.apache.jackrabbit.core.security.SimpleLoginModule">
@@ -47,34 +40,17 @@
</LoginModule>
</Security>
<Workspaces rootPath="${rep.home}/workspaces"
defaultWorkspace="default"/>
- <Workspace name="${wsp.name}">
- <!-- Virtual file system of the workspace: Configure to use FS or RDBMS.
-->
-
- <!-- HibernateStore: uses RDBMS + Hibernate for storage -->
+ <Workspace name="${wsp.name}">
<FileSystem
class="org.jboss.portal.cms.hibernate.HibernateStore">
<param name="schemaObjectPrefix" value="CMSEntry"/>
<param name="JNDIName"
value="java:/SessionFactory"/>
- </FileSystem>
- <!-- LocalFileSystem: uses FileSystem for storage. -->
- <!--<FileSystem
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}"/>
- </FileSystem>-->
-
- <!--
- persistence manager of the workspace.
- Use XMLPersistenceManager for LocalFileSystem Store and
HibernatePersistenceManager/JBossCachePersistenceManager .
- -->
-
- <!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage -->
+ </FileSystem>
<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"/>
- </PersistenceManager>
-
- <!-- XMLPersistenceManager: uses FileSystem for storage -->
- <!--<PersistenceManager
class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager"/>-->
-
+ </PersistenceManager>
+ <!--
<SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path"
value="${wsp.home}/index"/>
<param name="textFilterClasses"
value="org.apache.jackrabbit.core.query.HTMLTextFilter"/>
@@ -87,40 +63,19 @@
<param name="cacheSize" value="1000"/>
<param name="forceConsistencyCheck"
value="false"/>
<param name="autoRepair" value="true"/>
- </SearchIndex>
- </Workspace>
- <Versioning rootPath="${rep.home}/versions">
- <!--
- Configures the filesystem to use for versioning for the respective persistence
manager
- Configure to use FS or RDBMS.
+ </SearchIndex>
-->
-
- <!-- HibernateStore: uses RDBMS + Hibernate for storage -->
+ </Workspace>
+ <Versioning rootPath="${rep.home}/versions">
<FileSystem
class="org.jboss.portal.cms.hibernate.HibernateStore">
<param name="schemaObjectPrefix"
value="VersionEntry"/>
<param name="JNDIName"
value="java:/SessionFactory"/>
</FileSystem>
-
- <!-- LocalFileSystem: uses FileSystem for storage. -->
- <!--
- <FileSystem
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${rep.home}/versions"/>
- </FileSystem>
- -->
-
- <!--
- Configures the persistence manager to be used for persisting version state.
- Use XMLPersistenceManager for LocalFileSystem Store and
HibernatePersistenceManager/JBossCachePersistenceManager for HibernateStore.
- -->
-
- <!-- 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:/SessionFactory"/>
<param name="externalBLOBs" value="false"/>
- </PersistenceManager>
-
- <!-- XMLPersistenceManager: uses FileSystem for storage -->
- <!--<PersistenceManager
class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager"/>-->
+ </PersistenceManager>
</Versioning>
</Repository>
\ No newline at end of file