@Test public void testBasic () throws AS2InvalidParameterException { final AS2Message aMsg = new AS2Message (); aMsg.headers ().addHeader ("message-id", "12345"); aMsg.partnership ().setSenderAS2ID ("s1"); aMsg.partnership ().setReceiverAS2ID ("r1"); final ZonedDateTime aTestDT = PDTFactory.getCurrentZonedDateTime (); final CompositeParameters aParams = new CompositeParameters (false).add ("date", new DateParameters (aTestDT)) .add ("msg", new MessageParameters (aMsg)); final String sNow = PDTFormatter.getForPattern ("uuuuMMddhhmmss").format (aTestDT); String sName = aParams.format ("$date.uuuuMMddhhmmss$"); assertEquals (sNow, sName); sName = aParams.format ("any$date.uuuuMMddhhmmss$else"); assertEquals ("any" + sNow + "else", sName); sName = aParams.format ("$date.uuuuMMddhhmmss$$date.uuuuMMddhhmmss$"); assertEquals (sNow + sNow, sName); assertEquals ("sender.as2_id, receiver.as2_id, headers.message-id", aParams.format ("sender.as2_id, receiver.as2_id, headers.message-id")); assertEquals ("s1, r1, 12345", aParams.format ("$msg.sender.as2_id$, $msg.receiver.as2_id$, $msg.headers.message-id$")); try { aParams.format ("$dummy$"); fail (); } catch (final AS2InvalidParameterException ex) {} assertEquals ("$s1", aParams.format ("$$$msg.sender.as2_id$")); assertEquals ("$$s1", aParams.format ("$$$$$msg.sender.as2_id$")); assertEquals ("s1$", aParams.format ("$msg.sender.as2_id$$$")); assertEquals ("s1$$", aParams.format ("$msg.sender.as2_id$$$$$")); assertEquals ("s1$r1", aParams.format ("$msg.sender.as2_id$$$$msg.receiver.as2_id$")); assertEquals ("s1$$r1", aParams.format ("$msg.sender.as2_id$$$$$$msg.receiver.as2_id$")); assertEquals ("$$s1$$r1$$", aParams.format ("$$$$$msg.sender.as2_id$$$$$$msg.receiver.as2_id$$$$$")); }
@Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; }
CompositeParameters extends AbstractParameterParser { @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } }
CompositeParameters extends AbstractParameterParser { @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } CompositeParameters(final boolean bIgnoreMissingParsers);  CompositeParameters(final boolean bIgnoreMissingParsers,
                              @Nonnull final Map <String, ? extends AbstractParameterParser> aParameterParsers); }
CompositeParameters extends AbstractParameterParser { @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } CompositeParameters(final boolean bIgnoreMissingParsers);  CompositeParameters(final boolean bIgnoreMissingParsers,
                              @Nonnull final Map <String, ? extends AbstractParameterParser> aParameterParsers); @Nonnull CompositeParameters add(final String sKey, final AbstractParameterParser aParam); void setIgnoreMissingParsers(final boolean bIgnoreMissingParsers); boolean isIgnoreMissingParsers(); @Override void setParameter(final String sKey, final String sValue); @Override String getParameter(final String sKey); void setParameterParsers(@Nullable final ICommonsMap <String, AbstractParameterParser> aParameterParsers); }
CompositeParameters extends AbstractParameterParser { @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } CompositeParameters(final boolean bIgnoreMissingParsers);  CompositeParameters(final boolean bIgnoreMissingParsers,
                              @Nonnull final Map <String, ? extends AbstractParameterParser> aParameterParsers); @Nonnull CompositeParameters add(final String sKey, final AbstractParameterParser aParam); void setIgnoreMissingParsers(final boolean bIgnoreMissingParsers); boolean isIgnoreMissingParsers(); @Override void setParameter(final String sKey, final String sValue); @Override String getParameter(final String sKey); void setParameterParsers(@Nullable final ICommonsMap <String, AbstractParameterParser> aParameterParsers);  }