Search in sources :

Example 21 with Test

use of org.testng.annotations.Test in project weixin-java-tools by chanjarster.

the class WxMpMessageRouterTest method testSessionClean3.

@Test(dataProvider = "standardSessionManager")
public void testSessionClean3(StandardSessionManager ism) throws InterruptedException {
    // 2个异步请求,看是否处理完毕后会被清理掉
    final WxMpMessageRouter router = new WxMpMessageRouter(null);
    router.setSessionManager(ism);
    router.rule().async(true).handler(new WxSessionMessageHandler()).next().rule().async(true).handler(new WxSessionMessageHandler()).end();
    WxMpXmlMessage msg = new WxMpXmlMessage();
    msg.setFromUserName("abc");
    router.route(msg);
    Thread.sleep(2000l);
    Assert.assertEquals(ism.getActiveSessions(), 0);
}
Also used : WxMpXmlMessage(me.chanjar.weixin.mp.bean.WxMpXmlMessage) Test(org.testng.annotations.Test)

Example 22 with Test

use of org.testng.annotations.Test in project che by eclipse.

the class UrlUtilsTest method shouldExtractParametersWithMultipleValuesDividedAnotherParameters.

@Test
public void shouldExtractParametersWithMultipleValuesDividedAnotherParameters() throws Exception {
    Map<String, List<String>> expectedParams = new HashMap<>();
    List<String> v = new LinkedList<>();
    v.add("123");
    v.add("qwe");
    v.add("www");
    List<String> par = new LinkedList<>();
    par.add("test");
    expectedParams.put("v", v);
    expectedParams.put("par", par);
    Map<String, List<String>> params = UrlUtils.getQueryParameters(new URL("http://codenvy.com/factory?v=123&par=test&v=qwe&v=www"));
    assertEquals(params, expectedParams);
}
Also used : HashMap(java.util.HashMap) List(java.util.List) LinkedList(java.util.LinkedList) LinkedList(java.util.LinkedList) URL(java.net.URL) Test(org.testng.annotations.Test)

Example 23 with Test

use of org.testng.annotations.Test in project che by eclipse.

the class UrlUtilsTest method shouldIgnoreSlashAtTheEndOfPath.

@Test
public void shouldIgnoreSlashAtTheEndOfPath() throws Exception {
    Map<String, List<String>> expectedParams = new HashMap<>();
    List<String> v = new LinkedList<>();
    v.add("123");
    v.add("qwe");
    v.add("www");
    List<String> par = new LinkedList<>();
    par.add("test");
    expectedParams.put("v", v);
    expectedParams.put("par", par);
    Map<String, List<String>> params = UrlUtils.getQueryParameters(new URL("http://codenvy.com/factory/?v=123&par=test&v=qwe&v=www"));
    assertEquals(params, expectedParams);
}
Also used : HashMap(java.util.HashMap) List(java.util.List) LinkedList(java.util.LinkedList) LinkedList(java.util.LinkedList) URL(java.net.URL) Test(org.testng.annotations.Test)

Example 24 with Test

use of org.testng.annotations.Test in project che by eclipse.

the class ZipUtilsTest method testGetResources.

@Test
public void testGetResources() throws Exception {
    URL testJar = ZipUtilsTest.class.getResource("/che/che.jar");
    @SuppressWarnings("unchecked") Consumer<InputStream> consumer = mock(Consumer.class);
    ZipUtils.getResources(new ZipFile(testJar.getFile()), Pattern.compile(".*[//]?codenvy/[^//]+[.]json"), consumer);
    verify(consumer, times(2)).accept(any(InputStream.class));
}
Also used : ZipFile(java.util.zip.ZipFile) InputStream(java.io.InputStream) URL(java.net.URL) Test(org.testng.annotations.Test)

Example 25 with Test

use of org.testng.annotations.Test in project che by eclipse.

the class XMLTreeTest method shouldBeAbleToCreateTreeFromPath.

@Test
public void shouldBeAbleToCreateTreeFromPath() throws Exception {
    final byte[] bytes = XML_CONTENT.getBytes();
    final Path path = targetDir().resolve("test-xml.xml");
    write(path, bytes);
    final XMLTree tree = XMLTree.from(path);
    assertEquals(tree.getBytes(), bytes);
    delete(path);
}
Also used : Path(java.nio.file.Path) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)24007 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2438 Task (com.evolveum.midpoint.task.api.Task)2069 File (java.io.File)1433 ArrayList (java.util.ArrayList)1237 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)1188 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)1078 HashMap (java.util.HashMap)965 CommandLineProgramTest (org.broadinstitute.hellbender.CommandLineProgramTest)814 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)692 BeforeTest (org.testng.annotations.BeforeTest)692 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)690 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)651 Parameters (org.testng.annotations.Parameters)610 BaseTest (org.xdi.oxauth.BaseTest)582 BigDecimal (java.math.BigDecimal)574 List (java.util.List)558 LocalDate (org.joda.time.LocalDate)553 HashSet (java.util.HashSet)548 BaseTest (util.BaseTest)537