Author: chris.laprun(a)jboss.com
Date: 2007-11-21 18:14:11 -0500 (Wed, 21 Nov 2007)
New Revision: 9071
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/build.xml
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java
Log:
- Use proper exceptions.
- Added access to WSRP classes on the client for producer test to bypass RMI issues.
- All WSRP tests now pass pending resolution of test agent issue wrt to bundling of
portal-common-lib.jar.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/build.xml 2007-11-21 22:50:35 UTC (rev 9070)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/build.xml 2007-11-21 23:14:11 UTC (rev 9071)
@@ -720,6 +720,12 @@
<x-classpath>
<fileset dir="${build.lib.test}"
includes="test-wsrp-producer-lib.jar"/>
<path refid="tests.classpath"/>
+
+ <!--
+ Add access to WSRP classes on the client side to bypass RMI issues...
+ See
http://forum.springframework.org/showthread.php?t=38231 for more
details.
+ -->
+ <fileset dir="${build.lib}"
includes="portal-wsrp-lib.jar"/>
</x-classpath>
</execute-tests>
<antcall target="undeploy-producer-test"/>
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2007-11-21
22:50:35 UTC (rev 9070)
+++
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2007-11-21
23:14:11 UTC (rev 9071)
@@ -26,7 +26,6 @@
import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.wsrp.WSRPActionURL;
import org.jboss.portal.wsrp.WSRPConstants;
-import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPPortletURL;
import org.jboss.portal.wsrp.WSRPRenderURL;
import org.jboss.portal.wsrp.WSRPTypeFactory;
@@ -44,6 +43,7 @@
import org.jboss.portal.wsrp.core.RuntimeContext;
import org.jboss.portal.wsrp.core.SessionContext;
import org.jboss.portal.wsrp.core.StateChange;
+import org.jboss.portal.wsrp.core.UnsupportedModeFault;
import org.jboss.portal.wsrp.core.UpdateResponse;
import java.rmi.RemoteException;
@@ -84,12 +84,10 @@
markupService.getMarkup(getMarkup);
ExtendedAssert.fail();
}
- catch (RemoteException e)
+ catch (UnsupportedModeFault unsupportedModeFault)
{
- checkException(e, WSRPExceptionFactory.UNSUPPORTED_MODE);
+ // expected
}
- // reactivate check for exception once tests go through WS stack see:
JBPORTAL-1712
-// catch (UnsupportedModeFault unsupportedModeFault) { }
}
public void testGetMarkupWithSessionID() throws Exception
@@ -103,12 +101,10 @@
markupService.getMarkup(getMarkup);
ExtendedAssert.fail("A sessionID should not be allowed to be passed in
GetMarkup()");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED);
+ // expected
}
- // reactivate check for exception once tests go through WS stack see:
JBPORTAL-1712
-// catch (OperationFailedFault operationFailedFault){}
}
public void testGetMarkupEditNoSession() throws Exception
@@ -271,12 +267,10 @@
markupService.performBlockingInteraction(performBlockingInteraction);
ExtendedAssert.fail("Should not be able to pass a sessionID in a
PerformBlockingInteraction()");
}
- catch (RemoteException e)
+ catch (OperationFailedFault expected)
{
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED);
+ // expected
}
- // reactivate check for exception once tests go through WS stack see:
JBPORTAL-1712
-// catch (OperationFailedFault expected){}
}
public void testMarkupCaching() throws Exception
@@ -499,9 +493,14 @@
GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
MarkupResponse res = markupService.getMarkup(gm);
String markupString = res.getMarkupContext().getMarkupString();
- ExtendedAssert.assertEquals("<img
src='wsrp_rewrite?wsrp-urlType=resource&" +
-
"wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif&"
+
- "wsrp-requiresRewrite=true/wsrp_rewrite'/>", markupString);
+
+ // accept either localhost or 127.0.0.1 for the host part of the generated
markup
+ String markupStart = "<img
src='wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2F";
+ String markupEnd =
"%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif&wsrp-requiresRewrite=true/wsrp_rewrite'/>";
+ String localhostMarkup = markupStart + "localhost" + markupEnd;
+ String homeIPMarkup = markupStart + "127.0.0.1" + markupEnd;
+ boolean result = localhostMarkup.equals(markupString) ||
homeIPMarkup.equals(markupString);
+ ExtendedAssert.assertTrue(result);
}
finally
{
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java 2007-11-21
22:50:35 UTC (rev 9070)
+++
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java 2007-11-21
23:14:11 UTC (rev 9071)
@@ -26,7 +26,6 @@
import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
-import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.core.ClonePortlet;
import org.jboss.portal.wsrp.core.DestroyFailed;
import org.jboss.portal.wsrp.core.DestroyPortlets;
@@ -47,7 +46,6 @@
import javax.xml.soap.SOAPElement;
import java.util.Arrays;
-import java.rmi.RemoteException;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
@@ -199,15 +197,10 @@
response = portletManagementService.setPortletProperties(setPortletProperties);
ExtendedAssert.fail("Setting properties on Producer-Offered Portlet should
fail...");
}
- catch (RemoteException e)
+ catch (InconsistentParametersFault expected)
{
- //expected
- checkException(e, WSRPExceptionFactory.INCONSISTENT_PARAMETERS);
+ // expected
}
- // reactivate check for exception once tests go through WS stack see:
JBPORTAL-1712
- // catch (InconsistentParametersFault expected)
- {
- }
}
private Property[] checkGetPropertiesResponse(PropertyList response, Property[]
expected)
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2007-11-21
22:50:35 UTC (rev 9070)
+++
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2007-11-21
23:14:11 UTC (rev 9071)
@@ -25,21 +25,19 @@
import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.wsrp.WSRPConstants;
-import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.GetMarkup;
import org.jboss.portal.wsrp.core.GetServiceDescription;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
import org.jboss.portal.wsrp.core.ModifyRegistration;
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PropertyDescription;
import org.jboss.portal.wsrp.core.RegistrationContext;
import org.jboss.portal.wsrp.core.RegistrationData;
-import org.jboss.portal.wsrp.core.MissingParametersFault;
import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
import javax.xml.namespace.QName;
-import java.rmi.RemoteException;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
@@ -84,16 +82,10 @@
registrationService.register(regData);
ExtendedAssert.fail("Trying to register with an invalid consumer agent
String should fail.");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
// expected
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED);
}
- // reactivate check for exception once tests go through WS stack see:
JBPORTAL-1712
- // catch (OperationFailedFault operationFailedFault)
- {
- // expected
- }
regData.setConsumerAgent(WSRPConstants.CONSUMER_AGENT);
@@ -118,14 +110,8 @@
markupService.getMarkup(getMarkup);
ExtendedAssert.fail("Consumer tried to access info with a de-registered
context. Operations should fail.");
}
- catch (RemoteException e)
+ catch (InvalidRegistrationFault invalidRegistrationFault)
{
- //expected
- checkException(e, WSRPExceptionFactory.INVALID_REGISTRATION);
- }
- // reactivate check for exception once tests go through WS stack see:
JBPORTAL-1712
- //catch (InvalidRegistrationFault invalidRegistrationFault)
- {
// expected
}
@@ -138,14 +124,8 @@
serviceDescriptionService.getServiceDescription(gs);
ExtendedAssert.fail("Required registration info has been modified:
operations should fail until registration is modified.");
}
- catch (RemoteException e)
+ catch (InvalidRegistrationFault invalidRegistrationFault)
{
- //expected
- checkException(e, WSRPExceptionFactory.INVALID_REGISTRATION);
- }
- // reactivate check for exception once tests go through WS stack see:
JBPORTAL-1712
- //catch (InvalidRegistrationFault invalidRegistrationFault)
- {
// expected
}
@@ -178,14 +158,8 @@
markupService.getMarkup(getMarkup);
ExtendedAssert.fail("Required registration info has been modified:
operations should fail until registration is modified.");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- //expected
- checkException(e, WSRPExceptionFactory.INVALID_REGISTRATION);
- }
- // reactivate check for exception once tests go through WS stack see:
JBPORTAL-1712
- //catch (InvalidRegistrationFault invalidRegistrationFault)
- {
// expected
// WSRP primer recommends returning OperationFailedFault and NOT
InvalidRegistrationFault
// kinda weird... will be replaced by ModifyRegistrationRequiredFault in WSRP
2.0
@@ -200,14 +174,8 @@
serviceDescriptionService.getServiceDescription(gs);
ExtendedAssert.fail("Required registration info has been modified:
operations should fail until registration is modified.");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- //expected
- checkException(e, WSRPExceptionFactory.INVALID_REGISTRATION);
- }
- // reactivate check for exception once tests go through WS stack see:
JBPORTAL-1712
- //catch (InvalidRegistrationFault invalidRegistrationFault)
- {
// expected
// WSRP primer recommends returning OperationFailedFault and NOT
InvalidRegistrationFault
// kinda weird... will be replaced by ModifyRegistrationRequiredFault in WSRP
2.0
@@ -258,13 +226,8 @@
registerConsumer();
ExtendedAssert.fail("Shouldn't be possible to register if no
registration is required.");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED); // expected
- }
- // reactivate check for exception once tests go through WS stack see:
JBPORTAL-1712
- //catch (OperationFailedFault operationFailedFault)
- {
// expected
}
}
@@ -278,13 +241,8 @@
registrationService.deregister(null);
ExtendedAssert.fail("Shouldn't be possible to deregister if no
registration is required.");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED); // expected
- }
- // reactivate check for exception once tests go through WS stack see:
JBPORTAL-1712
- //catch (OperationFailedFault operationFailedFault)
- {
// expected
}
}
@@ -298,13 +256,8 @@
registrationService.modifyRegistration(null);
ExtendedAssert.fail("Shouldn't be possible to modify registration if no
registration is required.");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED); // expected
- }
- // reactivate check for exception once tests go through WS stack see:
JBPORTAL-1712
- //catch (OperationFailedFault operationFailedFault)
- {
// expected
}
}
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java 2007-11-21
22:50:35 UTC (rev 9070)
+++
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java 2007-11-21
23:14:11 UTC (rev 9071)
@@ -25,13 +25,11 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.junit.ExtendedAssert;
-import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.RegistrationContext;
import org.jboss.portal.wsrp.core.ReleaseSessions;
-import java.rmi.RemoteException;
-
/**
* Tests the behavior of the ReleaseSession method.
*
@@ -115,15 +113,10 @@
markupService.releaseSessions(releaseSessions);
ExtendedAssert.fail("ReleaseSessions did not thrown an OperationFailed
Fault." + getSetupString(releaseSessions));
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED);
- }
- // reactivate check for exception once tests go through WS stack see:
JBPORTAL-1712
- /*catch (OperationFailedFault operationFailedFault)
- {
// expected fault.
- }*/
+ }
finally
{
tearDown();