Author: tolusha
Date: 2010-06-16 10:20:41 -0400 (Wed, 16 Jun 2010)
New Revision: 2638
Removed:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/TesterSecurityManager.java
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
Log:
EXOJCR-756: move TestSecuritManager ot kernel project
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2010-06-16 14:19:46 UTC (rev 2637)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2010-06-16 14:20:41 UTC (rev 2638)
@@ -47,6 +47,11 @@
</dependency>
<dependency>
<groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.component.command</artifactId>
</dependency>
<dependency>
@@ -374,7 +379,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
-
<argLine>-Djava.security.manager=org.exoplatform.services.jcr.impl.util.TesterSecurityManager
-Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+
<argLine>-Djava.security.manager=org.exoplatform.commons.TestSecurityManager
-Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
<systemProperties>
<property>
<name>jcr.test.configuration.file</name>
@@ -570,7 +575,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- TAKE CARE TO UPDATE ALSO run-all PROFILE -->
-
<argLine>-Djava.security.manager=org.exoplatform.services.jcr.impl.util.TesterSecurityManager
-Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+
<argLine>-Djava.security.manager=org.exoplatform.commons.TestSecurityManager
-Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
<systemProperties>
<property>
<name>jcr.test.configuration.file</name>
@@ -643,7 +648,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- TAKE CARE TO UPDATE ALSO run-tck PROFILE -->
-
<argLine>-Djava.security.manager=org.exoplatform.services.jcr.impl.util.TesterSecurityManager
-Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+
<argLine>-Djava.security.manager=org.exoplatform.commons.TestSecurityManager
-Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
<systemProperties>
<property>
<name>jcr.test.configuration.file</name>
Deleted:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/TesterSecurityManager.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/TesterSecurityManager.java 2010-06-16
14:19:46 UTC (rev 2637)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/TesterSecurityManager.java 2010-06-16
14:20:41 UTC (rev 2638)
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.util;
-
-import java.security.Permission;
-
-/**
- * @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy
Bazko</a>
- * @version $Id$
- */
-public class TesterSecurityManager extends SecurityManager
-{
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void checkPermission(Permission perm)
- {
- try
- {
- super.checkPermission(perm);
- }
- catch (SecurityException se)
- {
- Throwable e = se;
-
- boolean srcCode = false;
- boolean testCode = false;
-
- while (e != null)
- {
- StackTraceElement[] traceElements = e.getStackTrace();
- for (int i = 0; i < traceElements.length; i++)
- {
- String className = traceElements[i].getClassName();
- String fileName = traceElements[i].getFileName();
-
- if (className.startsWith("org.exoplatform"))
- {
- // TesterSecurityManager should not be a part of source code
- if (fileName.equals("TesterSecurityManager.java"))
- {
- continue;
- }
-
- // hide Exception during JCR initialization
- if (fileName.equals("BaseStandaloneTest.java"))
- {
- return;
- }
-
- if (fileName.startsWith("Test") ||
fileName.endsWith("Test.java")
- || fileName.endsWith("TestBase.java") ||
fileName.equals("Probe.java")
- || fileName.equals("ExportBase.java"))
- {
- testCode = true;
- }
- else
- {
- srcCode = true;
- }
- }
- else if (className.startsWith("org.apache.jackrabbit.test"))
- {
- // Allow access to instances
- if (fileName.equals("RepositoryHelper.java"))
- {
- return;
- }
-
- if (fileName.endsWith("Test.java") ||
fileName.equals("JCRTestResult.java"))
- {
- testCode = true;
- }
- }
- else if
(className.startsWith("org.slf4j.impl.Log4jLoggerFactory"))
- {
- return;
- }
- }
-
- e = e.getCause();
- }
-
- // hide Exception if only test code exists
- if (!srcCode && testCode)
- {
- return;
- }
-
- throw se;
- }
- }
-}