diff --git a/pom.xml b/pom.xml index 68a6db0..d1d6c08 100644 --- a/pom.xml +++ b/pom.xml @@ -41,6 +41,11 @@ spring-boot-starter-tomcat provided + + javax.xml.bind + jaxb-api + 2.3.1 + diff --git a/src/main/java/com/essi/dependency/components/Bug.java b/src/main/java/com/essi/dependency/components/Bug.java index 3cf92c4..b7d5efe 100644 --- a/src/main/java/com/essi/dependency/components/Bug.java +++ b/src/main/java/com/essi/dependency/components/Bug.java @@ -28,12 +28,6 @@ public Bug(String id, String summary, String description, List comments) this.comments = comments; } - public Bug(List components) { - this.id = components.get(0); - this.summary = components.get(1); - this.description = components.get(2); - } - public String getId() { return id; } @@ -46,26 +40,10 @@ public String getDescription() { return description; } - public void setSummary(String summary) { - this.summary = summary; - } - - public void setDescription(String description) { - this.description = description; - } - - public void setId(String id) { - this.id = id; - } - public List getComments() { return comments; } - public void setComments(List comments) { - this.comments = comments; - } - @Override public String toString() { return "Bug [id=" + id + ",\n summary=" + summary + ",\n description=" + description diff --git a/src/main/java/com/essi/dependency/components/Clause.java b/src/main/java/com/essi/dependency/components/Clause.java index b0e8b3b..6016c7a 100644 --- a/src/main/java/com/essi/dependency/components/Clause.java +++ b/src/main/java/com/essi/dependency/components/Clause.java @@ -32,18 +32,6 @@ public Clause(String doc, String vol, String part, String sect, String subsect, this.id = id; } - public Clause(List components) { - this.id = Integer.parseInt(components.get(0)); - this.clauseString = components.get(1); - this.doc = components.get(2); - this.vol = components.get(3); - this.part = components.get(4); - this.sect = components.get(5); - this.subsect = components.get(6); - this.parag = components.get(7); - this.subparg = components.get(8); - } - @ApiModelProperty(value = "Document") public String getDoc() { return doc; diff --git a/src/main/java/com/essi/dependency/components/DependencyType.java b/src/main/java/com/essi/dependency/components/DependencyType.java index 54eab43..375a704 100644 --- a/src/main/java/com/essi/dependency/components/DependencyType.java +++ b/src/main/java/com/essi/dependency/components/DependencyType.java @@ -16,35 +16,4 @@ public enum DependencyType { CROSS_REFERENCE, @JsonProperty("external-cross-reference") EXTERNAL_CROSS_REFERENCE; - public DependencyType find(String elem) { - switch (elem.toUpperCase()) { - case "CONTRIBUTES": - return DependencyType.CONTRIBUTES; - case "DAMAGES": - return DependencyType.DAMAGES; - case "REFINES": - return DependencyType.REFINES; - case "REQUIRES": - return DependencyType.REQUIRES; - case "INCOMPATIBLE": - return DependencyType.INCOMPATIBLE; - case "DECOMPOSITION": - return DependencyType.DECOMPOSITION; - case "SIMILAR": - return DependencyType.SIMILAR; - case "DUPLICATES": - return DependencyType.DUPLICATES; - case "REPLACES": - return DependencyType.REPLACES; - case "CROSS_REFERENCE": - return DependencyType.CROSS_REFERENCE; - case "EXTERNAL_CROSS_REFERENCE": - return DependencyType.EXTERNAL_CROSS_REFERENCE; - default: - //error - break; - } - return null; - } - } diff --git a/src/main/java/com/essi/dependency/components/ExternalDependency.java b/src/main/java/com/essi/dependency/components/ExternalDependency.java deleted file mode 100644 index 96db9d9..0000000 --- a/src/main/java/com/essi/dependency/components/ExternalDependency.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.essi.dependency.components; - -public class ExternalDependency { - - private String externalDependencyKey; - private Object requirement; - - public ExternalDependency(String externalDependency, Object requirmenet) { - super(); - this.externalDependencyKey = externalDependency; - this.requirement = requirmenet; - } - - public String getExternalDependency() { - return externalDependencyKey; - } - - public int referenceId() { - return ((Clause) requirement).getId(); - } - - public Object getRequirement() { - return requirement; - } - - public void setRequirement(Object requirement) { - this.requirement = requirement; - } - - @Override - public String toString() { - return ((Clause) requirement).getId() + ", External-Dependency=" + ((Clause) requirement).getClauseString(); - } - -} diff --git a/src/main/java/com/essi/dependency/controller/Controller.java b/src/main/java/com/essi/dependency/controller/Controller.java index 4f9320e..e8ff7f6 100644 --- a/src/main/java/com/essi/dependency/controller/Controller.java +++ b/src/main/java/com/essi/dependency/controller/Controller.java @@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest; import com.essi.dependency.functionalities.JSONHandler; +import com.essi.dependency.service.StorageException; import com.essi.dependency.util.Control; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -111,14 +112,9 @@ public ResponseEntity crossReferenceDetector( objN = jh.storeDependencies("", dependencies); node = jh.storeRequirements(objN, clauseList); node = jh.createProject(node, clauseList); - } catch (FileFormatException e) { + } catch (StorageException | FileFormatException e) { // show the error with an entity format. - LinkedHashMap result = new LinkedHashMap<>(); - result.put("status", "500"); - result.put("error", "Internal Server Error"); - result.put("exception", e.toString()); - result.put("message", "The format file must be htm or html."); - return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); + return createException(500,"Internal Server Error",e.toString(),"The format file must be htm or html."); } // Delete the input data file and folder. @@ -200,33 +196,13 @@ public ResponseEntity crossReferenceDetector( objN = jh.storeRequirements(objN, clauseList); objN = jh.createProject(objN, clauseList); } catch (FileFormatException e) { - LinkedHashMap result = new LinkedHashMap<>(); - result.put("status", "500"); - result.put("error", "Internal Server Error"); - result.put("exception", e.toString()); - result.put("message", "The format file must be htm or html."); - return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); + return createException(500,"Internal Server Error",e.toString(),"The format file must be htm or html."); } catch (IndexOutOfBoundsException e) { - LinkedHashMap result = new LinkedHashMap<>(); - result.put("status", "500"); - result.put("error", "Internal Server Error"); - result.put("exception", e.toString()); - result.put("message", "Index exceeds the bounds."); - return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); + return createException(500,"Internal Server Error",e.toString(),"Index exceeds the bounds."); } catch (NumberFormatException e) { - LinkedHashMap result = new LinkedHashMap<>(); - result.put("status", "500"); - result.put("error", "Internal Server Error"); - result.put("exception", e.toString()); - result.put("message", "The parameters 'n' and 'm' must be Integers."); - return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); + return createException(500,"Internal Server Error",e.toString(),"The parameters 'n' and 'm' must be Integers."); } catch (IllegalArgumentException e) { - LinkedHashMap result = new LinkedHashMap<>(); - result.put("status", "500"); - result.put("error", "Internal Server Error"); - result.put("exception", e.toString()); - result.put("message", "The parameter 'n' must be bigger than 0 and lower than 'm' ( 0 < n < m )."); - return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); + return createException(500,"Internal Server Error",e.toString(),"The parameter 'n' must be bigger than 0 and lower than 'm' ( 0 < n < m )."); } return new ResponseEntity<>(objN, HttpStatus.OK); } @@ -278,13 +254,7 @@ public ResponseEntity crossReferenceDetectorJson( List> clauseList = jh.readRequirement(depService.getJson(), projectId); depService.storeClauseList(clauseList); } catch (Exception e) { - Control.getInstance().showErrorMessage(e.getMessage()); - LinkedHashMap result = new LinkedHashMap<>(); - result.put("status", "500"); - result.put("error", "Internal Server Error"); - result.put("exception", e.toString()); - result.put("message", ""); - return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); + return createException(500,"Internal Server Error",e.toString(),""); } @@ -354,12 +324,7 @@ public ResponseEntity crossReferenceDetectorJson( List> clauseList = jh.readRequirement(depService.getJson(), projectId); depService.storeClauseList(clauseList); } catch (Exception e) { - LinkedHashMap result = new LinkedHashMap<>(); - result.put("status", "500"); - result.put("error", "Internal Server Error"); - result.put("exception", e.toString()); - result.put("message", ""); - return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); + return createException(500,"Internal Server Error",e.toString(),""); } @@ -376,4 +341,13 @@ public ResponseEntity handleStorageFileNotFound(StorageFileNotFoundException return ResponseEntity.notFound().build(); } + private ResponseEntity createException(int status, String error, String exception, String message) { + LinkedHashMap result = new LinkedHashMap<>(); + result.put("status", status+""); + result.put("error", error); + result.put("exception", exception); + result.put("message", message); + return new ResponseEntity<>(result, HttpStatus.valueOf(status)); + } + } diff --git a/src/main/java/com/essi/dependency/functionalities/ClauseExtraction.java b/src/main/java/com/essi/dependency/functionalities/ClauseExtraction.java index 29805f5..8120331 100644 --- a/src/main/java/com/essi/dependency/functionalities/ClauseExtraction.java +++ b/src/main/java/com/essi/dependency/functionalities/ClauseExtraction.java @@ -266,42 +266,4 @@ private void extractClauses(List clauseList, String line, String doc, St } } } - - /** - * Write the expressions (clauses, bugs) into an external document. - * - * @param filename - * @param printID - * @throws IOException - */ - public void writeClauses(String filename, Boolean printID) throws IOException { - try(BufferedWriter outputWriter = new BufferedWriter(new FileWriter(filename))) { - for (Object c : clauseList) { - if (printID) { - outputWriter.write(((Clause) c).getId() + "- "); - } - outputWriter.write(((Clause) c).printMe()); - outputWriter.write("\n"); - outputWriter.newLine(); - } - outputWriter.flush(); - } - } - - /** - * Write all list into an external document. - * - * @param filename - * @param list - * @throws IOException - */ - public void writeList(String filename, List list) throws IOException { - try(BufferedWriter outputWriter = new BufferedWriter(new FileWriter(filename))) { - for (T object : list) { - outputWriter.write(object.toString()); - outputWriter.newLine(); - } - outputWriter.flush(); - } - } } diff --git a/src/main/java/com/essi/dependency/functionalities/Grammar.java b/src/main/java/com/essi/dependency/functionalities/Grammar.java index 486db93..6e14af3 100644 --- a/src/main/java/com/essi/dependency/functionalities/Grammar.java +++ b/src/main/java/com/essi/dependency/functionalities/Grammar.java @@ -212,7 +212,7 @@ public List applyGrammar(com.essi.dependency.components.Grammar grammarO dep = (ArrayList) task.get(30, TimeUnit.SECONDS); } catch (Exception e) { - Control.getInstance().showErrorMessage("[EXCEPTION] " + e + ": " + ((Bug) expression).toString()); + Control.getInstance().showErrorMessage("[EXCEPTION] " + e.getMessage()); } executor.shutdown(); @@ -488,7 +488,7 @@ public List resolvingCrossReference(Clause clause, Matcher matcher, List } else if (terms[i + 1].matches(markerTerm)) { tmpNextTerm = terms[i + 2].replaceAll("\\(|\\)", ""); } - if (tmpNextTerm.matches("\\d+(\\.\\d(\\.)?)*")) { + if (tmpNextTerm.matches("\\d+(\\.\\d(\\.)?)*") && currentLoc!=-1) { String tail = ""; String head = ""; String point = ""; diff --git a/src/main/java/com/essi/dependency/service/DependencyService.java b/src/main/java/com/essi/dependency/service/DependencyService.java index e145ee9..d26d9ec 100644 --- a/src/main/java/com/essi/dependency/service/DependencyService.java +++ b/src/main/java/com/essi/dependency/service/DependencyService.java @@ -55,14 +55,6 @@ public String getJson() { return json; } - public String getFilename() { - return this.filename; - } - - public String getFilenamePath() { - return load(this.filename).toString(); - } - /** * Store requirements into the list * @param clauseList @@ -95,7 +87,7 @@ public void storeClauseList(List> clauseList) { * * @param file */ - public void store(MultipartFile file) { + public void store(MultipartFile file) throws StorageException { this.filename = StringUtils.cleanPath(file.getOriginalFilename()); try { if (file.isEmpty()) { diff --git a/src/main/java/com/essi/dependency/service/FileFormatException.java b/src/main/java/com/essi/dependency/service/FileFormatException.java index b8386a7..9cac0ad 100644 --- a/src/main/java/com/essi/dependency/service/FileFormatException.java +++ b/src/main/java/com/essi/dependency/service/FileFormatException.java @@ -6,20 +6,4 @@ public FileFormatException() { super(); } - public FileFormatException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } - - public FileFormatException(String message, Throwable cause) { - super(message, cause); - } - - public FileFormatException(String message) { - super(message); - } - - public FileFormatException(Throwable cause) { - super(cause); - } - } diff --git a/src/test/java/com/essi/Dependency/AppTest.java b/src/test/java/com/essi/Dependency/AppTest.java index 5355c5a..aba620e 100644 --- a/src/test/java/com/essi/Dependency/AppTest.java +++ b/src/test/java/com/essi/Dependency/AppTest.java @@ -21,7 +21,7 @@ import java.io.BufferedReader; import java.io.FileReader; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -48,7 +48,7 @@ public void crossReferenceJSONProject() throws Exception { .content(read_file(path+"sample-1.json"))) .andDo(print()).andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); JSONObject result = new JSONObject(response); - Assert.assertEquals(1, result.getJSONArray("dependencies").length()); + Assert.assertEquals(2, result.getJSONArray("dependencies").length()); } @Test @@ -60,7 +60,7 @@ public void crossReferenceJSONProjectNM() throws Exception { .content(read_file(path+"sample-1.json"))) .andDo(print()).andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); JSONObject result = new JSONObject(response); - Assert.assertEquals(1, result.getJSONArray("dependencies").length()); + Assert.assertEquals(2, result.getJSONArray("dependencies").length()); } @Test @@ -75,7 +75,92 @@ public void crossReferenceHTMLProject() throws Exception { String response = this.mockMvc.perform(builder).andExpect(status().isOk()) .andDo(MockMvcResultHandlers.print()).andReturn().getResponse().getContentAsString();; JSONObject result = new JSONObject(response); - Assert.assertEquals(1, result.getJSONArray("dependencies").length()); + Assert.assertEquals(21, result.getJSONArray("dependencies").length()); + } + + @Test + public void crossReferenceHTMLProjectComplex() throws Exception { + MockMultipartFile mockMultipartFile = new MockMultipartFile("file","complex.html", + "text/html", read_html_file(path+"complex.html").getBytes()); + + MockHttpServletRequestBuilder builder = + MockMvcRequestBuilders.fileUpload("/upc/cross-reference-detection/file") + .file(mockMultipartFile); + + String response = this.mockMvc.perform(builder).andExpect(status().isOk()) + .andDo(MockMvcResultHandlers.print()).andReturn().getResponse().getContentAsString();; + JSONObject result = new JSONObject(response); + Assert.assertEquals(4, result.getJSONArray("dependencies").length()); + } + + @Test + public void crossReferenceHTMLProjectExternal() throws Exception { + MockMultipartFile mockMultipartFile = new MockMultipartFile("file","external.html", + "text/html", read_html_file(path+"external.html").getBytes()); + + MockHttpServletRequestBuilder builder = + MockMvcRequestBuilders.fileUpload("/upc/cross-reference-detection/file") + .file(mockMultipartFile); + + String response = this.mockMvc.perform(builder).andExpect(status().isOk()) + .andDo(MockMvcResultHandlers.print()).andReturn().getResponse().getContentAsString();; + JSONObject result = new JSONObject(response); + Assert.assertEquals(4, result.getJSONArray("dependencies").length()); + } + + + @Test + public void crossReferenceHTMLProjectWithGrammar() throws Exception { + this.mockMvc.perform( + post("/upc/cross-reference-detection/reqPrefix?company=upc_new") + .contentType(MediaType.APPLICATION_JSON) + .content(read_file(path+"prefixes.json"))) + .andDo(print()).andExpect(status().isOk()); + MockMultipartFile mockMultipartFile = new MockMultipartFile("file","sample-2.html", + "text/html", read_html_file(path+"sample-2.html").getBytes()); + + MockHttpServletRequestBuilder builder = + MockMvcRequestBuilders.fileUpload("/upc/cross-reference-detection/file?company=upc_new") + .file(mockMultipartFile); + + String response = this.mockMvc.perform(builder).andExpect(status().isOk()) + .andDo(MockMvcResultHandlers.print()).andReturn().getResponse().getContentAsString();; + JSONObject result = new JSONObject(response); + Assert.assertEquals(21, result.getJSONArray("dependencies").length()); + this.mockMvc.perform( + delete("/upc/cross-reference-detection/reqPrefix?company=upc_new")) + .andDo(print()).andExpect(status().isOk()); + } + + + @Test + public void crossReferenceHTMLProjectException() throws Exception { + MockMultipartFile mockMultipartFile = new MockMultipartFile("file","aux_exception.txt", + "text/html", read_html_file(path+"aux_exception.txt").getBytes()); + + MockHttpServletRequestBuilder builder = + MockMvcRequestBuilders.fileUpload("/upc/cross-reference-detection/file") + .file(mockMultipartFile); + + this.mockMvc.perform(builder).andExpect(status().isInternalServerError()); + + mockMultipartFile = new MockMultipartFile("file","empty_file.html", + "text/html", read_html_file(path+"empty_file.html").getBytes()); + + builder = + MockMvcRequestBuilders.fileUpload("/upc/cross-reference-detection/file") + .file(mockMultipartFile); + + this.mockMvc.perform(builder).andExpect(status().isInternalServerError()); + + mockMultipartFile = new MockMultipartFile("file","../aux_exception.html", + "text/html", read_html_file(path+"../aux_exception.html").getBytes()); + + builder = + MockMvcRequestBuilders.fileUpload("/upc/cross-reference-detection/file") + .file(mockMultipartFile); + + this.mockMvc.perform(builder).andExpect(status().isInternalServerError()); } @Test @@ -88,9 +173,100 @@ public void crossReferenceHTMLProjectNM() throws Exception { .file(mockMultipartFile); String response = this.mockMvc.perform(builder).andExpect(status().isOk()) - .andDo(MockMvcResultHandlers.print()).andReturn().getResponse().getContentAsString();; + .andDo(MockMvcResultHandlers.print()).andReturn().getResponse().getContentAsString(); + JSONObject result = new JSONObject(response); + Assert.assertEquals(4, result.getJSONArray("dependencies").length()); + } + + @Test + public void crossReferenceHTMLProjectNMException() throws Exception { + MockMultipartFile mockMultipartFile = new MockMultipartFile("file","aux_exception.txt", + "text/html", read_html_file(path+"aux_exception.txt").getBytes()); + MockHttpServletRequestBuilder builder = + MockMvcRequestBuilders.fileUpload("/upc/cross-reference-detection/file/1/2") + .file(mockMultipartFile); + this.mockMvc.perform(builder).andExpect(status().isInternalServerError()); + + mockMultipartFile = new MockMultipartFile("file","sample-2.html", + "text/html", read_html_file(path+"sample-2.html").getBytes()); + builder = + MockMvcRequestBuilders.fileUpload("/upc/cross-reference-detection/file/2/1") + .file(mockMultipartFile); + this.mockMvc.perform(builder).andExpect(status().isInternalServerError()); + } + + @Test + public void GrammarDeletePrefixes() throws Exception { + this.mockMvc.perform( + post("/upc/cross-reference-detection/reqPrefix?company=upc_new") + .contentType(MediaType.APPLICATION_JSON) + .content(read_file(path+"prefixes.json"))) + .andDo(print()).andExpect(status().isOk()); + this.mockMvc.perform( + delete("/upc/cross-reference-detection/reqPrefix?company=upc_new")) + .andDo(print()).andExpect(status().isOk()); + this.mockMvc.perform( + delete("/upc/cross-reference-detection/reqPrefix?company=upc_new")) + .andDo(print()).andExpect(status().isInternalServerError()); + } + + @Test + public void GrammarStorePrefixes() throws Exception { + this.mockMvc.perform( + post("/upc/cross-reference-detection/reqPrefix?company=upc_new") + .contentType(MediaType.APPLICATION_JSON) + .content(read_file(path+"prefixes.json"))) + .andDo(print()).andExpect(status().isOk()); + this.mockMvc.perform( + post("/upc/cross-reference-detection/reqPrefix?company=upc_new") + .contentType(MediaType.APPLICATION_JSON) + .content(read_file(path+"prefixes.json"))) + .andDo(print()).andExpect(status().isInternalServerError()); + this.mockMvc.perform( + delete("/upc/cross-reference-detection/reqPrefix?company=upc_new")) + .andDo(print()).andExpect(status().isOk()); + } + + @Test + public void GrammarUpdatePrefixes() throws Exception { + this.mockMvc.perform( + post("/upc/cross-reference-detection/reqPrefix?company=upc_new") + .contentType(MediaType.APPLICATION_JSON) + .content(read_file(path+"prefixes.json"))) + .andDo(print()).andExpect(status().isOk()); + this.mockMvc.perform( + put("/upc/cross-reference-detection/reqPrefix?company=upc_new") + .contentType(MediaType.APPLICATION_JSON) + .content(read_file(path+"prefixes.json"))) + .andDo(print()).andExpect(status().isOk()); + this.mockMvc.perform( + delete("/upc/cross-reference-detection/reqPrefix?company=upc_new")) + .andDo(print()).andExpect(status().isOk()); + this.mockMvc.perform( + put("/upc/cross-reference-detection/reqPrefix?company=upc_exception") + .contentType(MediaType.APPLICATION_JSON) + .content(read_file(path+"prefixes.json"))) + .andDo(print()).andExpect(status().isInternalServerError()); + } + + @Test + public void GrammarGetPrefixes() throws Exception { + this.mockMvc.perform( + post("/upc/cross-reference-detection/reqPrefix?company=upc_new") + .contentType(MediaType.APPLICATION_JSON) + .content(read_file(path+"prefixes.json"))) + .andDo(print()).andExpect(status().isOk()); + String response = this.mockMvc.perform( + get("/upc/cross-reference-detection/reqPrefix?company=upc_new")) + .andDo(MockMvcResultHandlers.print()).andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); JSONObject result = new JSONObject(response); - Assert.assertEquals(0, result.getJSONArray("dependencies").length()); + Assert.assertEquals("{\"prefixes\":[\"upc\",\"bug\",\"issue\"]}", result.toString()); + this.mockMvc.perform( + delete("/upc/cross-reference-detection/reqPrefix?company=upc_new")) + .andDo(print()).andExpect(status().isOk()); + this.mockMvc.perform( + get("/upc/cross-reference-detection/reqPrefix?company=upc_exception")) + .andDo(MockMvcResultHandlers.print()).andExpect(status().isInternalServerError()).andReturn().getResponse().getContentAsString(); } private String read_html_file(String path) throws Exception { diff --git a/testing/aux_exception.html b/testing/aux_exception.html new file mode 100644 index 0000000..97896a0 --- /dev/null +++ b/testing/aux_exception.html @@ -0,0 +1 @@ +nothing \ No newline at end of file diff --git a/testing/integration/aux_exception.txt b/testing/integration/aux_exception.txt new file mode 100644 index 0000000..97896a0 --- /dev/null +++ b/testing/integration/aux_exception.txt @@ -0,0 +1 @@ +nothing \ No newline at end of file diff --git a/testing/integration/complex.html b/testing/integration/complex.html new file mode 100644 index 0000000..1cc847f --- /dev/null +++ b/testing/integration/complex.html @@ -0,0 +1,21 @@ + + + +

1 FIRST PARAGRAPH

+

1.1 FIRST SUBPARAGRAPH

+ +

complex_1: article:A - article:B of the book-ix

+

complex_2: 1st article 2nd article or #12132

+

complex_3: lot-213 and -313 of above section

+

complex_4: item#2 to #3 above items

+

complex_5: item#2 to above

+

complex_5: item#2 to 5

+

complex_5: volume 1.1 to 2.1

+

complex_5: volume 1.2 to 2

+

complex_5: 1.1 to 1.3

+

complex_5: item#2 to 5.5.

+

complex_5: item#2 to A

+

complex_5: item#2 to subitem

+

complex_5: item z and 5

+ + \ No newline at end of file diff --git a/testing/integration/empty_file.html b/testing/integration/empty_file.html new file mode 100644 index 0000000..e69de29 diff --git a/testing/integration/external.html b/testing/integration/external.html new file mode 100644 index 0000000..e625108 --- /dev/null +++ b/testing/integration/external.html @@ -0,0 +1,15 @@ + + + +

1 SECTION

+

1.1 SUBSECTION

+ +

external_1: article 2 of the contract

+

external_2: item#2 to #3 of a tendering documentation

+ +

1.2 SUBSECTION

+ +

external_3: 4th article or 1st article and -3 and of the technical specifications

+

external_4: contractor proposal, described in item#2 to #3

+ + \ No newline at end of file diff --git a/testing/integration/prefixes.json b/testing/integration/prefixes.json new file mode 100644 index 0000000..46504b6 --- /dev/null +++ b/testing/integration/prefixes.json @@ -0,0 +1,5 @@ +{ + "prefixes": [ + "upc","bug","issue" + ] +} \ No newline at end of file diff --git a/testing/integration/sample-1.json b/testing/integration/sample-1.json index 36f481a..d221c98 100644 --- a/testing/integration/sample-1.json +++ b/testing/integration/sample-1.json @@ -8,7 +8,7 @@ "name" : "QTBUG", - "specifiedRequirements" : [ "QTBUG-150890", "QTBUG-162454"] + "specifiedRequirements" : [ "QTBUG-150890", "QTBUG-162454", "QTBUG-162455", "QTBUG-162456"] } @@ -34,8 +34,43 @@ "text": "Following issue qtbug-150890, the dialog do not work for multiple users under Windows O.S." + }, + { + + "id": "QTBUG-162455", + + "name": "complex_1: article:A - article:B of the book-ix", + + "text": "complex_2: 1st article 2nd article or #12132" + + }, + { + + "id": "QTBUG-162456", + + "name": "complex_3: lot-213 and -313 of above section ", + + "text": "complex_4: item#2 to #3 above items ", + + "comments": [{"text": "complex_5: lot-213 to 313 , subitem#xi or iv, subparagraph:21312 or 3213, section-3 to 1"}] + } + ], + "dependencies" : [ + { + + "dependency_type": "similar", + + "status": "accepted", + + "fromid": "QTBUG-150890", + + "toid": "QTBUG-150891", + + "description": "duplicates" + + } ] } \ No newline at end of file diff --git a/testing/integration/sample-2.html b/testing/integration/sample-2.html index 8687ccc..9344454 100644 --- a/testing/integration/sample-2.html +++ b/testing/integration/sample-2.html @@ -1,10 +1,38 @@ -

1 FIRST SECTION

-

1.1 FIRST SUBSECTION

-

The system must be tested [...]

-

1.2 SECOND SUBSECTION

-

As it is mentioned in the previous subsection 1.1, the system has to be validated [...]

+

1 SECTION 1

+

1.1 SUBSECTION 1

+

aux

+ +

1.1.1 SUBSECTION 1.1.1

+

simple_1: section-1 subsections:1.1 paragraph-Z volume=iv book#ix qtbug-(1324) autosuite-(A.341+.)

+

1.1.1.1 SUBSECTION 1.1.1.1

+

simple_2_1: 1st item

+

1.2 SUBSECTION 2

+

simple_2_2: 2nd subsect.

+

1.2.1 SUBSECTION 1.2.1

+

simple_2_3: 3rd lot previous articles

+

3rd lot above volume

+

this books

+

same points

+

same points ix

+

+

2.

+

xl)

+

(xl)

+

PART 1

+

simple_2_4: 4th sect.

+

PART 2

+

simple_3: above articles-1 current paragraph-A next book#ix

+

LOT 3

+

simple_4: previous 1st paragraphs

+

SECTION 2

+

simple_5: section-1 preceding

+

VOLUME IX

+

simple_6: that follows subitems

+

simple_7: lot preceding

+ +