use of com.taobao.weex.adapter.DefaultWXHttpAdapter in project weex-example by KalicyZhou.
the class WXStreamModuleTest method testFetchRequestHttpbinCallback.
@Test
public void testFetchRequestHttpbinCallback() throws Exception {
WXStreamModule streamModule = createModule(new DefaultWXHttpAdapter());
JSCallback progress = mock(JSCallback.class);
JSCallback finish = mock(JSCallback.class);
System.out.print("request start " + System.currentTimeMillis());
streamModule.fetch("{method: 'POST',url: 'http://httpbin.org/post',type:'json'}", finish, progress);
verify(progress, timeout(10 * 1000).atLeastOnce()).invokeAndKeepAlive(anyMapOf(String.class, Object.class));
verify(finish, timeout(10 * 1000).times(1)).invoke(anyMapOf(String.class, Object.class));
System.out.print("\nrequest finish" + System.currentTimeMillis());
}
use of com.taobao.weex.adapter.DefaultWXHttpAdapter in project incubator-weex by apache.
the class WXStreamModuleTest method testFetchRequestHttpbinCallback.
@Test
public void testFetchRequestHttpbinCallback() throws Exception {
WXStreamModule streamModule = createModule(new DefaultWXHttpAdapter());
JSCallback progress = mock(JSCallback.class);
JSCallback finish = mock(JSCallback.class);
System.out.print("request start " + System.currentTimeMillis());
streamModule.fetch(JSON.parseObject("{method: 'POST',url: 'http://httpbin.org/post',type:'json'}"), finish, progress);
verify(progress, timeout(10 * 1000).atLeastOnce()).invokeAndKeepAlive(anyMapOf(String.class, Object.class));
verify(finish, timeout(10 * 1000).times(1)).invoke(anyMapOf(String.class, Object.class));
System.out.print("\nrequest finish" + System.currentTimeMillis());
}
Aggregations