本文整理汇总了Java中com.helger.commons.collection.impl.ICommonsMap类的典型用法代码示例。如果您正苦于以下问题:Java ICommonsMap类的具体用法?Java ICommonsMap怎么用?Java ICommonsMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICommonsMap类属于com.helger.commons.collection.impl包,在下文中一共展示了ICommonsMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: schedule
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
/**
* @param aScheduleBuilder
* The schedule builder to be used. May not be <code>null</code>.
* Example:
* <code>SimpleScheduleBuilder.repeatMinutelyForever (1)</code>
* @return The created trigger key for further usage. Never <code>null</code>.
*/
@Nonnull
public static TriggerKey schedule (@Nonnull final SimpleScheduleBuilder aScheduleBuilder)
{
ValueEnforcer.notNull (aScheduleBuilder, "ScheduleBuilder");
final ICommonsMap <String, Object> aJobDataMap = new CommonsHashMap <> ();
return GlobalQuartzScheduler.getInstance ()
.scheduleJob (ReIndexJob.class.getName (),
JDK8TriggerBuilder.newTrigger ()
.startAt (PDTFactory.getCurrentLocalDateTime ()
.plusSeconds (5))
.withSchedule (aScheduleBuilder),
ReIndexJob.class,
aJobDataMap);
}
示例2: testReadBuildInfo
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
@Test
public void testReadBuildInfo ()
{
final ICommonsMap <String, String> aMap = new CommonsHashMap <> ();
final IReadableResource aRes = new ClassPathResource ("xml/buildinfo.xml");
assertTrue (XMLMapHandler.readMap (aRes, aMap).isSuccess ());
assertNull (XMLMapHandler.readMap (new ClassPathResource ("test1.txt")));
assertTrue (aMap.containsKey ("buildinfo.version"));
assertEquals ("1", aMap.get ("buildinfo.version"));
assertTrue (XMLMapHandler.readMap (aRes).containsKey ("buildinfo.version"));
assertEquals ("1", XMLMapHandler.readMap (aRes).get ("buildinfo.version"));
assertTrue (XMLMapHandler.writeMap (aMap, new ByteArrayOutputStreamProvider ()).isSuccess ());
assertTrue (XMLMapHandler.writeMap (aMap, new NonBlockingByteArrayOutputStream ()).isSuccess ());
}
示例3: testMap
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
@Test
public void testMap ()
{
final ICommonsMap <String, Object> aMap = new CommonsHashMap<> ();
aMap.put ("foo", "bar");
assertEquals ("{\"foo\":\"bar\"}", JsonConverter.convertToJson (aMap).getAsJsonString ());
final ICommonsNavigableMap <String, Object> aTreeMap = new CommonsTreeMap<> ();
aTreeMap.put ("foo", "bar");
aTreeMap.put ("foo2", Integer.valueOf (5));
assertEquals ("{\"foo\":\"bar\",\"foo2\":5}", JsonConverter.convertToJson (aTreeMap).getAsJsonString ());
final ICommonsOrderedMap <String, Object> aLinkedMap = new CommonsLinkedHashMap<> ();
aLinkedMap.put ("foo", "bar");
aLinkedMap.put ("foo2", Integer.valueOf (5));
assertEquals ("{\"foo\":\"bar\",\"foo2\":5}", JsonConverter.convertToJson (aLinkedMap).getAsJsonString ());
assertEquals ("{foo:\"bar\",foo2:5}",
JsonConverter.convertToJson (aLinkedMap)
.getAsJsonString (new JsonWriterSettings ().setQuoteNames (false)));
}
示例4: testWriteAndReadMap
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
@Test
public void testWriteAndReadMap ()
{
final ICommonsMap <String, Object> aMap = new CommonsHashMap<> ();
aMap.put ("foo", "bar");
_testWriteAndRead (aMap);
final ICommonsNavigableMap <String, Object> aTreeMap = new CommonsTreeMap<> ();
aTreeMap.put ("foo", "bar");
aTreeMap.put ("foo2", Integer.valueOf (5));
_testWriteAndRead (aTreeMap);
final ICommonsOrderedMap <String, Object> aLinkedMap = new CommonsLinkedHashMap<> ();
aLinkedMap.put ("foo", "bar");
aLinkedMap.put ("foo2", Integer.valueOf (5));
_testWriteAndRead (aLinkedMap);
}
示例5: testMap
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
@Test
public void testMap ()
{
final ICommonsMap <String, Object> aMap = new CommonsHashMap <> ();
aMap.put ("foo", "bar");
aMap.put ("foo2", Integer.valueOf (5));
assertTrue (JsonConverter.convertToJson (aMap) instanceof JsonObject);
final ICommonsNavigableMap <String, Object> aTreeMap = new CommonsTreeMap <> ();
aTreeMap.put ("foo", "bar");
aTreeMap.put ("foo2", Integer.valueOf (5));
assertTrue (JsonConverter.convertToJson (aTreeMap) instanceof JsonObject);
final ICommonsOrderedMap <String, Object> aLinkedMap = new CommonsLinkedHashMap <> ();
aLinkedMap.put ("foo", "bar");
aLinkedMap.put ("foo2", Integer.valueOf (5));
assertTrue (JsonConverter.convertToJson (aLinkedMap) instanceof JsonObject);
}
示例6: testMap
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
@Test
public void testMap ()
{
final ICommonsMap <String, Object> aMap = new CommonsHashMap <> ();
aMap.put ("foo", "bar");
_testEqualsHashcode (aMap);
final ICommonsMap <String, Object> aTreeMap = new CommonsTreeMap <> ();
aTreeMap.put ("foo", "bar");
aTreeMap.put ("foo2", Integer.valueOf (5));
_testEqualsHashcode (aTreeMap);
final ICommonsMap <String, Object> aLinkedMap = new CommonsLinkedHashMap <> ();
aLinkedMap.put ("foo", "bar");
aLinkedMap.put ("foo2", Integer.valueOf (5));
_testEqualsHashcode (aLinkedMap);
}
示例7: testReplaceMultipleMap
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
@Test
public void testReplaceMultipleMap ()
{
final ICommonsMap <String, String> aMap = new CommonsHashMap <> ();
aMap.put ("Hallo", "Hi");
aMap.put ("Welt", "world");
aMap.put ("!", "???");
assertEquals ("Abc die Katze lief im Schnee", StringHelper.replaceMultiple ("Abc die Katze lief im Schnee", aMap));
assertEquals ("Hi Katze", StringHelper.replaceMultiple ("Hallo Katze", aMap));
assertEquals ("Moin world", StringHelper.replaceMultiple ("Moin Welt", aMap));
assertEquals ("Moin welt", StringHelper.replaceMultiple ("Moin welt", aMap));
assertEquals ("Hi", StringHelper.replaceMultiple ("Hallo", aMap));
assertEquals ("Hi Hi", StringHelper.replaceMultiple ("Hallo Hallo", aMap));
assertEquals ("HiHiHi", StringHelper.replaceMultiple ("HalloHalloHallo", aMap));
assertEquals ("Hi world???", StringHelper.replaceMultiple ("Hallo Welt!", aMap));
assertEquals ("Hi world???Hi world???", StringHelper.replaceMultiple ("Hallo Welt!Hallo Welt!", aMap));
}
示例8: testBasic
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
@Test
public void testBasic ()
{
final WSClientConfig aCfg = new WSClientConfig (URLHelper.getAsURL ("http://www.example.org"));
final ICommonsMap <String, Object> aMap = new CommonsHashMap<> ();
final BindingProvider aBP = new MockBP (aMap);
aCfg.applyWSSettingsToBindingProvider (aBP);
assertEquals (5, aMap.size ());
assertEquals ("http://www.example.org", aMap.get (BindingProvider.ENDPOINT_ADDRESS_PROPERTY));
// 2 versions
assertEquals (Integer.valueOf (WSClientConfig.DEFAULT_CONNECTION_TIMEOUT_MS),
aMap.get ("com.sun.xml.ws.connect.timeout"));
assertEquals (Integer.valueOf (WSClientConfig.DEFAULT_CONNECTION_TIMEOUT_MS),
aMap.get ("com.sun.xml.internal.ws.connect.timeout"));
// 2 versions
assertEquals (Integer.valueOf (WSClientConfig.DEFAULT_REQUEST_TIMEOUT_MS),
aMap.get ("com.sun.xml.ws.request.timeout"));
assertEquals (Integer.valueOf (WSClientConfig.DEFAULT_REQUEST_TIMEOUT_MS),
aMap.get ("com.sun.xml.internal.ws.request.timeout"));
}
示例9: getAllVATItemsForCountry
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
/**
* Get all VAT types matching the given locale (without any fallback!). It
* contains both the specific definitions and the locale independent
* definitions.
*
* @param aCountry
* The locale to use. May not be <code>null</code>.
* @return A non-<code>null</code> map from ID to the matching VAT item. Also
* the deprecated VAT items are returned! VATTYPE_NONE.getID () is
* used if zero VAT is allowed
*/
@ReturnsMutableCopy
@Nonnull
public ICommonsMap <String, IVATItem> getAllVATItemsForCountry (@Nonnull final Locale aCountry)
{
ValueEnforcer.notNull (aCountry, "Country");
final ICommonsMap <String, IVATItem> ret = new CommonsHashMap <> ();
// first get locale specific VAT types
final VATCountryData aVATCountryData = getVATCountryData (aCountry);
if (aVATCountryData != null)
{
if (aVATCountryData.isZeroVATAllowed ())
ret.put (VATTYPE_NONE.getID (), VATTYPE_NONE);
ret.putAll (aVATCountryData.getAllItems ());
}
return ret;
}
示例10: PSXPathBoundAssertReport
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
public PSXPathBoundAssertReport (@Nonnull final PSAssertReport aAssertReport,
@Nonnull final String sTestExpression,
@Nonnull final XPathExpression aBoundTestExpression,
@Nonnull final ICommonsList <PSXPathBoundElement> aBoundContent,
@Nonnull final ICommonsMap <String, PSXPathBoundDiagnostic> aBoundDiagnostics)
{
ValueEnforcer.notNull (aAssertReport, "AssertReport");
ValueEnforcer.notNull (sTestExpression, "TestExpression");
ValueEnforcer.notNull (aBoundTestExpression, "BoundTestExpression");
ValueEnforcer.notNull (aBoundContent, "BoundContent");
ValueEnforcer.notNull (aBoundDiagnostics, "BoundDiagnostics");
m_aAssertReport = aAssertReport;
m_sTestExpression = sTestExpression;
m_aBoundTestExpression = aBoundTestExpression;
m_aBoundContent = aBoundContent;
m_aBoundDiagnostics = aBoundDiagnostics;
}
示例11: validateAndProduceSVRL
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
public static void validateAndProduceSVRL (@Nonnull final File aSchematron, final File aXML) throws Exception
{
// Create the custom parameters
final ICommonsMap <String, Object> aCustomParameters = new CommonsHashMap <> ();
aCustomParameters.put ("xyz", "mobile");
aCustomParameters.put ("expected", "");
final SchematronResourceSCH aSCH = SchematronResourceSCH.fromFile (aSchematron);
// Assign custom parameters
aSCH.setParameters (aCustomParameters);
if (false)
System.out.println (XMLWriter.getNodeAsString (aSCH.getXSLTProvider ().getXSLTDocument ()));
// Perform validation
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL (new FileSystemResource (aXML));
assertNotNull (aSVRL);
if (false)
System.out.println (new SVRLMarshaller ().getAsString (aSVRL));
}
示例12: eSENS_TA10
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
/**
* Prerequisite:<br>
* SMSH and RMSH are configured to exchange AS4 messages according to the
* e-SENS profile (One-Way/Push MEP). Simulate the RMSH to not send receipts
* (can be done by intercepting the receipts). SMSH tries to send an AS4 User
* Message to the RMSH.<br>
* <br>
* Predicate: <br>
* The SMSH retries to send the AS4 User Message (at least once).
*
* @throws Exception
* In case of error
*/
@Test
public void eSENS_TA10 () throws Exception
{
final ICommonsMap <String, Object> aOldSettings = m_aSettings.getClone ();
final int nProxyPort = 8001;
m_aSettings.putIn (SETTINGS_SERVER_PROXY_ENABLED, true);
m_aSettings.putIn (SETTINGS_SERVER_PROXY_ADDRESS, "localhost");
m_aSettings.putIn (SETTINGS_SERVER_PROXY_PORT, nProxyPort);
final HttpProxyServer aProxyServer = _startProxyServer (nProxyPort);
try
{
// send message
final MimeMessage aMsg = MimeMessageCreator.generateMimeMessage (m_eSOAPVersion,
testSignedUserMessage (m_eSOAPVersion,
m_aPayload,
null,
new AS4ResourceManager ()),
null);
sendMimeMessage (new HttpMimeMessageEntity (aMsg), false, EEbmsError.EBMS_OTHER.getErrorCode ());
}
finally
{
aProxyServer.stop ();
// Restore original properties
m_aSettings.setAll (aOldSettings);
}
}
示例13: internalCreateCryptoFactory
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
@Nonnull
protected AS4CryptoFactory internalCreateCryptoFactory ()
{
_checkKeyStoreAttributes ();
final ICommonsMap <String, String> aCryptoProps = new CommonsLinkedHashMap <> ();
aCryptoProps.put ("org.apache.wss4j.crypto.provider", org.apache.wss4j.common.crypto.Merlin.class.getName ());
aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.file", getKeyStoreResource ().getPath ());
aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.type", getKeyStoreType ().getID ());
aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.password", getKeyStorePassword ());
aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.alias", getKeyStoreAlias ());
aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.private.password", getKeyStoreKeyPassword ());
return new AS4CryptoFactory (aCryptoProps);
}
示例14: getAttachmentCompressionMode
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
/**
* @param sID
* id to look up
* @return Looks up if a compression mode with the id sID exists and returns
* the mode else null
*/
@Nullable
default EAS4CompressionMode getAttachmentCompressionMode (@Nullable final String sID)
{
final ICommonsMap <String, EAS4CompressionMode> aIDs = getCompressedAttachmentIDs ();
return aIDs == null ? null : aIDs.get (sID);
}
示例15: getClientUniqueID
import com.helger.commons.collection.impl.ICommonsMap; //导入依赖的package包/类
@Nullable
static String getClientUniqueID (@Nonnull final X509Certificate aCert)
{
try
{
// subject principal name must be in the order CN=XX,O=YY,C=ZZ
// In some JDK versions it is O=YY,CN=XX,C=ZZ instead (e.g. 1.6.0_45)
final LdapName aLdapName = new LdapName (aCert.getSubjectX500Principal ().getName ());
// Make a map from type to name
final ICommonsMap <String, Rdn> aParts = new CommonsHashMap <> ();
for (final Rdn aRdn : aLdapName.getRdns ())
aParts.put (aRdn.getType (), aRdn);
// Re-order - least important item comes first (=reverse order)!
final String sSubjectName = new LdapName (new CommonsArrayList <> (aParts.get ("C"),
aParts.get ("O"),
aParts.get ("CN"))).toString ();
// subject-name + ":" + serial number hexstring
return sSubjectName + ':' + aCert.getSerialNumber ().toString (16);
}
catch (final Exception ex)
{
s_aLogger.error ("Failed to parse '" + aCert.getSubjectX500Principal ().getName () + "'", ex);
return null;
}
}