Christian,
what's the problem here? At the client side its perfectly legal
to generate the timestamp with both fields. "Oprional" means you
can create it or you can leave it. WSS4J tooks the option to always
generate it - absolutly perfect with the specification.
At the receiver end the receiver shall be prpared that another
client does not generate an expires field and act accordingly.
If you woul like a client where you can control the generation
of optional fields then we have to introduce quite a lot of
additional control parameters. Therefore we usually generate
optional fields.
Regards,
Werner
Christian Müller wrote:
> Hi Werner!
>
> My Testclass for org.apache.ws.security.message.token.Timestamp fails:
>
> public void testTimestampBooleanDocumentInt() {
> Timestamp timestamp = new Timestamp(false, this.doc, 300);
>
> assertNotNull(timestamp.getCreated()); // fail
> assertNotNull(timestamp.getExpires ()); // fail
>
> Element timestampElement = timestamp.getElement();
> assertEquals(WSConstants.WSU_PREFIX + ":" +
> WSConstants.TIMESTAMP_TOKEN_LN , timestampElement.getTagName());
> assertEquals(WSConstants.WSU_NS,
> timestampElement.getNamespaceURI());
>
> Element createdElement = (Element) timestampElement.getFirstChild();
> assertEquals(WSConstants.WSU_PREFIX + ":" +
> WSConstants.CREATED_LN, createdElement.getTagName());
> assertEquals(WSConstants.WSU_NS, createdElement.getNamespaceURI());
> // TODO: refactor Timestamp -> externalize 'Calendar rightNow =
> Calendar.getInstance();' in a separat method 'getRightNow()' for better
> testing.
> // Test-Subclass can override getRightNow() and return a
> constant value...
> assertNotNull(((Text) createdElement.getFirstChild()).getData());
>
> Element expiresElement = (Element) createdElement.getNextSibling();
> assertEquals(WSConstants.WSU_PREFIX + ":" +
> WSConstants.EXPIRES_LN, expiresElement.getTagName());
> assertEquals(WSConstants.WSU_NS , expiresElement.getNamespaceURI());
> // TODO: If the Test-Subclass return a constant value for
> created, we can calculate and test expires...
> assertNotNull(((Text) expiresElement.getFirstChild()).getData());
> }
>
> Are you interested on the Testclass and/or the fix?
>
> Regards,
> Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]