Skip to content

Commit 9c233c9

Browse files
committed
Autobahntestsuite evaluation
1 parent e91a0ea commit 9c233c9

File tree

2 files changed

+168
-0
lines changed

2 files changed

+168
-0
lines changed

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@
8282
<version>4.11</version>
8383
<scope>test</scope>
8484
</dependency>
85+
<dependency>
86+
<groupId>org.json</groupId>
87+
<artifactId>json</artifactId>
88+
<version>20171018</version>
89+
<scope>test</scope>
90+
</dependency>
8591
</dependencies>
8692
<developers>
8793
<developer>
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
/*
2+
* Copyright (c) 2010-2017 Nathan Rajlich
3+
*
4+
* Permission is hereby granted, free of charge, to any person
5+
* obtaining a copy of this software and associated documentation
6+
* files (the "Software"), to deal in the Software without
7+
* restriction, including without limitation the rights to use,
8+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
* copies of the Software, and to permit persons to whom the
10+
* Software is furnished to do so, subject to the following
11+
* conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be
14+
* included in all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23+
* OTHER DEALINGS IN THE SOFTWARE.
24+
*/
25+
26+
package org.java_websocket.autobahn;
27+
28+
import org.json.JSONObject;
29+
import org.junit.Assume;
30+
import org.junit.BeforeClass;
31+
import org.junit.Test;
32+
33+
import java.io.File;
34+
import java.io.FileNotFoundException;
35+
import java.util.Scanner;
36+
37+
import static org.junit.Assert.assertEquals;
38+
import static org.junit.Assert.assertTrue;
39+
40+
public class AutobahnServerResults {
41+
42+
static JSONObject jsonObject = null;
43+
44+
@BeforeClass
45+
public static void getJSONObject() throws FileNotFoundException {
46+
File file = new File( "reports/servers/index.json" );
47+
//File file = new File( "C:\\Python27\\Scripts\\reports\\servers\\index.json" );
48+
if( file.exists() ) {
49+
String content = new Scanner( file ).useDelimiter("\\Z").next();
50+
jsonObject = new JSONObject( content );
51+
jsonObject = jsonObject.getJSONObject( "TooTallNate Java-WebSocket" );
52+
}
53+
Assume.assumeTrue( jsonObject != null );
54+
}
55+
56+
@Test
57+
public void test1_1_1() {
58+
JSONObject testResult = jsonObject.getJSONObject( "1.1.1" );
59+
assertEquals("OK", testResult.get( "behavior" ));
60+
assertEquals("OK", testResult.get( "behaviorClose" ));
61+
assertTrue(testResult.getInt( "duration" ) < 10);
62+
}
63+
@Test
64+
public void test1_1_2() {
65+
JSONObject testResult = jsonObject.getJSONObject( "1.1.2" );
66+
assertEquals("OK", testResult.get( "behavior" ));
67+
assertEquals("OK", testResult.get( "behaviorClose" ));
68+
assertTrue(testResult.getInt( "duration" ) < 10);
69+
}
70+
@Test
71+
public void test1_1_3() {
72+
JSONObject testResult = jsonObject.getJSONObject( "1.1.3" );
73+
assertEquals("OK", testResult.get( "behavior" ));
74+
assertEquals("OK", testResult.get( "behaviorClose" ));
75+
assertTrue(testResult.getInt( "duration" ) < 10);
76+
}
77+
@Test
78+
public void test1_1_4() {
79+
JSONObject testResult = jsonObject.getJSONObject( "1.1.4" );
80+
assertEquals("OK", testResult.get( "behavior" ));
81+
assertEquals("OK", testResult.get( "behaviorClose" ));
82+
assertTrue(testResult.getInt( "duration" ) < 10);
83+
}
84+
@Test
85+
public void test1_1_5() {
86+
JSONObject testResult = jsonObject.getJSONObject( "1.1.5" );
87+
assertEquals("OK", testResult.get( "behavior" ));
88+
assertEquals("OK", testResult.get( "behaviorClose" ));
89+
assertTrue(testResult.getInt( "duration" ) < 10);
90+
}
91+
@Test
92+
public void test1_1_6() {
93+
JSONObject testResult = jsonObject.getJSONObject( "1.1.6" );
94+
assertEquals("OK", testResult.get( "behavior" ));
95+
assertEquals("OK", testResult.get( "behaviorClose" ));
96+
assertTrue(testResult.getInt( "duration" ) < 30);
97+
}
98+
@Test
99+
public void test1_1_7() {
100+
JSONObject testResult = jsonObject.getJSONObject( "1.1.7" );
101+
assertEquals("OK", testResult.get( "behavior" ));
102+
assertEquals("OK", testResult.get( "behaviorClose" ));
103+
assertTrue(testResult.getInt( "duration" ) < 20);
104+
}
105+
@Test
106+
public void test1_1_8() {
107+
JSONObject testResult = jsonObject.getJSONObject( "1.1.8" );
108+
assertEquals("OK", testResult.get( "behavior" ));
109+
assertEquals("OK", testResult.get( "behaviorClose" ));
110+
assertTrue(testResult.getInt( "duration" ) < 30);
111+
}
112+
113+
@Test
114+
public void test1_2_1() {
115+
JSONObject testResult = jsonObject.getJSONObject( "1.2.1" );
116+
assertEquals("OK", testResult.get( "behavior" ));
117+
assertEquals("OK", testResult.get( "behaviorClose" ));
118+
assertTrue(testResult.getInt( "duration" ) < 10);
119+
}
120+
@Test
121+
public void test1_2_2() {
122+
JSONObject testResult = jsonObject.getJSONObject( "1.2.2" );
123+
assertEquals("OK", testResult.get( "behavior" ));
124+
assertEquals("OK", testResult.get( "behaviorClose" ));
125+
assertTrue(testResult.getInt( "duration" ) < 10);
126+
}
127+
@Test
128+
public void test1_2_3() {
129+
JSONObject testResult = jsonObject.getJSONObject( "1.2.3" );
130+
assertEquals("OK", testResult.get( "behavior" ));
131+
assertEquals("OK", testResult.get( "behaviorClose" ));
132+
assertTrue(testResult.getInt( "duration" ) < 10);
133+
}
134+
@Test
135+
public void test1_2_4() {
136+
JSONObject testResult = jsonObject.getJSONObject( "1.2.4" );
137+
assertEquals("OK", testResult.get( "behavior" ));
138+
assertEquals("OK", testResult.get( "behaviorClose" ));
139+
assertTrue(testResult.getInt( "duration" ) < 10);
140+
}
141+
@Test
142+
public void test1_2_5() {
143+
JSONObject testResult = jsonObject.getJSONObject( "1.2.5" );
144+
assertEquals("OK", testResult.get( "behavior" ));
145+
assertEquals("OK", testResult.get( "behaviorClose" ));
146+
assertTrue(testResult.getInt( "duration" ) < 10);
147+
}
148+
@Test
149+
public void test1_2_6() {
150+
JSONObject testResult = jsonObject.getJSONObject( "1.2.6" );
151+
assertEquals("OK", testResult.get( "behavior" ));
152+
assertEquals("OK", testResult.get( "behaviorClose" ));
153+
assertTrue(testResult.getInt( "duration" ) < 70);
154+
}
155+
@Test
156+
public void test1_2_8() {
157+
JSONObject testResult = jsonObject.getJSONObject( "1.2.8" );
158+
assertEquals("OK", testResult.get( "behavior" ));
159+
assertEquals("OK", testResult.get( "behaviorClose" ));
160+
assertTrue(testResult.getInt( "duration" ) < 60);
161+
}
162+
}

0 commit comments

Comments
 (0)