Commit b732a00a authored by Salva5297's avatar Salva5297

Solved Themis and OOPS

parent d6228900
......@@ -140,15 +140,15 @@ public class Clause_9_5_Checker extends AbstractClauseChecker {
OkHttpClient httpClient = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
String jsonRequest = "{\"ontologiesCode\":[\""
+ versionRDFXML.toString().replace("\\\"", "\\\\\"").replace("\"", "\\\"").replace("\t", " ")
+ "\"]," + "\"testfile\":[\"" + requirementsRDFXML.toString().replace("\\\"", "\\\\\"")
.replace("\"", "\\\"").replace("\t", " ")
+ versionRDFXML.toString().replaceAll("\\\"", "\\\\\"").replaceAll("\"", "\\\"").replaceAll("\t", " ")
+ "\"]," + "\"testfile\":[\"" + requirementsRDFXML.toString().replaceAll("\\\"", "\\\\\"")
.replaceAll("\"", "\\\"").replaceAll("\t", " ")
+ "\"]," + "\"format\":\"junit\"}";
RequestBody body = RequestBody.create(jsonRequest, mediaType);
Request request = new Request.Builder().url("http://themis.linkeddata.es/rest/api/results").method("POST", body)
.addHeader("accept", "application/json").addHeader("Content-Type", "application/json").build();
try {
Response response = httpClient.newCall(request).execute();
if (response.code() != 200) {
......@@ -163,12 +163,13 @@ public class Clause_9_5_Checker extends AbstractClauseChecker {
org.w3c.dom.Node node = nodeList.item(temp);
if (node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) {
Element element = (Element) node;
String id = element.getAttributeNode("id").toString();
String name = element.getAttributeNode("name").toString();
String message = ((Element) node).getElementsByTagName("error").item(0).getAttributes()
.getNamedItem("message").toString();
String themisError = String.format("%s, %s, %s", id, name, message);
themisErrors.add(themisError);
if (((Element) node).getElementsByTagName("error").item(0) != null) {
String id = element.getAttributeNode("id").toString();
String name = element.getAttributeNode("name").toString();
String message = ((Element) node).getElementsByTagName("error").item(0).getAttributes().getNamedItem("message").toString();
String themisError = String.format("%s, %s, %s", id, name, message);
themisErrors.add(themisError);
}
}
}
if (!themisErrors.isEmpty()) {
......
missing=The `tests` directory should contain a file `tests.csv`. This file shall conform to the requirements specification as defined in clause 9.5.2 in TS 103 673.
line=The `tests` specification shall be a CSV (Comma-Separated Values) file encoded in UTF-8. The first line of the file shall be the following: `Id;Requirement;Category;Test`
ioexception=Error while checking the `tests` directory
themis=OOPS found some problems. Violations are: %s
themis=Themis found some problems. Violations are: %s
themisError=Themis error. The service may be under maintenance.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment