ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1607044 - /webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java
Date Tue, 01 Jul 2014 11:17:16 GMT
Author: coheigea
Date: Tue Jul  1 11:17:15 2014
New Revision: 1607044

URL: http://svn.apache.org/r1607044
Log:
Make the ModifiedRequestTest more robust

Modified:
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java?rev=1607044&r1=1607043&r2=1607044&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java
Tue Jul  1 11:17:15 2014
@@ -49,6 +49,8 @@ import java.util.List;
 import java.util.ArrayList;
 
 import javax.security.auth.callback.CallbackHandler;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
 
 /**
  * This class tests the modification of requests.
@@ -487,7 +489,14 @@ public class ModifiedRequestTest extends
         Element createdValue = 
             WSSecurityUtil.findElement(timestampElement, "Created", WSConstants.WSU_NS);
         DateFormat zulu = new XmlSchemaDateFormat();
-        createdValue.setTextContent(zulu.format(new Date()));
+        
+        XMLGregorianCalendar createdCalendar = 
+            WSSConfig.datatypeFactory.newXMLGregorianCalendar(createdValue.getTextContent());
+        // Add 5 seconds
+        Duration duration = WSSConfig.datatypeFactory.newDuration(5000L);
+        createdCalendar.add(duration);
+        Date createdDate = createdCalendar.toGregorianCalendar().getTime();
+        createdValue.setTextContent(zulu.format(createdDate));
         
         if (LOG.isDebugEnabled()) {
             String outputString = 



Mime
View raw message