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 rw...@apache.org on 2009/02/20 17:32:07 UTC
svn commit: r746287 [1/4] - in
/portals/jetspeed-2/portal/branches/JPA_BRANCH:
components/jetspeed-capability/src/test/java/org/apache/jetspeed/capabilities/
components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/
components/jetspeed-cm/sr...
Author: rwatler
Date: Fri Feb 20 16:32:05 2009
New Revision: 746287
URL: http://svn.apache.org/viewvc?rev=746287&view=rev
Log:
JPA/OJB Spring Configuration Update
------------------------------------------------------
- modify bean filtering logic to use logical expressions to parse j2:cat meta tags instead of simple CSV list of categories
- add 'ojb' and 'jpa' categories throughout test cases and spring configuration to support and select proper beans
- modify jpa profiler unit tests to use common spring configuration instead of project specific versions of same
- fix minor security jpa mapping problem for principal attributes
- update component configuration documentation example to use category logical expression
Added:
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/JetspeedBeanDefinitionFilterMatcher.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/test/java/org/apache/jetspeed/components/TestBeanDefinitionMatcher.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/resources/jndi.properties
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/jpa-jta.xml
Removed:
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/resources/jpa-profiler.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/resources/openjpa-profiler.xml
Modified:
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-capability/src/test/java/org/apache/jetspeed/capabilities/TestOpenJPACapability.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/JetspeedBeanDefinitionFilter.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/TestOpenJPA2PCTransactions.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPADatabasePageManager.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPATransactions.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureOpenJPADatabasePageManager.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecurePermissionsOpenJPADatabasePageManager.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/OpenJPADatabasePageManagerServer.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal-site/src/test/resources/cache-test.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/assembly/cache-test.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/java/JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestOpenJPAProfiler.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/resources/cache-test.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceEnabledSpringTestCase.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletentity/TestOpenJPAPortletEntityDAO.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletpreferences/TestOpenJPAPortletPreferencesProvider.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/AbstractRegistryTest.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestOpenJPAPortletRegistryDAO.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestOpenJPARegistryCache.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestPortletRegistryDAO.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestRegistryCache.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/direct/TestOpenJPARegistryDirectAll.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/cache-test.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/jpa/SecurityAttributeValueImpl.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/AbstractSecurityTestcase.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestOpenJPAGroupManager.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestOpenJPALoginModule.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestOpenJPAPermissionManager.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestOpenJPARdbmsPolicy.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestOpenJPARdbmsPolicyFolder.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestOpenJPARoleManager.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestOpenJPAUserManager.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/resources/cache-test.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/AbstractSecurityTestCase.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/TestOpenJPASSOComponent.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/TestOpenJPASSOManager.java
portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/test/resources/cache-test.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/boot/datasource.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/cache.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/capabilities.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/jetspeed-base.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/jetspeed-properties.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/jetspeed-spring.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/page-manager.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/profiler.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/registry.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/search.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/security-atn.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/security-atz.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/security-managers.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/security-providers.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/security-spi-atn.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/security-spi.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/serializer.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/sso.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/static-bean-references.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/transaction.xml
portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/conf/jetspeed/spring-filter.properties
portals/jetspeed-2/portal/branches/JPA_BRANCH/src/site/xdoc/spring-config.xml
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-capability/src/test/java/org/apache/jetspeed/capabilities/TestOpenJPACapability.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-capability/src/test/java/org/apache/jetspeed/capabilities/TestOpenJPACapability.java?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-capability/src/test/java/org/apache/jetspeed/capabilities/TestOpenJPACapability.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-capability/src/test/java/org/apache/jetspeed/capabilities/TestOpenJPACapability.java Fri Feb 20 16:32:05 2009
@@ -41,6 +41,14 @@
}
/* (non-Javadoc)
+ * @see org.apache.jetspeed.capabilities.TestCapabilities#getBeanDefinitionFilterCategories()
+ */
+ protected String getBeanDefinitionFilterCategories()
+ {
+ return "default,jpa,jndiDS";
+ }
+
+ /* (non-Javadoc)
* @see org.apache.jetspeed.capabilities.TestCapabilities#getConfigurations()
*/
protected String[] getConfigurations()
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/JetspeedBeanDefinitionFilter.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/JetspeedBeanDefinitionFilter.java?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/JetspeedBeanDefinitionFilter.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/JetspeedBeanDefinitionFilter.java Fri Feb 20 16:32:05 2009
@@ -54,11 +54,14 @@
* <p>
* Beans which needs to be matched against active categories must define a:<br/>
* <pre><meta key="j2:cat" value="<categories>"/></pre> meta value within the bean definition.
- * The bean categories value may contain multiple comma separated values.
+ * The bean categories value is parsed as a standard logical expression that can utilize the unary
+ * NOT operator, the binary AND and OR operators, and parentheses. Categories within the expression are
+ * substituted with TRUE and FALSE values depending on whether the category is defined for filtering
+ * or not, respectively. The bean matches if the whole expression evaluates to TRUE.
* </p>
* <p>
- * Unmatched beans (having a "j2:cat" meta value for which none were active) will not be registered in the
- * Spring beanFactory (see: {@link FilteringListableBeanFactory}. By not defining an id or name attribute,
+ * Unmatched beans (having a "j2:cat" meta value expression that evaluates to FALSE) will not be registered
+ * in the Spring beanFactory (see: {@link FilteringListableBeanFactory}. By not defining an id or name attribute,
* or a unique one not referenced by other beans with different (or no) set of categories, different versions
* of a similar bean can be defined within a single Spring configuration file.
* </p>
@@ -90,7 +93,8 @@
private String categoriesKey;
private Properties props;
- private Set categories;
+ private Set<String> categories;
+ private JetspeedBeanDefinitionFilterMatcher matcher;
private boolean initialized;
public JetspeedBeanDefinitionFilter()
@@ -103,7 +107,7 @@
setCategories(categories);
}
- public JetspeedBeanDefinitionFilter(Set categories)
+ public JetspeedBeanDefinitionFilter(Set<String> categories)
{
setCategories(categories);
}
@@ -136,8 +140,8 @@
// interpolation of property references within properties delimited by '${' and '}'
// based on org.apache.maven.plugin.resources.PropertiesUtils
- HashSet circularRefs = new HashSet();
- ArrayList visitedProps = new ArrayList();
+ HashSet<String> circularRefs = new HashSet<String>();
+ ArrayList<String> visitedProps = new ArrayList<String>();
for ( Enumeration n = props.propertyNames(); n.hasMoreElements(); )
{
String k = (String) n.nextElement();
@@ -218,22 +222,25 @@
{
if (categories != null && categories.length()>0)
{
- this.categories = new HashSet();
+ this.categories = new HashSet<String>();
StringTokenizer st = new StringTokenizer(categories, " ,;\t");
while (st.hasMoreTokens())
{
this.categories.add(st.nextToken());
}
+ this.matcher = new JetspeedBeanDefinitionFilterMatcher(this.categories);
}
else
{
this.categories = null;
+ this.matcher = null;
}
}
- public void setCategories(Set categories)
+ public void setCategories(Set<String> categories)
{
this.categories = categories;
+ this.matcher = ((this.categories != null) ? new JetspeedBeanDefinitionFilterMatcher(this.categories) : null);
}
public Properties getProperties()
@@ -252,9 +259,9 @@
{
initialized = true;
- if (props != null && categories == null)
+ if (props != null && this.categories == null)
{
- this.categories = new HashSet();
+ this.categories = new HashSet<String>();
String value = System.getProperty(SYSTEM_PROPERTY_CATEGORIES_KEY);
if (value == null && props != null)
{
@@ -284,27 +291,19 @@
}
if (this.categories == null)
{
- this.categories = new HashSet();
+ this.categories = new HashSet<String>();
}
+ this.matcher = new JetspeedBeanDefinitionFilterMatcher(this.categories);
}
}
public boolean match(BeanDefinition bd)
{
- String beanCategories = (String)bd.getAttribute(CATEGORY_META_KEY);
+ String beanCategoriesExpression = (String)bd.getAttribute(CATEGORY_META_KEY);
boolean matched = true;
- if (beanCategories != null)
+ if (beanCategoriesExpression != null)
{
- matched = false;
- StringTokenizer st = new StringTokenizer(beanCategories, " ,;\t");
- while (st.hasMoreTokens())
- {
- if (categories.contains(st.nextToken()))
- {
- matched = true;
- break;
- }
- }
+ matched = ((matcher != null) && matcher.match(beanCategoriesExpression));
}
return matched;
}
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/JetspeedBeanDefinitionFilterMatcher.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/JetspeedBeanDefinitionFilterMatcher.java?rev=746287&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/JetspeedBeanDefinitionFilterMatcher.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/JetspeedBeanDefinitionFilterMatcher.java Fri Feb 20 16:32:05 2009
@@ -0,0 +1,281 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jetspeed.components;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * The JetspeedBeanDefinitionFilterMatcher is constructed with a set of bean category names
+ * that are used to evaluate boolean expressions composed of category names and traditional
+ * AND, OR, and NOT logical operators. The expression is evaluated by replacing all category
+ * names that are specified in the set used to construct this matcher with TRUE. Other
+ * names are replaced with FALSE and the expression is then evaluated conventionally.
+ */
+public class JetspeedBeanDefinitionFilterMatcher
+{
+ private Set<String> categories;
+
+ /**
+ * Construct category expression matcher with specified category names
+ * set that will be used to match bean definitions against.
+ *
+ * @param categories set of category names enabled for this matcher.
+ */
+ public JetspeedBeanDefinitionFilterMatcher(Set<String> categories)
+ {
+ this.categories = categories;
+ }
+
+ /**
+ * Match a bean expression against the set of category names that were
+ * used to construct this matcher.
+ *
+ * @param categoriesMatchExpression bean expression to be matched.
+ * @return matching result.
+ */
+ public boolean match(String categoriesMatchExpression)
+ {
+ List<String> expression = parse(categoriesMatchExpression);
+ if (expression != null)
+ {
+ return evaluate(expression, 0, expression.size());
+ }
+ return false;
+ }
+
+ /**
+ * Lexicographically parse a specified expression string. This simple
+ * parser decomposes the input string into a list of identifiers or
+ * parentheses.
+ *
+ * @param expression expression string to parse.
+ * @return list of expression elements.
+ */
+ private List<String> parse(String expression)
+ {
+ List<String> parsedExpression = new ArrayList<String>();
+ int parseIndex = 0;
+ int parseLimit = expression.length();
+ do
+ {
+ while ((parseIndex < parseLimit) && Character.isWhitespace(expression.charAt(parseIndex)))
+ {
+ parseIndex++;
+ }
+ if (parseIndex < parseLimit)
+ {
+ char expressionChar = expression.charAt(parseIndex++);
+ if (Character.isLetter(expressionChar))
+ {
+ int parseIdentifierIndex = parseIndex-1;
+ while ((parseIndex < parseLimit) && Character.isLetterOrDigit(expression.charAt(parseIndex)))
+ {
+ parseIndex++;
+ }
+ parsedExpression.add(expression.substring(parseIdentifierIndex, parseIndex));
+ }
+ else if (expressionChar == '(')
+ {
+ parsedExpression.add("(");
+ }
+ else if (expressionChar == ')')
+ {
+ parsedExpression.add(")");
+ }
+ else
+ {
+ throw new RuntimeException("Unable to parse expression: \""+expression+"\" at position "+(parseIndex-1));
+ }
+ }
+ }
+ while (parseIndex < parseLimit);
+ return parsedExpression;
+ }
+
+ /**
+ * Parse and evaluate an expression parsed lexicographically. The specified
+ * expression elements are parsed and evaluated as a simple logical expression
+ * composed of category names and parenthesized subexpressions. Unary NOT and
+ * binary AND and OR operators are support. AND operators bind more tightly
+ * than OR operators and thus take precedence.
+ *
+ * @param expression expression to evaluate.
+ * @param startIndex start index of expression to evaluate.
+ * @param endIndex end index of expression to evaluate.
+ * @return value of evaluated expression.
+ */
+ private boolean evaluate(List<String> expression, int startIndex, int endIndex)
+ {
+ int evaluateIndex = startIndex;
+ if (evaluateIndex < endIndex)
+ {
+ // evaluate expression left term
+ int [] termEndIndex = new int[1];
+ boolean left = evaluateTerm(expression, evaluateIndex, endIndex, termEndIndex);
+ evaluateIndex = termEndIndex[0];
+ // evaluate binary expression operator and right term pairs
+ while (evaluateIndex < endIndex)
+ {
+ // evaluate operator
+ String expressionElement = expression.get(evaluateIndex);
+ String operator;
+ if (expressionElement.equalsIgnoreCase("AND") || expressionElement.equalsIgnoreCase("OR"))
+ {
+ operator = expressionElement;
+ evaluateIndex++;
+ if (evaluateIndex < endIndex)
+ {
+ expressionElement = expression.get(evaluateIndex);
+ }
+ else
+ {
+ throw new RuntimeException("Unable to parse expression: "+expression);
+ }
+ }
+ else
+ {
+ throw new RuntimeException("Unable to parse expression: "+expression);
+ }
+ // evaluate right term
+ boolean right;
+ if (operator.equalsIgnoreCase("AND"))
+ {
+ // evaluate right expression term
+ right = evaluateTerm(expression, evaluateIndex, endIndex, termEndIndex);
+ evaluateIndex = termEndIndex[0];
+ // apply 'and' operator to left and right
+ left = left && right;
+ }
+ else if (operator.equalsIgnoreCase("OR"))
+ {
+ // evaluate remaining expression
+ right = evaluate(expression, evaluateIndex, endIndex);
+ evaluateIndex = endIndex;
+ // apply 'or' operator to left and right
+ left = left || right;
+ }
+ }
+ // return left value as expression value
+ return left;
+ }
+ else
+ {
+ throw new RuntimeException("Unable to parse expression: "+expression);
+ }
+ }
+
+ /**
+ * Parse and evaluate a single expression term. A term is optionally preceded
+ * by a unary NOT operator and is composed of either a single category name or
+ * a parenthesized subexpression. Category names that appear in the categories
+ * set specified as part of this matcher evaluate as TRUE. All other category
+ * names evaluate as FALSE.
+ *
+ * @param expression expression to evaluate.
+ * @param startIndex start index of term to evaluate.
+ * @param endIndex end index of expression to evaluate.
+ * @param termEndIndex returned end index of evaluated term.
+ * @return value of evaluated term.
+ */
+ private boolean evaluateTerm(List<String> expression, int startIndex, int endIndex, int [] termEndIndex)
+ {
+ int evaluateIndex = startIndex;
+ if (evaluateIndex < endIndex)
+ {
+ boolean term;
+ // evaluate term not unary operator
+ boolean invertTerm = false;
+ String expressionElement = expression.get(evaluateIndex);
+ while (expression.get(evaluateIndex).equalsIgnoreCase("NOT"))
+ {
+ invertTerm = !invertTerm;
+ evaluateIndex++;
+ if (evaluateIndex < endIndex)
+ {
+ expressionElement = expression.get(evaluateIndex);
+ }
+ else
+ {
+ throw new RuntimeException("Unable to parse expression: "+expression);
+ }
+ }
+ // evaluate expression term
+ if (expressionElement.equals("("))
+ {
+ int closeIndex = indexOfClose(expression, evaluateIndex, endIndex);
+ term = evaluate(expression, evaluateIndex+1, closeIndex);
+ evaluateIndex = closeIndex+1;
+ }
+ else if (!expressionElement.equalsIgnoreCase("AND") && !expressionElement.equalsIgnoreCase("OR") &&
+ !expressionElement.equalsIgnoreCase("NOT") && !expressionElement.equalsIgnoreCase(")"))
+ {
+ term = categories.contains(expressionElement);
+ evaluateIndex++;
+ }
+ else
+ {
+ throw new RuntimeException("Unable to parse expression: "+expression);
+ }
+ // invert term value if necessary and return along with evaluation index
+ termEndIndex[0] = evaluateIndex;
+ if (invertTerm)
+ {
+ term = !term;
+ }
+ return term;
+ }
+ else
+ {
+ throw new RuntimeException("Unable to parse expression: "+expression);
+ }
+ }
+
+ /**
+ * Search expression for next close paren at same nested depth as open
+ * paren found at specified index.
+ *
+ * @param expression expression to search.
+ * @param openIndex open paren index.
+ * @param endIndex end index of expression to search.
+ * @return index of close paren.
+ */
+ private static int indexOfClose(List<String> expression, int openIndex, int endIndex)
+ {
+ // find next close paren at same nested depth
+ int nestedDepth = 1;
+ int parseIndex = openIndex+1;
+ while (parseIndex < endIndex)
+ {
+ if (expression.get(parseIndex).equals(")"))
+ {
+ if (--nestedDepth == 0)
+ {
+ return parseIndex;
+ }
+ }
+ else if (expression.get(parseIndex).equals("("))
+ {
+ nestedDepth++;
+ }
+ parseIndex++;
+ }
+ throw new RuntimeException("Unmatched parens found in expression: "+expression);
+ }
+}
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/test/java/org/apache/jetspeed/components/TestBeanDefinitionMatcher.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/test/java/org/apache/jetspeed/components/TestBeanDefinitionMatcher.java?rev=746287&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/test/java/org/apache/jetspeed/components/TestBeanDefinitionMatcher.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-cm/src/test/java/org/apache/jetspeed/components/TestBeanDefinitionMatcher.java Fri Feb 20 16:32:05 2009
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jetspeed.components;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.jetspeed.test.JetspeedTestCase;
+
+public class TestBeanDefinitionMatcher extends JetspeedTestCase
+{
+ /**
+ * Test JetspeedBeanDefinitionFilterMatcher expression matching
+ */
+ public void testMatcher()
+ {
+ // construct matcher with categories
+ Set<String> testCategories = new HashSet<String>();
+ testCategories.add("x");
+ testCategories.add("yy");
+ testCategories.add("zzz0");
+ JetspeedBeanDefinitionFilterMatcher matcher = new JetspeedBeanDefinitionFilterMatcher(testCategories);
+
+ // validate matching expressions
+ assertTrue(matcher.match("x"));
+ assertTrue(matcher.match("zzz0"));
+ assertTrue(matcher.match("x and yy"));
+ assertTrue(matcher.match("x and yy and not a"));
+ assertFalse(matcher.match("a or x and b"));
+ assertTrue(matcher.match("(yy)"));
+ assertTrue(matcher.match("(((yy)))"));
+ assertFalse(matcher.match("(a)"));
+ assertTrue(matcher.match("(x or a)"));
+ assertTrue(matcher.match("(not a and b or zzz0)"));
+ assertTrue(matcher.match("(not a and (b or zzz0))"));
+ assertFalse(matcher.match("(not a and (b or c))"));
+ assertTrue(matcher.match("(not a and not (b or c))"));
+ assertTrue(matcher.match("not (a or (b and x) and zzz0)"));
+ assertTrue(matcher.match("x and yy or a and b"));
+ assertFalse(matcher.match("x and (a or b or c)"));
+ assertTrue(matcher.match("x AND ((a OR b OR c) OR yy)"));
+ }
+}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/TestOpenJPA2PCTransactions.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/TestOpenJPA2PCTransactions.java?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/TestOpenJPA2PCTransactions.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/TestOpenJPA2PCTransactions.java Fri Feb 20 16:32:05 2009
@@ -50,6 +50,14 @@
}
/* (non-Javadoc)
+ * @see org.apache.jetspeed.page.TestDatabasePageManager#getBeanDefinitionFilterCategories()
+ */
+ protected String getBeanDefinitionFilterCategories()
+ {
+ return "default,jpa,jndiDS";
+ }
+
+ /* (non-Javadoc)
* @see org.apache.jetspeed.page.TestDatabasePageManager#getConfigurations()
*/
protected String[] getConfigurations()
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPADatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPADatabasePageManager.java?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPADatabasePageManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPADatabasePageManager.java Fri Feb 20 16:32:05 2009
@@ -42,6 +42,14 @@
}
/* (non-Javadoc)
+ * @see org.apache.jetspeed.page.TestDatabasePageManager#getBeanDefinitionFilterCategories()
+ */
+ protected String getBeanDefinitionFilterCategories()
+ {
+ return "default,jpa,jndiDS";
+ }
+
+ /* (non-Javadoc)
* @see org.apache.jetspeed.page.TestDatabasePageManager#getConfigurations()
*/
protected String[] getConfigurations()
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPATransactions.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPATransactions.java?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPATransactions.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPATransactions.java Fri Feb 20 16:32:05 2009
@@ -44,6 +44,14 @@
}
/* (non-Javadoc)
+ * @see org.apache.jetspeed.page.TestDatabasePageManager#getBeanDefinitionFilterCategories()
+ */
+ protected String getBeanDefinitionFilterCategories()
+ {
+ return "default,jpa,jndiDS";
+ }
+
+ /* (non-Javadoc)
* @see org.apache.jetspeed.page.TestDatabasePageManager#getConfigurations()
*/
protected String[] getConfigurations()
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureOpenJPADatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureOpenJPADatabasePageManager.java?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureOpenJPADatabasePageManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureOpenJPADatabasePageManager.java Fri Feb 20 16:32:05 2009
@@ -44,6 +44,14 @@
}
/* (non-Javadoc)
+ * @see org.apache.jetspeed.page.TestDatabasePageManager#getBeanDefinitionFilterCategories()
+ */
+ protected String getBeanDefinitionFilterCategories()
+ {
+ return "default,jpa,jndiDS";
+ }
+
+ /* (non-Javadoc)
* @see org.apache.jetspeed.page.TestDatabasePageManager#getConfigurations()
*/
protected String[] getConfigurations()
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecurePermissionsOpenJPADatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecurePermissionsOpenJPADatabasePageManager.java?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecurePermissionsOpenJPADatabasePageManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecurePermissionsOpenJPADatabasePageManager.java Fri Feb 20 16:32:05 2009
@@ -44,6 +44,14 @@
}
/* (non-Javadoc)
+ * @see org.apache.jetspeed.page.TestDatabasePageManager#getBeanDefinitionFilterCategories()
+ */
+ protected String getBeanDefinitionFilterCategories()
+ {
+ return "default,jpa,jndiDS";
+ }
+
+ /* (non-Javadoc)
* @see org.apache.jetspeed.page.TestDatabasePageManager#getConfigurations()
*/
protected String[] getConfigurations()
@@ -78,4 +86,4 @@
{
junit.awtui.TestRunner.main(new String[]{TestSecurePermissionsOpenJPADatabasePageManager.class.getName()});
}
-}
\ No newline at end of file
+}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java Fri Feb 20 16:32:05 2009
@@ -70,7 +70,7 @@
// setup jetspeed test datasource and component manager
jndiDS = new JetspeedTestJNDIComponent();
jndiDS.setup();
- final JetspeedBeanDefinitionFilter beanDefinitionFilter = new JetspeedBeanDefinitionFilter("default,jdbcDS");
+ final JetspeedBeanDefinitionFilter beanDefinitionFilter = new JetspeedBeanDefinitionFilter(getConfigurationCategories());
final String [] bootConfigurations = new String[]{"boot/datasource.xml"};
baseDir = System.getProperty("basedir");
if ((baseDir == null) || (baseDir.length() == 0))
@@ -106,6 +106,16 @@
}
/**
+ * Get Spring page manager server configuration categories.
+ *
+ * @return server configuration categories.
+ */
+ protected String getConfigurationCategories()
+ {
+ return "default,ojb,jdbcDS";
+ }
+
+ /**
* Start conversational page manager transaction for current thread.
*/
protected void startConversationalTxn()
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/OpenJPADatabasePageManagerServer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/OpenJPADatabasePageManagerServer.java?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/OpenJPADatabasePageManagerServer.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/OpenJPADatabasePageManagerServer.java Fri Feb 20 16:32:05 2009
@@ -37,6 +37,14 @@
}
/* (non-Javadoc)
+ * @see org.apache.jetspeed.page.cache.DatabasePageManagerServer#getConfigurationCategories()
+ */
+ protected String getConfigurationCategories()
+ {
+ return "default,jpa,jndiDS";
+ }
+
+ /* (non-Javadoc)
* @see org.apache.jetspeed.page.cache.DatabasePageManagerServer#startConversationalTxn()
*/
protected void startConversationalTxn()
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal-site/src/test/resources/cache-test.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal-site/src/test/resources/cache-test.xml?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal-site/src/test/resources/cache-test.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal-site/src/test/resources/cache-test.xml Fri Feb 20 16:32:05 2009
@@ -20,20 +20,20 @@
<!-- Cache Manager -->
<bean id="cacheManagerConfig" class="org.apache.jetspeed.cache.impl.EhCacheConfigResource">
- <meta key="j2:cat" value="default,cache"/>
+ <meta key="j2:cat" value="default or cache"/>
<property name="defaultConfigResource" value="ehcache.xml"/>
<property name="test" value="true"/>
</bean>
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
- <meta key="j2:cat" value="default,cache"/>
+ <meta key="j2:cat" value="default or cache"/>
<property name="configLocation" ref="cacheManagerConfig"/>
</bean>
<!-- Page File Cache -->
<bean id="PageFileCache" class="org.apache.jetspeed.cache.file.FileCache" init-method="startFileScanner"
destroy-method="stopFileScanner">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<!-- Internal cache -->
<constructor-arg index="0">
<ref bean="internalPageFileCache" />
@@ -47,7 +47,7 @@
<!-- Factory bean used to instantiate a EHCache with the specified name (and corresponding
configuration in cacheManager.xml -->
<bean id="ehPortletContentCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -55,7 +55,7 @@
</bean>
<bean id="ContentCacheKeyGenerator" class="org.apache.jetspeed.cache.impl.JetspeedCacheKeyGenerator">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<!-- Keys are order specific in the list:
where username == the user principal name of the current user
pipeline == the name of the active pipeline for the current request (portal | desktop)
@@ -76,7 +76,7 @@
</bean>
<bean id="portletContentCache" class="org.apache.jetspeed.cache.impl.EhPortletContentCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg index="0">
<ref bean="ehPortletContentCache" />
</constructor-arg>
@@ -89,7 +89,7 @@
</bean>
<bean id="ehDecorationContentCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -97,7 +97,7 @@
</bean>
<bean id="decorationContentCache" class="org.apache.jetspeed.cache.impl.EhDecorationContentCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg index="0">
<ref bean="ehDecorationContentCache" />
</constructor-arg>
@@ -110,7 +110,7 @@
</bean>
<bean id="ehDecorationConfigurationCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -118,14 +118,14 @@
</bean>
<bean id="decorationConfigurationCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehDesktopContentCache" />
</constructor-arg>
</bean>
<bean id="ehPreferencesCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -133,14 +133,14 @@
</bean>
<bean id="preferencesCache" class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehPreferencesCache" />
</constructor-arg>
</bean>
<bean id="ehPortletApplicationOidCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -148,7 +148,7 @@
</bean>
<bean id="ehPortletApplicationNameCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -156,7 +156,7 @@
</bean>
<bean id="ehDesktopContentCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -164,28 +164,28 @@
</bean>
<bean id="portletApplicationOidCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehPortletApplicationOidCache" />
</constructor-arg>
</bean>
<bean id="portletApplicationNameCache" class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehPortletApplicationNameCache" />
</constructor-arg>
</bean>
<bean id="desktopContentCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehDesktopContentCache" />
</constructor-arg>
</bean>
<bean id="ehPortletDefinitionOidCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -193,7 +193,7 @@
</bean>
<bean id="ehPortletDefinitionNameCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -202,14 +202,14 @@
<bean id="portletDefinitionOidCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehPortletDefinitionOidCache" />
</constructor-arg>
</bean>
<bean id="portletDefinitionNameCache" class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehPortletDefinitionNameCache" />
</constructor-arg>
@@ -219,7 +219,7 @@
<!-- Factory bean used to instantiate a EHCache with the specified name (and corresponding
configuration in cacheManager.xml -->
<bean id="ehActiveAuthenticationCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -227,14 +227,14 @@
</bean>
<bean id="activeAuthenticationCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg index="0">
<ref bean="ehActiveAuthenticationCache" />
</constructor-arg>
</bean>
<bean id="ehPortletWindowCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -242,14 +242,14 @@
</bean>
<bean id="portletWindowCache" class="org.apache.jetspeed.cache.impl.EhPortletWindowCache">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg index="0">
<ref bean="ehPortletWindowCache" />
</constructor-arg>
</bean>
<bean id="ehInternalPageFileCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -257,14 +257,14 @@
</bean>
<bean id="internalPageFileCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehInternalPageFileCache" />
</constructor-arg>
</bean>
<bean id="ehInternalImportPageFileCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -272,7 +272,7 @@
</bean>
<bean id="internalImportPageFileCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehInternalImportPageFileCache" />
</constructor-arg>
@@ -280,24 +280,24 @@
<!-- Page Manager Caches -->
<bean id="ehPageManagerOidCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache"/>
+ <meta key="j2:cat" value="default or cache"/>
<property name="cacheManager" ref="cacheManager"/>
<property name="cacheName" value="pageManagerOidCache"/>
</bean>
<bean id="ehPageManagerPathCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache"/>
+ <meta key="j2:cat" value="default or cache"/>
<property name="cacheManager" ref="cacheManager"/>
<property name="cacheName" value="pageManagerPathCache"/>
</bean>
<bean id="pageManagerOidCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache"/>
+ <meta key="j2:cat" value="default or cache"/>
<constructor-arg><ref bean="ehPageManagerOidCache"/></constructor-arg>
</bean>
<bean id="pageManagerPathCache" class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl">
- <meta key="j2:cat" value="default,cache"/>
+ <meta key="j2:cat" value="default or cache"/>
<constructor-arg><ref bean="ehPageManagerPathCache"/></constructor-arg>
</bean>
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/assembly/cache-test.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/assembly/cache-test.xml?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/assembly/cache-test.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/assembly/cache-test.xml Fri Feb 20 16:32:05 2009
@@ -20,20 +20,20 @@
<!-- Cache Manager -->
<bean id="cacheManagerConfig" class="org.apache.jetspeed.cache.impl.EhCacheConfigResource">
- <meta key="j2:cat" value="default,cache"/>
+ <meta key="j2:cat" value="default or cache"/>
<property name="defaultConfigResource" value="ehcache.xml"/>
<property name="test" value="true"/>
</bean>
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
- <meta key="j2:cat" value="default,cache"/>
+ <meta key="j2:cat" value="default or cache"/>
<property name="configLocation" ref="cacheManagerConfig"/>
</bean>
<!-- Page File Cache -->
<bean id="PageFileCache" class="org.apache.jetspeed.cache.file.FileCache" init-method="startFileScanner"
destroy-method="stopFileScanner">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<!-- Internal cache -->
<constructor-arg index="0">
<ref bean="internalPageFileCache" />
@@ -47,7 +47,7 @@
<!-- Factory bean used to instantiate a EHCache with the specified name (and corresponding
configuration in cacheManager.xml -->
<bean id="ehPortletContentCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -55,7 +55,7 @@
</bean>
<bean id="ContentCacheKeyGenerator" class="org.apache.jetspeed.cache.impl.JetspeedCacheKeyGenerator">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<!-- Keys are order specific in the list:
where username == the user principal name of the current user
pipeline == the name of the active pipeline for the current request (portal | desktop)
@@ -76,7 +76,7 @@
</bean>
<bean id="portletContentCache" class="org.apache.jetspeed.cache.impl.EhPortletContentCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg index="0">
<ref bean="ehPortletContentCache" />
</constructor-arg>
@@ -89,7 +89,7 @@
</bean>
<bean id="ehDecorationContentCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -97,7 +97,7 @@
</bean>
<bean id="decorationContentCache" class="org.apache.jetspeed.cache.impl.EhDecorationContentCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg index="0">
<ref bean="ehDecorationContentCache" />
</constructor-arg>
@@ -110,7 +110,7 @@
</bean>
<bean id="ehDecorationConfigurationCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -118,14 +118,14 @@
</bean>
<bean id="decorationConfigurationCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehDesktopContentCache" />
</constructor-arg>
</bean>
<bean id="ehPreferencesCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -133,14 +133,14 @@
</bean>
<bean id="preferencesCache" class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehPreferencesCache" />
</constructor-arg>
</bean>
<bean id="ehPortletApplicationOidCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -148,7 +148,7 @@
</bean>
<bean id="ehPortletApplicationNameCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -156,7 +156,7 @@
</bean>
<bean id="ehDesktopContentCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -164,28 +164,28 @@
</bean>
<bean id="portletApplicationOidCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehPortletApplicationOidCache" />
</constructor-arg>
</bean>
<bean id="portletApplicationNameCache" class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehPortletApplicationNameCache" />
</constructor-arg>
</bean>
<bean id="desktopContentCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehDesktopContentCache" />
</constructor-arg>
</bean>
<bean id="ehPortletDefinitionOidCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -193,7 +193,7 @@
</bean>
<bean id="ehPortletDefinitionNameCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -202,14 +202,14 @@
<bean id="portletDefinitionOidCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehPortletDefinitionOidCache" />
</constructor-arg>
</bean>
<bean id="portletDefinitionNameCache" class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehPortletDefinitionNameCache" />
</constructor-arg>
@@ -219,7 +219,7 @@
<!-- Factory bean used to instantiate a EHCache with the specified name (and corresponding
configuration in cacheManager.xml -->
<bean id="ehActiveAuthenticationCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -227,14 +227,14 @@
</bean>
<bean id="activeAuthenticationCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg index="0">
<ref bean="ehActiveAuthenticationCache" />
</constructor-arg>
</bean>
<bean id="ehPortletWindowCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -242,14 +242,14 @@
</bean>
<bean id="portletWindowCache" class="org.apache.jetspeed.cache.impl.EhPortletWindowCache">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg index="0">
<ref bean="ehPortletWindowCache" />
</constructor-arg>
</bean>
<bean id="ehInternalPageFileCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -257,14 +257,14 @@
</bean>
<bean id="internalPageFileCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehInternalPageFileCache" />
</constructor-arg>
</bean>
<bean id="ehInternalImportPageFileCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<property name="cacheManager">
<ref local="cacheManager" />
</property>
@@ -272,7 +272,7 @@
</bean>
<bean id="internalImportPageFileCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache" />
+ <meta key="j2:cat" value="default or cache" />
<constructor-arg>
<ref bean="ehInternalImportPageFileCache" />
</constructor-arg>
@@ -280,24 +280,24 @@
<!-- Page Manager Caches -->
<bean id="ehPageManagerOidCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache"/>
+ <meta key="j2:cat" value="default or cache"/>
<property name="cacheManager" ref="cacheManager"/>
<property name="cacheName" value="pageManagerOidCache"/>
</bean>
<bean id="ehPageManagerPathCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <meta key="j2:cat" value="default,cache"/>
+ <meta key="j2:cat" value="default or cache"/>
<property name="cacheManager" ref="cacheManager"/>
<property name="cacheName" value="pageManagerPathCache"/>
</bean>
<bean id="pageManagerOidCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
- <meta key="j2:cat" value="default,cache"/>
+ <meta key="j2:cat" value="default or cache"/>
<constructor-arg><ref bean="ehPageManagerOidCache"/></constructor-arg>
</bean>
<bean id="pageManagerPathCache" class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl">
- <meta key="j2:cat" value="default,cache"/>
+ <meta key="j2:cat" value="default or cache"/>
<constructor-arg><ref bean="ehPageManagerPathCache"/></constructor-arg>
</bean>
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/java/JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/java/JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/java/JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/java/JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml Fri Feb 20 16:32:05 2009
@@ -21,7 +21,7 @@
<bean id="org.apache.jetspeed.security.spi.JetspeedPrincipalManagerProvider"
class="org.apache.jetspeed.security.impl.JetspeedPrincipalManagerProviderImpl">
- <meta key="j2:cat" value="default,security" />
+ <meta key="j2:cat" value="default or security" />
<constructor-arg index="0">
<set>
<ref bean="org.apache.jetspeed.security.UserManager" />
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/resources/jndi.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/resources/jndi.properties?rev=746287&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/resources/jndi.properties (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/resources/jndi.properties Fri Feb 20 16:32:05 2009
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# ------------------------------------------------------------------------
+#
+# JNDI Naming Configuration
+#
+# $Id: $
+#
+# ------------------------------------------------------------------------
+
+java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory
+java.naming.factory.url.pkgs=org.apache.naming
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml Fri Feb 20 16:32:05 2009
@@ -21,7 +21,7 @@
<bean id="org.apache.jetspeed.security.spi.JetspeedPrincipalManagerProvider"
class="org.apache.jetspeed.security.impl.JetspeedPrincipalManagerProviderImpl">
- <meta key="j2:cat" value="default,security" />
+ <meta key="j2:cat" value="default or security" />
<constructor-arg index="0">
<set>
<ref bean="org.apache.jetspeed.security.UserManager" />
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestOpenJPAProfiler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestOpenJPAProfiler.java?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestOpenJPAProfiler.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestOpenJPAProfiler.java Fri Feb 20 16:32:05 2009
@@ -18,9 +18,12 @@
import junit.framework.Test;
+import org.apache.jetspeed.capabilities.jpa.CapabilitiesManagerContext;
+import org.apache.jetspeed.components.portletregistry.jpa.RegistryManagerContext;
import org.apache.jetspeed.profiler.jpa.ProfilerManagerContext;
import org.apache.jetspeed.profiler.rules.jpa.RoleFallbackProfilingRule;
import org.apache.jetspeed.profiler.rules.jpa.StandardProfilingRule;
+import org.apache.jetspeed.security.spi.jpa.SecurityManagerContext;
/**
* TestOpenJPAProfiler
@@ -30,7 +33,10 @@
*/
public class TestOpenJPAProfiler extends TestProfiler
{
- private ProfilerManagerContext context;
+ private ProfilerManagerContext profilerContext;
+ private SecurityManagerContext securityContext;
+ private RegistryManagerContext registryContext;
+ private CapabilitiesManagerContext capabilitiesContext;
/**
* Define ordered test case test methods.
@@ -43,22 +49,11 @@
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.profiler.TestProfiler#getConfigurations()
- */
- protected String[] getConfigurations()
- {
- return new String[] {"openjpa-profiler.xml", "transaction.xml", "serializer.xml", "security-providers.xml", "cache-test.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",
- "JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml" };
- }
-
- /* (non-Javadoc)
* @see org.apache.jetspeed.profiler.TestProfiler#getBeanDefinitionFilterCategories()
*/
protected String getBeanDefinitionFilterCategories()
{
- return "security,serializer,registry,search,capabilities,dbSecurity,transaction,cache,noRequestContext,jdbcDS";
+ return "jpa,security,serializer,registry,search,capabilities,profiler,dbSecurity,transaction,cache,noRequestContext,jndiDS";
}
/* (non-Javadoc)
@@ -66,8 +61,11 @@
*/
protected void startConversationalTxn()
{
- // create scoped context bean for thread transaction
- context = (ProfilerManagerContext)scm.createPrototypeComponent("profilerManagerContext");
+ // create scoped profilerContext beans for thread transaction
+ capabilitiesContext = (CapabilitiesManagerContext)scm.createPrototypeComponent("capabilitiesManagerContext");
+ registryContext = (RegistryManagerContext)scm.createPrototypeComponent("registryManagerContext");
+ securityContext = (SecurityManagerContext)scm.createPrototypeComponent("securityManagerContext");
+ profilerContext = (ProfilerManagerContext)scm.createPrototypeComponent("profilerManagerContext");
}
/* (non-Javadoc)
@@ -75,8 +73,11 @@
*/
protected void endConversationalTxn()
{
- // destroy scoped context bean for thread transaction
- scm.destroyPrototypeComponent("profilerManagerContext", context);
+ // destroy scoped profilerContext beans for thread transaction
+ scm.destroyPrototypeComponent("profilerManagerContext", profilerContext);
+ scm.destroyPrototypeComponent("securityManagerContext", securityContext);
+ scm.destroyPrototypeComponent("registryManagerContext", registryContext);
+ scm.destroyPrototypeComponent("capabilitiesManagerContext", capabilitiesContext);
}
/* (non-Javadoc)
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java?rev=746287&r1=746286&r2=746287&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java Fri Feb 20 16:32:05 2009
@@ -42,8 +42,8 @@
import org.apache.jetspeed.request.RequestContext;
import org.apache.jetspeed.security.JetspeedSubjectFactory;
import org.apache.jetspeed.security.PrincipalsSet;
-import org.apache.jetspeed.security.impl.RoleImpl;
-import org.apache.jetspeed.security.impl.UserImpl;
+import org.apache.jetspeed.security.impl.TransientRole;
+import org.apache.jetspeed.security.impl.TransientUser;
import org.apache.jetspeed.serializer.JetspeedSerializer;
/**
@@ -158,7 +158,7 @@
return new String[] { "profiler.xml", "transaction.xml", "serializer.xml", "security-providers.xml", "cache-test.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",
- "JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml" };
+ "jpa-jta.xml", "JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml" };
}
/* (non-Javadoc)
@@ -166,7 +166,7 @@
*/
protected String getBeanDefinitionFilterCategories()
{
- return "security,serializer,registry,search,capabilities,profiler,dbSecurity,transaction,cache,noRequestContext,jdbcDS";
+ return "ojb,security,serializer,registry,search,capabilities,profiler,dbSecurity,transaction,cache,noRequestContext,jdbcDS";
}
/**
@@ -272,10 +272,10 @@
Set publicCredentials = new HashSet();
Set privateCredentials = new HashSet();
- principals.add(new UserImpl("david"));
- principals.add(new RoleImpl("ATP"));
- principals.add(new RoleImpl("NB"));
- principals.add(new RoleImpl("ATP-NB"));
+ principals.add(new TransientUser("david"));
+ principals.add(new TransientRole("ATP"));
+ principals.add(new TransientRole("NB"));
+ principals.add(new TransientRole("ATP-NB"));
Subject subject = new Subject(true, principals, publicCredentials, privateCredentials);
return subject;
@@ -287,9 +287,9 @@
Set publicCredentials = new HashSet();
Set privateCredentials = new HashSet();
- principals.add(new UserImpl("david"));
- principals.add(new RoleImpl("ATP"));
- principals.add(new RoleImpl("NB"));
+ principals.add(new TransientUser("david"));
+ principals.add(new TransientRole("ATP"));
+ principals.add(new TransientRole("NB"));
Subject subject = new Subject(true, principals, publicCredentials, privateCredentials);
return subject;
@@ -306,7 +306,7 @@
assertTrue("default rule class not mapped", rule.getClass() == getStandardProfilingRuleClass());
// Test anonymous principal-rule
- ProfilingRule anonRule = profiler.getRuleForPrincipal(new UserImpl("anon"),
+ ProfilingRule anonRule = profiler.getRuleForPrincipal(new TransientUser("anon"),
ProfileLocator.PAGE_LOCATOR);
assertNotNull("anonymous rule is null", anonRule);
assertTrue("anonymous rule is j1", anonRule.getId().equals(DEFAULT_RULE));
@@ -436,7 +436,7 @@
assertNotNull("profiler service is null", profiler);
RequestContext request = new MockRequestContext("default-other");
- request.setSubject(JetspeedSubjectFactory.createSubject(new UserImpl("anon"), null, null, null));
+ request.setSubject(JetspeedSubjectFactory.createSubject(new TransientUser("anon"), null, null, null));
request.setLocale(new Locale("en", "US"));
request.setMediaType("HTML");
request.setMimeType("text/html");
@@ -520,7 +520,7 @@
RequestContext request = new MockRequestContext();
- request.setSubject(JetspeedSubjectFactory.createSubject(new UserImpl("anon"), null, null, null));
+ request.setSubject(JetspeedSubjectFactory.createSubject(new TransientUser("anon"), null, null, null));
request.setLocale(new Locale("en", "US"));
request.setMediaType("HTML");
request.setMimeType("text/html");
@@ -546,7 +546,7 @@
public void testGetLocatorNames() throws Exception
{
assertNotNull("profiler service is null", profiler);
- String[] result = profiler.getLocatorNamesForPrincipal(new UserImpl("guest"));
+ String[] result = profiler.getLocatorNamesForPrincipal(new TransientUser("guest"));
for (int ix = 0; ix < result.length; ix++)
{
System.out.println("$$$ result = " + result[ix]);
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org