use of oap.http.Server in project oap by oaplatform.
the class WsFileUploaderTest method beforeMethod.
@BeforeMethod
@Override
public void beforeMethod() throws Exception {
Env.resetPorts();
super.beforeMethod();
kernel = new Kernel(Lists.empty());
kernel.start();
path = Env.tmpPath("/tmp");
Files.ensureDirectory(path);
medias.clear();
server = new Server(100);
ws = new WebServices(server, new SessionManager(10, null, "/"), GenericCorsPolicy.DEFAULT, WsConfig.CONFIGURATION.fromResource(getClass(), "ws-multipart.conf"));
WsFileUploader service = new WsFileUploader(path, 1024 * 1024, -1, singletonList(new VastMediaProcessing(shell("ffprobe -v quiet -print_format xml -show_format -sexagesimal -show_streams {FILE}"), 10000L)));
service.addListener((media, mediaInfo, mediaContext) -> WsFileUploaderTest.this.medias.add(__(media, mediaInfo)));
kernel.register("upload", service);
ws.start();
listener = new SynchronizedThread(new PlainHttpListener(server, Env.port()));
listener.start();
Cuid.reset("p", 1);
}
use of oap.http.Server in project oap by oaplatform.
the class AbstractWebServicesTest method startServer.
@BeforeClass
public void startServer() {
Env.resetPorts();
kernel = new Kernel(Lists.empty());
server = new Server(100);
ws = new WebServices(server, new SessionManager(10, null, "/"), GenericCorsPolicy.DEFAULT, Lists.map(getConfig(), n -> WsConfig.CONFIGURATION.fromResource(getClass(), n)));
kernel.start();
registerServices(kernel);
ws.start();
listener = new SynchronizedThread(new PlainHttpListener(server, Env.port()));
listener.start();
}
use of oap.http.Server in project oap by oaplatform.
the class WebServicesPerformance method blockingThreads.
@Test
public void blockingThreads() {
Server server = new Server(5000);
SynchronizedThread listener = new SynchronizedThread(new PlainHttpListener(server, Env.port()));
listener.start();
try {
WebServices ws = new WebServices(server, SESSION_MANAGER, GenericCorsPolicy.DEFAULT);
ws.bind("x/v/math", GenericCorsPolicy.DEFAULT, new MathWS(), false, SESSION_MANAGER, Collections.emptyList(), Protocol.HTTP);
HttpAsserts.reset();
benchmark("Server.invocations", samples, () -> HttpAsserts.assertGet(HTTP_URL("/x/v/math/id?a=aaa")).responded(200, "OK", ContentType.APPLICATION_JSON, "\"aaa\"")).inThreads(5000).run();
HttpAsserts.reset();
} finally {
listener.stop();
server.stop();
}
}
Aggregations