1 package org.simantics.db.tests.client;
4 import org.simantics.db.exception.DatabaseException;
5 import org.simantics.db.service.LifecycleSupport;
6 import org.simantics.db.testing.annotation.Fails;
7 import org.simantics.db.testing.base.ExistingDatabaseTest;
8 import org.simantics.db.testing.common.Client;
9 import org.simantics.db.testing.common.ClientFactory;
10 import org.simantics.db.tests.common.Configuration;
12 public class CallTest extends ExistingDatabaseTest {
13 private static final int COUNT = Configuration.get().callLoopCount;
14 private static final int CALL_COUNT = Configuration.get().callCallCount;
15 private static final int N_THREADS = Configuration.get().callThreadCount;
16 private CallTestThread[] threads = new CallTestThread[N_THREADS];
20 public void testCall() throws DatabaseException {
21 for (int i=0; i<COUNT; ++i) {
24 for (int i=0; i<N_THREADS; ++i)
27 void callTestImpl() throws DatabaseException {
29 // ServerAddress serverAddress = getSessionContext().getAddress();
30 for (int i=0; i<N_THREADS; ++i) {
31 threads[i] = new CallTestThread(i, ClientFactory.create(getRandomString()), CALL_COUNT);
36 for (int i=0; i<N_THREADS; ++i) {
37 if (null != threads[i])
40 } catch (InterruptedException e) {
43 DatabaseException ex = null;
44 for (int i=0; i<N_THREADS; ++i) {
45 if (null != threads[i] && null != threads[i].client)
47 threads[i].client.close();
48 } catch (DatabaseException e) {
56 class CallTestThread extends Thread {
58 private final int size;
59 DatabaseException exception = null;
60 LifecycleSupport support;
61 public CallTestThread(int index, Client client, int size) {
62 super("CallTestThread " + ++index);
65 support = client.getSession().getService(LifecycleSupport.class);
69 for (int i=0; i<size; ++i) {
72 } catch (DatabaseException e) {