cleanups of AutobahnTests

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2020-11-10 11:23:13 +11:00
parent 6ba1ac55b7
commit ab8b4c3427
1 changed files with 5 additions and 19 deletions

View File

@ -74,11 +74,6 @@ public class AutobahnTests
@BeforeAll @BeforeAll
public static void before() throws Exception public static void before() throws Exception
{ {
String workspace;
workspace = System.getenv().get("WORKSPACE");
LOG.info("Workspace: {}", workspace);
LOG.info("User Dir: {}", USER_DIR);
fuzzingServer = USER_DIR.resolve("fuzzingserver.json"); fuzzingServer = USER_DIR.resolve("fuzzingserver.json");
assertTrue(Files.exists(fuzzingServer), fuzzingServer + " not exists"); assertTrue(Files.exists(fuzzingServer), fuzzingServer + " not exists");
@ -310,11 +305,9 @@ public class AutobahnTests
{ {
JSONObject object = (JSONObject)parser.parse(reader); JSONObject object = (JSONObject)parser.parse(reader);
JSONObject agent = (JSONObject)object.values().iterator().next(); JSONObject agent = (JSONObject)object.values().iterator().next();
if (agent == null) if (agent == null)
{ throw new Exception("no agent");
return null;
}
for (Object cases : agent.keySet()) for (Object cases : agent.keySet())
{ {
JSONObject c = (JSONObject)agent.get(cases); JSONObject c = (JSONObject)agent.get(cases);
@ -323,15 +316,7 @@ public class AutobahnTests
Number duration = (Number)c.get("duration"); Number duration = (Number)c.get("duration");
Number remoteCloseCode = (Number)c.get("remoteCloseCode"); Number remoteCloseCode = (Number)c.get("remoteCloseCode");
Long code; Long code = (remoteCloseCode == null) ? null : remoteCloseCode.longValue();
if (remoteCloseCode == null)
{
code = null;
}
else
{
code = remoteCloseCode.longValue();
}
String reportfile = (String)c.get("reportfile"); String reportfile = (String)c.get("reportfile");
AutobahnCaseResult result = new AutobahnCaseResult(cases.toString(), AutobahnCaseResult result = new AutobahnCaseResult(cases.toString(),
AutobahnCaseResult.Behavior.parse(behavior), AutobahnCaseResult.Behavior.parse(behavior),
@ -372,8 +357,9 @@ public class AutobahnTests
return WRONG_CODE; return WRONG_CODE;
case "FAILED BY CLIENT": case "FAILED BY CLIENT":
return FAILED_BY_CLIENT; return FAILED_BY_CLIENT;
default:
return valueOf(value);
} }
return valueOf(value);
} }
} }