You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by at...@apache.org on 2008/10/07 15:57:11 UTC
svn commit: r702484 - in
/portals/jetspeed-2/portal/branches/security-refactoring/components:
jetspeed-profiler/
jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/
jetspeed-profiler/src/test/resources/
jetspeed-security/src/main/java/org/apa...
Author: ate
Date: Tue Oct 7 06:57:11 2008
New Revision: 702484
URL: http://svn.apache.org/viewvc?rev=702484&view=rev
Log:
Fixes for security, profiler and statistics component testcases
Removed:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/src/test/resources/
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/pom.xml
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/util/test/AbstractSecurityTestcase.java
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-statistics/src/test/java/org/apache/jetspeed/statistics/TestStatistics.java
Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/pom.xml?rev=702484&r1=702483&r2=702484&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/pom.xml Tue Oct 7 06:57:11 2008
@@ -69,6 +69,21 @@
<!-- Test Dependencies -->
<dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>jetspeed-capability</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>jetspeed-registry</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>jetspeed-search</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<scope>test</scope>
@@ -113,12 +128,16 @@
<resources>
<resource>
<path>assembly</path>
- <include>profiler.xml,transaction.xml,cache.xml,security-*.xml,boot/datasource.xml</include>
+ <include>*.xml,boot/datasource.xml</include>
</resource>
<resource>
<path>db-ojb</path>
</resource>
<resource>
+ <path>conf/jetspeed</path>
+ <include>jetspeed.properties</include>
+ </resource>
+ <resource>
<path>seed/min</path>
<include>j2-seed.xml</include>
</resource>
Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java?rev=702484&r1=702483&r2=702484&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java Tue Oct 7 06:57:11 2008
@@ -16,6 +16,9 @@
*/
package org.apache.jetspeed.profiler;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
@@ -66,6 +69,38 @@
}
/**
+ * Override the location of the test properties by using the jetspeed properties found in the default package.
+ * Make sure to have your unit test copy in jetspeed properties into the class path root like:
+ <blockquote><pre>
+ <resource>
+ <path>conf/jetspeed</path>
+ <include>*.properties</include>
+ </resource>
+ </pre></blockquote>
+ */
+ @Override
+ protected Properties getInitProperties()
+ {
+ Properties props = new Properties();
+ try
+ {
+ InputStream is = this.getClass().getClassLoader().getResourceAsStream("jetspeed.properties");
+ if (is != null)
+ props.load(is);
+ } catch (FileNotFoundException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (IOException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return props;
+ }
+
+ /**
* Start the tests.
*
* @param args
@@ -124,7 +159,7 @@
public void firstTestSetup() throws Exception
{
System.out.println("firstTestSetup");
- JetspeedSerializer serializer = (JetspeedSerializer)scm.getComponent("serializer");
+ JetspeedSerializer serializer = (JetspeedSerializer)scm.getComponent("JetspeedSerializer");
serializer.deleteData();
serializer.importData(getBaseDir()+"target/test-classes/j2-seed.xml");
}
@@ -132,7 +167,7 @@
public void lastTestTeardown() throws Exception
{
System.out.println("lastTestTeardown");
- JetspeedSerializer serializer = (JetspeedSerializer)scm.getComponent("serializer");
+ JetspeedSerializer serializer = (JetspeedSerializer)scm.getComponent("JetspeedSerializer");
serializer.deleteData();
}
@@ -523,11 +558,14 @@
protected String[] getConfigurations()
{
- return new String[] { "profiler.xml", "transaction.xml", "serializer.xml", "security-providers.xml", "cache.xml",
- "security-managers.xml", "security-spi.xml", "security-spi-atn.xml", "security-spi-atz.xml", "security-atz.xml" };
+ return new String[] { "profiler.xml", "transaction.xml", "serializer.xml", "security-providers.xml", "cache.xml", "capabilities.xml", "registry.xml", "search.xml", "jetspeed-spring.xml",
+ "security-managers.xml", "security-spi.xml", "security-spi-atn.xml", "security-atz.xml", "static-bean-references.xml" };
}
-
+ protected String getBeanDefinitionFilterCategories()
+ {
+ return "security,serializer,registry,search,capabilities,profiler,dbSecurity,transaction,cache,noRequestContext,jdbcDS";
+ }
protected RuleCriterion addRuleCriterion(ProfilingRule rule,
String criterionName, String criterionType, String criterionValue,int fallbackOrder, int fallbackType)
Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/util/test/AbstractSecurityTestcase.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/util/test/AbstractSecurityTestcase.java?rev=702484&r1=702483&r2=702484&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/util/test/AbstractSecurityTestcase.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/util/test/AbstractSecurityTestcase.java Tue Oct 7 06:57:11 2008
@@ -114,7 +114,7 @@
protected String getBeanDefinitionFilterCategories()
{
- return "security,transaction,cache,jdbcDS";
+ return "security,dbSecurity,transaction,cache,jdbcDS";
}
protected String[] getConfigurations()
Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-statistics/src/test/java/org/apache/jetspeed/statistics/TestStatistics.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-statistics/src/test/java/org/apache/jetspeed/statistics/TestStatistics.java?rev=702484&r1=702483&r2=702484&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-statistics/src/test/java/org/apache/jetspeed/statistics/TestStatistics.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-statistics/src/test/java/org/apache/jetspeed/statistics/TestStatistics.java Tue Oct 7 06:57:11 2008
@@ -32,7 +32,6 @@
import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
import org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl;
import org.apache.jetspeed.request.RequestContext;
-import org.apache.jetspeed.security.impl.UserImpl;
import org.apache.jetspeed.statistics.impl.StatisticsQueryCriteriaImpl;
import com.mockrunner.mock.web.MockHttpServletRequest;
@@ -294,7 +293,7 @@
MockHttpServletResponse response = new MockHttpServletResponse();
MockHttpSession session = new MockHttpSession();
- request.setUserPrincipal(new UserImpl(USERNAME));
+ request.setUserPrincipal(new Principal(){ public String getName(){ return USERNAME; } });
request.setRemoteAddr("123.234.145.156");
request.setSession(session);
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org