Author: chris.laprun(a)jboss.com
Date: 2010-08-23 15:56:17 -0400 (Mon, 23 Aug 2010)
New Revision: 3892
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/ServiceDescriptionEndpoint.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/NeedPortletHandleTest.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/V2ProducerBaseTest.java
Log:
- GNTWSRP-42, GTNWSRP-43: done for GetServiceDescription, forcing setting of
RegistrationContext and UserContext since the WSRP xsd specifies that they are required,
albeit nillable.
- GTNWSRP-37: properly transmit requested portlet handles for service description
filtering to producer.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
===================================================================
---
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-08-23
19:37:25 UTC (rev 3891)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-08-23
19:56:17 UTC (rev 3892)
@@ -139,13 +139,19 @@
/** ====== WSRP request objects ====== **/
/**
- * registrationContext(RegistrationContext)?, desiredLocales(xsd:string)*
+ * registrationContext(RegistrationContext, nillable), desiredLocales(xsd:string)*,
portletHandles(xsd:string)*,
+ * userContext(UserContext, nillable)
*
+ * @param registrationContext can be null
+ * @param userContext can be null
* @return
*/
- public static GetServiceDescription createGetServiceDescription()
+ public static GetServiceDescription createGetServiceDescription(RegistrationContext
registrationContext, UserContext userContext)
{
- return new GetServiceDescription();
+ GetServiceDescription getServiceDescription = new GetServiceDescription();
+ getServiceDescription.setRegistrationContext(registrationContext);
+ getServiceDescription.setUserContext(userContext);
+ return getServiceDescription;
}
/**
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
===================================================================
---
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-08-23
19:37:25 UTC (rev 3891)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-08-23
19:56:17 UTC (rev 3892)
@@ -864,8 +864,7 @@
{
if (getServiceDescription != null)
{
- GetServiceDescription result = WSRPTypeFactory.createGetServiceDescription();
-
result.setRegistrationContext(toV2RegistrationContext(getServiceDescription.getRegistrationContext()));
+ GetServiceDescription result =
WSRPTypeFactory.createGetServiceDescription(toV2RegistrationContext(getServiceDescription.getRegistrationContext()),
null);
List<String> locales = getServiceDescription.getDesiredLocales();
if (ParameterValidation.existsAndIsNotEmpty(locales))
{
Modified:
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java 2010-08-23
19:37:25 UTC (rev 3891)
+++
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java 2010-08-23
19:56:17 UTC (rev 3892)
@@ -82,8 +82,8 @@
@WebParam(mode = WebParam.Mode.OUT, name = "extensions", targetNamespace
= "urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>>
extensions
) throws V1InvalidRegistration, V1OperationFailed
{
- GetServiceDescription getServiceDescription =
WSRPTypeFactory.createGetServiceDescription();
-
getServiceDescription.setRegistrationContext(V1ToV2Converter.toV2RegistrationContext(registrationContext));
+ GetServiceDescription getServiceDescription =
WSRPTypeFactory.createGetServiceDescription(
+ V1ToV2Converter.toV2RegistrationContext(registrationContext), null);
getServiceDescription.getDesiredLocales().addAll(desiredLocales);
ServiceDescription description;
Modified:
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/ServiceDescriptionEndpoint.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/ServiceDescriptionEndpoint.java 2010-08-23
19:37:25 UTC (rev 3891)
+++
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/ServiceDescriptionEndpoint.java 2010-08-23
19:56:17 UTC (rev 3892)
@@ -23,6 +23,7 @@
package org.gatein.wsrp.endpoints.v2;
+import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.endpoints.WSRPBaseEndpoint;
import org.oasis.wsrp.v2.CookieProtocol;
import org.oasis.wsrp.v2.EventDescription;
@@ -87,9 +88,9 @@
@WebParam(name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions)
throws InvalidRegistration, ModifyRegistrationRequired, OperationFailed,
ResourceSuspended
{
- GetServiceDescription getServiceDescription = new GetServiceDescription();
- getServiceDescription.setRegistrationContext(registrationContext);
+ GetServiceDescription getServiceDescription =
WSRPTypeFactory.createGetServiceDescription(registrationContext, userContext);
getServiceDescription.getDesiredLocales().addAll(desiredLocales);
+ getServiceDescription.getPortletHandles().addAll(portletHandles);
ServiceDescription description =
producer.getServiceDescription(getServiceDescription);
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/NeedPortletHandleTest.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/NeedPortletHandleTest.java 2010-08-23
19:37:25 UTC (rev 3891)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/NeedPortletHandleTest.java 2010-08-23
19:56:17 UTC (rev 3892)
@@ -1,33 +1,27 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2010, 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 2010, 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.wsrp.protocol.v2;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
import org.gatein.wsrp.WSRPConstants;
import org.gatein.wsrp.WSRPTypeFactory;
import org.oasis.wsrp.v2.GetMarkup;
@@ -38,6 +32,12 @@
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.ServiceDescription;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
* @version $Revision$
@@ -106,7 +106,7 @@
if (!war2Handles.containsKey(archiveName))
{
- GetServiceDescription getServiceDescription =
WSRPTypeFactory.createGetServiceDescription();
+ GetServiceDescription getServiceDescription =
WSRPTypeFactory.createGetServiceDescription(null, null);
ServiceDescription serviceDescription =
producer.getServiceDescription(getServiceDescription);
List<PortletDescription> offered =
serviceDescription.getOfferedPortlets();
if (offered != null)
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/V2ProducerBaseTest.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/V2ProducerBaseTest.java 2010-08-23
19:37:25 UTC (rev 3891)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/V2ProducerBaseTest.java 2010-08-23
19:56:17 UTC (rev 3892)
@@ -23,8 +23,6 @@
package org.gatein.wsrp.protocol.v2;
-import javax.xml.namespace.QName;
-
import org.gatein.registration.RegistrationException;
import org.gatein.registration.RegistrationManager;
import org.gatein.registration.policies.DefaultRegistrationPolicy;
@@ -39,6 +37,8 @@
import org.gatein.wsrp.test.ExtendedAssert;
import org.oasis.wsrp.v2.GetServiceDescription;
+import javax.xml.namespace.QName;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
@@ -46,7 +46,7 @@
public class V2ProducerBaseTest extends WSRPProducerBaseTest
{
protected WSRP2Producer producer = ProducerHolder.getProducer(true);
-
+
private static final String CONSUMER = "test-consumer";
public V2ProducerBaseTest() throws Exception
@@ -67,12 +67,12 @@
protected GetServiceDescription getNoRegistrationServiceDescriptionRequest()
{
- GetServiceDescription gs = WSRPTypeFactory.createGetServiceDescription();
+ GetServiceDescription gs = WSRPTypeFactory.createGetServiceDescription(null,
null);
gs.getDesiredLocales().add("en-US");
gs.getDesiredLocales().add("en");
return gs;
}
-
+
protected RegistrationPropertyDescription configureRegistrationSettings(boolean
requiresRegistration, boolean provideUnregisteredFullDescription)
{
// define expected registration infos