Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

Commit 0cbcee1

Browse files
committed
KITE Version 2.0.5
1 parent 0b4e258 commit 0cbcee1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+949
-710
lines changed

KITE-AppRTC-Test/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>org.webrtc.kite</groupId>
1010
<artifactId>kite-base</artifactId>
11-
<version>2.0.4</version>
11+
<version>2.0.5</version>
1212
</parent>
1313

1414
<artifactId>apprtc-test</artifactId>

KITE-AppRTC-Test/src/main/java/org/webrtc/kite/apprtc/checks/BitrateCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected void step() throws KiteTestException {
6565
double avgBitrate = computeBitrate(stats.getJsonArray("statsArray"), stat, mediaType);
6666
System.out.println("avgBitrate lah =>>>>>> " + avgBitrate);
6767
// Assuming that there's a 10% tolerance to the test result:
68-
Reporter.getInstance().textAttachment(report, "Bitrate check",
68+
reporter.textAttachment(report, "Bitrate check",
6969
"Expected : [" + 0.9*expectedBitrate + " -> " + 1.1*expectedBitrate + "], found " + avgBitrate , "plain" );
7070
if (avgBitrate < 0.9*expectedBitrate || 1.1*expectedBitrate < avgBitrate) {
7171
throw new KiteTestException("Expected bitrate to be in [" + 0.9*expectedBitrate + "," + 1.1*expectedBitrate + "], found " + avgBitrate, Status.FAILED);

KITE-AppRTC-Test/src/main/java/org/webrtc/kite/apprtc/checks/RemoteVideoDisplayCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected void step() throws KiteTestException {
4040
logger.info("Looking for video object");
4141
String videoCheck = appRTCMeetingPage.remoteVideoCheck();
4242
if (!"video".equalsIgnoreCase(videoCheck)) {
43-
Reporter.getInstance().textAttachment(report, "Remote Video", videoCheck, "plain");
43+
reporter.textAttachment(report, "Remote Video", videoCheck, "plain");
4444
throw new KiteTestException("The first video is " + videoCheck, Status.FAILED);
4545
}
4646
}

KITE-AppRTC-Test/src/main/java/org/webrtc/kite/apprtc/checks/RemoteVideoHDCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected void step() throws KiteTestException {
5252
, Status.FAILED);
5353
}
5454

55-
Reporter.getInstance().textAttachment(this.report, "Remote video resolution: width:", width + ", height:" + height, "plain");
55+
reporter.textAttachment(this.report, "Remote video resolution: width:", width + ", height:" + height, "plain");
5656
}
5757

5858

KITE-AppRTC-Test/src/main/java/org/webrtc/kite/apprtc/steps/GetStatsStep.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ protected void step() throws KiteTestException {
4949
try {
5050
JsonObject stats = getPCStatOvertime(webDriver, getStatsConfig).get(0);
5151
JsonObject statsSummary = appRTCMeetingPage.buildstatSummary(stats, getStatsConfig.getJsonArray("selectedStats"));
52-
Reporter.getInstance().jsonAttachment(report, "getStatsRaw", stats);
53-
Reporter.getInstance().jsonAttachment(this.report, "Stats Summary", statsSummary);
52+
reporter.jsonAttachment(report, "getStatsRaw", stats);
53+
reporter.jsonAttachment(this.report, "Stats Summary", statsSummary);
5454
} catch (Exception e) {
5555
logger.error(getStackTrace(e));
5656
throw new KiteTestException("Failed to getStats", Status.BROKEN, e);

KITE-Engine/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.webrtc.kite</groupId>
88
<artifactId>kite-base</artifactId>
9-
<version>2.0.4</version>
9+
<version>2.0.5</version>
1010
</parent>
1111

1212
<artifactId>kite-engine</artifactId>

KITE-Engine/src/main/java/org/webrtc/kite/Engine.java

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import io.cosmosoftware.kite.report.KiteLogger;
2020
import org.webrtc.kite.config.Configurator;
2121
import org.webrtc.kite.config.client.Client;
22+
import org.webrtc.kite.config.client.MobileSpecs;
2223
import org.webrtc.kite.config.paas.Paas;
2324
import org.webrtc.kite.config.test.TestConfig;
2425
import org.webrtc.kite.config.test.Tuple;
@@ -29,6 +30,7 @@
2930
import javax.json.JsonException;
3031
import java.io.FileNotFoundException;
3132
import java.text.SimpleDateFormat;
33+
import java.util.ArrayList;
3234
import java.util.Date;
3335
import java.util.List;
3436
import java.util.concurrent.ExecutionException;
@@ -45,14 +47,14 @@ public class Engine {
4547
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HHmmss");
4648
System.setProperty("current.date", dateFormat.format(new Date()));
4749
}
48-
50+
4951
private static final KiteLogger logger = KiteLogger.getLogger(Engine.class.getName());
5052

51-
public static void buildConfig(String pathToConfigFile) {
53+
public static void buildConfig(Configurator configurator, String pathToConfigFile) {
5254
try {
53-
Configurator.getInstance().setConfigFilePath(pathToConfigFile);
54-
Configurator.getInstance().buildConfig();
55-
Configurator.getInstance().setTimeStamp();
55+
configurator.setConfigFilePath(pathToConfigFile);
56+
configurator.buildConfig();
57+
configurator.setTimeStamp();
5658
} catch (FileNotFoundException e) {
5759
logger
5860
.fatal("Error [File Not Found]: '" + pathToConfigFile + "' either doesn't exist or is not a file.",
@@ -73,11 +75,12 @@ public static void buildConfig(String pathToConfigFile) {
7375
}
7476
}
7577

76-
private static void distributeRemote(List<Tuple> tupleList) {
78+
public static void distributeRemote(Configurator configurator, List<Tuple> tupleList) {
7779
// setting remote hub address to client, using circular linked list
7880
// each tuple will be prioritised to be in the same hub
81+
//need to handle mobile == null
7982
for (Tuple tuple : tupleList) {
80-
Paas paas = Configurator.getInstance().getRemoteList().get();
83+
Paas paas = configurator.getRemoteList().get();
8184
for (Client client : tuple.getClients()) {
8285
if (client.getPaas() == null) {
8386
client.setPaas(paas);
@@ -96,13 +99,30 @@ public static void main(String[] args) {
9699
logger.error("Error [Missing Argument]: Use java -jar KITE.jar <absolute path/config.json>");
97100
return;
98101
}
99-
100-
buildConfig(args[0]);
101-
102-
for (TestConfig testConfig : Configurator.getInstance().getConfigHandler().getTestList()) {
102+
Configurator configurator = new Configurator();
103+
buildConfig(configurator, args[0]);
104+
105+
106+
for (TestConfig testConfig : configurator.getConfigHandler().getTestList()) {
107+
List<Tuple> tupleList = new ArrayList<>();
108+
List<List<Integer>> matrix = testConfig.getMatrix();
109+
if (matrix != null && !matrix.isEmpty()) {
110+
for (List<Integer> indexList: matrix ) {
111+
Tuple tuple = new Tuple();
112+
for (int index: indexList) {
113+
tuple.add(configurator.getConfigHandler().getClientList().get(index));
114+
}
115+
tupleList.add(tuple);
116+
}
117+
} else {
118+
tupleList = configurator
119+
.buildTuples(testConfig.getTupleSize(), testConfig.isPermute(), testConfig.isRegression());
120+
}
121+
distributeRemote(configurator, tupleList);
122+
testConfig.setReportPath(configurator.getReportPath());
103123
ExecutorService service = Executors.newSingleThreadExecutor();
104124
try {
105-
runInterop(service, testConfig);
125+
runInterop(service, configurator.getName(), testConfig, tupleList);
106126
} catch (Exception e) {
107127
e.printStackTrace();
108128
} finally {
@@ -111,17 +131,10 @@ public static void main(String[] args) {
111131
}
112132
}
113133

114-
public static List<Future<Object>> runInterop(ExecutorService service, TestConfig testConfig) throws ExecutionException, InterruptedException {
115-
if (service == null) {
116-
service = Executors.newSingleThreadExecutor();
117-
}
118-
List<Tuple> tupleList = Configurator.getInstance()
119-
.buildTuples(testConfig.getTupleSize(), testConfig.isPermute(), testConfig.isRegression());
120-
distributeRemote(tupleList);
121-
return runInterop(service, testConfig, tupleList);
122-
}
123134

124-
public static List<Future<Object>> runInterop(ExecutorService service, TestConfig testConfig, List<Tuple> tupleList) throws ExecutionException, InterruptedException {
125-
return service.submit(new TestRunThread(testConfig, tupleList)).get();
135+
public static List<Future<Object>> runInterop(ExecutorService service, String testSuiteName, TestConfig testConfig, List<Tuple> tupleList) throws ExecutionException, InterruptedException {
136+
TestRunThread runThread = new TestRunThread(testConfig, tupleList);
137+
runThread.setName(testSuiteName);
138+
return service.submit(runThread).get();
126139
}
127140
}

KITE-Engine/src/main/java/org/webrtc/kite/MatrixRunner.java

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616

1717
package org.webrtc.kite;
1818

19-
import io.cosmosoftware.kite.manager.RoomManager;
2019
import io.cosmosoftware.kite.report.Container;
2120
import io.cosmosoftware.kite.report.KiteLogger;
22-
import io.cosmosoftware.kite.report.Reporter;
2321
import org.webrtc.kite.config.test.TestConfig;
2422
import org.webrtc.kite.config.test.Tuple;
2523

@@ -36,31 +34,35 @@
3634
* A class to manage the asynchronous execution of TestManager objects.
3735
*/
3836
public class MatrixRunner {
39-
37+
4038
private final KiteLogger logger = KiteLogger.getLogger(MatrixRunner.class.getName());
4139
private final TestConfig testConfig;
4240
private boolean interrupted;
4341
private ExecutorService multiExecutorService;
4442
private List<Tuple> tupleList = new ArrayList<>();
45-
43+
Container testSuite;
44+
4645
/**
4746
* Constructs a new MatrixRunner with the given TestConfig and List<Tuple>.
4847
*
4948
* @param testConfig TestConfig
5049
* @param listOfTuples a list of tuples (containing 1 or multiples kite config objects).
5150
*/
52-
public MatrixRunner(TestConfig testConfig, List<Tuple> listOfTuples) {
51+
public MatrixRunner(TestConfig testConfig, List<Tuple> listOfTuples, String parentSuiteName) {
5352
this.testConfig = testConfig;
5453
this.tupleList.addAll(listOfTuples);
54+
testSuite = new Container(testConfig.getName());
55+
testSuite.setParentSuite(parentSuiteName);
56+
testSuite.setReporter(testConfig.getReporter());
57+
5558
}
56-
59+
5760
/**
5861
* Returns a sublist of the given futureList exclusive of the type of objects specified by the
5962
* objectClass.
6063
*
6164
* @param futureList List of Future<Object>
6265
* @param objectClass The class for the undesired required object.
63-
*
6466
* @return A sublist of the given futureList exclusive of the type of objects specified by the
6567
* objectClass.
6668
*/
@@ -79,13 +81,12 @@ private List<Future<Object>> getExclusiveSubList(List<Future<Object>> futureList
7981
}
8082
return listOfFutureObjects;
8183
}
82-
84+
8385
/**
8486
* Returns a sublist from the given list of the type of objects specified by the objectClass.
8587
*
8688
* @param futureList List of Future<Object>
8789
* @param objectClass The class for the desired required object list.
88-
*
8990
* @return A sublist from the given list of the type of objects specified by the objectClass.
9091
*/
9192
private List<?> getSubList(List<Future<Object>> futureList, Class<?> objectClass) {
@@ -102,34 +103,31 @@ private List<?> getSubList(List<Future<Object>> futureList, Class<?> objectClass
102103
}
103104
return listOfObject;
104105
}
105-
106+
106107
/**
107108
* Interrupt.
108109
*/
109110
public void interrupt() {
110111
this.interrupted = true;
111112
this.shutdownExecutors();
112113
}
113-
114+
114115
/**
115116
* Executes the test contained inside the TestManager for the provided matrix.
116117
*
117118
* @return List<Future < Object>>
118119
*/
119120
public List<Future<Object>> run() {
120-
Container testSuite = new Container(testConfig.getName());
121-
122121
int totalTestCases = this.tupleList.size();
123122
if (totalTestCases < 1) {
124123
return null;
125124
}
126-
125+
127126
List<TestManager> testManagerList = new ArrayList<>();
128127
List<Future<Object>> futureList = new ArrayList<>();
129-
RoomManager.init();
130128
this.multiExecutorService =
131-
Executors.newFixedThreadPool(this.testConfig.getNoOfThreads());
132-
129+
Executors.newFixedThreadPool(this.testConfig.getNoOfThreads());
130+
133131
logger.info("Executing " + this.testConfig + " for " + totalTestCases + " browser tuples with size :" + tupleList.get(0).size());
134132
try {
135133
for (int index = 0; index < this.tupleList.size(); index++) {
@@ -140,27 +138,27 @@ public List<Future<Object>> run() {
140138
}
141139
testManagerList.add(manager);
142140
}
143-
141+
144142
List<Future<Object>> tempFutureList;
145143
while (testManagerList.size() > 0) {
146144
tempFutureList = multiExecutorService.invokeAll(testManagerList);
147145
testManagerList = (List<TestManager>) this.getSubList(tempFutureList, TestManager.class);
148146
futureList.addAll(this.getExclusiveSubList(tempFutureList, TestManager.class));
149147
}
150-
148+
151149
testManagerList.clear();
152-
150+
153151
} catch (Exception e) {
154152
logger.error(getStackTrace(e));
155153
} finally {
156154
testSuite.setStopTimestamp();
157-
Reporter.getInstance().generateReportFiles();
155+
testConfig.getReporter().generateReportFiles();
158156
this.shutdownExecutors();
159157
}
160-
158+
161159
return futureList;
162160
}
163-
161+
164162
/**
165163
* Shutdown executors.
166164
*/
@@ -170,5 +168,5 @@ synchronized private void shutdownExecutors() {
170168
this.multiExecutorService = null;
171169
}
172170
}
173-
171+
174172
}

0 commit comments

Comments
 (0)