本文整理汇总了Java中com.helger.commons.mock.CommonsTestHelper.testInParallel方法的典型用法代码示例。如果您正苦于以下问题:Java CommonsTestHelper.testInParallel方法的具体用法?Java CommonsTestHelper.testInParallel怎么用?Java CommonsTestHelper.testInParallel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.helger.commons.mock.CommonsTestHelper
的用法示例。
在下文中一共展示了CommonsTestHelper.testInParallel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetCollatorSpaceBeforeDot
import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testGetCollatorSpaceBeforeDot ()
{
final Collator c = CollatorHelper.getCollatorSpaceBeforeDot (L_DE);
assertNotNull (c);
final Collator c2 = CollatorHelper.getCollatorSpaceBeforeDot (L_DE);
assertNotNull (c2);
assertNotSame (c, c2);
CommonsTestHelper.testDefaultImplementationWithEqualContentObject (c, c2);
// Unknown locale
assertNotNull (CollatorHelper.getCollatorSpaceBeforeDot (new Locale ("xy", "87")));
final List <Collator> res = new CommonsVector <> ();
final int nMax = 100;
CommonsTestHelper.testInParallel (nMax, () -> res.add (CollatorHelper.getCollatorSpaceBeforeDot (L_EN)));
assertEquals (nMax, res.size ());
for (int i = 1; i < nMax; ++i)
CommonsTestHelper.testDefaultImplementationWithEqualContentObject (res.get (0), res.get (i));
}
示例2: testMultithreadedSAX_CachingSAXInputSource
import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testMultithreadedSAX_CachingSAXInputSource ()
{
CommonsTestHelper.testInParallel (1000,
(IThrowingRunnable <SAXException>) () -> assertTrue (SAXReader.readXMLSAX (new CachingSAXInputSource (new ClassPathResource ("xml/buildinfo.xml")),
new SAXReaderSettings ().setContentHandler (new DefaultHandler ()))
.isSuccess ()));
}
示例3: testMultithreadedSAX_ReadableResourceSAXInputSource
import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testMultithreadedSAX_ReadableResourceSAXInputSource ()
{
CommonsTestHelper.testInParallel (1000,
(IThrowingRunnable <SAXException>) () -> assertTrue (SAXReader.readXMLSAX (new ClassPathResource ("xml/buildinfo.xml"),
new SAXReaderSettings ().setContentHandler (new DefaultHandler ()))
.isSuccess ()));
}
示例4: testSort
import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testSort ()
{
final int nMax = 10000;
CommonsTestHelper.testInParallel (nMax, () -> {
Collator c = CollatorHelper.getCollatorSpaceBeforeDot (L_DE);
assertEquals (-1, CompareHelper.compare ("1.1 a", "1.1.1 a", c));
c = CollatorHelper.getCollatorSpaceBeforeDot (L_EN);
assertEquals (-1, CompareHelper.compare ("1.1 a", "1.1.1 a", c));
});
}
示例5: testWriteXMLMultiThreaded
import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testWriteXMLMultiThreaded ()
{
final String sSPACER = " ";
final String sINDENT = XMLWriterSettings.DEFAULT_INDENTATION_STRING;
final String sTAGNAME = "notext";
CommonsTestHelper.testInParallel (1000, () -> {
// Java 1.6 JAXP handles things differently
final String sSerTagName = "<" + sTAGNAME + "></" + sTAGNAME + ">";
final Document doc = XMLFactory.newDocument ("html", DOCTYPE_XHTML10_QNAME, DOCTYPE_XHTML10_URI);
final Element aHead = (Element) doc.getDocumentElement ()
.appendChild (doc.createElementNS (DOCTYPE_XHTML10_URI, "head"));
aHead.appendChild (doc.createTextNode ("Hallo"));
final Element aNoText = (Element) doc.getDocumentElement ()
.appendChild (doc.createElementNS (DOCTYPE_XHTML10_URI, sTAGNAME));
aNoText.appendChild (doc.createTextNode (""));
// test including doc type
final String sResult = XMLWriter.getNodeAsString (doc, XMLWriterSettings.createForXHTML ());
assertEquals ("<!DOCTYPE html PUBLIC \"" +
DOCTYPE_XHTML10_QNAME +
"\"" +
sSPACER +
"\"" +
DOCTYPE_XHTML10_URI +
"\">" +
CRLF +
"<html xmlns=\"" +
DOCTYPE_XHTML10_URI +
"\">" +
CRLF +
sINDENT +
"<head>Hallo</head>" +
CRLF +
sINDENT +
sSerTagName +
CRLF +
"</html>" +
CRLF,
sResult);
assertEquals (sResult, XMLWriter.getNodeAsString (doc, XMLWriterSettings.createForXHTML ()));
});
}
示例6: testMultithreadedDOM
import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testMultithreadedDOM ()
{
CommonsTestHelper.testInParallel (100,
(IThrowingRunnable <SAXException>) () -> assertNotNull (DOMReader.readXMLDOM (new ClassPathResource ("xml/buildinfo.xml"))));
}