Author: mwringe
Date: 2010-06-16 12:09:05 -0400 (Wed, 16 Jun 2010)
New Revision: 3350
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
Log:
GTNWSRP-46: fix issues with the ServiceDescriptionTestCase, should now pass.
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java
===================================================================
---
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-06-16
15:36:15 UTC (rev 3349)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-06-16
16:09:05 UTC (rev 3350)
@@ -1073,6 +1073,27 @@
}
}
+ public static V1PropertyDescription toV1PropertyDescription(PropertyDescription
propertyDescription)
+ {
+ if (propertyDescription != null)
+ {
+ V1PropertyDescription result =
WSRP1TypeFactory.createPropertyDescription(propertyDescription.getName().toString(),
propertyDescription.getType());
+ result.setHint(toV1LocalizedString(propertyDescription.getHint()));
+ result.setLabel(toV1LocalizedString(propertyDescription.getLabel()));
+ List<V1Extension> extensions =
WSRPUtils.transform(propertyDescription.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
private static class V2ToV1Extension implements Function<Extension,
V1Extension>
{
public V1Extension apply(Extension from)
@@ -1260,23 +1281,7 @@
public V1PropertyDescription apply(PropertyDescription from)
{
- if (from != null)
- {
- V1PropertyDescription result =
WSRP1TypeFactory.createPropertyDescription(from.getName().toString(), from.getType());
- result.setHint(toV1LocalizedString(from.getHint()));
- result.setLabel(toV1LocalizedString(from.getLabel()));
- List<V1Extension> extensions =
WSRPUtils.transform(from.getExtensions(), EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
-
- return result;
- }
- else
- {
- return null;
- }
+ return toV1PropertyDescription(from);
}
}
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java 2010-06-16
15:36:15 UTC (rev 3349)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java 2010-06-16
16:09:05 UTC (rev 3350)
@@ -33,6 +33,7 @@
import org.gatein.wsrp.protocol.v1.V1ProducerBaseTest;
import org.gatein.wsrp.registration.RegistrationPropertyDescription;
import org.gatein.wsrp.servlet.ServletAccess;
+import org.gatein.wsrp.spec.v1.V2ToV1Converter;
import org.gatein.wsrp.test.ExtendedAssert;
import org.gatein.wsrp.test.support.MockHttpServletRequest;
import org.gatein.wsrp.test.support.MockHttpServletResponse;
@@ -127,7 +128,7 @@
checkRequiredRegistrationProperties(sd, regProp);
// No offered portlets without registration!
- ExtendedAssert.assertNull(sd.getOfferedPortlets());
+ ExtendedAssert.assertTrue("Should not get any offered portlets back. Retrieved
" + sd.getOfferedPortlets(), (sd.getOfferedPortlets() == null ||
sd.getOfferedPortlets().isEmpty()));
}
@Test
@@ -192,6 +193,6 @@
List<V1PropertyDescription> propertyDescriptions =
registrationPropertyDescription.getPropertyDescriptions();
ExtendedAssert.assertNotNull(propertyDescriptions);
ExtendedAssert.assertEquals(1, propertyDescriptions.size());
- assertEquals(WSRPUtils.convertToPropertyDescription(regProp),
propertyDescriptions.get(0));
+
assertEquals(V2ToV1Converter.toV1PropertyDescription(WSRPUtils.convertToPropertyDescription(regProp)),
propertyDescriptions.get(0));
}
}
\ No newline at end of file