gatein SVN: r6348 - in portal/trunk: examples/extension/config and 15 other directories.
by do-not-reply@jboss.org
Author: mstruk
Date: 2011-04-26 11:41:50 -0400 (Tue, 26 Apr 2011)
New Revision: 6348
Modified:
portal/trunk/examples/extension/config/pom.xml
portal/trunk/examples/extension/ear/pom.xml
portal/trunk/examples/extension/jar/pom.xml
portal/trunk/examples/extension/pom.xml
portal/trunk/examples/extension/war/pom.xml
portal/trunk/examples/portal/config/pom.xml
portal/trunk/examples/portal/ear/pom.xml
portal/trunk/examples/portal/jar/pom.xml
portal/trunk/examples/portal/pom.xml
portal/trunk/examples/portal/rest-war/pom.xml
portal/trunk/examples/portal/war/pom.xml
portal/trunk/examples/portlets/pom.xml
portal/trunk/examples/skins/pom.xml
portal/trunk/packaging/jboss-as5/pkg/pom.xml
portal/trunk/packaging/jboss-as6/pkg/pom.xml
portal/trunk/starter/ear/pom.xml
portal/trunk/starter/war/pom.xml
Log:
GTNPORTAL-1846 Update components and update POM files
- fixed repository dependencies by adding parent.relativePath to several modules, and by removing a noop exo.portal.server.jboss.plugin dependency
Modified: portal/trunk/examples/extension/config/pom.xml
===================================================================
--- portal/trunk/examples/extension/config/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/examples/extension/config/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -24,6 +24,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: portal/trunk/examples/extension/ear/pom.xml
===================================================================
--- portal/trunk/examples/extension/ear/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/examples/extension/ear/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -24,6 +24,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: portal/trunk/examples/extension/jar/pom.xml
===================================================================
--- portal/trunk/examples/extension/jar/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/examples/extension/jar/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -24,6 +24,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: portal/trunk/examples/extension/pom.xml
===================================================================
--- portal/trunk/examples/extension/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/examples/extension/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -25,6 +25,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>exo.portal.sample.extension.root</artifactId>
Modified: portal/trunk/examples/extension/war/pom.xml
===================================================================
--- portal/trunk/examples/extension/war/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/examples/extension/war/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -24,6 +24,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: portal/trunk/examples/portal/config/pom.xml
===================================================================
--- portal/trunk/examples/portal/config/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/examples/portal/config/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -24,6 +24,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: portal/trunk/examples/portal/ear/pom.xml
===================================================================
--- portal/trunk/examples/portal/ear/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/examples/portal/ear/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -24,6 +24,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: portal/trunk/examples/portal/jar/pom.xml
===================================================================
--- portal/trunk/examples/portal/jar/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/examples/portal/jar/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -24,6 +24,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: portal/trunk/examples/portal/pom.xml
===================================================================
--- portal/trunk/examples/portal/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/examples/portal/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -25,6 +25,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>exo.portal.sample.portal.root</artifactId>
Modified: portal/trunk/examples/portal/rest-war/pom.xml
===================================================================
--- portal/trunk/examples/portal/rest-war/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/examples/portal/rest-war/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -24,6 +24,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: portal/trunk/examples/portal/war/pom.xml
===================================================================
--- portal/trunk/examples/portal/war/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/examples/portal/war/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -24,6 +24,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: portal/trunk/examples/portlets/pom.xml
===================================================================
--- portal/trunk/examples/portlets/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/examples/portlets/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -6,6 +6,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
</parent>
<groupId>org.gatein.portal.examples.portlets</groupId>
Modified: portal/trunk/examples/skins/pom.xml
===================================================================
--- portal/trunk/examples/skins/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/examples/skins/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -6,6 +6,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
</parent>
<groupId>org.gatein.portal.examples.skins</groupId>
Modified: portal/trunk/packaging/jboss-as5/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/jboss-as5/pkg/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/packaging/jboss-as5/pkg/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -457,10 +457,10 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web.server</artifactId>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.server.jboss.plugin</artifactId>
- </dependency>
+ </dependency-->
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui.core</artifactId>
Modified: portal/trunk/packaging/jboss-as6/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/jboss-as6/pkg/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/packaging/jboss-as6/pkg/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -455,10 +455,10 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web.server</artifactId>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.server.jboss.plugin</artifactId>
- </dependency>
+ </dependency-->
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui.core</artifactId>
Modified: portal/trunk/starter/ear/pom.xml
===================================================================
--- portal/trunk/starter/ear/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/starter/ear/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -24,6 +24,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: portal/trunk/starter/war/pom.xml
===================================================================
--- portal/trunk/starter/war/pom.xml 2011-04-26 10:22:53 UTC (rev 6347)
+++ portal/trunk/starter/war/pom.xml 2011-04-26 15:41:50 UTC (rev 6348)
@@ -24,6 +24,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
13 years, 8 months
gatein SVN: r6347 - portal/branches/branch-GTNPORTAL-1872/component/portal/src/main/java/org/exoplatform/portal/pom/config.
by do-not-reply@jboss.org
Author: ndkhoiits
Date: 2011-04-26 06:22:53 -0400 (Tue, 26 Apr 2011)
New Revision: 6347
Modified:
portal/branches/branch-GTNPORTAL-1872/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
Log:
GTNPORTAL-1878 Search Page by owner id is invalid
Modified: portal/branches/branch-GTNPORTAL-1872/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2011-04-25 11:31:16 UTC (rev 6346)
+++ portal/branches/branch-GTNPORTAL-1872/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2011-04-26 10:22:53 UTC (rev 6347)
@@ -252,7 +252,7 @@
ownerId = ownerId.trim();
if (!ownerId.isEmpty())
{
- ownerIdChunk = formatter.encodeNodeName(null, ownerId);
+ ownerIdChunk = "mop:" + formatter.encodeNodeName(null, ownerId);
}
}
13 years, 8 months
gatein SVN: r6346 - portal/branches/branch-GTNPORTAL-1872/component/portal/src/main/java/org/exoplatform/portal/config.
by do-not-reply@jboss.org
Author: kien_nguyen
Date: 2011-04-25 07:31:16 -0400 (Mon, 25 Apr 2011)
New Revision: 6346
Modified:
portal/branches/branch-GTNPORTAL-1872/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java
Log:
GTNPORTAL-1879 Anonymous users couldn't access guests pages
Modified: portal/branches/branch-GTNPORTAL-1872/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java 2011-04-25 09:59:41 UTC (rev 6345)
+++ portal/branches/branch-GTNPORTAL-1872/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java 2011-04-25 11:31:16 UTC (rev 6346)
@@ -29,6 +29,7 @@
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.ConversationState;
import org.exoplatform.services.security.Identity;
+import org.exoplatform.services.security.IdentityConstants;
import org.exoplatform.services.security.MembershipEntry;
import java.io.Serializable;
@@ -483,7 +484,7 @@
Permission permission = new Permission();
permission.setPermissionExpression(expPerm);
String groupId = permission.getGroupId();
- if (currentUser == null && groupId.equals(guestGroup_))
+ if ((currentUser == null || currentUser.equals(IdentityConstants.ANONIM)) && groupId.equals(guestGroup_))
{
return true;
}
13 years, 8 months
gatein SVN: r6345 - in portal/trunk: packaging/jboss-as6/pkg and 1 other directory.
by do-not-reply@jboss.org
Author: mstruk
Date: 2011-04-25 05:59:41 -0400 (Mon, 25 Apr 2011)
New Revision: 6345
Modified:
portal/trunk/examples/skins/simpleskin/src/main/webapp/WEB-INF/web.xml
portal/trunk/packaging/jboss-as6/pkg/pom.xml
Log:
GTNPORTAL-1812 Packaging that supports JBossAS6 and does away with javascript packager
- fixed gatein-sample-skin example, and put back samples in jboss-as6 packaging
Modified: portal/trunk/examples/skins/simpleskin/src/main/webapp/WEB-INF/web.xml
===================================================================
--- portal/trunk/examples/skins/simpleskin/src/main/webapp/WEB-INF/web.xml 2011-04-25 03:40:04 UTC (rev 6344)
+++ portal/trunk/examples/skins/simpleskin/src/main/webapp/WEB-INF/web.xml 2011-04-25 09:59:41 UTC (rev 6345)
@@ -21,9 +21,11 @@
-->
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.5">
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
<display-name>gatein-sample-skin</display-name>
<filter>
<filter-name>ResourceRequestFilter</filter-name>
Modified: portal/trunk/packaging/jboss-as6/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/jboss-as6/pkg/pom.xml 2011-04-25 03:40:04 UTC (rev 6344)
+++ portal/trunk/packaging/jboss-as6/pkg/pom.xml 2011-04-25 09:59:41 UTC (rev 6345)
@@ -803,7 +803,7 @@
</dependency>
<!-- Ear files -->
- <!--dependency>
+ <dependency>
<?move gatein-sample-portal.ear?>
<groupId>org.exoplatform.portal</groupId>
<artifactId>gatein-sample-portal</artifactId>
@@ -816,7 +816,7 @@
<artifactId>gatein-sample-extension</artifactId>
<type>ear</type>
<version>${project.version}</version>
- </dependency-->
+ </dependency>
<dependency>
<?move starter-gatein.ear?>
<groupId>org.exoplatform.portal</groupId>
@@ -885,12 +885,12 @@
<artifactId>exo.portal.portlet.dashboard</artifactId>
<type>war</type>
</dependency>
- <!--dependency>
+ <dependency>
<?move gatein-sample-skin.war?>
<groupId>org.gatein.portal.examples.skins</groupId>
<artifactId>gatein-sample-skin</artifactId>
<type>war</type>
- </dependency-->
+ </dependency>
</dependencies>
<build>
13 years, 8 months
gatein SVN: r6344 - portal/branches/branch-GTNPORTAL-1872/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/webui/component/UIBarDecorator/UIAction.
by do-not-reply@jboss.org
Author: kien_nguyen
Date: 2011-04-24 23:40:04 -0400 (Sun, 24 Apr 2011)
New Revision: 6344
Modified:
portal/branches/branch-GTNPORTAL-1872/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/webui/component/UIBarDecorator/UIAction/Stylesheet.css
Log:
GTNPORTAL-1848 IE 7 - Simple Skin mode some buttons are blank display
Modified: portal/branches/branch-GTNPORTAL-1872/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/webui/component/UIBarDecorator/UIAction/Stylesheet.css
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/webui/component/UIBarDecorator/UIAction/Stylesheet.css 2011-04-25 03:38:34 UTC (rev 6343)
+++ portal/branches/branch-GTNPORTAL-1872/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/webui/component/UIBarDecorator/UIAction/Stylesheet.css 2011-04-25 03:40:04 UTC (rev 6344)
@@ -34,14 +34,6 @@
cursor: pointer;
}
-.UIAction a {
-}
-
-.UIAction a:hover {
- color: #058ee6;
-}
-
-
.UIAction .ActionButton .Icon {
padding-left: 20px; /* orientation=lt */
padding-right: 20px; /* orientation=rt */
@@ -67,7 +59,7 @@
.UIAction .LightBlueStyle .ButtonMiddle {
background: url(background/SimpleStyle1.gif) repeat-x left -20px;
line-height: 20px;
- padding: 0px 8px;
+ padding: 0px 12px;
color: #565656;
}
@@ -97,7 +89,6 @@
.UIAction a {
color: #565656;
- margin: 0px 6px;
white-space: nowrap;
}
13 years, 8 months
gatein SVN: r6343 - portal/branches/branch-GTNPORTAL-1872/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/portal/webui/component/view/UIToolbarContainer.
by do-not-reply@jboss.org
Author: kien_nguyen
Date: 2011-04-24 23:38:34 -0400 (Sun, 24 Apr 2011)
New Revision: 6343
Modified:
portal/branches/branch-GTNPORTAL-1872/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/portal/webui/component/view/UIToolbarContainer/Stylesheet.css
Log:
GTNPORTAL-1835 The menu is missing with simple skin and Arabic language [IE7]
Modified: portal/branches/branch-GTNPORTAL-1872/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/portal/webui/component/view/UIToolbarContainer/Stylesheet.css
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/portal/webui/component/view/UIToolbarContainer/Stylesheet.css 2011-04-24 21:29:13 UTC (rev 6342)
+++ portal/branches/branch-GTNPORTAL-1872/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/portal/webui/component/view/UIToolbarContainer/Stylesheet.css 2011-04-25 03:38:34 UTC (rev 6343)
@@ -71,8 +71,6 @@
.UIToolbarContainer .UIHorizontalTabs .TabsContainer {
height: 30px; /* orientation=lt */
height: auto; /* orientation=rt */
- float: left; /* orientation=lt */
- float: right; /* orientation=rt */
}
.UIToolbarContainer .UIHorizontalTabs .UITab {
@@ -86,6 +84,7 @@
float: none;
!float: left;/* orientation=rt */
_float: none;/* orientation=rt */
+ cursor: pointer;
}
.UserToolBarSitePortletTDContainer {
13 years, 8 months
gatein SVN: r6342 - in sandbox/cdi_support/cdi/trunk: api/src/main/java/org/gatein/cdi/api/proxyproducer and 2 other directories.
by do-not-reply@jboss.org
Author: mstruk
Date: 2011-04-24 17:29:13 -0400 (Sun, 24 Apr 2011)
New Revision: 6342
Added:
sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/proxyproducer/
sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/proxyproducer/ProxyProducer.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/InjectionPointImpl.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/ProxyProducerBean.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/ProxyProducerExtension.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/ProxyProducerInvocationHandler.java
Log:
Added missing code
Added: sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/proxyproducer/ProxyProducer.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/proxyproducer/ProxyProducer.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/proxyproducer/ProxyProducer.java 2011-04-24 21:29:13 UTC (rev 6342)
@@ -0,0 +1,13 @@
+package org.gatein.cdi.api.proxyproducer;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.METHOD)
+public @interface ProxyProducer
+{
+
+}
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/InjectionPointImpl.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/InjectionPointImpl.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/InjectionPointImpl.java 2011-04-24 21:29:13 UTC (rev 6342)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.gatein.cdi.impl.proxyproducer;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.util.AnnotationLiteral;
+
+/**
+ * A simple implementation of InjectionPoint
+ *
+ * @author stuart
+ *
+ */
+public class InjectionPointImpl implements InjectionPoint
+{
+
+ public InjectionPointImpl(AnnotatedField<?> field, Set<Annotation> qualifiers, Bean<?> bean, boolean trans, boolean delegate)
+ {
+ this.annotated = field;
+ this.member = field.getJavaMember();
+ this.qualifiers = new HashSet<Annotation>(qualifiers);
+ this.type = field.getJavaMember().getGenericType();
+ this.trans = trans;
+ this.delegate = delegate;
+ this.bean = bean;
+ }
+
+ public InjectionPointImpl(AnnotatedField<?> field, BeanManager beanManager, Bean<?> bean, boolean trans, boolean delegate)
+ {
+ this.annotated = field;
+ this.member = field.getJavaMember();
+ this.qualifiers = new HashSet<Annotation>();
+ this.type = field.getJavaMember().getGenericType();
+ this.trans = trans;
+ this.delegate = delegate;
+ this.bean = bean;
+ for (Annotation a : field.getAnnotations())
+ {
+ if (beanManager.isQualifier(a.annotationType()))
+ {
+ qualifiers.add(a);
+ }
+ }
+ }
+
+ public InjectionPointImpl(AnnotatedParameter<?> param, Set<Annotation> qualifiers, Bean<?> bean, boolean trans, boolean delegate)
+ {
+ this.annotated = param;
+ this.member = param.getDeclaringCallable().getJavaMember();
+ this.qualifiers = new HashSet<Annotation>(qualifiers);
+ this.trans = trans;
+ this.delegate = delegate;
+ this.bean = bean;
+ this.type = param.getBaseType();
+ }
+
+ public InjectionPointImpl(AnnotatedParameter<?> param, BeanManager beanManager, Bean<?> bean, boolean trans, boolean delegate)
+ {
+ this.annotated = param;
+ this.member = param.getDeclaringCallable().getJavaMember();
+ this.qualifiers = new HashSet<Annotation>();
+ this.trans = trans;
+ this.delegate = delegate;
+ this.bean = bean;
+ this.type = param.getBaseType();
+ for (Annotation a : annotated.getAnnotations())
+ {
+ if (beanManager.isQualifier(a.annotationType()))
+ {
+ qualifiers.add(a);
+ }
+ }
+ qualifiers.add(new AnnotationLiteral<Default>() {});
+ }
+
+ private final Annotated annotated;
+
+ private final Member member;
+
+ private final Bean<?> bean;
+
+ private final Set<Annotation> qualifiers;
+
+ private final Type type;
+
+ private final boolean trans;
+
+ private final boolean delegate;
+
+ public Annotated getAnnotated()
+ {
+ return annotated;
+ }
+
+ public Bean<?> getBean()
+ {
+ return bean;
+ }
+
+ public Member getMember()
+ {
+ return member;
+ }
+
+ public Set<Annotation> getQualifiers()
+ {
+ return qualifiers;
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ public boolean isDelegate()
+ {
+ return delegate;
+ }
+
+ public boolean isTransient()
+ {
+ return trans;
+ }
+
+}
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/ProxyProducerBean.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/ProxyProducerBean.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/ProxyProducerBean.java 2011-04-24 21:29:13 UTC (rev 6342)
@@ -0,0 +1,234 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.gatein.cdi.impl.proxyproducer;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javassist.util.proxy.MethodFilter;
+import javassist.util.proxy.ProxyFactory;
+import javassist.util.proxy.ProxyObject;
+import org.jboss.interceptor.util.proxy.TargetInstanceProxy;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Named;
+
+/**
+ * Bean implementation that produces a JDK proxy
+ *
+ * when a method is invoked on the proxy it calls the managed producer method
+ * and invokes the method on the returned object
+ *
+ * @author stuart
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ *
+ * @param <M>
+ */
+public class ProxyProducerBean<M> implements Bean<M>
+{
+
+ final private Class<?> beanClass;
+
+ final private String name;
+
+ final private Set<Annotation> qualifiers;
+
+ final private Set<Type> types;
+
+ final private Class<M> proxyClass;
+
+ final private BeanManager manager;
+
+ final private AnnotatedMethod<?> method;
+
+ private final static Annotation[] defaultQualifiers = { new AnnotationLiteral<Default>()
+ {
+ } };
+
+ public ProxyProducerBean(AnnotatedMethod<?> method, BeanManager manager)
+ {
+ this.method = method;
+ beanClass = method.getDeclaringType().getJavaClass();
+ // get the name
+ if (method.isAnnotationPresent(Named.class))
+ {
+ name = method.getAnnotation(Named.class).value();
+ }
+ else
+ {
+ name = null;
+ }
+ // get the qualifiers
+ qualifiers = new HashSet<Annotation>();
+ for (Annotation a : method.getAnnotations())
+ {
+ if (manager.isQualifier(a.annotationType()))
+ {
+ qualifiers.add(a);
+ }
+ }
+ if (qualifiers.isEmpty())
+ {
+ qualifiers.add(new AnnotationLiteral<Default>()
+ {
+ });
+ }
+ // get the bean types
+ types = new HashSet<Type>();
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ types.add(method.getBaseType());
+ types.add(Object.class);
+ /*
+ for (Type t : method.getTypeClosure())
+ {
+ if (t instanceof Class<?>)
+ {
+ Class<?> c = (Class<?>) t;
+ types.add(c);
+ classes.add(c);
+ }
+ else if (t instanceof ParameterizedType)
+ {
+ ParameterizedType p = (ParameterizedType) t;
+ Class<?> c = (Class<?>) p.getRawType();
+ types.add(t);
+ }
+ break;
+ }
+ */
+ this.manager = manager;
+
+ // build the properties
+ /*
+ Class<?>[] iarray = new Class[classes.size()];
+ int count = 0;
+ for (Class<?> c : classes)
+ {
+ iarray[count++] = c;
+ }
+ */
+ ProxyFactory f = new ProxyFactory();
+ Class<?> retType = method.getJavaMember().getReturnType();
+ if (retType.isInterface())
+ {
+ f.setSuperclass(Object.class);
+ Class<?>[] ifaces = { retType, TargetInstanceProxy.class };
+ f.setInterfaces(ifaces);
+ }
+ else
+ {
+ f.setSuperclass(retType);
+ Class<?>[] ifaces = { TargetInstanceProxy.class };
+ f.setInterfaces(ifaces);
+ }
+
+ f.setFilter(new MethodFilter()
+ {
+ public boolean isHandled(Method m)
+ {
+ // ignore finalize()
+ return !m.getName().equals("finalize");
+ }
+ });
+ proxyClass = f.createClass();
+
+ }
+
+ public Class<?> getBeanClass()
+ {
+ return beanClass;
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return Collections.emptySet();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Set<Annotation> getQualifiers()
+ {
+ return qualifiers;
+ }
+
+ /**
+ * the proxies that are injected all have Dependant scope
+ */
+ public Class<? extends Annotation> getScope()
+ {
+ return Dependent.class;
+ }
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ public boolean isAlternative()
+ {
+ return false;
+ }
+
+ public boolean isNullable()
+ {
+ return false;
+ }
+
+ public M create(CreationalContext<M> creationalContext)
+ {
+ Set<Bean<?>> beans = manager.getBeans(InjectionPoint.class, defaultQualifiers);
+ Bean<?> injectionPointBean = (Bean<?>) beans.iterator().next();
+ InjectionPoint injectionPoint = (InjectionPoint) manager.getReference(injectionPointBean, InjectionPoint.class, creationalContext);
+ ProxyProducerInvocationHandler hdl = new ProxyProducerInvocationHandler(manager, this.method, this, injectionPoint);
+ try
+ {
+ M obj = proxyClass.newInstance();
+ ((ProxyObject) obj).setHandler(hdl);
+ creationalContext.push(obj);
+ return obj;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void destroy(M instance, CreationalContext<M> creationalContext)
+ {
+ creationalContext.release();
+ }
+}
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/ProxyProducerExtension.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/ProxyProducerExtension.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/ProxyProducerExtension.java 2011-04-24 21:29:13 UTC (rev 6342)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.gatein.cdi.impl.proxyproducer;
+
+import org.gatein.cdi.api.proxyproducer.ProxyProducer;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+/**
+ * An extension that allows the use of @ManagedProducer methods
+ *
+ * these methods work in a similar manner to @Unwrap methods in seam 2
+ *
+ * @author stuart
+ *
+ */
+public class ProxyProducerExtension implements Extension
+{
+
+ final private Set<ProxyProducerBean<?>> beans = new HashSet<ProxyProducerBean<?>>();
+
+ public void processAnnotatedType(@Observes ProcessAnnotatedType<?> type, BeanManager manager)
+ {
+ for (AnnotatedMethod<?> m : type.getAnnotatedType().getMethods())
+ {
+ if (m.isAnnotationPresent(ProxyProducer.class))
+ {
+ // we have a managed producer
+ // lets make a note of it and register it later
+ beans.add(new ProxyProducerBean(m, manager));
+ }
+ }
+ }
+
+ public void afterBeanDiscovery(@Observes AfterBeanDiscovery afterBean)
+ {
+ for (ProxyProducerBean<?> b : beans)
+ {
+ afterBean.addBean(b);
+ }
+ }
+
+}
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/ProxyProducerInvocationHandler.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/ProxyProducerInvocationHandler.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/proxyproducer/ProxyProducerInvocationHandler.java 2011-04-24 21:29:13 UTC (rev 6342)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.gatein.cdi.impl.proxyproducer;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javassist.util.proxy.MethodHandler;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.AmbiguousResolutionException;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.interceptor.util.proxy.TargetInstanceProxy;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class ProxyProducerInvocationHandler implements MethodHandler
+{
+
+ final private BeanManager manager;
+ final private AnnotatedMethod<?> annotatedMethod;
+ final private Method method;
+ final private Bean<?> bean;
+ final private InjectionPoint[] injectionPoints;
+ final private Bean<?> mainClassBean;
+ final private InjectionPoint injectionPoint;
+
+
+ public ProxyProducerInvocationHandler(BeanManager manager, AnnotatedMethod<?> method, Bean<?> bean, InjectionPoint injectionPoint)
+ {
+ this.manager = manager;
+ this.method = method.getJavaMember();
+ this.annotatedMethod = method;
+ this.bean = bean;
+ injectionPoints = new InjectionPoint[this.method.getParameterTypes().length];
+ for (int i = 0; i < injectionPoints.length; ++i)
+ {
+ injectionPoints[i] = new InjectionPointImpl(method.getParameters().get(i), manager, bean, false, false);
+ }
+ Type mainType = method.getDeclaringType().getBaseType();
+ HashSet<Annotation> mainClassQualifiers = new HashSet<Annotation>();
+ for (Annotation a : method.getDeclaringType().getAnnotations())
+ {
+ if (manager.isQualifier(a.annotationType()))
+ {
+ mainClassQualifiers.add(a);
+ }
+ }
+ Set<Bean<?>> beans = manager.getBeans(mainType, mainClassQualifiers.toArray(new Annotation[0]));
+ if (beans.isEmpty())
+ {
+ throw new UnsatisfiedResolutionException("Could not find declaring bean for managed producer method " + method.getDeclaringType().getJavaClass() + "." + this.method.getName());
+ }
+ else if (beans.size() > 1)
+ {
+ throw new AmbiguousResolutionException("Could not find declaring bean for managed producer method " + method.getDeclaringType().getJavaClass() + "." + this.method.getName());
+ }
+ mainClassBean = beans.iterator().next();
+ this.injectionPoint = injectionPoint;
+ }
+
+ public Object invoke(Object proxy, Method thisMethod, Method m, Object[] args) throws Throwable
+ {
+ CreationalContext<?> ctx = manager.createCreationalContext(bean);
+ try
+ {
+ Object[] params = new Object[method.getParameterTypes().length];
+ for (int i = 0; i < this.method.getParameterTypes().length; ++i)
+ {
+ if (InjectionPoint.class.isAssignableFrom(this.method.getParameterTypes()[i]))
+ {
+ params[i] = injectionPoint;
+ }
+ else
+ {
+ params[i] = manager.getInjectableReference(injectionPoints[i], ctx);
+ }
+ }
+ Object base = manager.getReference(mainClassBean, annotatedMethod.getDeclaringType().getJavaClass(), ctx);
+
+ Object result = method.invoke(base, params);
+
+ Class declaringClass = thisMethod.getDeclaringClass();
+ if (declaringClass == TargetInstanceProxy.class)
+ {
+ if ("getTargetInstance".equals(thisMethod.getName()))
+ return result;
+ else if ("getTargetClass".equals(thisMethod.getName()))
+ {
+ return method.getReturnType();
+ }
+ }
+
+ if (result == null)
+ {
+ if (declaringClass == Object.class && "toString".equals(thisMethod.getName()))
+ {
+ return proxy.getClass() + "@ -- No delegate --";
+ }
+ else
+ {
+ throw new IllegalStateException("Proxy has no delegate (" + method + " returned null)");
+ }
+ }
+ Object ret = thisMethod.invoke(result, args);
+ return ret;
+ }
+ finally
+ {
+ ctx.release();
+ }
+ }
+
+}
13 years, 8 months
gatein SVN: r6341 - portal/trunk/packaging/jboss-as6/pkg.
by do-not-reply@jboss.org
Author: mstruk
Date: 2011-04-24 16:42:02 -0400 (Sun, 24 Apr 2011)
New Revision: 6341
Modified:
portal/trunk/packaging/jboss-as6/pkg/pom.xml
Log:
GTNPORTAL-1874 Support for CDI (JSR-299) in portlets
- CDI packaging support for jboss-as6 - via additional build profile
Modified: portal/trunk/packaging/jboss-as6/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/jboss-as6/pkg/pom.xml 2011-04-24 20:38:52 UTC (rev 6340)
+++ portal/trunk/packaging/jboss-as6/pkg/pom.xml 2011-04-24 20:42:02 UTC (rev 6341)
@@ -1204,7 +1204,7 @@
<?move gatein-cdi-example-portlet.war?>
<groupId>org.gatein.cdi</groupId>
<artifactId>gatein-cdi-example-portlet</artifactId>
- <version>pong${org.gatein.cdi.version}</version>
+ <version>${org.gatein.cdi.version}</version>
<type>war</type>
</dependency>
</dependencies>
13 years, 8 months
gatein SVN: r6340 - sandbox/cdi_support/pc/branches/cdi/cdi.
by do-not-reply@jboss.org
Author: mstruk
Date: 2011-04-24 16:38:52 -0400 (Sun, 24 Apr 2011)
New Revision: 6340
Modified:
sandbox/cdi_support/pc/branches/cdi/cdi/pom.xml
Log:
Fix version
Modified: sandbox/cdi_support/pc/branches/cdi/cdi/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/cdi/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
+++ sandbox/cdi_support/pc/branches/cdi/cdi/pom.xml 2011-04-24 20:38:52 UTC (rev 6340)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<artifactId>pc-cdi</artifactId>
13 years, 8 months
gatein SVN: r6339 - in sandbox/cdi_support/pc/branches/cdi: api and 28 other directories.
by do-not-reply@jboss.org
Author: mstruk
Date: 2011-04-23 18:18:05 -0400 (Sat, 23 Apr 2011)
New Revision: 6339
Added:
sandbox/cdi_support/pc/branches/cdi/test/servers/tomcat7/src/test/resources/config/server.xml
Removed:
sandbox/cdi_support/pc/branches/cdi/api/src/test/resources/
Modified:
sandbox/cdi_support/pc/branches/cdi/
sandbox/cdi_support/pc/branches/cdi/api/pom.xml
sandbox/cdi_support/pc/branches/cdi/api/src/main/java/org/gatein/pc/api/PortletContext.java
sandbox/cdi_support/pc/branches/cdi/api/src/main/java/org/gatein/pc/api/StatefulPortletContext.java
sandbox/cdi_support/pc/branches/cdi/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
sandbox/cdi_support/pc/branches/cdi/bridge/pom.xml
sandbox/cdi_support/pc/branches/cdi/controller/pom.xml
sandbox/cdi_support/pc/branches/cdi/controller/src/test/java/org/gatein/pc/controller/EventControllerContextFailureTestCase.java
sandbox/cdi_support/pc/branches/cdi/controller/src/test/java/org/gatein/pc/controller/PortletControllerRequestTestCase.java
sandbox/cdi_support/pc/branches/cdi/controller/src/test/java/org/gatein/pc/controller/PortletControllerTestCase.java
sandbox/cdi_support/pc/branches/cdi/docs/pom.xml
sandbox/cdi_support/pc/branches/cdi/docs/user-guide/pom.xml
sandbox/cdi_support/pc/branches/cdi/federation/pom.xml
sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java
sandbox/cdi_support/pc/branches/cdi/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java
sandbox/cdi_support/pc/branches/cdi/jsr168api/pom.xml
sandbox/cdi_support/pc/branches/cdi/management/pom.xml
sandbox/cdi_support/pc/branches/cdi/mc/pom.xml
sandbox/cdi_support/pc/branches/cdi/pom.xml
sandbox/cdi_support/pc/branches/cdi/portal/pom.xml
sandbox/cdi_support/pc/branches/cdi/portlet/pom.xml
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
sandbox/cdi_support/pc/branches/cdi/samples/pom.xml
sandbox/cdi_support/pc/branches/cdi/test/core/pc-test-core.iml
sandbox/cdi_support/pc/branches/cdi/test/core/pom.xml
sandbox/cdi_support/pc/branches/cdi/test/pom.xml
sandbox/cdi_support/pc/branches/cdi/test/servers/jboss42/pom.xml
sandbox/cdi_support/pc/branches/cdi/test/servers/pom.xml
sandbox/cdi_support/pc/branches/cdi/test/servers/tomcat7/pom.xml
sandbox/cdi_support/pc/branches/cdi/test/servers/tomcat7/src/test/build.xml
Log:
Merged changes from pc trunk up to r6338
Property changes on: sandbox/cdi_support/pc/branches/cdi
___________________________________________________________________
Modified: svn:mergeinfo
- /components/pc/trunk:5848-6137
+ /components/pc/trunk:5848-6338
Modified: sandbox/cdi_support/pc/branches/cdi/api/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/api/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/api/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,3 +1,26 @@
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.gatein.pc</groupId>
@@ -2,3 +25,3 @@
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
@@ -19,55 +42,26 @@
<groupId>org.gatein.wci</groupId>
<artifactId>wci-wci</artifactId>
</dependency>
-
<dependency>
- <groupId>sun-jaxb</groupId>
- <artifactId>jaxb-api</artifactId>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
</dependency>
- <!--<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>-->
<dependency>
- <groupId>org.jboss.unit</groupId>
- <artifactId>jboss-unit-mc</artifactId>
- <scope>test</scope>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
</dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${version.apache.log4j}</version>
- </dependency>
</dependencies>
<build>
<plugins>
<plugin>
- <groupId>org.jboss.unit</groupId>
- <artifactId>jboss-unit-tooling-maven2</artifactId>
- <executions>
- <execution>
- <phase>test</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- </execution>
- </executions>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
<configuration>
- <failOnError>true</failOnError>
- <testsuites>
- <testsuite>
- <config>jboss-unit.xml</config>
- </testsuite>
- </testsuites>
- <reports>
- <xml>target/tests/reports/xml</xml>
- <html>target/tests/reports/html</html>
- </reports>
+ <skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
-
</project>
Modified: sandbox/cdi_support/pc/branches/cdi/api/src/main/java/org/gatein/pc/api/PortletContext.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.pc.api;
import org.gatein.common.util.ParameterValidation;
@@ -35,52 +35,237 @@
public class PortletContext implements Serializable
{
- /** . */
- protected final String id;
- private final String applicationName;
- private final String portletName;
private static final String PREFIX = "/";
private static final char SEPARATOR = '.';
- PortletContext(String id) throws IllegalArgumentException
+ /** The separator used in the id to route to the correct invoker. */
+ public static final String INVOKER_SEPARATOR = ".";
+
+ public static final String PRODUCER_CLONE_ID_PREFIX = "_";
+ public static final int PRODUCER_CLONE_PREFIX_LENGTH = PRODUCER_CLONE_ID_PREFIX.length();
+
+ public static final String CONSUMER_CLONE_ID_PREFIX = "@";
+ public static final int CONSUMER_CLONE_PREFIX_LENGTH = CONSUMER_CLONE_ID_PREFIX.length();
+
+ public static final String CONSUMER_CLONE_DUMMY_STATE_ID = "dumbvalue";
+ public static final String CONSUMER_CLONE_ID = PRODUCER_CLONE_ID_PREFIX + CONSUMER_CLONE_DUMMY_STATE_ID;
+
+ public final static PortletContext LOCAL_CONSUMER_CLONE = PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + INVOKER_SEPARATOR + CONSUMER_CLONE_ID);
+ public static final String INVALID_PORTLET_CONTEXT = "Invalid portlet context: ";
+
+ private final Components components;
+
+ protected PortletContext(String id) throws IllegalArgumentException
{
+ this(id, true);
+ }
+
+ protected PortletContext(String id, boolean interpret)
+ {
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "portlet id", "PortletContext");
+ Components components;
+
// components
+ if (interpret)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "portlet id", "PortletContext");
+
+ components = interpretIntoComponents(id);
+ }
+ else
+ {
+ components = new UninterpretedPortletContextComponents(id);
+ }
+
+ this.components = components;
+ }
+
+ /**
+ * <p>Interprets the specified identifier and splits it into Components that can then be used to create a
+ * PortletContext.</p>
+ * <p/>
+ * <ul>Currently supported formats:
+ * <li>portletContext := invokerId + {@link #INVOKER_SEPARATOR} + {@link #PREFIX} + applicationName + {@link
+ * #SEPARATOR} + portletName</li>
+ * <li>portletContext := invokerId + {@link #INVOKER_SEPARATOR} + arbitraryPortletName</li>
+ * <li>portletContext := {@link #PRODUCER_CLONE_ID_PREFIX} + portletName</li>
+ * <li>portletContext := {@link #CONSUMER_CLONE_ID_PREFIX} + portletName</li>
+ * <li>invokerId := space* + (digit | letter)+ + (digit | letter | space)*</li>
+ * <li>applicationName := space* + (digit | letter)+ + (digit | letter | space)*</li>
+ * <li>portletName := space* + (digit | letter)+ + (digit | letter | space)*</li>
+ * <li>arbitraryPortletName := ({@link #PREFIX} | {@link #PRODUCER_CLONE_ID_PREFIX} | {@link
+ * #CONSUMER_CLONE_ID_PREFIX})? + portletName</li> </ul>
+ *
+ * @param id the portlet identifier to interpret into components
+ * @return a Components object representing the interpreted components of the specified portlet identifier
+ * @throws IllegalArgumentException if the specified identifier cannot be properly interpreted into components
+ */
+ private Components interpretIntoComponents(String id)
+ {
String trimmedId = id.trim();
- if (trimmedId.startsWith(PREFIX)) // only consider components if the id starts with '/'
+ try
{
- String compound = trimmedId.substring(1); // exclude starting '/'
-
- int separator = compound.indexOf(SEPARATOR); // find first separator, other separator are considered part of the portlet name
- if (separator != -1)
+ if (trimmedId.startsWith(PREFIX))
{
- portletName = compound.substring(separator + 1).trim();
- applicationName = compound.substring(0, separator).trim();
+ // check the case: /application.portlet
+ int separator = trimmedId.indexOf(SEPARATOR); // find first separator, other separator are considered part of the portlet name
+ String portletName = trimmedId.substring(separator + 1).trim();
+ String appName = trimmedId.substring(1, separator).trim();
+ if (separator != -1 && appName.length() > 0 && portletName.length() > 0)
+ {
+ return new InterpretedPortletContextComponents(null, appName, portletName, null);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Application name and portlet names were both empty.");
+ }
}
else
{
- portletName = null;
- applicationName = null;
+ if (!(trimmedId.startsWith(PRODUCER_CLONE_ID_PREFIX) || trimmedId.startsWith(CONSUMER_CLONE_ID_PREFIX)))
+ {
+ int invoker = trimmedId.indexOf(INVOKER_SEPARATOR);
+ int prefix = trimmedId.indexOf(PREFIX);
+
+ boolean isCompoundAppPortlet = false;
+ if (prefix != -1)
+ {
+ // check if we have the case: invokerId./something
+ if (invoker > 0 && invoker < prefix)
+ {
+ String invokerId = trimmedId.substring(0, invoker).trim();
+
+ int separator = trimmedId.indexOf(SEPARATOR, prefix);
+ // check the case: invokerId./application.portlet
+ if (separator != -1)
+ {
+ String portletName = trimmedId.substring(separator + 1).trim();
+ trimmedId = trimmedId.substring(invoker + 1).trim();
+ String applicationName = trimmedId.substring(1, trimmedId.indexOf(SEPARATOR)).trim();
+ isCompoundAppPortlet = invokerId.length() > 0 && applicationName.length() > 0 && portletName.length() > 0;
+ if (isCompoundAppPortlet)
+ {
+ return new InterpretedPortletContextComponents(invokerId, applicationName, portletName, null);
+ }
+ }
+ }
+ }
+
+ // check if we have the case: invokerId.something
+ if (!isCompoundAppPortlet && invoker > 0)
+ {
+ String invokerId = trimmedId.substring(0, invoker).trim();
+
+ if (invokerId.length() > 0)
+ {
+ String portletNameOrStateId = trimmedId.substring(invoker + 1).trim();
+
+ if (portletNameOrStateId.length() > 0)
+ {
+ boolean isProducerClone = portletNameOrStateId.startsWith(PRODUCER_CLONE_ID_PREFIX);
+ boolean isConsumerClone = portletNameOrStateId.startsWith(CONSUMER_CLONE_ID_PREFIX);
+ if (isProducerClone || isConsumerClone)
+ {
+ int prefixLength = isProducerClone ? PRODUCER_CLONE_PREFIX_LENGTH : CONSUMER_CLONE_PREFIX_LENGTH;
+ portletNameOrStateId = portletNameOrStateId.substring(prefixLength).trim();
+ if (portletNameOrStateId.length() > 0)
+ {
+ return new InterpretedPortletContextComponents(invokerId, null, portletNameOrStateId, isProducerClone);
+ }
+ }
+ else
+ {
+ return new InterpretedPortletContextComponents(invokerId, null, portletNameOrStateId, null);
+ }
+ }
+ }
+ }
+
+ // we're in the case where we have an arbitrary string
+ throw new IllegalArgumentException("'" + trimmedId + "' doesn't fit any known PortletContext formats");
+ }
+ else
+ {
+ boolean isProducerClone = trimmedId.startsWith(PRODUCER_CLONE_ID_PREFIX);
+ boolean isConsumerClone = trimmedId.startsWith(CONSUMER_CLONE_ID_PREFIX);
+ if (isProducerClone || isConsumerClone)
+ {
+ int prefixLength = isProducerClone ? PRODUCER_CLONE_PREFIX_LENGTH : CONSUMER_CLONE_PREFIX_LENGTH;
+ trimmedId = trimmedId.substring(prefixLength).trim();
+ if (trimmedId.length() > 0)
+ {
+ return new InterpretedPortletContextComponents(null, null, trimmedId, isProducerClone);
+ }
+ }
+
+ // we're in the case where we have an arbitrary string
+ throw new IllegalArgumentException("'" + trimmedId + "' doesn't fit any known PortletContext formats");
+ }
}
}
- else
+ catch (Exception e)
{
- portletName = null;
- applicationName = null;
+ throw new IllegalArgumentException(INVALID_PORTLET_CONTEXT + id, e);
}
+ }
- if (portletName == null || applicationName == null)
+ protected PortletContext(Components components)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(components, "portlet context components");
+ this.components = components;
+ }
+
+ public static PortletContext dereference(PortletContext compoundPortletContext)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(compoundPortletContext, "PortletContext to dereference");
+
+ Components components = compoundPortletContext.getInternalComponents();
+ if (!components.isInterpreted())
{
- this.id = trimmedId;
+ try
+ {
+ // try interpretation to see if we can extract an invoker id from the components
+ components = compoundPortletContext.interpret();
+ }
+ catch (IllegalArgumentException e)
+ {
+ // we couldn't interpret the given portlet context so return it as is
+ return compoundPortletContext;
+ }
}
+
+ return createCopyWithNewComponents(compoundPortletContext, components.createCopyWithoutInvoker());
+ }
+
+ protected Components interpret()
+ {
+ return interpretIntoComponents(components.getId());
+ }
+
+ public static PortletContext reference(String invokerId, PortletContext portletContext)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext to reference");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(invokerId, "Invoker id to reference with", null);
+
+ final Components newComponents = portletContext.getInternalComponents().createCopyWithInvoker(invokerId);
+
+ return createCopyWithNewComponents(portletContext, newComponents);
+ }
+
+ private static PortletContext createCopyWithNewComponents(PortletContext portletContextToCopy, Components newComponents)
+ {
+ if (portletContextToCopy instanceof StatefulPortletContext)
+ {
+ StatefulPortletContext<?> compoundStatefulPortletContext = (StatefulPortletContext<?>)portletContextToCopy;
+ return StatefulPortletContext.create(newComponents, compoundStatefulPortletContext);
+ }
else
{
- this.id = PREFIX + applicationName + SEPARATOR + portletName;
+ return new PortletContext(newComponents);
}
}
-
public boolean equals(Object o)
{
if (this == o)
@@ -90,24 +275,24 @@
if (o instanceof PortletContext)
{
PortletContext that = (PortletContext)o;
- return id.equals(that.id);
+ return getId().equals(that.getId());
}
return false;
}
public int hashCode()
{
- return id.hashCode();
+ return getId().hashCode();
}
public String getId()
{
- return id;
+ return components.getId();
}
public String toString()
{
- return "PortletContext[" + id + "]";
+ return "PortletContext[" + getId() + "]";
}
/**
@@ -120,14 +305,7 @@
@Deprecated()
public static PortletContext createPortletContext(String id, byte[] state)
{
- if (state != null && state.length > 0)
- {
- return new StatefulPortletContext<byte[]>(id, PortletStateType.OPAQUE, state);
- }
- else
- {
- return new PortletContext(id);
- }
+ return createPortletContext(id, state, true);
}
/**
@@ -145,23 +323,245 @@
return new StatefulPortletContext<byte[]>(id, PortletStateType.OPAQUE, state);
}
+ /**
+ * Creates a PortletContext by interpreting the specified identifier and breaking it down to its components. When
+ * possible, it's better to use {@link #createPortletContext(String, String)} to create the PortletContext from its
+ * components instead of trying to build it manually. In case a PortletContext namespaced by a PortletInvoker id is
+ * needed, please use {@link #reference(String, PortletContext)}.
+ *
+ * @param portletId the portlet identifier to interpret as a PortletContext
+ * @return a newly created PortletContext representing the portlet associated with the specified identifier
+ * @throws IllegalArgumentException if the specified identifier cannot be properly interpreted into components
+ * @see {@link #interpretIntoComponents(String)}
+ */
public static PortletContext createPortletContext(String portletId)
{
- return createPortletContext(portletId, (byte[])null);
+ return createPortletContext(portletId, true);
}
- public String getApplicationName()
+ public static PortletContext createPortletContext(String portletId, boolean interpret)
{
- return applicationName;
+ return createPortletContext(portletId, null, interpret);
}
- public String getPortletName()
+ public static PortletContext createPortletContext(String portletId, byte[] state, boolean interpret)
{
- return portletName;
+ if (state != null && state.length > 0)
+ {
+ return new StatefulPortletContext<byte[]>(portletId, PortletStateType.OPAQUE, state);
+ }
+ else
+ {
+ return new PortletContext(portletId, interpret);
+ }
}
- public static PortletContext createPortletContext(String portletApplicationId, String containerId)
+ /**
+ * Creates a new PortletContext referencing the specified portlet in the specified application (usually a web
+ * application).
+ *
+ * @param applicationName the application name (usually a web application context path)
+ * @param portletName the portlet name
+ * @return a newly created PortletContext referencing the specified portlet in the specified application.
+ * @throws IllegalArgumentException if the specified arguments are null or empty and if the application name is not
+ * properly formatted.
+ */
+ public static PortletContext createPortletContext(String applicationName, String portletName)
{
- return PortletContext.createPortletContext(portletApplicationId + SEPARATOR + containerId);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(applicationName, "portlet application id", "PortletContext");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletName, "container id", "PortletContext");
+
+ if (applicationName.startsWith(PREFIX))
+ {
+ applicationName = applicationName.substring(1);
+ }
+
+ return new PortletContext(new InterpretedPortletContextComponents(null, applicationName, portletName, null));
}
+
+ public PortletContextComponents getComponents()
+ {
+ return getInternalComponents();
+ }
+
+ private Components getInternalComponents()
+ {
+ return components;
+ }
+
+ public static interface PortletContextComponents
+ {
+ String getApplicationName();
+
+ String getPortletName();
+
+ String getInvokerName();
+
+ boolean isCloned();
+
+ boolean isProducerCloned();
+
+ boolean isConsumerCloned();
+
+ String getStateId();
+
+ String getId();
+
+ boolean isInterpreted();
+ }
+
+ protected static interface Components extends PortletContextComponents
+ {
+ Components createCopyWithoutInvoker();
+
+ Components createCopyWithInvoker(String invoker);
+ }
+
+ private static class InterpretedPortletContextComponents implements Components
+ {
+ private final String applicationName;
+ private final String portletName;
+ private final String invokerName;
+ private final Boolean producerCloned;
+ private final String id;
+
+ InterpretedPortletContextComponents(String invokerName, String applicationName, String portletNameOrStateId, Boolean producerCloned)
+ {
+ this.producerCloned = producerCloned;
+
+ if (isCloned() && !ParameterValidation.isNullOrEmpty(applicationName))
+ {
+ throw new IllegalArgumentException("Cannot be a clone if applicationName is provided");
+ }
+
+ this.applicationName = applicationName;
+ this.portletName = portletNameOrStateId;
+ this.invokerName = invokerName;
+
+ id = (invokerName == null ? "" : invokerName + INVOKER_SEPARATOR)
+ + (applicationName == null ? "" : PREFIX + applicationName + SEPARATOR)
+ + (portletName == null ? "" : (producerCloned != null ? (producerCloned ? PRODUCER_CLONE_ID_PREFIX : CONSUMER_CLONE_ID_PREFIX) : "") + portletName);
+ }
+
+ public String getApplicationName()
+ {
+ return applicationName;
+ }
+
+ public String getPortletName()
+ {
+ return isCloned() ? null : portletName;
+ }
+
+ public String getInvokerName()
+ {
+ return invokerName;
+ }
+
+ public boolean isCloned()
+ {
+ return producerCloned != null;
+ }
+
+ public boolean isProducerCloned()
+ {
+ return isCloned() && producerCloned;
+ }
+
+ public boolean isConsumerCloned()
+ {
+ return isCloned() && !producerCloned;
+ }
+
+ public String getStateId()
+ {
+ return isCloned() ? portletName : null;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public boolean isInterpreted()
+ {
+ return true;
+ }
+
+ public Components createCopyWithoutInvoker()
+ {
+ return new InterpretedPortletContextComponents(null, applicationName, portletName, producerCloned);
+ }
+
+ public Components createCopyWithInvoker(String invoker)
+ {
+ return new InterpretedPortletContextComponents(invoker, applicationName, portletName, producerCloned);
+ }
+ }
+
+ private static class UninterpretedPortletContextComponents implements Components
+ {
+ private static final String ERROR = "This PortletContext was not intepreted, only the portlet name is available!";
+ private final String portletName;
+
+ private UninterpretedPortletContextComponents(String portletName)
+ {
+ this.portletName = portletName;
+ }
+
+ public String getApplicationName()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public String getPortletName()
+ {
+ return portletName;
+ }
+
+ public String getInvokerName()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public boolean isCloned()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public boolean isProducerCloned()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public boolean isConsumerCloned()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public String getStateId()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public String getId()
+ {
+ return portletName;
+ }
+
+ public boolean isInterpreted()
+ {
+ return false;
+ }
+
+ public Components createCopyWithoutInvoker()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public Components createCopyWithInvoker(String invoker)
+ {
+ return new InterpretedPortletContextComponents(invoker, null, portletName, null);
+ }
+ }
}
Modified: sandbox/cdi_support/pc/branches/cdi/api/src/main/java/org/gatein/pc/api/StatefulPortletContext.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/api/src/main/java/org/gatein/pc/api/StatefulPortletContext.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/api/src/main/java/org/gatein/pc/api/StatefulPortletContext.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.pc.api;
import org.gatein.common.util.ParameterValidation;
@@ -40,6 +40,11 @@
return new StatefulPortletContext<S>(id, spc.type, spc.state);
}
+ static <S extends Serializable> StatefulPortletContext<S> create(Components components, StatefulPortletContext<S> spc)
+ {
+ return new StatefulPortletContext<S>(components, spc.type, spc.state);
+ }
+
public static <S extends Serializable> StatefulPortletContext<S> create(
String id,
PortletStateType<S> type,
@@ -58,19 +63,29 @@
{
super(id);
- //
ParameterValidation.throwIllegalArgExceptionIfNull(type, "Portlet type");
ParameterValidation.throwIllegalArgExceptionIfNull(state, "Portlet state");
- //
this.type = type;
this.state = state;
}
- public PortletStateType<S> getType() {
- return type;
+ StatefulPortletContext(Components components, PortletStateType<S> type, S state)
+ {
+ super(components);
+
+ ParameterValidation.throwIllegalArgExceptionIfNull(type, "Portlet type");
+ ParameterValidation.throwIllegalArgExceptionIfNull(state, "Portlet state");
+
+ this.type = type;
+ this.state = state;
}
+ public PortletStateType<S> getType()
+ {
+ return type;
+ }
+
public boolean equals(Object o)
{
if (this == o)
@@ -114,6 +129,6 @@
public String toString()
{
- return "StatefulPortletContext[" + id + "," + type.toString(state) + "]";
+ return "StatefulPortletContext[" + getId() + "," + type.toString(state) + "]";
}
}
Modified: sandbox/cdi_support/pc/branches/cdi/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,76 +1,377 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2008, 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.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.pc.api;
-import static org.jboss.unit.api.Assert.*;
-import org.jboss.unit.api.pojo.annotations.Test;
+import junit.framework.TestCase;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
*/
-public class PortletContextTestCase
+public class PortletContextTestCase extends TestCase
{
- @Test
+ public void testSimple()
+ {
+ try
+ {
+ PortletContext.createPortletContext("foo");
+ fail("Invalid by default");
+ }
+ catch (Exception e)
+ {
+ // expected
+ }
+
+ final PortletContext foo = PortletContext.createPortletContext("foo", false);
+ assertEquals("foo", foo.getId());
+ final PortletContext.PortletContextComponents components = foo.getComponents();
+ assertNotNull(components);
+ assertFalse(components.isInterpreted());
+ assertEquals("foo", components.getId());
+ assertEquals("foo", components.getPortletName());
+ }
+
public void testGetComponents()
{
PortletContext context = PortletContext.createPortletContext("/applicationName.portletName");
- assertEquals("applicationName", context.getApplicationName());
- assertEquals("portletName", context.getPortletName());
assertEquals("/applicationName.portletName", context.getId());
+ PortletContext.PortletContextComponents components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertNull(components.getInvokerName());
+ assertEquals("applicationName", components.getApplicationName());
+ assertEquals("portletName", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
context = PortletContext.createPortletContext("\t\t\n /applicationName.portletName \t");
- assertEquals("applicationName", context.getApplicationName());
- assertEquals("portletName", context.getPortletName());
assertEquals("/applicationName.portletName", context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertNull(components.getInvokerName());
+ assertEquals("applicationName", components.getApplicationName());
+ assertEquals("portletName", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
- context = PortletContext.createPortletContext("/");
- assertNull(context.getApplicationName());
- assertNull(context.getPortletName());
- assertEquals("/", context.getId());
+ try
+ {
+ PortletContext.createPortletContext("/");
+ fail("invalid");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
- context = PortletContext.createPortletContext("applicationName.portletName");
- assertNull(context.getApplicationName());
- assertNull(context.getPortletName());
- assertEquals("applicationName.portletName", context.getId());
+ try
+ {
+ PortletContext.createPortletContext("/app");
+ fail("invalid");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ String portletId = "applicationName" + PortletContext.INVOKER_SEPARATOR + "portletName";
+ context = PortletContext.createPortletContext(portletId);
+ assertEquals(portletId, context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertEquals("applicationName", components.getInvokerName());
+ assertNull(components.getApplicationName());
+ assertEquals("portletName", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
+
context = PortletContext.createPortletContext("/applicationName.portlet.Name");
- assertEquals("applicationName", context.getApplicationName());
- assertEquals("portlet.Name", context.getPortletName());
assertEquals("/applicationName.portlet.Name", context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertNull(components.getInvokerName());
+ assertEquals("applicationName", components.getApplicationName());
+ assertEquals("portlet.Name", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
- context = PortletContext.createPortletContext("/.");
- assertEquals("", context.getApplicationName());
- assertEquals("", context.getPortletName());
- assertEquals("/.", context.getId());
+ try
+ {
+ PortletContext.createPortletContext("/.");
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
context = PortletContext.createPortletContext("/ applicationName\t. portlet Name");
- assertEquals("applicationName", context.getApplicationName());
- assertEquals("portlet Name", context.getPortletName());
assertEquals("/applicationName.portlet Name", context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertNull(components.getInvokerName());
+ assertEquals("applicationName", components.getApplicationName());
+ assertEquals("portlet Name", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
}
- @Test
+ public void testPortletContextWithInvokerId()
+ {
+ String id = "local" + PortletContext.INVOKER_SEPARATOR + "/foo.bar";
+ PortletContext context = PortletContext.createPortletContext(id);
+ assertEquals(id, context.getId());
+ PortletContext.PortletContextComponents components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertEquals("local", components.getInvokerName());
+ assertEquals("foo", components.getApplicationName());
+ assertEquals("bar", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
+
+ context = PortletContext.createPortletContext(" local\t " + PortletContext.INVOKER_SEPARATOR + " / foo \t. \t\n bar");
+ assertEquals("local" + PortletContext.INVOKER_SEPARATOR + "/foo.bar", context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertEquals("local", components.getInvokerName());
+ assertEquals("foo", components.getApplicationName());
+ assertEquals("bar", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
+
+ id = "local" + PortletContext.INVOKER_SEPARATOR + "foo.bar";
+ context = PortletContext.createPortletContext(id);
+ assertEquals(id, context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertEquals("local", components.getInvokerName());
+ assertNull(components.getApplicationName());
+ assertEquals("foo.bar", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
+
+ id = "local" + PortletContext.INVOKER_SEPARATOR + "/foo";
+ context = PortletContext.createPortletContext(id);
+ assertEquals(id, context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertEquals("local", components.getInvokerName());
+ assertNull(components.getApplicationName());
+ assertEquals("/foo", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
+ }
+
+ public void testCreateFromAppAndPortletName()
+ {
+ PortletContext fromId = PortletContext.createPortletContext("/applicationName.portletName");
+
+ PortletContext context = PortletContext.createPortletContext("applicationName", "portletName");
+ assertEquals("/applicationName.portletName", context.getId());
+ PortletContext.PortletContextComponents components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertNull(components.getInvokerName());
+ assertEquals("applicationName", components.getApplicationName());
+ assertEquals("portletName", components.getPortletName());
+ assertEquals(context, fromId);
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
+ }
+
+ public void testShouldProperlyHandleApplicationNameStartingWithSlash()
+ {
+ PortletContext fromId = PortletContext.createPortletContext("/applicationName.portletName");
+
+ PortletContext context = PortletContext.createPortletContext("/applicationName", "portletName");
+ assertEquals("/applicationName.portletName", context.getId());
+ PortletContext.PortletContextComponents components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertNull(components.getInvokerName());
+ assertEquals("applicationName", components.getApplicationName());
+ assertEquals("portletName", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
+ assertEquals(context, fromId);
+ }
+
+ public void testShouldWorkWithoutInterpretation()
+ {
+ PortletContext context = PortletContext.createPortletContext("foo", false);
+ PortletContext.PortletContextComponents components = context.getComponents();
+ assertNotNull(components);
+ assertFalse(components.isInterpreted());
+ assertEquals("foo", context.getId());
+ assertEquals("foo", components.getPortletName());
+ assertEquals(components.getId(), context.getId());
+
+ try
+ {
+ components.getApplicationName();
+ fail("Unintrepreted so only component available is portlet name");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ components.getInvokerName();
+ fail("Unintrepreted so only component available is portlet name");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ components.getStateId();
+ fail("Unintrepreted so only component available is portlet name");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ components.isCloned();
+ fail("Unintrepreted so only component available is portlet name");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ components.isConsumerCloned();
+ fail("Unintrepreted so only component available is portlet name");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ components.isProducerCloned();
+ fail("Unintrepreted so only component available is portlet name");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+ }
+
+ public void testAcceptProducerClones()
+ {
+ PortletContext context;
+ PortletContext.PortletContextComponents components;
+
+ checkClones(PortletContext.PRODUCER_CLONE_ID_PREFIX);
+
+ String id = "foo" + PortletContext.INVOKER_SEPARATOR + PortletContext.CONSUMER_CLONE_ID;
+ context = PortletContext.createPortletContext(id);
+ assertEquals(id, context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertEquals("foo", components.getInvokerName());
+ assertNull(components.getApplicationName());
+ assertNull(components.getPortletName());
+ assertTrue(components.isCloned());
+ assertEquals(PortletContext.CONSUMER_CLONE_DUMMY_STATE_ID, components.getStateId());
+ }
+
+ private void checkClones(String clonePrefix)
+ {
+ PortletContext context;
+ PortletContext.PortletContextComponents components;
+ context = PortletContext.createPortletContext(clonePrefix + "clone");
+ assertEquals(clonePrefix + "clone", context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertNull(components.getInvokerName());
+ assertNull(components.getApplicationName());
+ assertNull(components.getPortletName());
+ assertTrue(components.isCloned());
+ assertEquals("clone", components.getStateId());
+
+ String id = "foo" + PortletContext.INVOKER_SEPARATOR + clonePrefix + "clone";
+ context = PortletContext.createPortletContext(id);
+ assertEquals(id, context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertEquals("foo", components.getInvokerName());
+ assertNull(components.getApplicationName());
+ assertNull(components.getPortletName());
+ assertTrue(components.isCloned());
+ assertEquals("clone", components.getStateId());
+
+ context = PortletContext.createPortletContext("foo \t \n " + PortletContext.INVOKER_SEPARATOR + " \t" + clonePrefix + " \t\nclone");
+ assertEquals(id, context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertEquals("foo", components.getInvokerName());
+ assertNull(components.getApplicationName());
+ assertNull(components.getPortletName());
+ assertTrue(components.isCloned());
+ assertEquals("clone", components.getStateId());
+ }
+
+ public void testAcceptConsumerClones()
+ {
+ checkClones(PortletContext.CONSUMER_CLONE_ID_PREFIX);
+ }
+
+ public void testAcceptLocalConsumerClone()
+ {
+ PortletContext.PortletContextComponents components = PortletContext.LOCAL_CONSUMER_CLONE.getComponents();
+ assertNotNull(components);
+ assertTrue(components.isInterpreted());
+ assertEquals(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, components.getInvokerName());
+ assertNull(components.getApplicationName());
+ assertNull(components.getPortletName());
+ assertTrue(components.isCloned());
+ assertEquals(PortletContext.CONSUMER_CLONE_DUMMY_STATE_ID, components.getStateId());
+ }
+
public void testCreateFromNullOrEmpty()
{
try
@@ -93,4 +394,55 @@
// expected
}
}
+
+ public void testReference()
+ {
+ final String invoker = "invoker";
+ final PortletContext context = PortletContext.createPortletContext("app", "portlet");
+
+ final PortletContext referenced = PortletContext.reference(invoker, context);
+ final PortletContext.PortletContextComponents components = referenced.getComponents();
+ assertTrue(components.isInterpreted());
+
+ assertEquals(invoker, components.getInvokerName());
+
+ final PortletContext.PortletContextComponents originalComponents = context.getComponents();
+ assertEquals(originalComponents.getApplicationName(), components.getApplicationName());
+ assertEquals(originalComponents.getPortletName(), components.getPortletName());
+ assertEquals(originalComponents.isCloned(), components.isCloned());
+ assertEquals(originalComponents.isConsumerCloned(), components.isConsumerCloned());
+ assertEquals(originalComponents.isProducerCloned(), components.isProducerCloned());
+ }
+
+ public void testDereferenceDoesNotAffectNonReferencedPortletContexts()
+ {
+ final PortletContext foo = PortletContext.createPortletContext("foo", false);
+ assertEquals(foo, PortletContext.dereference(foo));
+ }
+
+ public void testDereferenceWorksOnValidUninterpretedPortletContexts()
+ {
+ final String invoker = "foo";
+ final PortletContext referenced = PortletContext.createPortletContext(invoker + PortletContext.INVOKER_SEPARATOR + "portlet", false);
+ final PortletContext dereferenced = PortletContext.dereference(referenced);
+
+ // force interpretation of referenced
+ final PortletContext.PortletContextComponents referencedComponents = referenced.interpret();
+ assertTrue(referencedComponents.isInterpreted());
+ assertEquals(invoker, referencedComponents.getInvokerName());
+
+ final PortletContext.PortletContextComponents dereferencedComponents = dereferenced.getComponents();
+ assertTrue(dereferencedComponents.isInterpreted());
+
+ assertEquals(referencedComponents.getPortletName(), dereferencedComponents.getPortletName());
+ assertNull(dereferencedComponents.getInvokerName());
+ assertFalse(dereferenced.getId().contains(invoker));
+ }
+
+ public void testReferencingRoundtrip()
+ {
+ final PortletContext context = PortletContext.createPortletContext("app", "portlet");
+ final PortletContext referencedContext = PortletContext.reference("invoker", context);
+ assertEquals(context, PortletContext.dereference(referencedContext));
+ }
}
Modified: sandbox/cdi_support/pc/branches/cdi/bridge/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/bridge/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/bridge/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-bridge</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/controller/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/controller/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/controller/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-controller</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/controller/src/test/java/org/gatein/pc/controller/EventControllerContextFailureTestCase.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/controller/src/test/java/org/gatein/pc/controller/EventControllerContextFailureTestCase.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/controller/src/test/java/org/gatein/pc/controller/EventControllerContextFailureTestCase.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.pc.controller;
import org.gatein.pc.portlet.support.PortletInvokerSupport;
@@ -36,9 +36,9 @@
import org.gatein.pc.controller.handlers.NoOpEventHandler;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
-import org.gatein.pc.controller.PortletController;
import org.jboss.unit.api.pojo.annotations.Test;
import org.jboss.unit.api.pojo.annotations.Create;
+
import static org.jboss.unit.api.Assert.assertInstanceOf;
import static org.jboss.unit.api.Assert.assertEquals;
import static org.jboss.unit.api.Assert.assertTrue;
@@ -55,6 +55,8 @@
public class EventControllerContextFailureTestCase
{
+ public static final String DST_WINDOW_ID = "/webappdst.dst";
+
/** . */
private PortletController controller = new PortletController();
@@ -85,11 +87,11 @@
@Create
public void create()
{
- request = context.createActionRequest("foo");
- srcName = new QName("juu", "foo");
- dstName = new QName("juu", "bar");
- fooPortlet = invoker.addPortlet("foo");
- barPortlet = invoker.addPortlet("bar");
+ request = context.createActionRequest(PortletInvokerSupport.FOO_PORTLET_ID);
+ srcName = new QName("ns1", "src");
+ dstName = new QName("ns2", "dst");
+ fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
+ barPortlet = invoker.addPortlet(PortletInvokerSupport.BAR_PORTLET_ID);
called = false;
}
@@ -104,7 +106,7 @@
throw new RuntimeException();
}
};
- ecc.createWire(srcName, "foo", dstName, "bar");
+ ecc.createWire(srcName, PortletInvokerSupport.FOO_PORTLET_ID, dstName, PortletInvokerSupport.BAR_PORTLET_ID);
// We test that a runtime exception thrown does not interrrupt the flow of the controller
context.setEventControllerContext(ecc);
@@ -126,7 +128,7 @@
throw error;
}
};
- ecc.createWire(srcName, "foo", dstName, "bar");
+ ecc.createWire(srcName, PortletInvokerSupport.FOO_PORTLET_ID, dstName, PortletInvokerSupport.BAR_PORTLET_ID);
//
context.setEventControllerContext(ecc);
@@ -202,7 +204,7 @@
throw new RuntimeException();
}
};
- ecc.createWire(srcName, "foo", dstName, "bar");
+ ecc.createWire(srcName, PortletInvokerSupport.FOO_PORTLET_ID, dstName, PortletInvokerSupport.BAR_PORTLET_ID);
// We test that a runtime exception thrown does not interrrupt the flow of the controller
context.setEventControllerContext(ecc);
@@ -224,7 +226,7 @@
throw error;
}
};
- ecc.createWire(srcName, "foo", dstName, "bar");
+ ecc.createWire(srcName, PortletInvokerSupport.FOO_PORTLET_ID, dstName, PortletInvokerSupport.BAR_PORTLET_ID);
//
context.setEventControllerContext(ecc);
@@ -254,7 +256,7 @@
throw new RuntimeException();
}
};
- ecc.createWire(srcName, "foo", dstName, "bar_");
+ ecc.createWire(srcName, PortletInvokerSupport.FOO_PORTLET_ID, dstName, DST_WINDOW_ID);
// We test that a runtime exception thrown does not interrrupt the flow of the controller
context.setEventControllerContext(ecc);
@@ -276,7 +278,7 @@
throw error;
}
};
- ecc.createWire(srcName, "foo", dstName, "bar_");
+ ecc.createWire(srcName, PortletInvokerSupport.FOO_PORTLET_ID, dstName, DST_WINDOW_ID);
//
context.setEventControllerContext(ecc);
Modified: sandbox/cdi_support/pc/branches/cdi/controller/src/test/java/org/gatein/pc/controller/PortletControllerRequestTestCase.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/controller/src/test/java/org/gatein/pc/controller/PortletControllerRequestTestCase.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/controller/src/test/java/org/gatein/pc/controller/PortletControllerRequestTestCase.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,28 +1,29 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.pc.controller;
import static org.jboss.unit.api.Assert.*;
+
import org.jboss.unit.api.pojo.annotations.Test;
import org.gatein.pc.portlet.support.PortletInvokerSupport;
import org.gatein.pc.portlet.support.PortletSupport;
@@ -34,7 +35,6 @@
import org.gatein.pc.api.OpaqueStateString;
import org.gatein.pc.api.StateString;
import org.gatein.pc.api.cache.CacheLevel;
-import org.gatein.pc.controller.PortletController;
import org.gatein.pc.controller.request.PortletActionRequest;
import org.gatein.pc.controller.request.PortletResourceRequest;
import org.gatein.pc.controller.request.PortletRenderRequest;
@@ -88,7 +88,7 @@
@Test
public void testPortletControllerActionRequest() throws PortletInvokerException
{
- PortletSupport fooPortlet = invoker.addPortlet("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
fooPortlet.addHandler(new PortletSupport.ActionHandler()
{
protected PortletInvocationResponse invoke(ActionInvocation action) throws PortletInvokerException
@@ -106,7 +106,7 @@
});
//
- PortletActionRequest action = new PortletActionRequest("foo", is, body, windowNS, pageNS);
+ PortletActionRequest action = new PortletActionRequest(PortletInvokerSupport.FOO_PORTLET_ID, is, body, windowNS, pageNS);
//
controller.process(context, action);
@@ -115,15 +115,15 @@
@Test
public void testPortletControllerRenderRequest() throws PortletInvokerException
{
- invoker.addPortlet("foo");
- PortletRenderRequest render = new PortletRenderRequest("foo", windowNS, new HashMap<String, String[]>(), pageNS);
+ invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
+ PortletRenderRequest render = new PortletRenderRequest(PortletInvokerSupport.FOO_PORTLET_ID, windowNS, new HashMap<String, String[]>(), pageNS);
controller.process(context, render);
}
@Test
public void testPortletControllerResourceRequestFullScope() throws PortletInvokerException
{
- PortletSupport fooPortlet = invoker.addPortlet("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
ResourceHandlerImpl resourceHandler = new ResourceHandlerImpl();
resourceHandler.expectedResourceId = "resourceid";
resourceHandler.expectedRS = rs;
@@ -134,26 +134,26 @@
resourceHandler.expectedWindowState = org.gatein.pc.api.WindowState.NORMAL;
resourceHandler.expectedPublicState = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest fullServing = new PortletResourceRequest("foo", "resourceid", rs, body, new PortletResourceRequest.FullScope());
+ PortletResourceRequest fullServing = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, body, new PortletResourceRequest.FullScope());
controller.process(context, fullServing);
//
resourceHandler.expectedBody = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest fullServing2 = new PortletResourceRequest("foo", "resourceid", rs, null, new PortletResourceRequest.FullScope());
+ PortletResourceRequest fullServing2 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, null, new PortletResourceRequest.FullScope());
controller.process(context, fullServing2);
//
resourceHandler.expectedResourceId = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest fullServing3 = new PortletResourceRequest("foo", null, rs, null, new PortletResourceRequest.FullScope());
+ PortletResourceRequest fullServing3 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, null, rs, null, new PortletResourceRequest.FullScope());
controller.process(context, fullServing3);
}
@Test
public void testPortletControllerResourceRequestPortletScope() throws PortletInvokerException
{
- PortletSupport fooPortlet = invoker.addPortlet("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
ResourceHandlerImpl resourceHandler = new ResourceHandlerImpl();
resourceHandler.expectedResourceId = "resourceid";
resourceHandler.expectedRS = rs;
@@ -164,7 +164,7 @@
resourceHandler.expectedWindowState = org.gatein.pc.api.WindowState.MAXIMIZED;
resourceHandler.expectedPublicState = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest portletServing = new PortletResourceRequest("foo", "resourceid", rs, body, new PortletResourceRequest.PortletScope(windowNS));
+ PortletResourceRequest portletServing = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, body, new PortletResourceRequest.PortletScope(windowNS));
controller.process(context, portletServing);
//
@@ -172,20 +172,20 @@
resourceHandler.expectedMode = Mode.VIEW;
resourceHandler.expectedWindowState = org.gatein.pc.api.WindowState.NORMAL;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest portletServing2 = new PortletResourceRequest("foo", "resourceid", rs, body, new PortletResourceRequest.PortletScope(null));
+ PortletResourceRequest portletServing2 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, body, new PortletResourceRequest.PortletScope(null));
controller.process(context, portletServing2);
//
resourceHandler.expectedResourceId = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest portletServing3 = new PortletResourceRequest("foo", null, rs, body, new PortletResourceRequest.PortletScope(null));
+ PortletResourceRequest portletServing3 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, null, rs, body, new PortletResourceRequest.PortletScope(null));
controller.process(context, portletServing3);
}
@Test
public void testPortletControllerResourceRequestPageScope() throws PortletInvokerException
{
- PortletSupport fooPortlet = invoker.addPortlet("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
ResourceHandlerImpl resourceHandler = new ResourceHandlerImpl();
resourceHandler.expectedResourceId = "resourceid";
resourceHandler.expectedRS = rs;
@@ -196,7 +196,7 @@
resourceHandler.expectedCacheability = CacheLevel.PAGE;
resourceHandler.expectedPublicState = new ParameterMap();
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest pageServing = new PortletResourceRequest("foo", "resourceid", rs, body, new PortletResourceRequest.PageScope(windowNS, pageNS));
+ PortletResourceRequest pageServing = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, body, new PortletResourceRequest.PageScope(windowNS, pageNS));
controller.process(context, pageServing);
//
@@ -204,25 +204,25 @@
resourceHandler.expectedMode = Mode.VIEW;
resourceHandler.expectedWindowState = org.gatein.pc.api.WindowState.NORMAL;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest pageServing2 = new PortletResourceRequest("foo", "resourceid", rs, body, new PortletResourceRequest.PageScope(null, pageNS));
+ PortletResourceRequest pageServing2 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, body, new PortletResourceRequest.PageScope(null, pageNS));
controller.process(context, pageServing2);
//
resourceHandler.expectedBody = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest pageServing3 = new PortletResourceRequest("foo", "resourceid", rs, null, new PortletResourceRequest.PageScope(null, pageNS));
+ PortletResourceRequest pageServing3 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, null, new PortletResourceRequest.PageScope(null, pageNS));
controller.process(context, pageServing3);
//
resourceHandler.expectedPublicState = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest pageServing4 = new PortletResourceRequest("foo", "resourceid", rs, null, new PortletResourceRequest.PageScope(null, null));
+ PortletResourceRequest pageServing4 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, null, new PortletResourceRequest.PageScope(null, null));
controller.process(context, pageServing4);
//
resourceHandler.expectedResourceId = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest pageServing5 = new PortletResourceRequest("foo", null, rs, null, new PortletResourceRequest.PageScope(null, null));
+ PortletResourceRequest pageServing5 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, null, rs, null, new PortletResourceRequest.PageScope(null, null));
controller.process(context, pageServing5);
}
Modified: sandbox/cdi_support/pc/branches/cdi/controller/src/test/java/org/gatein/pc/controller/PortletControllerTestCase.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/controller/src/test/java/org/gatein/pc/controller/PortletControllerTestCase.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/controller/src/test/java/org/gatein/pc/controller/PortletControllerTestCase.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.pc.controller;
import org.gatein.pc.controller.request.ControllerRequest;
@@ -45,11 +45,11 @@
import org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse;
import org.gatein.pc.api.invocation.ActionInvocation;
import org.gatein.pc.api.invocation.EventInvocation;
-import org.gatein.pc.controller.PortletController;
import org.gatein.common.util.Tools;
import org.gatein.pc.api.WindowState;
import org.jboss.unit.api.pojo.annotations.Test;
import org.jboss.unit.api.pojo.annotations.Create;
+
import static org.jboss.unit.api.Assert.*;
import javax.xml.namespace.QName;
@@ -75,6 +75,9 @@
/** . */
PortletInvokerSupport invoker = context.getInvoker();
+ public static final QName SRC_NAME = new QName("ns1", "src");
+ public static final QName DST_NAME = new QName("ns2", "dest");
+
@Create
public void create()
{
@@ -84,16 +87,16 @@
@Test
public void testPortletControllerRenderRequest() throws PortletInvokerException
{
- invoker.addPortlet("foo");
+ invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
StateString portletNS = new OpaqueStateString("abc");
PortletPageNavigationalState pageNS = context.getStateControllerContext().createPortletPageNavigationalState(true);
PortletWindowNavigationalState windowNS = new PortletWindowNavigationalState(portletNS, org.gatein.pc.api.Mode.EDIT, WindowState.MAXIMIZED);
- PortletRenderRequest render = new PortletRenderRequest("foo", windowNS, new HashMap<String, String[]>(), pageNS);
+ PortletRenderRequest render = new PortletRenderRequest(PortletInvokerSupport.FOO_PORTLET_ID, windowNS, new HashMap<String, String[]>(), pageNS);
ControllerResponse response = controller.process(context, render);
PageUpdateResponse pageUpdate = assertInstanceOf(response, PageUpdateResponse.class);
PortletPageNavigationalState pageNS2 = assertNotNull(pageUpdate.getPageNavigationalState());
- assertEquals(Tools.toSet("foo"), pageNS2.getPortletWindowIds());
- PortletWindowNavigationalState windowNS2 = pageNS2.getPortletWindowNavigationalState("foo");
+ assertEquals(Tools.toSet(PortletInvokerSupport.FOO_PORTLET_ID), pageNS2.getPortletWindowIds());
+ PortletWindowNavigationalState windowNS2 = pageNS2.getPortletWindowNavigationalState(PortletInvokerSupport.FOO_PORTLET_ID);
assertNotNull(windowNS2);
assertEquals(portletNS, windowNS2.getPortletNavigationalState());
assertEquals(org.gatein.pc.api.Mode.EDIT, windowNS2.getMode());
@@ -114,11 +117,8 @@
private void testAction(final boolean publishEvent) throws PortletInvokerException
{
- final QName srcName = new QName("juu", "foo");
- final QName dstName = new QName("juu", "bar");
-
//
- PortletSupport fooPortlet = invoker.addPortlet("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
fooPortlet.addHandler(new PortletSupport.ActionHandler()
{
protected PortletInvocationResponse invoke(ActionInvocation action) throws PortletInvokerException
@@ -131,21 +131,21 @@
//
if (publishEvent)
{
- updateNS.queueEvent(new UpdateNavigationalStateResponse.Event(srcName, null));
+ updateNS.queueEvent(new UpdateNavigationalStateResponse.Event(SRC_NAME, null));
}
-
+
//
return updateNS;
}
});
//
- PortletSupport barPortlet = invoker.addPortlet("bar");
+ PortletSupport barPortlet = invoker.addPortlet(PortletInvokerSupport.BAR_PORTLET_ID);
barPortlet.addHandler(new PortletSupport.EventHandler()
{
protected PortletInvocationResponse invoke(EventInvocation action) throws PortletInvokerException
{
- assertEquals(dstName, action.getName());
+ assertEquals(DST_NAME, action.getName());
assertEquals(null, action.getPayload());
//
@@ -160,16 +160,16 @@
});
//
- eventControllerContext.createWire(srcName, "foo", dstName, "bar");
+ eventControllerContext.createWire(SRC_NAME, PortletInvokerSupport.FOO_PORTLET_ID, DST_NAME, PortletInvokerSupport.BAR_PORTLET_ID);
//
- ControllerRequest request = context.createActionRequest("foo");
+ ControllerRequest request = context.createActionRequest(PortletInvokerSupport.FOO_PORTLET_ID);
ControllerResponse response = controller.process(context, request);
PageUpdateResponse pageUpdate = assertInstanceOf(response, PageUpdateResponse.class);
PortletPageNavigationalState pageNS = assertNotNull(pageUpdate.getPageNavigationalState());
//
- PortletWindowNavigationalState fooNS = assertNotNull(pageNS.getPortletWindowNavigationalState("foo"));
+ PortletWindowNavigationalState fooNS = assertNotNull(pageNS.getPortletWindowNavigationalState(PortletInvokerSupport.FOO_PORTLET_ID));
assertEquals(WindowState.MAXIMIZED, fooNS.getWindowState());
assertEquals(org.gatein.pc.api.Mode.EDIT, fooNS.getMode());
assertEquals(new OpaqueStateString("abc"), fooNS.getPortletNavigationalState());
@@ -177,17 +177,17 @@
//
if (publishEvent)
{
- assertEquals(Tools.toSet("foo", "bar"), pageNS.getPortletWindowIds());
+ assertEquals(Tools.toSet(PortletInvokerSupport.FOO_PORTLET_ID, PortletInvokerSupport.BAR_PORTLET_ID), pageNS.getPortletWindowIds());
//
- PortletWindowNavigationalState barNS = assertNotNull(pageNS.getPortletWindowNavigationalState("bar"));
+ PortletWindowNavigationalState barNS = assertNotNull(pageNS.getPortletWindowNavigationalState(PortletInvokerSupport.BAR_PORTLET_ID));
assertEquals(WindowState.MINIMIZED, barNS.getWindowState());
assertEquals(org.gatein.pc.api.Mode.HELP, barNS.getMode());
assertEquals(new OpaqueStateString("def"), barNS.getPortletNavigationalState());
}
else
{
- assertEquals(Tools.toSet("foo"), pageNS.getPortletWindowIds());
+ assertEquals(Tools.toSet(PortletInvokerSupport.FOO_PORTLET_ID), pageNS.getPortletWindowIds());
}
}
@@ -195,7 +195,7 @@
public void testActionThrowsPortletInvokerException() throws PortletInvokerException
{
final PortletInvokerException e = new PortletInvokerException();
- PortletSupport fooPortlet = invoker.addPortlet("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
fooPortlet.addHandler(new PortletSupport.ActionHandler()
{
protected PortletInvocationResponse invoke(ActionInvocation action) throws PortletInvokerException
@@ -205,7 +205,7 @@
});
//
- ControllerRequest request = context.createActionRequest("foo");
+ ControllerRequest request = context.createActionRequest(PortletInvokerSupport.FOO_PORTLET_ID);
try
{
@@ -221,14 +221,12 @@
@Test
public void testProcessActionProducedEventIsDistributed() throws PortletInvokerException
{
- QName srcName = new QName("juu", "foo");
- QName dstName = new QName("juu", "bar");
- PortletSupport fooPortlet = invoker.addPortlet("foo");
- PortletSupport barPortlet = invoker.addPortlet("bar");
- EventProducerActionHandler eventProducerHandler = new EventProducerActionHandler(srcName);
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
+ PortletSupport barPortlet = invoker.addPortlet(PortletInvokerSupport.BAR_PORTLET_ID);
+ EventProducerActionHandler eventProducerHandler = new EventProducerActionHandler(SRC_NAME);
NoOpEventHandler eventConsumer = new NoOpEventHandler();
- eventControllerContext.createWire(srcName, "foo", dstName, "bar");
- ControllerRequest request = context.createActionRequest("foo");
+ eventControllerContext.createWire(SRC_NAME, PortletInvokerSupport.FOO_PORTLET_ID, DST_NAME, PortletInvokerSupport.BAR_PORTLET_ID);
+ ControllerRequest request = context.createActionRequest(PortletInvokerSupport.FOO_PORTLET_ID);
//
controller.setDistributeNonProduceableEvents(true);
@@ -248,7 +246,7 @@
barPortlet.assertInvocationCountIs(1);
//
- barPortlet.getInfo().getEventing().addConsumedEvent(new EventInfoSupport(dstName));
+ barPortlet.getInfo().getEventing().addConsumedEvent(new EventInfoSupport(DST_NAME));
//
controller.setDistributeNonProduceableEvents(true);
@@ -285,7 +283,7 @@
barPortlet.assertInvocationCountIs(3);
//
- fooPortlet.getInfo().getEventing().addProducedEvent(new EventInfoSupport(srcName));
+ fooPortlet.getInfo().getEventing().addProducedEvent(new EventInfoSupport(SRC_NAME));
//
controller.setDistributeNonProduceableEvents(false);
@@ -309,14 +307,13 @@
@Test
public void testEventFloodDetection() throws PortletInvokerException
{
- QName srcName = new QName("juu", "foo");
- PortletSupport fooPortlet = invoker.addPortlet("foo");
- eventControllerContext.createWire(srcName, "foo", srcName, "foo");
- ControllerRequest request = context.createActionRequest("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
+ eventControllerContext.createWire(SRC_NAME, PortletInvokerSupport.FOO_PORTLET_ID, SRC_NAME, PortletInvokerSupport.FOO_PORTLET_ID);
+ ControllerRequest request = context.createActionRequest(PortletInvokerSupport.FOO_PORTLET_ID);
//
- EventProducerActionHandler eventProducerActionHandler = new EventProducerActionHandler(srcName);
- EventProducerEventHandler eventProducerEventHandler = new EventProducerEventHandler(srcName);
+ EventProducerActionHandler eventProducerActionHandler = new EventProducerActionHandler(SRC_NAME);
+ EventProducerEventHandler eventProducerEventHandler = new EventProducerEventHandler(SRC_NAME);
//
controller.setConsumedEventThreshold(10);
@@ -340,13 +337,12 @@
@Test
public void testEventFloodInterruption() throws PortletInvokerException
{
- QName srcName = new QName("juu", "foo");
- PortletSupport fooPortlet = invoker.addPortlet("foo");
- eventControllerContext.createWire(srcName, "foo", srcName, "foo");
- ControllerRequest request = context.createActionRequest("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
+ eventControllerContext.createWire(SRC_NAME, PortletInvokerSupport.FOO_PORTLET_ID, SRC_NAME, PortletInvokerSupport.FOO_PORTLET_ID);
+ ControllerRequest request = context.createActionRequest(PortletInvokerSupport.FOO_PORTLET_ID);
//
- EventProducerActionHandler eventProducerActionHandler = new EventProducerActionHandler(srcName);
+ EventProducerActionHandler eventProducerActionHandler = new EventProducerActionHandler(SRC_NAME);
//
controller.setConsumedEventThreshold(10);
Modified: sandbox/cdi_support/pc/branches/cdi/docs/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/docs/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/docs/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<artifactId>docs-aggregator</artifactId>
<packaging>pom</packaging>
Modified: sandbox/cdi_support/pc/branches/cdi/docs/user-guide/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/docs/user-guide/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/docs/user-guide/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -4,8 +4,8 @@
<parent>
<groupId>org.gatein.pc</groupId>
- <artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <artifactId>docs-aggregator</artifactId>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<groupId>org.gatein.pc</groupId>
<artifactId>user-guide-${translation}</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/federation/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/federation/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/federation/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-federation</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.pc.federation.impl;
import org.gatein.pc.api.Portlet;
@@ -197,7 +197,7 @@
{
DestroyCloneFailure failure = failures.get(i);
String cloneId = failure.getPortletId();
- failure = new DestroyCloneFailure(FederatingPortletInvokerService.reference(cloneId, id));
+ failure = new DestroyCloneFailure(PortletContext.reference(id, PortletContext.createPortletContext(cloneId)).getId());
failures.set(i, failure);
}
@@ -242,12 +242,12 @@
private PortletContext dereference(PortletContext compoundPortletContext)
{
- return FederatingPortletInvokerService.dereference(compoundPortletContext, id);
+ return PortletContext.dereference(compoundPortletContext);
}
private PortletContext reference(PortletContext portletContext)
{
- return FederatingPortletInvokerService.reference(portletContext, id);
+ return PortletContext.reference(id, portletContext);
}
}
Modified: sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -62,47 +62,11 @@
/** . */
private static final Logger log = LoggerFactory.getLogger(FederatingPortletInvokerService.class);
- /** The separator used in the id to route to the correct invoker. */
- static final String SEPARATOR = ".";
-
/** The registred FederatedPortletInvokers. */
private volatile Map<String, FederatedPortletInvoker> registry = new HashMap<String, FederatedPortletInvoker>();
private NullInvokerHandler nullHandler = NullInvokerHandler.DEFAULT_HANDLER;
- public static PortletContext dereference(PortletContext compoundPortletContext, String invokerId)
- {
- String portletId = compoundPortletContext.getId().substring(invokerId.length() + 1);
- if (compoundPortletContext instanceof StatefulPortletContext)
- {
- StatefulPortletContext<?> compoundStatefulPortletContext = (StatefulPortletContext<?>)compoundPortletContext;
- return StatefulPortletContext.create(portletId, compoundStatefulPortletContext);
- }
- else
- {
- return PortletContext.createPortletContext(portletId);
- }
- }
-
- public static PortletContext reference(PortletContext portletContext, String invokerId)
- {
- String compoundPortletId = reference(portletContext.getId(), invokerId);
- if (portletContext instanceof StatefulPortletContext)
- {
- StatefulPortletContext<?> statefulPortletContext = (StatefulPortletContext<?>)portletContext;
- return StatefulPortletContext.create(compoundPortletId, statefulPortletContext);
- }
- else
- {
- return PortletContext.createPortletContext(compoundPortletId);
- }
- }
-
- static String reference(String portletId, String invokerId)
- {
- return invokerId + SEPARATOR + portletId;
- }
-
public synchronized FederatedPortletInvoker registerInvoker(String federatedId, PortletInvoker federatedInvoker)
{
if (federatedId == null)
@@ -315,18 +279,21 @@
throw new IllegalArgumentException("No null portlet id accepted");
}
- //
- String compoundPortletId = compoundPortletContext.getId();
+ PortletContext.PortletContextComponents components = compoundPortletContext.getComponents();
+ final String compoundPortletId = compoundPortletContext.getId();
+ if (components == null)
+ {
+ // force intepretation
+ compoundPortletContext = PortletContext.createPortletContext(compoundPortletId, true);
+ components = compoundPortletContext.getComponents();
+ }
- //
- int pos = compoundPortletId.indexOf(SEPARATOR);
- if (pos == -1)
+ final String invokerId = components.getInvokerName();
+ if (invokerId == null)
{
throw new IllegalArgumentException("Bad portlet id format " + compoundPortletId);
}
- //
- String invokerId = compoundPortletId.substring(0, pos);
FederatedPortletInvoker federated = registry.get(invokerId);
if (federated == null)
{
Modified: sandbox/cdi_support/pc/branches/cdi/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -51,6 +51,12 @@
public class FederatingPortletInvokerTestCase
{
+ private static final PortletContext PORTLET = PortletContext.createPortletContext("/webapp.portlet", false);
+ private static final String INVOKER_ID = "foo";
+ private static final PortletContext LOCAL_PORTLET = PortletContext.createPortletContext("/web.local", false);
+ private static final PortletContext REFERENCED_PORTLET = PortletContext.reference(INVOKER_ID, PORTLET);
+ private static final PortletContext REFERENCED_LOCAL_PORTLET = PortletContext.reference(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, LOCAL_PORTLET);
+
/** . */
private FederatingPortletInvoker federatingInvoker;
@@ -75,17 +81,17 @@
federatedInvokerDelegate = new PortletInvokerSupport();
PortletInfoSupport fooInfo = new PortletInfoSupport();
fooInfo.getMeta().setDisplayName("FooPortlet");
- portlet = federatedInvokerDelegate.addPortlet("MyPortlet", fooInfo);
+ portlet = federatedInvokerDelegate.addPortlet(PORTLET.getId(), fooInfo);
portletContext = portlet.getContext();
- federatedInvoker = federatingInvoker.registerInvoker("foo", federatedInvokerDelegate);
+ federatedInvoker = federatingInvoker.registerInvoker(INVOKER_ID, federatedInvokerDelegate);
assertNotNull(federatedInvoker);
- assertEquals("foo", federatedInvoker.getId());
+ assertEquals(INVOKER_ID, federatedInvoker.getId());
// create 'local' invoker and register it with federating service
localInvokerDelegate = new PortletInvokerSupport();
PortletInfoSupport localInfo = new PortletInfoSupport();
localInfo.getMeta().setDisplayName("LocalPortlet");
- localInvokerDelegate.addPortlet("MyLocalPortlet", localInfo);
+ localInvokerDelegate.addPortlet(LOCAL_PORTLET.getId(), localInfo);
localInvoker = federatingInvoker.registerInvoker(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, localInvokerDelegate);
assertNotNull(localInvoker);
assertEquals(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, localInvoker.getId());
@@ -108,22 +114,22 @@
assertNotNull(portlets);
assertEquals(2, portlets.size());
+
for (Portlet portlet : portlets)
{
PortletContext context = portlet.getContext();
- String id = context.getId();
- assertTrue("foo.MyPortlet".equals(id) || (PortletInvoker.LOCAL_PORTLET_INVOKER_ID + ".MyLocalPortlet").equals(id));
+ assertTrue(REFERENCED_PORTLET.getId().equals(context.getId()) || REFERENCED_LOCAL_PORTLET.getId().equals(context.getId()));
}
}
@Test
public void testGetStatus() throws PortletInvokerException
{
- assertEquals(PortletStatus.OFFERED, federatingInvoker.getStatus(PortletContext.createPortletContext("foo.MyPortlet")));
- assertEquals(PortletStatus.OFFERED, federatingInvoker.getStatus(PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + ".MyLocalPortlet")));
+ assertEquals(PortletStatus.OFFERED, federatingInvoker.getStatus(REFERENCED_PORTLET));
+ assertEquals(PortletStatus.OFFERED, federatingInvoker.getStatus(REFERENCED_LOCAL_PORTLET));
- assertEquals(PortletStatus.OFFERED, federatedInvoker.getStatus(PortletContext.createPortletContext("foo.MyPortlet")));
- assertEquals(PortletStatus.OFFERED, localInvoker.getStatus(PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + ".MyLocalPortlet")));
+ assertEquals(PortletStatus.OFFERED, federatedInvoker.getStatus(REFERENCED_PORTLET));
+ assertEquals(PortletStatus.OFFERED, localInvoker.getStatus(REFERENCED_LOCAL_PORTLET));
}
@Test
@@ -133,9 +139,9 @@
assertNotNull(federateds);
assertEquals(2, federateds.size());
- FederatedPortletInvoker federated = federatingInvoker.getFederatedInvoker("foo");
+ FederatedPortletInvoker federated = federatingInvoker.getFederatedInvoker(INVOKER_ID);
assertNotNull(federated);
- assertEquals("foo", federated.getId());
+ assertEquals(INVOKER_ID, federated.getId());
assertEquals(federatedInvoker, federated);
assertEquals(federatedInvokerDelegate, federated.getPortletInvoker());
@@ -176,7 +182,7 @@
@Test
public void testGetPortletOnFederatedInvoker() throws PortletInvokerException
{
- PortletContext federatedContext = PortletContext.createPortletContext(federatedInvoker.getId() + "." + portletContext.getId());
+ PortletContext federatedContext = PortletContext.createPortletContext(federatedInvoker.getId() + PortletContext.INVOKER_SEPARATOR + portletContext.getId());
Portlet samePortlet = federatedInvoker.getPortlet(federatedContext);
assertNotNull(samePortlet);
assertEquals(samePortlet.getContext(), federatedContext);
@@ -189,7 +195,7 @@
assertEquals(1, localPortlets.size());
Portlet localPortlet = localPortlets.iterator().next();
assertNotNull(localPortlet);
- assertEquals("local.MyLocalPortlet", localPortlet.getContext().getId());
+ assertEquals(REFERENCED_LOCAL_PORTLET, localPortlet.getContext());
}
@Test
@@ -199,7 +205,7 @@
assertEquals(1, portlets.size());
Portlet portlet = portlets.iterator().next();
assertNotNull(portlet);
- assertEquals("foo.MyPortlet", portlet.getContext().getId());
+ assertEquals(REFERENCED_PORTLET, portlet.getContext());
}
@Test
@@ -209,10 +215,12 @@
final TestFederatedPortletInvoker remote = new TestFederatedPortletInvoker();
PortletInfoSupport remoteInfo = new PortletInfoSupport();
remoteInfo.getMeta().setDisplayName("RemotePortlet");
- Portlet portlet = remote.addPortlet("RemotePortlet", remoteInfo);
+ final PortletContext context = PortletContext.createPortletContext("/app.RemotePortlet");
+ Portlet portlet = remote.addPortlet(context.getId(), remoteInfo);
// this invoker is not registered
- assertNull(federatingInvoker.getFederatedInvoker("inexistent"));
+ final String federatedId = "inexistent";
+ assertNull(federatingInvoker.getFederatedInvoker(federatedId));
federatingInvoker.setNullInvokerHandler(new NullInvokerHandler()
{
@@ -223,7 +231,8 @@
}
});
- assertEquals(portlet, federatingInvoker.getPortlet(PortletContext.createPortletContext("inexistent.RemotePortlet")));
+ assertEquals(portlet, federatingInvoker.getPortlet(PortletContext.createPortletContext(federatedId + PortletContext.INVOKER_SEPARATOR + context.getId())));
+ assertEquals(portlet, federatingInvoker.getPortlet(PortletContext.reference(federatedId, context)));
}
private class TestFederatedPortletInvoker extends PortletInvokerSupport implements FederatedPortletInvoker
@@ -239,9 +248,9 @@
{
// fake dereferencing of compound portlet id
String portletId = portletContext.getId();
- if (portletId.startsWith(getId() + "."))
+ if (portletId.startsWith(getId() + PortletContext.INVOKER_SEPARATOR))
{
- return super.getPortlet(PortletContext.createPortletContext(portletId.substring(portletId.indexOf('.') + 1)));
+ return super.getPortlet(PortletContext.createPortletContext(portletId.substring(portletId.indexOf(PortletContext.INVOKER_SEPARATOR) + 1)));
}
else
{
Modified: sandbox/cdi_support/pc/branches/cdi/jsr168api/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/jsr168api/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/jsr168api/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-jsr168api</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/management/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/management/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/management/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-management</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/mc/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/mc/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/mc/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-mc</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,6 +1,6 @@
<!--
~ JBoss, a division of Red Hat
- ~ Copyright 2010, Red Hat Middleware, LLC, and individual
+ ~ Copyright 2011, 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.
@@ -29,7 +29,7 @@
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
@@ -45,12 +45,14 @@
</scm>
<properties>
- <version.gatein.common>2.0.4-Beta01</version.gatein.common>
+ <version.gatein.common>2.0.4-Beta02</version.gatein.common>
<version.gatein.wci>2.1.0-Beta01</version.gatein.wci>
<version.apache.portals.bridges>1.0.4</version.apache.portals.bridges>
<version.apache.taglibs>1.1.2</version.apache.taglibs>
<version.apache.log4j>1.2.14</version.apache.log4j>
<version.discovery>0.4</version.discovery>
+ <version.servlet>2.5</version.servlet>
+ <version.junit>4.6</version.junit>
<!-- used in test module by maven-antrun-extended-plugin -->
<version.jboss.unit>1.2.3</version.jboss.unit>
@@ -164,6 +166,16 @@
<version>${version.apache.taglibs}</version>
</dependency>
<dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${version.servlet}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ </dependency>
+ <dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>${version.apache.taglibs}</version>
@@ -171,9 +183,9 @@
<dependency>
<groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-jetty-deployer</artifactId>
- <type>war</type>
- <version>${version.cargo.jetty.deployer}</version>
+ <artifactId>cargo-jetty-deployer</artifactId>
+ <type>war</type>
+ <version>${version.cargo.jetty.deployer}</version>
</dependency>
<dependency>
<groupId>org.jboss.integration</groupId>
Modified: sandbox/cdi_support/pc/branches/cdi/portal/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/portal/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/portal/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-portal</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/portlet/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/portlet/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/portlet/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-portlet</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.pc.portlet.state.consumer;
import org.gatein.common.NotYetImplemented;
@@ -55,9 +55,6 @@
{
/** . */
- private static final String CLONE_ID_PREFIX = "@";
-
- /** . */
private ConsumerPersistenceManager persistenceManager;
public PortletContext unwrapCCP(String wrappedCCP) throws InvalidPortletIdException
@@ -66,11 +63,11 @@
{
throw new IllegalArgumentException();
}
- if (!wrappedCCP.startsWith(CLONE_ID_PREFIX))
+ if (!wrappedCCP.startsWith(PortletContext.CONSUMER_CLONE_ID_PREFIX))
{
throw new InvalidPortletIdException(wrappedCCP);
}
- return PortletContext.createPortletContext(wrappedCCP.substring(CLONE_ID_PREFIX.length()));
+ return PortletContext.createPortletContext(wrappedCCP.substring(PortletContext.CONSUMER_CLONE_ID_PREFIX.length()));
}
public PortletContext unwrapPOP(String wrappedPOPId) throws InvalidPortletIdException
@@ -88,7 +85,7 @@
{
throw new IllegalArgumentException();
}
- return CLONE_ID_PREFIX + ccpCtx.getId();
+ return PortletContext.CONSUMER_CLONE_ID_PREFIX + ccpCtx.getId();
}
public String wrapPOP(PortletContext popCtx) throws InvalidPortletIdException
@@ -97,9 +94,9 @@
{
throw new IllegalArgumentException();
}
- if (popCtx.getId().startsWith(CLONE_ID_PREFIX))
+ if (popCtx.getId().startsWith(PortletContext.CONSUMER_CLONE_ID_PREFIX))
{
- throw new IllegalArgumentException("Must not start with " + CLONE_ID_PREFIX);
+ throw new IllegalArgumentException("Must not start with " + PortletContext.CONSUMER_CLONE_ID_PREFIX);
}
return popCtx.getId();
}
@@ -157,7 +154,7 @@
// Save the clone state
ConsumerState consumerState = new ConsumerState<Serializable>(clonedContext.getId(), stateType, state);
String stateId = persistenceManager.createState(consumerState);
- String clonedId = CLONE_ID_PREFIX + stateId;
+ String clonedId = PortletContext.CONSUMER_CLONE_ID_PREFIX + stateId;
StateEvent event = new StateEvent(PortletContext.createPortletContext(clonedId), StateEvent.Type.PORTLET_CLONED_EVENT);
cictx.onStateEvent(event);
}
@@ -217,7 +214,7 @@
StatefulPortletContext statefulClonedContext = (StatefulPortletContext)clonedContext;
ConsumerState consumerState = new ConsumerState<Serializable>(clonedContext.getId(), statefulClonedContext.getType(), statefulClonedContext.getState());
String id = persistenceManager.createState(consumerState);
- return PortletContext.createPortletContext(CLONE_ID_PREFIX + id);
+ return PortletContext.createPortletContext(PortletContext.CONSUMER_CLONE_ID_PREFIX + id);
}
else
{
@@ -237,7 +234,7 @@
StatefulPortletContext statefulimportContext = (StatefulPortletContext)importContext;
ConsumerState consumerState = new ConsumerState<Serializable>(importContext.getId(), statefulimportContext.getType(), statefulimportContext.getState());
String id = persistenceManager.createState(consumerState);
- return PortletContext.createPortletContext(CLONE_ID_PREFIX + id);
+ return PortletContext.createPortletContext(PortletContext.CONSUMER_CLONE_ID_PREFIX + id);
}
else
{
@@ -413,9 +410,9 @@
String portletId = portletContext.getId();
//
- if (portletId.startsWith(CLONE_ID_PREFIX))
+ if (portletId.startsWith(PortletContext.CONSUMER_CLONE_ID_PREFIX))
{
- String stateId = portletId.substring(CLONE_ID_PREFIX.length());
+ String stateId = portletId.substring(PortletContext.CONSUMER_CLONE_ID_PREFIX.length());
try
{
ConsumerStateContext stateCtx = persistenceManager.loadState(stateId);
Modified: sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -73,12 +73,6 @@
{
/** . */
- private static final String PRODUCER_CLONE_ID_PREFIX = "_";
-
- /** . */
- private static final String CONSUMER_CLONE_ID = "_dumbvalue";
-
- /** . */
private PortletStatePersistenceManager persistenceManager;
/** . */
@@ -160,7 +154,7 @@
String portletId = portletContext.getId();
//
- if (CONSUMER_CLONE_ID.equals(portletId))
+ if (PortletContext.CONSUMER_CLONE_ID.equals(portletId))
{
if (portletContext instanceof StatefulPortletContext)
{
@@ -184,11 +178,11 @@
throw new InvalidPortletIdException("", portletId);
}
}
- else if (portletId.startsWith(PRODUCER_CLONE_ID_PREFIX))
+ else if (portletId.startsWith(PortletContext.PRODUCER_CLONE_ID_PREFIX))
{
try
{
- String stateId = portletId.substring(PRODUCER_CLONE_ID_PREFIX.length());
+ String stateId = portletId.substring(PortletContext.PRODUCER_CLONE_ID_PREFIX.length());
PortletStateContext stateContext = persistenceManager.loadState(stateId);
PortletState state = stateContext.getState();
Portlet delegate = super.getPortlet(PortletContext.createPortletContext(state.getPortletId()));
@@ -300,7 +294,7 @@
String cloneStateId = persistenceManager.cloneState(portletStateId, newPrefs);
// Return the clone context
- String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
+ String cloneId = PortletContext.PRODUCER_CLONE_ID_PREFIX + cloneStateId;
PortletContext clonedCtx = PortletContext.createPortletContext(cloneId);
StateEvent event = new StateEvent(clonedCtx, StateEvent.Type.PORTLET_CLONED_EVENT);
instanceCtx.onStateEvent(event);
@@ -333,7 +327,7 @@
String cloneStateId = persistenceManager.createState(context.getPortletId(), newPrefs);
// Return the clone context
- String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
+ String cloneId = PortletContext.PRODUCER_CLONE_ID_PREFIX + cloneStateId;
PortletContext clonedCtx = PortletContext.createPortletContext(cloneId);
StateEvent event = new StateEvent(clonedCtx, StateEvent.Type.PORTLET_CLONED_EVENT);
instanceCtx.onStateEvent(event);
@@ -418,8 +412,8 @@
{
try
{
- String stateId = portletId.substring(PRODUCER_CLONE_ID_PREFIX.length());
- String cloneId = PRODUCER_CLONE_ID_PREFIX + persistenceManager.cloneState(stateId);
+ String stateId = portletId.substring(PortletContext.PRODUCER_CLONE_ID_PREFIX.length());
+ String cloneId = PortletContext.PRODUCER_CLONE_ID_PREFIX + persistenceManager.cloneState(stateId);
return PortletContext.createPortletContext(cloneId);
}
catch (NoSuchStateException e)
@@ -443,7 +437,7 @@
if (persistLocally)
{
String cloneId = persistenceManager.createState(portletId, newState);
- return PortletContext.createPortletContext(PRODUCER_CLONE_ID_PREFIX + cloneId);
+ return PortletContext.createPortletContext(PortletContext.PRODUCER_CLONE_ID_PREFIX + cloneId);
}
else
{
@@ -467,7 +461,7 @@
if (!(portletContext instanceof StatefulPortletContext))
{
String portletId = portletContext.getId();
- if (!portletId.startsWith(PRODUCER_CLONE_ID_PREFIX))
+ if (!portletId.startsWith(PortletContext.PRODUCER_CLONE_ID_PREFIX))
{
log.debug("Attempt to destroy a producer offered portlet " + portletId);
DestroyCloneFailure failure = new DestroyCloneFailure(portletId, "Cannot destroy POP");
@@ -477,7 +471,7 @@
{
try
{
- persistenceManager.destroyState(portletId.substring(PRODUCER_CLONE_ID_PREFIX.length()));
+ persistenceManager.destroyState(portletId.substring(PortletContext.PRODUCER_CLONE_ID_PREFIX.length()));
}
catch (NoSuchStateException e)
{
@@ -733,7 +727,7 @@
String cloneStateId = persistenceManager.createState(statefulPortletContext.getId(), portletState.getProperties());
// Return the clone context
- String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
+ String cloneId = PortletContext.PRODUCER_CLONE_ID_PREFIX + cloneStateId;
return PortletContext.createPortletContext(cloneId);
}
else
@@ -758,7 +752,7 @@
{
PortletState sstate = new PortletState(portletId, props);
S marshalledState = stateConverter.marshall(stateType, sstate);
- return StatefulPortletContext.create(CONSUMER_CLONE_ID, stateType, marshalledState);
+ return StatefulPortletContext.create(PortletContext.CONSUMER_CLONE_ID, stateType, marshalledState);
}
catch (StateConversionException e)
{
@@ -816,9 +810,9 @@
if (!(portletContext instanceof StatefulPortletContext))
{
String portletId = portletContext.getId();
- if (portletContext.getId().startsWith(PRODUCER_CLONE_ID_PREFIX))
+ if (portletContext.getId().startsWith(PortletContext.PRODUCER_CLONE_ID_PREFIX))
{
- String stateId = portletId.substring(PRODUCER_CLONE_ID_PREFIX.length());
+ String stateId = portletId.substring(PortletContext.PRODUCER_CLONE_ID_PREFIX.length());
try
{
PortletStateContext stateContext = persistenceManager.loadState(stateId);
Modified: sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.pc.portlet.support;
import org.gatein.pc.api.InvalidPortletIdException;
@@ -52,6 +52,8 @@
public class PortletInvokerSupport implements PortletInvoker
{
+ public static final String FOO_PORTLET_ID = "/webapp1.foo";
+ public static final String BAR_PORTLET_ID = "/webapp2.bar";
/** . */
private Map<String, PortletSupport> portlets;
Modified: sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.pc.test.portlet.state;
import org.gatein.common.util.Tools;
@@ -49,6 +49,7 @@
import org.gatein.pc.portlet.state.producer.PortletState;
import static org.jboss.unit.api.Assert.*;
+
import org.jboss.unit.api.pojo.annotations.Test;
import java.util.Collections;
@@ -64,6 +65,9 @@
*/
public abstract class AbstractStatefulPortletInvokerTestCase
{
+ public static final String PORTLET_ID = "/foo.PortletId";
+ public static final String NON_EXISTING_PORTLET_ID = "/foo.NonExistingPortletId";
+ public static final String INVALID_PORTLET_ID = "/foo.InvalidPortletId";
/** . */
protected final boolean persistLocally;
@@ -172,18 +176,18 @@
*
*/
protected abstract void addPreference(PortletContext popRef, String key, List<String> defaultValue, Boolean readOnly);
-
+
/**
- *
+ *
*/
protected abstract PortletContext exportPortletContext(PortletContext contextToImport) throws PortletInvokerException;
-
+
/**
*
*/
protected abstract PortletContext importPortletContext(PortletContext contextToImport) throws PortletInvokerException;
-
+
/**
*
*/
@@ -471,7 +475,7 @@
// @Test
// public void testDestroyInvalidCCP() throws Exception
// {
-// PortletContext ccpId = getProducer().wrapCCP("PortletId");
+// PortletContext ccpId = getProducer().wrapCCP(PORTLET_ID);
// List failures = getProducer().destroyClones(Collections.singletonList(ccpId));
// assertEquals(1, failures.size());
// DestroyCloneFailure failure = (DestroyCloneFailure)failures.get(0);
@@ -769,15 +773,15 @@
//
PropertyChange[] changes = new PropertyChange[]
- {
- PropertyChange.newUpdate("override_update", Arrays.asList("override_update_clone_value_2")),
- PropertyChange.newReset("override_reset"),
- PropertyChange.newUpdate("override_create", Arrays.asList("override_create_clone_value_2")),
- PropertyChange.newUpdate("dynamic_update", Arrays.asList("dynamic_update_clone_value_2")),
- PropertyChange.newReset("dynamic_reset"),
- PropertyChange.newUpdate("dynamic_create", Arrays.asList("dynamic_create_clone_value_2")),
- PropertyChange.newUpdate("readonly_create", Arrays.asList("readonly_create_clone_value_2")),
- };
+ {
+ PropertyChange.newUpdate("override_update", Arrays.asList("override_update_clone_value_2")),
+ PropertyChange.newReset("override_reset"),
+ PropertyChange.newUpdate("override_create", Arrays.asList("override_create_clone_value_2")),
+ PropertyChange.newUpdate("dynamic_update", Arrays.asList("dynamic_update_clone_value_2")),
+ PropertyChange.newReset("dynamic_reset"),
+ PropertyChange.newUpdate("dynamic_create", Arrays.asList("dynamic_create_clone_value_2")),
+ PropertyChange.newUpdate("readonly_create", Arrays.asList("readonly_create_clone_value_2")),
+ };
ccpCtx = setProperties(ccpCtx, changes);
//
@@ -916,7 +920,7 @@
PortletSupport portletSupport = getPortletSupport(popCtx);
portletSupport.addHandler(handler);
addPreference(popCtx, "abc", Arrays.asList("def"));
-
+
//
PortletContext ccpCtx = createClone(popCtx);
@@ -951,17 +955,17 @@
// Compare States
Object expectedState = null;
Object actualState = null;
-
+
if (expected instanceof StatefulPortletContext)
- {
+ {
expectedState = ((StatefulPortletContext)expected).getState();
}
-
+
if (actual instanceof StatefulPortletContext)
{
actualState = ((StatefulPortletContext)actual).getState();
}
-
+
if (expectedState == null)
{
assertNull("Actual state should be null", actualState);
@@ -973,7 +977,7 @@
}
}
}
-
+
@Test
public void testExportNullPortletContext() throws Exception
{
@@ -988,11 +992,11 @@
}
assertNoExistingState();
}
-
+
@Test
public void testExportsNonExisitngPOP() throws Exception
{
- PortletContext popCTX = createNonExistingPOPRef();
+ PortletContext popCTX = createNonExistingPOPRef();
try
{
exportPortletContext(popCTX);
@@ -1004,11 +1008,11 @@
}
assertNoExistingState();
}
-
+
@Test
public void testExportNonExisitngCCP() throws Exception
{
- PortletContext ccpCTX = createNonExistingLocalCCPRef();
+ PortletContext ccpCTX = createNonExistingLocalCCPRef();
try
{
exportPortletContext(ccpCTX);
@@ -1020,7 +1024,7 @@
}
assertNoExistingState();
}
-
+
@Test
public void testExportInvalidPOP() throws Exception
{
@@ -1035,42 +1039,42 @@
}
assertNoExistingState();
}
-
+
@Test
public void testExportPortlet() throws Exception
{
PropertyMap expectedProperties = new SimplePropertyMap();
expectedProperties.setProperty("abc", Arrays.asList("def"));
-
+
PortletInfoSupport info = new PortletInfoSupport();
info.getMeta().setDisplayName("MyPortlet");
PortletContext popCtx = createPOPRef(info);
-
+
PortletContext export0Ctx = exportPortletContext(popCtx);
//Make sure we get back the ID for the original portlet
- assertEquals("PortletId", export0Ctx.getId());
+ assertEquals(PORTLET_ID, export0Ctx.getId());
//check by doing an import
checkWithImportPortlet(export0Ctx, popCtx, new SimplePropertyMap());
-
-
+
+
//add a preference to the portlet to make it store a state
addPreference(popCtx, "abc", Arrays.asList("def"));
PortletContext export1Ctx = exportPortletContext(popCtx);
//Make sure we get back the ID for the original portlet
- assertEquals("PortletId", export1Ctx.getId());
+ assertEquals(PORTLET_ID, export1Ctx.getId());
//check by doing an import
checkWithImportPortlet(export1Ctx, popCtx, expectedProperties);
-
+
PortletContext ccp1Ctx = createClone(popCtx);
PortletContext export2Ctx = exportPortletContext(ccp1Ctx);
-
+
//Make sure we get back the ID for the original portlet
- assertEquals("PortletId", export2Ctx.getId());
+ assertEquals(PORTLET_ID, export2Ctx.getId());
//Check by doing an import
checkWithImportPortlet(export2Ctx, ccp1Ctx, expectedProperties);
-
+
PortletContext ccp2Ctx = createClone(ccp1Ctx);
//make sure that adding a property to the already cloned ccp1Ctx doesn't interfere with exports
PropertyChange[] propertyChanges = new PropertyChange[1];
@@ -1078,11 +1082,11 @@
ccp1Ctx = setProperties(ccp1Ctx, propertyChanges);
assertTrue(getProperties(ccp1Ctx).containsKey("123"));
assertFalse(getProperties(export2Ctx).containsKey("123"));
-
+
PortletContext export3Ctx = exportPortletContext(ccp2Ctx);
//Make sure we get back the ID for the original portlet
- assertEquals("PortletId", export3Ctx.getId());
+ assertEquals(PORTLET_ID, export3Ctx.getId());
//Check by doing an import
checkWithImportPortlet(export3Ctx, ccp2Ctx, expectedProperties);
}
@@ -1090,27 +1094,26 @@
protected void checkWithImportPortlet(PortletContext exportedPortletContext, PortletContext originalPortletContext, PropertyMap expectedProperties) throws Exception
{
PortletContext importedPortletContext = importPortletContext(exportedPortletContext);
-
+
Portlet importedPortlet = getPortlet(importedPortletContext);
-
+
PortletContext portletContext = importedPortlet.getContext();
-
- //make sure the expected portlet context and the one we get back from the import are the same
- assertEquals(originalPortletContext.getApplicationName(), portletContext.getApplicationName());
- assertEquals(originalPortletContext.getPortletName(), portletContext.getPortletName());
-
+
+ //check that the portlet info for the original and new imported portlet are the same (which is assumed to ensure that the contexts refer to the same portlet)
+ assertEquals(getPortlet(originalPortletContext).getInfo(), getPortlet(portletContext).getInfo());
+
if (originalPortletContext instanceof StatefulPortletContext)
{
StatefulPortletContext statefulExpected = (StatefulPortletContext)originalPortletContext;
-
+
assertTrue(portletContext instanceof StatefulPortletContext);
StatefulPortletContext statefulPortletContext = (StatefulPortletContext)portletContext;
-
+
//Check that the states are the same
StateConverter sc = new StateConverterV0();
PortletState state = sc.unmarshall(PortletStateType.OPAQUE, (byte[])statefulPortletContext.getState());
PortletState expectedState = sc.unmarshall(PortletStateType.OPAQUE, (byte[])statefulExpected.getState());
-
+
assertEquals(expectedState.getPortletId(), state.getPortletId());
assertEquals(expectedState.getProperties(), state.getProperties());
assertEquals(expectedState.getTerminationTime(), state.getTerminationTime());
@@ -1120,9 +1123,9 @@
PropertyMap properties = getProperties(portletContext);
assertEquals(expectedProperties, properties);
assertEquals(getProperties(originalPortletContext), properties);
-
+
}
-
+
@Test
public void testImportNullPortletContext() throws Exception
{
@@ -1137,11 +1140,11 @@
}
assertNoExistingState();
}
-
+
@Test
public void testImportsNonExisitngPOP() throws Exception
{
- PortletContext popCTX = createNonExistingPOPRef();
+ PortletContext popCTX = createNonExistingPOPRef();
try
{
importPortletContext(popCTX);
@@ -1153,11 +1156,11 @@
}
assertNoExistingState();
}
-
+
@Test
public void testImportNonExisitngCCP() throws Exception
{
- PortletContext ccpCTX = createNonExistingLocalCCPRef();
+ PortletContext ccpCTX = createNonExistingLocalCCPRef();
try
{
importPortletContext(ccpCTX);
@@ -1169,7 +1172,7 @@
}
assertNoExistingState();
}
-
+
@Test
public void testImportInvalidPOP() throws Exception
{
@@ -1191,22 +1194,22 @@
//This will create the portlet into the container and check that it doesn't have any properties set
PortletContext popCtx = createPOPRef(new PortletInfoSupport());
assertTrue(getProperties(popCtx).isEmpty());
-
+
//Create the state bytes manually and create the portletcontext.
//Tests what happens if a stateful portlet is export on one machine and imported into another
StateConverter sc = new StateConverterV0();
PropertyMap propertyMap = new SimplePropertyMap();
propertyMap.setProperty("test", Arrays.asList("123"));
- PortletState portletState = new PortletState("PortletId", propertyMap);
+ PortletState portletState = new PortletState(PORTLET_ID, propertyMap);
byte[] stateBytes = sc.marshall(PortletStateType.OPAQUE, portletState);
-
- StatefulPortletContext portletContext = StatefulPortletContext.create("PortletId", PortletStateType.OPAQUE, stateBytes);
-
+
+ StatefulPortletContext portletContext = StatefulPortletContext.create(PORTLET_ID, PortletStateType.OPAQUE, stateBytes);
+
//import portlet
PortletContext importedPortletContext = importPortletContext(portletContext);
-
+
//Make sure that this new portlet has the properties we want
assertEquals(propertyMap, getProperties(importedPortletContext));
}
-
+
}
Modified: sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.pc.test.portlet.state;
import org.gatein.pc.api.Portlet;
@@ -46,6 +46,7 @@
import org.gatein.pc.portlet.state.producer.ProducerPortlet;
import static org.jboss.unit.api.Assert.*;
+
import org.jboss.unit.api.pojo.annotations.Create;
import java.util.Collections;
@@ -58,7 +59,6 @@
*/
public class ConsumerStatefulPortletInvokerTestCase extends AbstractStatefulPortletInvokerTestCase
{
-
public ConsumerStatefulPortletInvokerTestCase(boolean persistLocally)
{
super(persistLocally);
@@ -137,24 +137,24 @@
protected PortletContext createPOPRef(PortletInfoSupport portletSupport) throws PortletInvokerException
{
- container.addPortlet("PortletId", portletSupport);
+ container.addPortlet(PORTLET_ID, portletSupport);
Portlet portlet = getSinglePOP();
return portlet.getContext();
}
protected PortletContext createNonExistingPOPRef() throws PortletInvokerException
{
- container.addPortlet("NonExistingPortletId", new PortletInfoSupport());
+ container.addPortlet(NON_EXISTING_PORTLET_ID, new PortletInfoSupport());
PortletContext popContext = getSinglePOP().getContext();
- container.removePortlet("NonExistingPortletId");
+ container.removePortlet(NON_EXISTING_PORTLET_ID);
return popContext;
}
protected PortletContext createInvalidPOPRef() throws PortletInvokerException
{
- container.addPortlet("InvalidPortletId", new PortletInfoSupport());
+ container.addPortlet(INVALID_PORTLET_ID, new PortletInfoSupport());
PortletContext popContext = getSinglePOP().getContext();
- container.setValid("InvalidPortletId", false);
+ container.setValid(INVALID_PORTLET_ID, false);
return popContext;
}
@@ -252,12 +252,12 @@
assertEquals(1, portlets.size());
return (Portlet)portlets.iterator().next();
}
-
+
protected PortletContext importPortletContext(PortletContext contextToImport) throws PortletInvokerException
{
return consumer.importPortlet(PortletStateType.OPAQUE, contextToImport);
}
-
+
protected PortletContext exportPortletContext(PortletContext originalPortletContext) throws PortletInvokerException
{
return consumer.exportPortlet(PortletStateType.OPAQUE, originalPortletContext);
Modified: sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.pc.test.portlet.state;
import org.gatein.pc.api.Portlet;
@@ -104,24 +104,24 @@
protected PortletContext createPOPRef(PortletInfoSupport portletSupport) throws PortletInvokerException
{
- container.addPortlet("PortletId", portletSupport);
+ container.addPortlet(PORTLET_ID, portletSupport);
Portlet portlet = getSinglePOP();
return portlet.getContext();
}
protected PortletContext createNonExistingPOPRef()
{
- container.addPortlet("NonExistingPortletId", new PortletInfoSupport());
+ container.addPortlet(NON_EXISTING_PORTLET_ID, new PortletInfoSupport());
PortletContext popCtx = getSinglePOP().getContext();
- container.removePortlet("NonExistingPortletId");
+ container.removePortlet(NON_EXISTING_PORTLET_ID);
return popCtx;
}
protected PortletContext createInvalidPOPRef()
{
- container.addPortlet("InvalidPortletId", new PortletInfoSupport());
+ container.addPortlet(INVALID_PORTLET_ID, new PortletInfoSupport());
PortletContext popCtx = getSinglePOP().getContext();
- container.setValid("InvalidPortletId", false);
+ container.setValid(INVALID_PORTLET_ID, false);
return popCtx;
}
@@ -271,6 +271,6 @@
assertEquals(PortletStatus.MANAGED, producer.getStatus(ccp2Ctx));
// inexistent portlet
- assertNull(producer.getStatus(PortletContext.createPortletContext("foo")));
+ assertNull(producer.getStatus(PortletContext.createPortletContext("/foo.bar")));
}
}
Modified: sandbox/cdi_support/pc/branches/cdi/samples/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/samples/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/samples/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -1,3 +1,26 @@
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2011, 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.
+ -->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.gatein.pc</groupId>
@@ -2,3 +25,3 @@
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
@@ -22,6 +45,10 @@
<groupId>sun-jaxb</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
</dependencies>
<build>
Modified: sandbox/cdi_support/pc/branches/cdi/test/core/pc-test-core.iml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/test/core/pc-test-core.iml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/test/core/pc-test-core.iml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -6,16 +6,17 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" name="Maven: org.gatein.common:common-mc:2.0.3-GA" level="project" />
- <orderEntry type="library" name="Maven: org.gatein.common:common-logging:2.0.3-GA" level="project" />
+ <orderEntry type="library" name="Maven: org.gatein.common:common-mc:2.0.4-Beta01" level="project" />
+ <orderEntry type="library" name="Maven: org.gatein.common:common-logging:2.0.4-Beta01" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.5.6" level="project" />
- <orderEntry type="library" name="Maven: org.jboss.microcontainer:jboss-kernel:2.0.6.GA" level="project" />
- <orderEntry type="library" name="Maven: org.jboss.microcontainer:jboss-dependency:2.0.6.GA" level="project" />
+ <orderEntry type="library" name="Maven: org.jboss.microcontainer:jboss-kernel:2.0.9.GA" level="project" />
+ <orderEntry type="library" name="Maven: org.jboss.microcontainer:jboss-dependency:2.0.9.GA" level="project" />
<orderEntry type="library" name="Maven: org.jboss:jbossxb:2.0.1.GA" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging-spi:2.0.5.GA" level="project" />
<orderEntry type="library" name="Maven: org.jboss:jboss-common-core:2.2.9.GA" level="project" />
@@ -29,8 +30,8 @@
<orderEntry type="library" name="Maven: org.jboss.man:jboss-managed:2.0.0.GA" level="project" />
<orderEntry type="library" name="Maven: org.jboss.man:jboss-metatype:2.0.0.GA" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:servlet-api:2.5" level="project" />
- <orderEntry type="library" name="Maven: org.gatein.wci:wci-wci:2.1.0-Alpha03" level="project" />
- <orderEntry type="library" name="Maven: org.gatein.common:common-common:2.0.3-GA" level="project" />
+ <orderEntry type="library" name="Maven: org.gatein.wci:wci-wci:2.1.0-Beta01" level="project" />
+ <orderEntry type="library" name="Maven: org.gatein.common:common-common:2.0.4-Beta01" level="project" />
<orderEntry type="library" name="Maven: org.jboss:jboss-vfs:2.1.0.GA" level="project" />
<orderEntry type="library" name="Maven: commons-httpclient:commons-httpclient:3.0.1" level="project" />
<orderEntry type="library" name="Maven: junit:junit:3.8.2" level="project" />
@@ -46,12 +47,10 @@
<orderEntry type="library" name="Maven: apache-xerces:resolver:2.9.1" level="project" />
<orderEntry type="module" module-name="pc-mc" />
<orderEntry type="library" name="Maven: org.jboss.unit:jboss-unit:1.2.3" level="project" />
- <orderEntry type="library" name="Maven: apache-log4j:log4j:1.2.14" level="project" />
<orderEntry type="library" name="Maven: org.jboss.unit:jboss-unit-remote:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.jboss.unit:portal-test:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.cargo:cargo-core-uberjar:1.0.1-alpha-1" level="project" />
<orderEntry type="library" name="Maven: sun-opends:opends-core:legacy" level="project" />
- <orderEntry type="library" name="Maven: hibernate:hibernate3:3.2.3.GA" level="project" />
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" />
<orderEntry type="library" name="Maven: jboss.jbossas.core-libs:jboss-transaction:4.0.4.GA" level="project" />
@@ -61,9 +60,7 @@
<orderEntry type="library" name="Maven: jboss.jbossas.core-libs:jboss:4.0.4.GA" level="project" />
<orderEntry type="library" name="Maven: jboss:jboss-j2ee:4.2.3.GA" level="project" />
<orderEntry type="library" name="Maven: jboss:jboss-common-core:2.2.0.GA" level="project" />
- <orderEntry type="library" name="Maven: apache-httpclient:commons-httpclient:3.0.1" level="project" />
<orderEntry type="library" name="Maven: oswego-concurrent:concurrent:1.3.4" level="project" />
- <orderEntry type="library" name="Maven: apache-slide:webdavlib:2.0" level="project" />
<orderEntry type="library" name="Maven: jboss:jboss-common-logging-spi:2.0.4.GA" level="project" />
<orderEntry type="library" name="Maven: jboss:jboss-jmx:4.2.3.GA" level="project" />
<orderEntry type="library" name="Maven: jboss:jboss-system:4.2.0.GA" level="project" />
Modified: sandbox/cdi_support/pc/branches/cdi/test/core/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/test/core/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/test/core/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-test</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-test-core</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/test/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/test/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/test/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-test</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/test/servers/jboss42/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/test/servers/jboss42/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/test/servers/jboss42/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-test-servers</artifactId>
- <version>2.3.0-Alpha02-SNAPSHOT</version>
+ <version>2.3.0-Beta02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-test-jboss42</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/test/servers/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/test/servers/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/test/servers/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-test</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-test-servers</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/test/servers/tomcat7/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/test/servers/tomcat7/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/test/servers/tomcat7/pom.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-test-servers</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-test-tomcat7</artifactId>
@@ -166,7 +166,7 @@
<dependency>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-test-core</artifactId>
- <version>2.3.0-Beta02-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
Modified: sandbox/cdi_support/pc/branches/cdi/test/servers/tomcat7/src/test/build.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/test/servers/tomcat7/src/test/build.xml 2011-04-23 21:19:45 UTC (rev 6338)
+++ sandbox/cdi_support/pc/branches/cdi/test/servers/tomcat7/src/test/build.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -92,6 +92,7 @@
<property name="cargo.logging" value="high"/>
<property name="cargo.jvmargs" value="-Duser.language=en ${cargo.debug}"/>
<file file="${target}/test-classes/config/tomcat-users.xml" tofile="conf/tomcat-users.xml" overwrite="true"/>
+ <configfile file="${target}/test-classes/config/server.xml" tofile="conf/server.xml"/>
<deployable type="war" file="${test.temp.lib}/Tomcat-7.0/portlet-test.war"/>
</configuration>
</cargo>
Copied: sandbox/cdi_support/pc/branches/cdi/test/servers/tomcat7/src/test/resources/config/server.xml (from rev 6338, components/pc/trunk/test/servers/tomcat7/src/test/resources/config/server.xml)
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/test/servers/tomcat7/src/test/resources/config/server.xml (rev 0)
+++ sandbox/cdi_support/pc/branches/cdi/test/servers/tomcat7/src/test/resources/config/server.xml 2011-04-23 22:18:05 UTC (rev 6339)
@@ -0,0 +1,153 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+ 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.
+-->
+<!-- Note: A "Server" is not itself a "Container", so you may not
+ define subcomponents such as "Valves" at this level.
+ Documentation at /docs/config/server.html
+ -->
+<Server port="@cargo.rmi.port@" shutdown="SHUTDOWN" debug="@catalina.logging.level@">
+ <!-- Security listener. Documentation at /docs/config/listeners.html
+ <Listener className="org.apache.catalina.security.SecurityListener" />
+ -->
+ <!--APR library loader. Documentation at /docs/apr.html -->
+ <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
+ <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
+ <Listener className="org.apache.catalina.core.JasperListener" />
+ <!-- Prevent memory leaks due to use of particular java/javax APIs-->
+ <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
+ <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+ <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
+
+ <!-- Global JNDI resources
+ Documentation at /docs/jndi-resources-howto.html
+ -->
+ <GlobalNamingResources>
+ <!-- Editable user database that can also be used by
+ UserDatabaseRealm to authenticate users
+ -->
+ <Resource name="UserDatabase" auth="Container"
+ type="org.apache.catalina.UserDatabase"
+ description="User database that can be updated and saved"
+ factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+ pathname="conf/tomcat-users.xml" />
+ </GlobalNamingResources>
+
+ <!-- A "Service" is a collection of one or more "Connectors" that share
+ a single "Container" Note: A "Service" is not itself a "Container",
+ so you may not define subcomponents such as "Valves" at this level.
+ Documentation at /docs/config/service.html
+ -->
+ <Service name="Catalina" debug="@catalina.logging.level@">
+
+ <!--The connectors can use a shared executor, you can define one or more named thread pools-->
+ <!--
+ <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
+ maxThreads="150" minSpareThreads="4"/>
+ -->
+
+
+ <!-- A "Connector" represents an endpoint by which requests are received
+ and responses are returned. Documentation at :
+ Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
+ Java AJP Connector: /docs/config/ajp.html
+ APR (HTTP/AJP) Connector: /docs/apr.html
+ Define a non-SSL HTTP/1.1 Connector on port @cargo.servlet.port@
+ -->
+ <Connector port="@cargo.servlet.port@" protocol="HTTP/1.1"
+ connectionTimeout="20000"
+ redirectPort="8443"
+ scheme="@cargo.protocol@"
+ secure="@catalina.secure@"
+ SSLEnabled="@catalina.secure@"
+ debug="@catalina.logging.level@"
+ emptySessionPath="@catalina.connector.emptySessionPath@"
+ URIEncoding="@catalina.servlet.uriencoding@" />
+ <!-- A "Connector" using the shared thread pool-->
+ <!--
+ <Connector executor="tomcatThreadPool"
+ port="@cargo.servlet.port@" protocol="HTTP/1.1"
+ connectionTimeout="20000"
+ redirectPort="8443" />
+ -->
+ <!-- Define a SSL HTTP/1.1 Connector on port 8443
+ This connector uses the JSSE configuration, when using APR, the
+ connector should be using the OpenSSL style configuration
+ described in the APR documentation -->
+ <!--
+ <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
+ maxThreads="150" scheme="https" secure="true"
+ clientAuth="false" sslProtocol="TLS" />
+ -->
+
+ <!-- Define an AJP 1.3 Connector on port @cargo.tomcat.ajp.port@ -->
+ <Connector port="@cargo.tomcat.ajp.port@" protocol="AJP/1.3" redirectPort="8443" />
+
+
+ <!-- An Engine represents the entry point (within Catalina) that processes
+ every request. The Engine implementation for Tomcat stand alone
+ analyzes the HTTP headers included with the request, and passes them
+ on to the appropriate Host (virtual host).
+ Documentation at /docs/config/engine.html -->
+
+ <!-- You should set jvmRoute to support load-balancing via AJP ie :
+ <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
+ -->
+ <Engine name="Catalina" defaultHost="@cargo.hostname@"
+ debug="@catalina.logging.level@">
+
+ <!--For clustering, please take a look at documentation at:
+ /docs/cluster-howto.html (simple how to)
+ /docs/config/cluster.html (reference documentation) -->
+ <!--
+ <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
+ -->
+
+ <!-- Use the LockOutRealm to prevent attempts to guess user passwords
+ via a brute-force attack -->
+ <Realm className="org.apache.catalina.realm.LockOutRealm">
+ <!-- This Realm uses the UserDatabase configured in the global JNDI
+ resources under the key "UserDatabase". Any edits
+ that are performed against this UserDatabase are immediately
+ available for use by the Realm. -->
+ <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+ resourceName="UserDatabase"/>
+ </Realm>
+
+ <Host name="@cargo.hostname@" appBase="webapps"
+ unpackWARs="true" autoDeploy="true"
+ xmlValidation="false" xmlNamespaceAware="false"
+ debug="@catalina.logging.level@">
+
+ @tomcat.webapps@
+
+ <!-- SingleSignOn valve, share authentication between web applications
+ Documentation at: /docs/config/valve.html -->
+ <!--
+ <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
+ -->
+
+ <!-- Access log processes all example.
+ Documentation at: /docs/config/valve.html
+ Note: The pattern used is equivalent to using pattern="common" -->
+ <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+ prefix="@cargo.hostname@_access_log." suffix=".txt"
+ pattern="%h %l %u %t "%r" %s %b" resolveHosts="false"/>
+
+ </Host>
+ </Engine>
+ </Service>
+</Server>
13 years, 8 months