Author: chris.laprun(a)jboss.com
Date: 2007-01-07 14:18:34 -0500 (Sun, 07 Jan 2007)
New Revision: 5948
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java
Log:
- Fixed to work on JDK 1.4.
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java 2007-01-06
22:56:50 UTC (rev 5947)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java 2007-01-07
19:18:34 UTC (rev 5948)
@@ -30,8 +30,6 @@
import org.jboss.portal.wsrp.core.RegistrationContext;
import org.jboss.portal.wsrp.core.ReleaseSessions;
-import java.util.Arrays;
-
/**
* Tests the behavior of the ReleaseSession method.
*
@@ -65,85 +63,93 @@
}
-// public void testReleaseSession() throws Exception
-// {
-// // possible registration contexts are: actual RegistrationContext, null, and a
made up value
-// RegistrationContext fakeRegContext =
WSRPTypeFactory.createRegistrationContext("Fake Registration Handle");
-// RegistrationContext[] regContexts = new
RegistrationContext[]{getRegistrationContext(), null, fakeRegContext};
-//
-// // possible types of sessionIDs include null and a made up value.
-// // Note: a valid session id cannot be used since the sessionID should never be
sent to the consumer
-// String nullSessionID = null;
-// String fakeSessionID = "Fake Session ID";
-//
-// String[][] sessionIDs = new String[][]{{nullSessionID},
-// {nullSessionID, nullSessionID},
-// {fakeSessionID},
-// {fakeSessionID, fakeSessionID},
-// {fakeSessionID, nullSessionID},
-// {nullSessionID, fakeSessionID}};
-//
-// for (int i = 0; i < regContexts.length; i++)
-// {
-// for (int j = 0; j < sessionIDs.length; j++)
-// {
-// ReleaseSessions releaseSession = new ReleaseSessions(regContexts[i],
sessionIDs[j]);
-// releaseSessions(releaseSession, false);
-// releaseSessions(releaseSession, true);
-// }
-// }
-// }
-//
-// private RegistrationContext getRegistrationContext() throws Exception
-// {
-// return registerConsumer();
-// }
+ public void testReleaseSession() throws Exception
+ {
+ // possible registration contexts are: actual RegistrationContext, null, and a made
up value
+ RegistrationContext fakeRegContext =
WSRPTypeFactory.createRegistrationContext("Fake Registration Handle");
+ RegistrationContext[] regContexts = new
RegistrationContext[]{getRegistrationContext(), null, fakeRegContext};
-// private void releaseSessions(ReleaseSessions releaseSessions, boolean
useRegistration) throws Exception
-// {
-// setUp();
-// try
-// {
-// log.info(getSetupString(releaseSessions));
-// if (useRegistration)
-// {
-// configureRegistrationSettings(false);
-// }
-// markupService.releaseSessions(releaseSessions);
-// ExtendedAssert.fail("ReleaseSessions did not thrown an OperationFailed
Fault." + getSetupString(releaseSessions));
-// }
-// catch (OperationFailedFault operationFailedFault)
-// {
-// // expected error;
-// }
-// finally
-// {
-// tearDown();
-// }
-// }
+ // possible types of sessionIDs include null and a made up value.
+ // Note: a valid session id cannot be used since the sessionID should never be sent
to the consumer
+ String nullSessionID = null;
+ String fakeSessionID = "Fake Session ID";
-// private String getSetupString(ReleaseSessions releaseSessions)
-// {
-// String message = "ReleaseSessions Setup:\n";
-//
-// if (releaseSessions == null)
-// {
-// message += " ReleaseSessions : null";
-// }
-// else
-// {
-// RegistrationContext regContext = releaseSessions.getRegistrationContext();
-// String[] sessionIDs = releaseSessions.getSessionIDs();
-// message += " RegistrationContext : " + (regContext != null ?
regContext.getRegistrationHandle() : null);
-// message += " | SessionIDs : " + Arrays.toString(sessionIDs);
-// }
-//
-// if (producer.getProducerRegistrationRequirements().requiresRegistration())
-// {
-// message += " | with registration required.";
-// }
-//
-// return message;
-// }
+ String[][] sessionIDs = new String[][]{{nullSessionID},
+ {nullSessionID, nullSessionID},
+ {fakeSessionID},
+ {fakeSessionID, fakeSessionID},
+ {fakeSessionID, nullSessionID},
+ {nullSessionID, fakeSessionID}};
+ for (int i = 0; i < regContexts.length; i++)
+ {
+ for (int j = 0; j < sessionIDs.length; j++)
+ {
+ ReleaseSessions releaseSession = new ReleaseSessions(regContexts[i],
sessionIDs[j]);
+ releaseSessions(releaseSession, false);
+ releaseSessions(releaseSession, true);
+ }
+ }
+ }
+
+ private RegistrationContext getRegistrationContext() throws Exception
+ {
+ return registerConsumer();
+ }
+
+ private void releaseSessions(ReleaseSessions releaseSessions, boolean useRegistration)
throws Exception
+ {
+ setUp();
+ try
+ {
+ log.info(getSetupString(releaseSessions));
+ if (useRegistration)
+ {
+ configureRegistrationSettings(false);
+ }
+ markupService.releaseSessions(releaseSessions);
+ ExtendedAssert.fail("ReleaseSessions did not thrown an OperationFailed
Fault." + getSetupString(releaseSessions));
+ }
+ catch (OperationFailedFault operationFailedFault)
+ {
+ // expected error;
+ }
+ finally
+ {
+ tearDown();
+ }
+ }
+
+ private String getSetupString(ReleaseSessions releaseSessions)
+ {
+ StringBuffer message = new StringBuffer("ReleaseSessions Setup:\n");
+
+ if (releaseSessions == null)
+ {
+ message.append(" ReleaseSessions : null");
+ }
+ else
+ {
+ RegistrationContext regContext = releaseSessions.getRegistrationContext();
+ String[] sessionIDs = releaseSessions.getSessionIDs();
+ message.append(" RegistrationContext : ").append(regContext != null ?
regContext.getRegistrationHandle() : null);
+ message.append(" | SessionIDs : ");
+ if (sessionIDs != null)
+ {
+ for (int i = 0; i < sessionIDs.length; i++)
+ {
+ message.append(sessionIDs[i]).append(i == sessionIDs.length - 1 ?
"" : ", ");
+ }
+ }
+
+ }
+
+ if (producer.getProducerRegistrationRequirements().requiresRegistration())
+ {
+ message.append(" | with registration required.");
+ }
+
+ return message.toString();
+ }
+
}
\ No newline at end of file
Show replies by date