From d3eb7dc044735f3fa47d1a79dd5108595dd44852 Mon Sep 17 00:00:00 2001 From: legoc Date: Thu, 15 Nov 2018 08:40:42 +0100 Subject: [PATCH] Added test --- .../test/TestServerWithSimpleApplication.java | 54 +++++++++++++++++++ .../test/TestStartWithSimpleApplication.java | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/main/java/fr/ill/ics/cameo/test/TestServerWithSimpleApplication.java diff --git a/src/main/java/fr/ill/ics/cameo/test/TestServerWithSimpleApplication.java b/src/main/java/fr/ill/ics/cameo/test/TestServerWithSimpleApplication.java new file mode 100644 index 0000000..5dac6c2 --- /dev/null +++ b/src/main/java/fr/ill/ics/cameo/test/TestServerWithSimpleApplication.java @@ -0,0 +1,54 @@ +/* + * Copyright 2015 Institut Laue-Langevin + * + * Licensed under the EUPL, Version 1.1 only (the "License"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ + +package fr.ill.ics.cameo.test; + +import java.util.Date; + +import fr.ill.ics.cameo.Application; +import fr.ill.ics.cameo.Server; + + +public class TestServerWithSimpleApplication { + + public static void main(String[] args) { + + int numberOfTimes = Integer.parseInt(args[0]); + + Server server = new Server("tcp://localhost:10000"); + + Date d = new Date(); + + // loop the number of times. + for (int i = 0; i < numberOfTimes; ++i) { + + // start the application. + Application.Instance application = server.start("simplejava"); + + try { + Thread.sleep(400); + } catch (InterruptedException e) { + } + + System.out.println("finished application " + application); + } + + server.terminate(); + + System.out.println("finished the application after " + ((new Date()).getTime() - d.getTime()) + "ms"); + } + +} \ No newline at end of file diff --git a/src/main/java/fr/ill/ics/cameo/test/TestStartWithSimpleApplication.java b/src/main/java/fr/ill/ics/cameo/test/TestStartWithSimpleApplication.java index 647ba68..468e1ae 100644 --- a/src/main/java/fr/ill/ics/cameo/test/TestStartWithSimpleApplication.java +++ b/src/main/java/fr/ill/ics/cameo/test/TestStartWithSimpleApplication.java @@ -52,7 +52,7 @@ public class TestStartWithSimpleApplication { // the getString is blocking until the application finishes application.waitFor(); - + System.out.println("finished application " + application); } -- GitLab