diff --git a/grails-app/conf/BuildConfig.groovy b/grails-app/conf/BuildConfig.groovy index 42066943..5c5fdbab 100644 --- a/grails-app/conf/BuildConfig.groovy +++ b/grails-app/conf/BuildConfig.groovy @@ -28,6 +28,7 @@ grails.project.dependency.resolution = { grailsHome() grailsCentral() mavenCentral() + mavenRepo "http://repo.grails.org/grails/plugins" // uncomment these to enable remote dependency resolution from public Maven repositories //mavenCentral() @@ -46,6 +47,7 @@ grails.project.dependency.resolution = { compile('lib:itext-pdfa:5.4.0') compile('lib:itext-xtra:5.4.0') compile('lib:twitter4j-core:4.0.1') + compile('commons-codec:commons-codec:1.6') compile(group: 'org.apache.poi', name: 'poi', version: '3.7') { excludes 'xmlbeans' diff --git a/grails-app/controllers/rgms/member/ResearchGroupController.groovy b/grails-app/controllers/rgms/member/ResearchGroupController.groovy index c894c14f..6ffcfe65 100644 --- a/grails-app/controllers/rgms/member/ResearchGroupController.groovy +++ b/grails-app/controllers/rgms/member/ResearchGroupController.groovy @@ -46,6 +46,10 @@ class ResearchGroupController { def save() { def researchGroupInstance = new ResearchGroup(params) + + /* Checando Caracteres Não Permitidos Nos Nomes*/ + allowedChar(researchGroupInstance) + //#if($researchGroupHierarchy) try { validarChildOf(researchGroupInstance, researchGroupInstance.getChildOf()) @@ -266,4 +270,34 @@ class ResearchGroupController { researchGroupInstance.save() redirect(action: "show", id: researchGroupInstance.id) } + + def allowedChar(researchGroupInstance) { + def caracteres = ['#','%','*','@','!','$','¨','(',')','-','='] + + boolean pesquisa + pesquisa = false + + /* Procurando Caracteres não permitidos */ + for (x in caracteres){ + for (y in researchGroupInstance.name){ + if(x == y) + pesquisa = true; + } + + for (y in researchGroupInstance.twitter){ + if(x == y) + pesquisa = true; + } + + for (y in researchGroupInstance.sigla){ + if(x == y) + pesquisa = true; + } + } /* Fim for */ + + /* Checando se foi achado caracteres não permitidos */ + if (pesquisa){ + throw new RuntimeException("Não é possível registrar um grupo com Caracteres Especiais!") + } + } /* Fim allowedChar method*/ } diff --git a/grails-app/controllers/rgms/publication/BibTexMainMenuController.groovy b/grails-app/controllers/rgms/publication/BibTexMainMenuController.groovy new file mode 100644 index 00000000..895c2db6 --- /dev/null +++ b/grails-app/controllers/rgms/publication/BibTexMainMenuController.groovy @@ -0,0 +1,15 @@ +package rgms.publication + +/** + * Created by Luís Delgado on 02/05/15. + */ +class BibTexMainMenuController { + + def index() { + + } + + def list = { + } + +} diff --git a/grails-app/controllers/rgms/publication/XMLController.groovy b/grails-app/controllers/rgms/publication/XMLController.groovy index 62fb08ad..f31e4de7 100644 --- a/grails-app/controllers/rgms/publication/XMLController.groovy +++ b/grails-app/controllers/rgms/publication/XMLController.groovy @@ -14,12 +14,15 @@ import rgms.member.Member */ class XMLController { + static int similarityTolerance = 0 + def home() {} def upload() { + similarityTolerance = Integer.parseInt(params.tolerance) String flashMessage = 'Publications imported!' String controller = "Publication" - if (!XMLService.Import(savePublication, returnWithMessage, flashMessage, controller, request)) + if (!XMLService.Import(savePublication, returnWithMessage, flashMessage, controller, request, similarityTolerance)) return } @@ -95,6 +98,16 @@ class XMLController { XMLService.createDissertations(xmlFile) } + private Closure saveDissertationsWithSimilarityAnalisys = { + Node xmlFile -> + XMLService.createDissertationsWithSimilarityAnalysis(xmlFile, similarityTolerance) + } + + def boolean verifyDissertations(String title, Node xmlFile) + { + return XMLService.verifyDissertations(title, xmlFile) + } + def enviarConferenciaXML() { String flashMessage = message(code: 'default.importedMsg.message') @@ -163,4 +176,10 @@ class XMLController { User user = User.findByUsername(SecurityUtils.getSubject()?.getPrincipal().toString()) return user?.author } + + def setSimilarityTolerance(int value) { + similarityTolerance = value; + } + + } diff --git a/grails-app/controllers/rgms/tool/Levenshtein.groovy b/grails-app/controllers/rgms/tool/Levenshtein.groovy new file mode 100644 index 00000000..d282299f --- /dev/null +++ b/grails-app/controllers/rgms/tool/Levenshtein.groovy @@ -0,0 +1,17 @@ +package rgms.tool + +class Levenshtein { + def static int distance(String str1, String str2) { + def str1_len = str1.length() + def str2_len = str2.length() + int[][] distance = new int[str1_len + 1][str2_len + 1] + (str1_len + 1).times { distance[it][0] = it } + (str2_len + 1).times { distance[0][it] = it } + (1..str1_len).each { i -> + (1..str2_len).each { j -> + distance[i][j] = [distance[i-1][j]+1, distance[i][j-1]+1, str1[i-1]==str2[j-1]?distance[i-1][j-1]:distance[i-1][j-1]+1].min() + } + } + distance[str1_len][str2_len] + } +} \ No newline at end of file diff --git a/grails-app/domain/rgms/member/ResearchGroup.groovy b/grails-app/domain/rgms/member/ResearchGroup.groovy index c942cf1a..aca68be2 100644 --- a/grails-app/domain/rgms/member/ResearchGroup.groovy +++ b/grails-app/domain/rgms/member/ResearchGroup.groovy @@ -7,6 +7,7 @@ class ResearchGroup { String name String description String twitter + String sigla //#if($researchGroupHierarchy) ResearchGroup childOf; @@ -15,9 +16,10 @@ class ResearchGroup { static hasMany = [memberships: Membership, news: News] static constraints = { - name(maxSize: 10, blank: false, unique: true) + name(maxSize: 15, blank: false, unique: true) description(maxSize: 1000, blank: false) twitter(nullable: true) + sigla(maxSize: 10, blank: true, unique: true) //#if($researchGroupHierarchy) childOf(nullable: true, blank: true) diff --git a/grails-app/domain/rgms/publication/BibTexMainMenu.groovy b/grails-app/domain/rgms/publication/BibTexMainMenu.groovy new file mode 100644 index 00000000..4a7cdd46 --- /dev/null +++ b/grails-app/domain/rgms/publication/BibTexMainMenu.groovy @@ -0,0 +1,11 @@ +package rgms.publication + +/** + * Created by Luís Delgado on 02/05/15. + */ +class BibTexMainMenu { + + static constraints = { + } + +} \ No newline at end of file diff --git a/grails-app/i18n/messages.properties b/grails-app/i18n/messages.properties index 05c696f1..92bb42ca 100644 --- a/grails-app/i18n/messages.properties +++ b/grails-app/i18n/messages.properties @@ -168,6 +168,7 @@ orientation.same.members=Um membro nao pode orientar a si mesmo default.xml.parserror.message=No file uploaded or it wasn't a valid XML default.xml.structure.message=The XML struct doesn't comply with Lattes default.xml.unknownerror.message=An unknown error occurred. Contact the administrator +default.xml.similar.dissertation.message = The file was not imported because there is a dissertation with a similar title registered xml.label=XMLImport file.already.exist.message=A file has already been saved with the same name diff --git a/grails-app/i18n/messages_pt_BR.properties b/grails-app/i18n/messages_pt_BR.properties index 6d3cc59d..9c015c9e 100644 --- a/grails-app/i18n/messages_pt_BR.properties +++ b/grails-app/i18n/messages_pt_BR.properties @@ -176,6 +176,7 @@ tese.month.label=Mês tese.arquivo.label=Arquivo tese.label=Tese tese.duplicatetitle.failure = Tese não cadastrada porque já existe uma tese com o mesmo título +default.xml.similar.dissertation.message = O arquivo não foi importado porque existe uma dissertação com um título semelhante registrada #end #if($news) diff --git a/grails-app/services/rgms/XMLService.groovy b/grails-app/services/rgms/XMLService.groovy index 107c729b..45578502 100644 --- a/grails-app/services/rgms/XMLService.groovy +++ b/grails-app/services/rgms/XMLService.groovy @@ -7,6 +7,7 @@ import rgms.member.Orientation import rgms.publication.* import rgms.researchProject.Funder import rgms.researchProject.ResearchProject +import rgms.tool.Levenshtein class XMLService { @@ -14,14 +15,25 @@ class XMLService { saveEntity - closure que salva a classe de domínio que está usando a importação */ + + static boolean Import(Closure saveEntity, Closure returnWithMessage, String flashMessage, String controller, - javax.servlet.http.HttpServletRequest request) { + javax.servlet.http.HttpServletRequest request, int similarityTolerance) { boolean errorFound = false try { Node xmlFile = parseReceivedFile(request) - saveEntity(xmlFile) + if(!checkExistenceWithSimilarityAnalysis(xmlFile, similarityTolerance)) + { + saveEntity(xmlFile) + } + else + { + flashMessage = 'default.xml.similar.dissertation.message' + + errorFound = true + } } //If file is not XML or if no file was uploaded catch (SAXParseException) { @@ -282,6 +294,52 @@ class XMLService { createDissertation(doutorado) } + static void createDissertationsWithSimilarityAnalysis(Node xmlFile, int toleranceLevel) { + + List dissertations = Dissertacao.findAll(); + + Node dadosGerais = (Node) xmlFile.children()[0] + Node formacaoAcademica = getNodeFromNode(dadosGerais, "FORMACAO-ACADEMICA-TITULACAO") + Node mestrado = (Node) formacaoAcademica.children()[1] + Node doutorado = (Node) formacaoAcademica.children()[2] + + String dissertacaoMestrado = getAttributeValueFromNode(mestrado, "TITULO-DA-DISSERTACAO-TESE") + + String dissertacaoDoutorado = getAttributeValueFromNode(doutorado, "TITULO-DA-DISSERTACAO-TESE") + + boolean mestradoOK = true + boolean doutoradoOK = true + + for (int i = 0; i < dissertations.size(); i++) + { + String current = dissertations.get(i) + int distanciaMestrado = Levenshtein.distance(current, dissertacaoMestrado) + if (( distanciaMestrado> toleranceLevel) && distanciaMestrado <= 10) + { + mestradoOK = false + + } + + int distanciaDoutorado = Levenshtein.distance(current, dissertacaoDoutorado) + if(distanciaDoutorado > toleranceLevel && distanciaDoutorado <=10) + { + doutoradoOK = false + + } + } + + if(mestradoOK) + { + createDissertation(mestrado) + } + + if(doutoradoOK) + { + createDissertation(doutorado) + } + + } + private static void createDissertation(Node xmlNode) { Dissertacao newDissertation = new Dissertacao() newDissertation.title = getAttributeValueFromNode(xmlNode, "TITULO-DA-DISSERTACAO-TESE") @@ -293,6 +351,68 @@ class XMLService { newDissertation.save(flush: false) } + static boolean checkExistenceWithSimilarityAnalysis(Node xmlFile, int toleranceLevel) + { + List dissertations = Dissertacao.findAll(); + + Node dadosGerais = (Node) xmlFile.children()[0] + Node formacaoAcademica = getNodeFromNode(dadosGerais, "FORMACAO-ACADEMICA-TITULACAO") + Node mestrado = (Node) formacaoAcademica.children()[1] + Node doutorado = (Node) formacaoAcademica.children()[2] + + String dissertacaoMestrado = getAttributeValueFromNode(mestrado, "TITULO-DA-DISSERTACAO-TESE") + + String dissertacaoDoutorado = getAttributeValueFromNode(doutorado, "TITULO-DA-DISSERTACAO-TESE") + + for (int i = 0; i < dissertations.size(); i++) + { + String current = dissertations.get(i) + if (Levenshtein.distance(current, dissertacaoMestrado) > toleranceLevel) + { + return true + } + else if(Levenshtein.distance(current, dissertacaoDoutorado) > toleranceLevel) + { + return true + } + } + return false + + + } + + static boolean verifyDissertations (String title, Node xmlFile ) + { + Node dadosGerais = (Node) xmlFile.children()[0] + Node formacaoAcademica = getNodeFromNode(dadosGerais, "FORMACAO-ACADEMICA-TITULACAO") + Node mestrado = (Node) formacaoAcademica.children()[1] + Node doutorado = (Node) formacaoAcademica.children()[2] + + if(analizeDissertationNode(title, mestrado) || analizeDissertationNode(title, doutorado)) + { + return true + } + else + { + return false + } + + } + + static boolean analizeDissertationNode(String title, Node node) + { + Dissertacao newDissertation = new Dissertacao() + newDissertation.title = getAttributeValueFromNode(node, "TITULO-DA-DISSERTACAO-TESE") + if(newDissertation.title == title) + { + return true + } + else + { + return false + } + } + static void createConferencias(Node xmlFile) { Node trabalhosEmEventos = (Node) ((Node) xmlFile.children()[1]).children()[0] diff --git a/grails-app/views/XML/home.gsp b/grails-app/views/XML/home.gsp index d6edee2a..8f9bd30d 100644 --- a/grails-app/views/XML/home.gsp +++ b/grails-app/views/XML/home.gsp @@ -17,7 +17,8 @@
- + + diff --git a/grails-app/views/bibTexMainMenu/_form.gsp b/grails-app/views/bibTexMainMenu/_form.gsp new file mode 100644 index 00000000..be7ea132 --- /dev/null +++ b/grails-app/views/bibTexMainMenu/_form.gsp @@ -0,0 +1,4 @@ +<%@ page import="rgms.publication.BibTexMainMenu" %> + + + diff --git a/grails-app/views/bibTexMainMenu/create.gsp b/grails-app/views/bibTexMainMenu/create.gsp new file mode 100644 index 00000000..f71f7706 --- /dev/null +++ b/grails-app/views/bibTexMainMenu/create.gsp @@ -0,0 +1,39 @@ +<%@ page import="rgms.publication.BibTexMainMenu" %> + + + + + + <g:message code="default.create.label" args="[entityName]" /> + + + + +
+

+ +
${flash.message}
+
+ + + + +
+ +
+
+ +
+
+
+ + diff --git a/grails-app/views/bibTexMainMenu/edit.gsp b/grails-app/views/bibTexMainMenu/edit.gsp new file mode 100644 index 00000000..09414bdc --- /dev/null +++ b/grails-app/views/bibTexMainMenu/edit.gsp @@ -0,0 +1,43 @@ +<%@ page import="rgms.publication.BibTexMainMenu" %> + + + + + + <g:message code="default.edit.label" args="[entityName]" /> + + + + +
+

+ +
${flash.message}
+
+ + + + + + +
+ +
+
+ + +
+
+
+ + diff --git a/grails-app/views/bibTexMainMenu/list.gsp b/grails-app/views/bibTexMainMenu/list.gsp new file mode 100644 index 00000000..56e9d250 --- /dev/null +++ b/grails-app/views/bibTexMainMenu/list.gsp @@ -0,0 +1,44 @@ + +<%@ page import="rgms.publication.BibTexMainMenu" %> + + + + + + <g:message code="default.list.label" args="[entityName]" /> + + + + +
+

+ +
${flash.message}
+
+ + + + + + + + + + + + + +
+ + + +
+ + diff --git a/grails-app/views/bibTexMainMenu/show.gsp b/grails-app/views/bibTexMainMenu/show.gsp new file mode 100644 index 00000000..d83ab69f --- /dev/null +++ b/grails-app/views/bibTexMainMenu/show.gsp @@ -0,0 +1,36 @@ + +<%@ page import="rgms.publication.BibTexMainMenu" %> + + + + + + <g:message code="default.show.label" args="[entityName]" /> + + + + +
+

+ +
${flash.message}
+
+
    + +
+ +
+ + + +
+
+
+ + diff --git a/grails-app/views/bibtexGenerateFile/home.gsp b/grails-app/views/bibtexGenerateFile/home.gsp index f4538d83..9276df96 100644 --- a/grails-app/views/bibtexGenerateFile/home.gsp +++ b/grails-app/views/bibtexGenerateFile/home.gsp @@ -6,6 +6,7 @@ + <g:message code="default.list.label" args="[entityName]" /> @@ -84,7 +85,54 @@ +
+

+ +
${flash.message}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
${fieldValue(bean: periodicoInstance, field: "title")}${fieldValue(bean: periodicoInstance, field: "file")}${fieldValue(bean: periodicoInstance, field: "researchLine")}${fieldValue(bean: periodicoInstance, field: "authors")}${fieldValue(bean: periodicoInstance, field: "journal")}
+
\ No newline at end of file diff --git a/grails-app/views/researchGroup/_form.gsp b/grails-app/views/researchGroup/_form.gsp index fb13fbe0..fe582b6c 100644 --- a/grails-app/views/researchGroup/_form.gsp +++ b/grails-app/views/researchGroup/_form.gsp @@ -1,70 +1,82 @@ -<%@ page import="rgms.member.ResearchGroup" %> - - - - -
- - -
- -
- - -
- -
- - -
- - - -
- - -
- -
- - -
    - -
  • - -
  • -
    - -
-
- -
- - -
+<%@ page import="rgms.member.ResearchGroup" %> + + + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
    + +
  • ${m?.encodeAsHTML()}
  • +
    +
  • + ${message(code: 'default.add.label', args: [message(code: 'membership.label', default: 'Membership')])} +
  • +
+ +
+ +
+ + +
    + +
  • ${n?.encodeAsHTML()}
  • +
    +
  • + ${message(code: 'default.add.label', args: [message(code: 'news.label', default: 'News')])} +
  • +
+ +
+ diff --git a/grails-app/views/researchGroup/create.gsp b/grails-app/views/researchGroup/create.gsp index a7f21cfb..59c55ca1 100644 --- a/grails-app/views/researchGroup/create.gsp +++ b/grails-app/views/researchGroup/create.gsp @@ -1,39 +1,45 @@ -<%@ page import="rgms.member.ResearchGroup" %> - - - - - - <g:message code="default.create.label" args="[entityName]" /> - - - - -
-

- -
${flash.message}
-
- - - - -
- -
-
- -
-
-
- - +<%@ page import="rgms.member.ResearchGroup" %> + + + + + + <g:message code="default.create.label" args="[entityName]"/> + + + + + + + +
+

+ +
${flash.message}
+
+ + + + +
+ +
+
+ +
+
+
+ + diff --git a/grails-app/views/researchGroup/edit.gsp b/grails-app/views/researchGroup/edit.gsp index 0f8eb404..52f6a31f 100644 --- a/grails-app/views/researchGroup/edit.gsp +++ b/grails-app/views/researchGroup/edit.gsp @@ -1,43 +1,52 @@ -<%@ page import="rgms.member.ResearchGroup" %> - - - - - - <g:message code="default.edit.label" args="[entityName]" /> - - - - -
-

- -
${flash.message}
-
- - - - - - -
- -
-
- - -
-
-
- - +<%@ page import="rgms.member.ResearchGroup" %> + + + + + + <g:message code="default.edit.label" args="[entityName]"/> + + + + + + + +
+

+ +
${flash.message}
+
+ + + + + + +
+ +
+
+ + +
+
+
+ + diff --git a/grails-app/views/researchGroup/editMembers.gsp b/grails-app/views/researchGroup/editMembers.gsp deleted file mode 100644 index 34aceb06..00000000 --- a/grails-app/views/researchGroup/editMembers.gsp +++ /dev/null @@ -1,7 +0,0 @@ -
- - -
\ No newline at end of file diff --git a/grails-app/views/researchGroup/list.gsp b/grails-app/views/researchGroup/list.gsp index 30f2448a..e5f8e6e4 100644 --- a/grails-app/views/researchGroup/list.gsp +++ b/grails-app/views/researchGroup/list.gsp @@ -1,59 +1,70 @@ - -<%@ page import="rgms.member.ResearchGroup" %> - - - - - - <g:message code="default.list.label" args="[entityName]" /> - - - - -
-

- -
${ flash.message }
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
${ fieldValue(bean: researchGroupInstance, field: "name") }${ fieldValue(bean: researchGroupInstance, field: "description") } ${ fieldValue(bean: researchGroupInstance, field: "childOf") }
- -
- - - +<%@ page import="rgms.member.ResearchGroup" %> + + + + + + <g:message code="default.list.label" args="[entityName]"/> + + + + + + + +
+

+ +
${flash.message}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
${fieldValue(bean: researchGroupInstance, field: "name")}${fieldValue(bean: researchGroupInstance, field: "description")}${fieldValue(bean: researchGroupInstance, field: "twitter")}${fieldValue(bean: researchGroupInstance, field: "sigla")}${fieldValue(bean: researchGroupInstance, field: "childOf")}
+ + +
+ + diff --git a/grails-app/views/researchGroup/show.gsp b/grails-app/views/researchGroup/show.gsp index 396c70a3..ffbaec5f 100644 --- a/grails-app/views/researchGroup/show.gsp +++ b/grails-app/views/researchGroup/show.gsp @@ -1,160 +1,156 @@ - -<%@ page import="rgms.member.ResearchGroup" %> - - - - - - <g:message code="default.show.label" args="[entityName]"/> - - - -- --
-- - - - - -- --
-- - - - - - --
-- - - - - - - - - - - - - - -
-

- -
${flash.message}
-
-
    - - -
  1. - - - - -
  2. -
    - - -
  3. - - - - -
  4. -
    - - -
  5. - - - - -
  6. -
    - - - -
  7. - - - ${researchGroupInstance?.childOf?.encodeAsHTML()} - -
  8. -
    - - - - - -
  9. - - - - ${m.member?.encodeAsHTML()} - - - -
  10. -
    - - -
  11. - - - - - - - - - -
    ${index + 1} -${n.description?.encodeAsHTML()}
    - -
  12. -
    - -
-
    -
  1. - - -
  2. -
- - -
- - - -
-
-
- - - +<%@ page import="rgms.member.ResearchGroup" %> + + + + + + <g:message code="default.show.label" args="[entityName]"/> + + + + + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + + + + + + +
+

+ +
${flash.message}
+
+
    + + +
  1. + + + + +
  2. +
    + + +
  3. + + + + +
  4. +
    + + +
  5. + + + + +
  6. +
    + + +
  7. + + + + +
  8. +
    + + +
  9. + + + ${researchGroupInstance?.childOf?.encodeAsHTML()} + +
  10. +
    + + +
  11. + + + + ${m?.encodeAsHTML()} + + +
  12. +
    + + +
  13. + + + + ${n?.encodeAsHTML()} + + +
  14. +
    + +
+ +
+ + + +
+
+
+ + diff --git a/test/cucumber/BibtexGenerateFile.feature b/test/cucumber/BibtexGenerateFile.feature index 566bfa51..0f17e6a4 100644 --- a/test/cucumber/BibtexGenerateFile.feature +++ b/test/cucumber/BibtexGenerateFile.feature @@ -8,3 +8,77 @@ Feature: all bibtex When I select the export bibtex file option at the publications menu And I select Generate All BibTex option at the export bibtex page Then I can see the bibtex details + + Scenario: Duplicate citation-key generation + Given I have an article named "A theory of software product line refinement" + And I have another article named "Modularity analysis of use case implementations" + When I generate a BibTex file from articles named "A theory of software product line refinement" and "Modularity analysis of use case implementations" + Then the BibTex file has unique citation-keys for the articles "A theory of software product line refinement" and "Modularity analysis of use case implementations" + + Scenario: Generate new BibTex from a subset of publications web + Given I am on the "Publications" menu + When I select the publications "A theory of software product line refinement" and "Modularity analysis of use case implementations" + And I click on the "Generate BibTex" option + Then the BibTex details are showed + And It only contains the articles "A theory of software product line refinement" and "Modularity analysis of use case implementations" + + Scenario: Publications with multiple authors must have authors' names separated by and + Given I have an article named "A theory of software product line refinement" with multiple authors + When I generate a BibTex file from the article named "A theory of software product line refinement" + Then the BibTex file author field must have the authors' names separated by "and" + + #if ($InvalidEntryOfBibtex) + Scenario: Tags of entry of BibTex are not separated by commas + Given: I am logged into the system + And: I am at the BibTexGenerateFile page + When: I click to "Generate BibTex manually" + And: A BibTeX entry is "@article{mrx05 + auTHor = "Mr. X", + Title = {Something Great}, + publisher = "nob" # "ody", + YEAR = 2005, + }" + And: I click on the other button "Generate BibTex" + Then: I see an error message + + Scenario: Tags of entry of BibTex are incompatible with type of publication chosen + Given: I am logged into the system + And: I am at the BibTexGenerateFile page + When: I click to "Generate BibTex manually" + And: A BibTex entry is "@article{mrx05, + auTHor = "Mr. X", + Title = {Something Great}, + publisher = "nob" # "ody", + YEAR = 2005, + chapter = 8, + }" + And: I click on the other button "Generate BibTex" + Then: I see an error message + + Scenario: Lack mandatory tags in entry of BibTex with type of publication chosen + Given: I am logged into the system + And: I am at the BibTexGenerateFile page + When: I click to "Generate BibTex manually" + And: A BibTeX entry is "@article{mrx05, + auTHor = "Mr. X", + Title = {Something Great}, + publisher = "nob" # "ody", + } + And: I click on the other button "Generate BibTex" + Then: I see an error message + #end + + #if ($CorrectEntryOfBibtex) + Scenario: BibTex file is generated manually + Given: I am logged into the system + And: I am at the BibTexGenerateFile page + When: I click to "Generate BibTex manually" + And: A Bibtex entry is "@article{mrx05, + auTHor = "Mr. X", + Title = {Something Great}, + publisher = "nob" # "ody", + YEAR = 2005, + }" + And: I click on the other button "Generate BibTex" + Then: a BibTex file is generated + #end \ No newline at end of file diff --git a/test/cucumber/Conferencia.feature b/test/cucumber/Conferencia.feature index 8553a4a3..d7ca67e1 100644 --- a/test/cucumber/Conferencia.feature +++ b/test/cucumber/Conferencia.feature @@ -1,8 +1,8 @@ @i9n Feature: conferencia As a member of a research group - I want to add, remove and modify conferencias I have published - so that I can generate web pages and reports containing these conferencias + So that I can add, remove and modify conferencias I had published + I want to generate web pages and reports containing these conferencias Scenario: new conferencia Given the system has no conferencia entitled "IV Conference on Software Product Lines" @@ -144,4 +144,93 @@ Feature: conferencia And I select the option Serach for Conference at the conference page Then a list of all conferences containing that date will be presented in the conference screen -# voces podem criar cenários para ordenar a lista de conferencia, filtrar a lista, verificar se alguns campos podem ser opcionais, etc. + Scenario: Publish a new article + Given I am at the article registration page + When I am filling in the author field + And As I type the name, they come up suggestions of names containing the string entered as "And" may appear names like " Anderson " or " Candido " + Then I choose the right name if it appears , otherwise we fill the whole field + + Scenario: new article + Given I am at the publications + When I select the "conferencia" option at the publications menu + And I select the new article + Then I can fill the article details + + Scenario: remove article + Given I am at the publications menu + When I select the "conferencia" option at the publications menu + And a list of articles stored by the system is displayed at the conferencia page + Then I select the desired article + Then I can remove the article + + Scenario: new article from an existing conference + Given the conference "I International Conference on software Engineering" is stored in the system + When I type the letter "I" in the conference field to publish a new article + Then the system suggests "I International Conference on software Engineering" + + Scenario: author suggestion for a new article (existing author) + Given I am adding a new article + When I type the first letter in the Author field + Then a list is displayed suggesting names from Authors who already published an article + And I select the name I want + + Scenario: Search conference web by existing Author + Given I am at the Search Conference page + When I write a name from an Author who already published an article at the Search field + And I click on the Search button + Then a list of all conferences with articles from that Author are displayed + + Scenario: System can suggest one author for new conferencia being created (good path) + Given I am at Add new conferencia page + And I had previously published only with "Júnior" + When I try to fill "J" in Authors + Then the system should suggest "Júnior" as an possible author + When I select "Júnior" + Then "Júnior" should be added in "Authors" + + Background: Start from the Add new conferencia page with conferencias yet published + Given I am at Add new conferencia page + And I had previously published with "Jorge", "Junior Lima" and "Fábio Jr" + + Scenario: System can suggest some authors for new conferencia being created (good path) + When I try to fill "J" in Authors + Then the system should suggest "Jorge", "Junior Lima" and "Fábio Jr" as possible authors in lexicographical order + When I select "Jorge" and other suggested authors + Then the selected authors should be added in "Authors" + + Scenario: System can try to suggest some authors for new conferencia being created (bad path) + When I try to fill "K" in Authors + Then the system should suggest the latest 5 authors I had published as possible authors + When I select any suggested author + Then the selected author should be added in "Authors" + +Scenario: Fill in the field "Author Name" + Given I'm registering a new Article + And I'm filling the field " Author Name" + When I type "and" if there author names as " Anderson " or " Candido " registered in the system + And the names " Anderson " and " Candido " will be suggested by the system + Then I choose between " Anderso " and " Candido " or if it is not neither I fill with the desired name + +Scenario: Remove Article Web + Given I want to remove the article "A theory of software" with the file name "ATOS.pdf" + When I click on "A theory of software" that is on the list of articles published in the conference page + And I click with the mouse in the article "A theory of software" + And appear the options to edit or remove the article + Then I click the button to remove and the "A theory of software" is removed from the list of articles + And the aquirvo "ATOS.pdf" is removed from the system + +# voces podem criar cenários para ordenar a lista de conferencia, filtrar a lista, verificar se alguns campos podem ser opcionais, etc. + + Scenario: Search conference articles by Author web + Given I am at the Conference Articles page + And the system has some conference articles authored by "Jose", among several publications + When I write "J" at the Search field + And I click on the Search button + Then a list of all conference articles by "Jose" is displayed + + Scenario: Search for conferences which an Author have published web + Given I am at the Conference page + And an Author named "Junior" had published the articles "An Analysis and Survey of the Development of Mutation Testing", "A Systematic Survey of Program Comprehension through Dynamic Analysis", and "Engineering Privacy", for the conferences "International Conference on Software Engineering", "Information and Software Technology" and "International Symposium on Software Testing and Analysis" + When I write "Junior" at the search field + And I click on the search button + Then a list of all conferences, composed by "International Conference on Software Engineering", "Information and Software Technology" and "International Symposium on Software Testing and Analysis", that "Junior" published an article is displayed diff --git a/test/cucumber/Reports.feature b/test/cucumber/Reports.feature index bf58123a..4ca01497 100644 --- a/test/cucumber/Reports.feature +++ b/test/cucumber/Reports.feature @@ -7,6 +7,9 @@ Feature: Reports When I select the "1" option at the Member list And I can select the option Export to HTML at the Member show Then I can generate a HTML report about Member "1" + And I can see a photography of the Member + And I can see a description about the member + And I can see a list of Menber publications Scenario: export existent member report to xml Given I am at the Member list page @@ -14,41 +17,114 @@ Feature: Reports And I can select the option Export to XML at the Member show Then I can generate a XML report about Member "1" - Scenario: export recently created member report to pdf - Given I am at the publications menu - When I select the Novo Member option - Then I fill the Member details with "John Smith" "JohnSmith" "JohnSmith@gmail.cin.ufpe.br" "UFPE" and create a new one - Then I select the "2" option at the Member list + Scenario: export existent member report to pdf + Given I am at the Member list page + When I select the "1" option at the Member list And I can select the option Export to PDF at the Member show - Then I can generate a PDF report about Member "2" + Then I can generate a PDF report about Member "1" - Scenario: export report to pdf of recently created research group + Scenario: create a new Member + Given I am at the Member list page + When I select the "New Member" option + And I can fill the Member "Name" with "John Smith" + And I can fill the Member "Username" with "JohnSmith" + And I can fill the Member "Email" with "JohnSmith@gmail.cin.ufpe.br" + And I can fill the Member "University" "UFPE" + And I can select "Criar" option + Then I can see the new user at the Member List + + Scenario: missing field error when creating a new Member + Given I am at the Member list page + When I select the Novo Member option + And I dont fill a field with * symbol + And I can select Criar option + Then I can see a error message + + Scenario: invalid value in field error when creating a new Member + Given I am at the Member list page + When I select the "Novo Member" option + And I can fill a field with an invalid value "&%(#@" + And I select "Create" option + Then I can see a error message + + Scenario: export recently created member report to pdf + Given I am at the Member list page + When I can create a new Member named "João Paulo Silva" + Then I can export to PDF the existent member named "João Paulo Silva" + + Scenario: export recently created member report to xml + Given I am at the Member list page + When I can create a new Member named "João Paulo Silva" + Then I can export to XML the existent member named "João Paulo Silva" + + Scenario: export recently created member report to html + Given I am at the Member list page + When I can create a new Member named "João Paulo Silva" + Then I can export to HTML the existent member named "João Paulo Silva" + + Scenario: create a new research group + Given I am at the publications menu page + When I select the "Research Group" option at the publications menu page + And I select the "New Research Group" at research group list page + Then I can fill the field "Nome" with value "Grupo1" + And I can fill the field "Twitter" with value "@Grupo1" + And I can fill the field "Descrição" with value "Grupo de pesquisa 1" + And I can fill the field "Sigla" with value "G1" + And I select a member "1" at member list + And I select "Criar" option + Then I should see the new research group named "Grupo1" in Research Group list + + + Scenario: missing field error when creating a research group Given I am at the publications menu When I select the "Research Group" option at the publications menu And I select the new research group option at research group list page - Then I can fill the research group details with name "RGroup" and create a new one - And I select the "RGroup" option at the Research Group list - And I can select the option Export to PDF at the Research Group show - And I can generate a PDF report about Research Group "RGroup" + And I dont fill a field with "*" symbol + And I can select "Criar" option + Then I can see a error message - Scenario: export report to html of recently created research group + Scenario: invalid value in field error when creating a research group Given I am at the publications menu When I select the "Research Group" option at the publications menu And I select the new research group option at research group list page - Then I can fill the research group details with name "RGroup" and create a new one + And I can fill a field with an invalid value + And I can select "Criar" option + Then I can see a error message + + Scenario: export report to pdf of existent research group + Given I am at the publications menu And I select the "RGroup" option at the Research Group list - And I can select the option Export to HTML at the Research Group show - And I can generate a HTML report about Research Group "RGroup" + And I can select the option Export to PDF at the Research Group show page + Then I can generate a PDF report about Research Group "RGroup" - Scenario: export report to xml of recently created research group + Scenario: export report to xml of existent research group + Given I am at the publications menu + And I select the "RGroup" option at the Research Group list + And I can select the option Export to PDF at the Research Group show page + Then I can generate a XML report about Research Group "RGroup" + + Scenario: export report to html of existent research group Given I am at the publications menu - When I select the "Research Group" option at the publications menu - And I select the new research group option at research group list page - Then I can fill the research group details with name "RGroup" and create a new one And I select the "RGroup" option at the Research Group list - And I can select the option Export to XML at the Research Group show - And I can generate a XML report about Research Group "RGroup" + And I can select the option Export to PDF at the Research Group show page + Then I can generate a HMTL report about Research Group "RGroup" + + Scenario: export report to pdf of recently created research group + Given I am at the publications menu + When I create a new Research Group named "RGroup" + Then I can generate a PDF report about existent Research Group "RGroup" + + + Scenario: export report to html of recently created research group + Given I am at the publications menu + When I create a new Research Group named "RGroup" + Then I can generate a HTML report about existent Research Group "RGroup" + + Scenario: export report to xml of recently created research group + Given I am at the publications menu + When I create a new Research Group named "RGroup" + Then I can generate a XML report about existent Research Group "RGroup" Scenario: export existent member report to html and access bibtex from him Given I am at the Member list page @@ -94,3 +170,53 @@ Feature: Reports And I select the option Export to HTML at the News list page Then The system generate a HTML report with the news "The first news" in it #end + + Scenario: export a existent research group report to html + Given I am in research group list page + When I select "RGMSGroup" option at the research group list + And I select the option "export to html" at the research group show + Then I export a html report about resourch group "RGMSGroup" + + Scenario: export a existent news report to html + Given I am in News list page + When I select "RGMSNews" option at the News list + And I select the option "export to html" at the News show + Then I export a html report about News "RGMSNews" + + Scenario: export a existent research group report to pdf + Given I am in research group list page + When I select "RGMSGroup" option at the research group list + And I select the option "export to PDF" at the resourch group show + Then I export a PDF report about research group "RGMSGroup" + + Scenario: export a existent news report to PDF + Given I am in News list page + When I select "RGMSNews" option at the News list + And I select the option "export to PDF" at the News show + Then I export a PDF report about News "RGMSNews" + + Scenario: export a existent research group report to xml + Given I am in research group list page + When I select "RGMSGroup" option at the resourch group list + And I select the option "export to XML" at the research group show + Then I export a XML report about resourch group "RGMSGroup" + + Scenario: export a existent news report to xml + Given I am in News list page + When I select "RGMSNews" option at the News list + And I select the option "export to XML" at the News show + Then I export a XML report about News "RGMSNews" + + Scenario: export report to html link not enable when there is not research group created + Given I am at "publications" menu + And there is not research group created + When I select the "Research Group" option + Then I view that the research group list is empty + And I can not select the option "Export to html" + + Scenario: export report to html link not enable when there is not members report created + Given I am at "publications" menu + And there is not member created + When I select the "Member" option + Then I view that the member list is empty + And I can not select the option "Export to html" \ No newline at end of file diff --git a/test/cucumber/XMLImport.feature b/test/cucumber/XMLImport.feature index cc0dcc6a..af8ef770 100644 --- a/test/cucumber/XMLImport.feature +++ b/test/cucumber/XMLImport.feature @@ -10,8 +10,6 @@ Feature: XMLImport When I select the "upload" button And I upload the file "cv.pdf" Then the system outputs an error message - And no new publication is stored by the system - And the previously stored publications do not change @ignore Scenario: invalid file @@ -30,20 +28,15 @@ Feature: XMLImport @ignore Scenario: no file web Given I am at the "Import XML File" Page - And the system has some publications stored When I click on "upload" without select a xml file Then the system outputs an error message - And no new publication is stored by the system - And the previously stored publications do not change @ignore - Scenario: new publication + Scenario: create a new publication Given the system has some publications stored - And the system has no journal article entitled "An Abstract Equivalence Notion for Object Models" authored by me - When I upload the file "cv.xml" which contains a journal article entitled "An Abstract Equivalence Notion for Object Models" authored by me - Then the system outputs a list of imported publications which contains the journal article entitled "An Abstract Equivalence Notion for Object Models" with status "stable" - And no new publication is stored by the system - And the previously stored publications do not change + And the system has no journal article entitled "An Abstract Equivalence Notion for Object Models” authored by me + When I upload the file "cv.xml" which contains a journal article entitled "An Abstract Equivalence Notion for Object Models” + Then a journal article entitled "An Abstract Equivalence Notion for Object Models” is stored by the system @ignore Scenario: confirm import of new publication @@ -327,6 +320,24 @@ Feature: XMLImport When I cancel the import of the master's orientation entitled "Structuring Adaptive Aplications using AspectJ" with status "conflicted" And the master's orientation entitled "Structuring Adaptive Aplications using AspectJ" with status "conflicted" is removed from the list of imported orientations And the previously stored orientations do not change + + + + #if($ToleranceLevel) + + Scenario: dissertations with similar names should be considered as duplicates, according to the tolerance level + Given the system has a dissertation entitled "Semantics and Refinement for a Concurrent Object Oriented Language" stored + And the similarity tolerance is configured to "5" + When I upload the file "curriculo5.xml" which contains a dissertation entitled "Semantics an refinement for a concurrent object oriented language" + Then the system outputs a list of imported dissertations which contains the dissertation entitled "Semantics and Refinement for a Concurrent Object Oriented Language" + And no new dissertation entitled "Semantics an refinement for a concurrent object oriented language" is stored by the system + + Scenario: the tolerance level is not informed + Given I am at the XMLImport Page + And I select a xml file + When I click on "upload" without informing the tolerance level + Then the system outputs an error message + #end # o que acontece quando o arquivo tem publicações já cadastradas? e # publicações com mesmos títulos mas outras partes diferentes? e diff --git a/test/cucumber/steps/BibtexGenerateFileSteps.groovy b/test/cucumber/steps/BibtexGenerateFileSteps.groovy index 849cd8bd..33564c8e 100644 --- a/test/cucumber/steps/BibtexGenerateFileSteps.groovy +++ b/test/cucumber/steps/BibtexGenerateFileSteps.groovy @@ -1,4 +1,9 @@ import pages.BibtexGenerateFilePage +import pages.LoginPage +import pages.PublicationsPage +import rgms.publication.Periodico +import rgms.publication.BibtexGenerateFile + import static cucumber.api.groovy.EN.* @@ -14,4 +19,95 @@ When(~'^I select Generate All BibTex option at the export bibtex page$') {-> Then(~'^I can see the bibtex details$') {-> } +Given(~'^I have an article named "([^"]*)"$') {String title -> + article = Periodico.findByTitle(title) + assert article != null +} + +And(~'^I have another article named "([^"]*)"$') {String title -> + article = Periodico.findByTitle(title) + assert article != null +} + +When(~'^I generate a BibTex file from articles named "([^"]*)" and "([^"]*)"$') { String title1, String title2 -> + article1 = Periodico.findByTitle(title1) + article2 = Periodico.findByTitle(title2) + bib1 = generateBibtexPeriodico(article1) + assert bib1 != null + bib2 = generateBibtexPeriodico(article2) + assert bib2 != null + bibtexFile = bib1 + "\n" + bib2 + assert bibtexFile != null +} + +Then(~'^the BibTex file has unique citation-keys for the articles "([^"]*)" and "([^"]*)"$') { String title1, String title2 -> + // The method that generates a BibTex does not include a citation-key + // Need to fix this issue first +} + +Given(~'^I am on the "Publications" menu$') {-> + to LoginPage + at LoginPage + page.add("admin", "adminadmin") + at PublicationsPage +} + +When(~'^I select the publications "([^"]*)" and "([^"]*)"$') { String p1, String p2 -> + // Need to adjust the BibTex Export page in order to implement this +} + +And(~'^I click on the "([^"]*)" option$') {String o -> + at PublicationsPage + page.select(o) +} + +Then(~'^the BibTex details are showed$') {-> + +} + +And(~'^It only contains the articles "([^"]*)" and "([^"]*)"$') { String title1, String title2 -> +} + +#if ($InvalidEntryOfBibtex) +Given(~'^I am logged into the system$') {-> + to LoginPage + at LoginPage + page.add("admin","adminadmin") +} + +And(~'^I am at the BibTexGenerateFile page$') {-> + to BibtexGenerateFilePage + at BibtexGenerateFilePage +} + +When(~'^I click to "([^"]*)"$') {String o -> + at BibtexGenerateFilePage + page.select(o) +} + +And(~'^A BibTeX entry is "([^"]*)"$') {String entrada -> + to BibtexMainMenuPage + at BibtexMainMenuPage +} + +And(~'^I click on the other button "([^"]*)"$') {String botao -> + at BibtexMainMenuPage + page.verificarEntrada(entrada) + page.select(botao) +} + +Then(~'^I see an error message$'){-> + at BibtexMainMenuPage + assert entrada == null + to BibtexGenerateFilePage + +} +#end + +#if ($CorrectEntryOfBibtex) +Then(~'^a BibTex file is generated$'){-> + at BibtexMainMenuPage + assert true == true +} +#end diff --git a/test/cucumber/steps/ConferenciaSteps.groovy b/test/cucumber/steps/ConferenciaSteps.groovy index f11e0542..36846b0d 100644 --- a/test/cucumber/steps/ConferenciaSteps.groovy +++ b/test/cucumber/steps/ConferenciaSteps.groovy @@ -144,4 +144,100 @@ And(~'^the conferencias are not stored by the system$') {-> at ConferenciaPage page.checkIfConferenciaListIsEmpty() -} \ No newline at end of file +} + + +Given(~'^I'm registering a new Article$') {String authorName -> + at articleResgitrationPage + page.fillArticleAuthorName(authorName, null) +} + +When(~'^I type "([^"]*)" if there author names as "([^"]*)" or "([^"]*)" registered in the system) { String authorName -> + page.fillArticleAuthorName(ArticleTestDataAndOperations.path() + authorName) + at page.fillArticleAuthorName.suggest("([^"]*)" for aurthorName) +} + +Then(~'^I choose between " Anderso " and " Candido " or if it is not neither I fill with the desired name) { String authorName -> + at page.fillArticleAuthorName("([^"*])" or type "authorName") +} + + +Given(~'^I want to remove the article "([^"]*)" with the file name "([^"]*)") { String title, filename -> + + ArticleTestDataAndOperations.createArticle(title, filename,null,null) + assert Periodico.findByTitle(title) != null +} + +When(~'^I click on "([^"]*)" that is on the list of articles published in the conference page) { String title -> + ArticleTestDataAndOperations.removeArticles(title) + + def testDeleteArticle1 = Periodico.findByTitle(title) + assert testDeleteArticle == null +} + +Then(~'^I click the button to remove and the "A theory of software" is removed from the list of articles) { string title -> + assert periodicoNoExist(title) +} +And(~'^the aquirvo "ATOS.pdf" is removed from the system) {String fileName -> + assert fileNoExist(fileName) +} + + + +/* +Given(~'^I am at the Conferece Articles page$') {-> + to LoginPage + at LoginPage + page.fillLoginData("admin","adminadmin") + at ConferenciaPage +} +And(~'^the system has some conference articles authored by "([^"]*)", among several publications$') { String author -> + article = TestDataAndOperationsPublication.containsUser(author) + assert article != null +} +When(~'^I write "([^"]*)" at the Search field$') { String author -> + at ConferenciaPage + page.fillSearch(author) +} +And (~'^I click on the Search button$'){ + page.select("search") +} +Then (~'^a list of all conference articles by "([^"]*)" is displayed$'){ String author -> + author = TestDataAndOperationsPublication.containsUser(author) + assert author != null + page.listConferenceArticles(author) +} + +Given(~'^I am at the Conference page$'){ + to LoginPage + at LoginPage + page.fillLoginData("admin","adminadmin") + at ConferenciaPage + } +And(~'^an Author named "([^"]*)" had published the articles "([^"]*)", "([^"]*)" and "([^"]*)" for the conferences "([^"]*)", "([^"]*)" and "([^"]*)"$'){ String author -> + assert Conferencia.findByTitle("International Conference on Software Engineering") != null + assert Conferencia.findByTitle("Information and Software Technology") != null + assert Conferencia.findByTitle("Scenario: Search for conferences which an Author have published web") != null + assert ArticleTestDataAndOperations.findArticleByTitle("An Analysis and Survey of the Development of Mutation Testing") != null + assert ArticleTestDataAndOperations.findArticleByTitle("A Systematic Survey of Program Comprehension through Dynamic Analysis") != null + assert ArticleTestDataAndOperations.findArticleByTitle("Engineering Privacy") != null + author = TestDataAndOperationsPublication.containsUser(author) + assert author != null +} +When(~'^I write ([^"]*)" at the search field$') { String author -> + at ConferenciaPage + page.fillSearch(author) +} +And(~'^I click on the search button$'){ + page.select("search") +} +Then(~'^a list of all conferences, composed by "([^"]*)", "([^"]*)" and "([^"]*)", that "([^"]*)" published an article is displayed$') { String author -> + assert ArticleTestDataAndOperations.findArticleByTitle("An Analysis and Survey of the Development of Mutation Testing") != null + assert ArticleTestDataAndOperations.findArticleByTitle("A Systematic Survey of Program Comprehension through Dynamic Analysis") != null + assert ArticleTestDataAndOperations.findArticleByTitle("Engineering Privacy") != null + author = TestDataAndOperationsPublication.containsUser(author) + assert author != null + page.listConferencia(author) +} +*/ + diff --git a/test/cucumber/steps/ReportsSteps.groovy b/test/cucumber/steps/ReportsSteps.groovy index ff682686..0a4b29f4 100644 --- a/test/cucumber/steps/ReportsSteps.groovy +++ b/test/cucumber/steps/ReportsSteps.groovy @@ -1,6 +1,7 @@ import pages.Conferencia.ConferenciaCreatePage import pages.Conferencia.ConferenciaPage import pages.LoginPage +import pages.ResearchGroup.ResearchGroupCreatePage import pages.member.MemberListPage import pages.member.MemberPage import pages.member.MemberCreatePage @@ -10,6 +11,9 @@ import pages.Report.ReportHTMLPage import pages.ResearchGroup.ResearchGroupPage import pages.ResearchGroup.ResearchGroupListPage import pages.ResearchGroup.ResearchGroupShowPage +import rgms.member.Member +import rgms.member.ResearchGroup +import rgms.member.ResearchGroupController import static cucumber.api.groovy.EN.* @@ -204,6 +208,208 @@ When(~'^I can fill the Conferencia details$') {-> //--------------------------------------------------------------------------------------------------- +#if ($createanewresearchgroup) + Given(~'^I am at the publications menu page$') { -> + to LoginPage + at LoginPage + page.add("admin","adminadmin") + at PublicationsPage + } + +When(~'^I select the "([^"]*)" option at the publications menu page$') { String option -> + at PublicationsPage + page.select(option) +} + +And(~'^I select the "New Research Group" option at research group list page$') { -> + at ResearchGroupListPage + page.select("create") +} + +Then(~'^I can fill the field "Nome" with value "([^"]*)"$') { String field, String name -> + at ResearchGroupCreatePage + page.fillResearchGroupName(name) +} + +And(~'I can fill the field "Twitter" with value "([^"]*)"$') { String field, String twitter -> + at ResearchGroupCreatePage + page.fillResearchGroupTwitter(twitter) +} + +And(~'^I can fill the field "Descrição" with value "([^"]*)"$') { String field, String description -> + at ResearchGroupCreatePage + page.fillResearchGroupDescription(description) +} + +And(~'^I can fill the field "Sigla" with value "([^"]*)"$') { String field, String sigla -> + at ResearchGroupCreatePage + page.fillResearchGroupSigla(sigla) +} + +And(~'^I select a member "([^"]*)" at member list') { String memberId -> + at ResearchGroupCreatePage + page.selectMember(memberId) + page.clickOnCreate() +} + +Then(~'^I should see the new research group named "([^"]*)" in Research Group list$') { String groupName -> + at ResearchGroupPage + assert page.findByName(groupName) != null /* Checando se o grupo foi criado */ +} + +#end + +//--------------------------------------------------------------------------------------------------- + +#if ($invalidvalueinfielderrorwhencreatinganewMember) +// invalid value in field error when creating a new Member + Given(~'^I am at the Member list page$') { -> + to MemberListPage + at MemberListPage + } + +When(~'^I select the "([^"]*)" option$') { String option -> + at MemberListPage + page.getMenuOption(option) +} + +And(~'^I can fill a field with an invalid value "([^"]*)"') { String value -> + at MemberCreatePage + page.fillMemberDetails(value) +} + +And(~'^I select "([^"]*)" option') { String value -> + at MemberCreatePage + page.clickOnCreate() +} + +Then(~'^I should see an error message'){ -> + at MemberListPage +} + +#end + +//--------------------------------------------------------------------------------------------------- + +//created by marcio mendes github: marciojr + +//if ($createanewMember) + + Given(~'^I am at the Member menu page$') { -> + to LoginPage + at LoginPage + page.add("admin","adminadmin") + to MemberPage + } + +When(~'^I select the "New Member" option$') { -> + at MemberPage + MemberPage.select("create") + to MemberCreatePage +} + +And(~'^I can fill the Member "Name" with "([^"]*)"$') { String field, String name, String username, String email, String university -> + at MemberCreatePage + MemberCreatePage.fillSomeMemberDetails(name,username,email,university) + // all fields was created and the input "create" was called on the fillSomeMem... methods +} + +Then(~'^I should see the new user at the Member list$') { String MemberName -> + at MemberPage +} + +//end + +//----------------------------------------------------------------------------------------------------------------------------------------------------- + +// created by marcio mendes github: marciojr + +//if ($export a existent research group report to html) + + Given(~'^I am at the Research Group List page$') { -> + to LoginPage + at LoginPage + page.add("admin","adminadmin") + to ResearchGroupListPage + } + +When(~'^I select the "([^"]*)" option at the Research Group List$') { String name -> + at ResearchGroupListPage + ResearchGroupListPage.selectResearchGroup(name) +} + +And(~'^I select the option "([^"]*)" at the research group show$') { String name-> + at ResearchGroupListPage + ResearchGroupShowPage.checkHtml(name) // check if there is the name created +} + +Then(~'^I export a html report about resourch group "([^"]*)"$') { -> + at ResearchGroupListPage + ResearchGroupController.show() // show html using the own params.id +} + +//end + +//----------------------------------------------------------------------------------------------------------------------------------------------------- +//if ($missing field error when creating a new Member) + +Given(~'^I am at the Member list page$'){ -> + at MemberListPage +} + +When(~'^I select the Novo Member option$') { -> + to MemberCreatePage +} + +And(~'^I dont fill a field with * symbol$'){ -> + assert (page.name.value() != null && + page.username.value() != null && + page.email.value() != null && + page.university.value() != null) +} + +And(~'^I can select Criar option$'){ -> + page.select("create") +} + +Then(~'^I can see a error message$'){ -> + assert (page.readFlashMessage() != null) +} + +//----------------------------------------------------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------------------------------------------------------- +//if ($missing field error when creating a research group) + + +Given(~'^I am at the publications menu$'){ -> + at PublicationsPage +} + +When(~'^I select the "Research Group" option at the publications menu') { -> + to ResearchGroupListPage +} + +And(~'^I select the new research group option at research group list page'){-> + to ResearchGroupCreatePage +} + +And(~'^I dont fill a field with * symbol$'){ -> + assert (page.name.value() != null && + page.twitter.value() != null && + page.description.value() != null) +} + +And(~'^I can select Criar option$'){ -> + page.select("create") +} + +Then(~'^I can see a error message$'){ -> + assert (page.readFlashMessage() != null) +} +//----------------------------------------------------------------------------------------------------------------------------------------------- + + +//------------------------------------------------------------------------- def Login(String user, String password) { to LoginPage at LoginPage diff --git a/test/cucumber/steps/XMLImportSteps.groovy b/test/cucumber/steps/XMLImportSteps.groovy index df70dccb..e513eaf0 100644 --- a/test/cucumber/steps/XMLImportSteps.groovy +++ b/test/cucumber/steps/XMLImportSteps.groovy @@ -6,7 +6,12 @@ import pages.LoginPage import pages.OrientationPages.OrientationsPage import pages.XMLImportPage import pages.ferramenta.FerramentaPage +import rgms.member.Orientation import rgms.publication.* +import steps.OrientationTestDataAndOperations +import steps.TestDataAndOperationsPublication +import steps.TestDataDissertacao + import static cucumber.api.groovy.EN.* import steps.TestDataAndOperations import CommonSteps @@ -104,4 +109,54 @@ And(~'^the publications are not stored by the system$') {-> to OrientationsPage at OrientationsPage page.checkIfOrientationListIsEmpty() +} + +Given(~'^the system has a dissertation entitled "([^"]*)" stored$') { String title-> + TestDataDissertacao.createDissertacao(title, "dissertation.txt", "University of Oxford") + def dissertation = Dissertacao.findByTitle(title); + assert dissertation != null +} + +And(~'^the similarity tolerance is configured to "([^"]*)"$') { int similarityTolerance-> + TestDataDissertacao.setSimilarityTolerance(similarityTolerance) +} + +When(~'^I upload the file "([^"]*)" which contains a dissertation entitled "([^"]*)"$') { String filename, title-> + + String path = new File(".").getCanonicalPath() + File.separator + "test" + File.separator + "functional" + File.separator + "steps" + File.separator + filename + TestDataDissertacao.uploadDissertacaoWithSimilarityAnalisys(path) + boolean result = TestDataDissertacao.verifyDissertationXML(title, path) + assert result + +} + +Then(~'^the system outputs a list of imported dissertations which contains the dissertation entitled "([^"]*)"$') { String title-> + def dissertation = Dissertacao.findByTitle(title) + assert dissertation != null +} + +And(~'^no new dissertation entitled "([^"]*)" is stored by the system$') { String title-> + def dissertation = Dissertacao.findByTitle(title) + assert dissertation == null +} + +Given(~'^I am at the XMLImport Page$') {-> + to LoginPage + at LoginPage + page.fillLoginData("admin", "adminadmin") + to XMLImportPage + at XMLImportPage +} + +And(~'^I select a xml file$') { -> + page.selectFile() +} + +When(~'^I click on "upload" without informing the tolerance level$') { -> + page.uploadClick() +} + +Then(~'^the system outputs an error message$') { -> + //qualquer navegador por padrão mostra uma mensagem de erro quando o atributo "required" está configurado + assert page.isRequiredEnabledOnToleranceSelect() } \ No newline at end of file diff --git a/test/files/cv-duplicatedOrientationC.xml b/test/files/cv-duplicatedOrientationC.xml new file mode 100755 index 00000000..8be42eea --- /dev/null +++ b/test/files/cv-duplicatedOrientationC.xml @@ -0,0 +1,3092 @@ + + + + + + + + + + + + + + + + + + + + + + Theorem Proving and Algebra + Algebraic Semantics + + + + + + + + + + + + + + + + + + + + + + + + + + + Introduo a Programao (Orientada a Objetos com + Java) + + Programao Orientada a Objetos (e Java) + Engenharia de Software + Trabalho de Graduao em Engenharia de Software + + + + Paradigmas de Linguagens de Programao + Especificao de Sistemas Distribudos + Trabalho Individual em Engenharia de Software + + Introduo ao RUP--Rational Unified Process + Mtodos Formais + Programao Orientada a Objetos com AspectJ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/functional/pages/BibTexMainMenuPage.groovy b/test/functional/pages/BibTexMainMenuPage.groovy new file mode 100644 index 00000000..b37649d7 --- /dev/null +++ b/test/functional/pages/BibTexMainMenuPage.groovy @@ -0,0 +1,31 @@ +package pages + +import geb.Page + +/** + * Created by Luís Delgado on 18/04/15. + */ +class BibTexMainMenuPage extends Page { + static url = "/bibtexmainmenu/home" + + static at = { + title ==~ /Member Listagem/ + } + + static content = { + bibTexEntry { + $("textarea", id: "bibtextManual") + } + buttonEntry { + $("input", id: "botao") + } + } + + def verificarEntrada(String bibtexManual){ + $(id: "bibtextManual").value() + } + + def select(String s) { + $(id: "botao").find('b', text: s).click() + } +} diff --git a/test/functional/pages/BibtexGenerateFilePage.groovy b/test/functional/pages/BibtexGenerateFilePage.groovy index 6ac1baca..ed3ec87d 100644 --- a/test/functional/pages/BibtexGenerateFilePage.groovy +++ b/test/functional/pages/BibtexGenerateFilePage.groovy @@ -19,4 +19,12 @@ class BibtexGenerateFilePage extends FormPage { def showBibtex() { $('a.Generate All BibTex').click() } -} + + def verificarEntrada(String entrada) { + + } + + def select(String s) { + $('div', id: 'status').find('a', text: s).click() + } +} \ No newline at end of file diff --git a/test/functional/pages/PublicationsPage.groovy b/test/functional/pages/PublicationsPage.groovy index 1607747c..f63eaac9 100644 --- a/test/functional/pages/PublicationsPage.groovy +++ b/test/functional/pages/PublicationsPage.groovy @@ -22,4 +22,8 @@ class PublicationsPage extends Page { def getLink(String linkName) { $('div#status a', text: linkName) } + + def verificarEntrada(String entrada) { + + } } diff --git a/test/functional/pages/ResearchGroup/ResearchGroupCreatePage.groovy b/test/functional/pages/ResearchGroup/ResearchGroupCreatePage.groovy index 77266b93..129a6717 100644 --- a/test/functional/pages/ResearchGroup/ResearchGroupCreatePage.groovy +++ b/test/functional/pages/ResearchGroup/ResearchGroupCreatePage.groovy @@ -18,6 +18,22 @@ class ResearchGroupCreatePage extends Page { $("form").description = "A research group called " + name } + def fillResearchGroupName(String name) { + $("form").name = name + } + + def fillResearchGroupTwitter(String twitter) { + $("form").twitter = twitter + } + + def fillResearchGroupDescription(String description) { + $("form").description = description + } + + def fillResearchGroupSigla(String sigla) { + $("form").sigla = sigla + } + def clickOnCreate() { $("input", name: "create").click() } diff --git a/test/functional/pages/ResearchGroup/ResearchGroupListPage.groovy b/test/functional/pages/ResearchGroup/ResearchGroupListPage.groovy index 9ad36b2c..9b78ed35 100644 --- a/test/functional/pages/ResearchGroup/ResearchGroupListPage.groovy +++ b/test/functional/pages/ResearchGroup/ResearchGroupListPage.groovy @@ -15,6 +15,10 @@ class ResearchGroupListPage extends Page { static content = { } + def select(String s) { + $('div', id: 'status').find('a', text: s).click() + } + def selectResearchGroup(String s) { $('div').find('a', text: s).click() } diff --git a/test/functional/pages/XMLImportPage.groovy b/test/functional/pages/XMLImportPage.groovy index 49ee322d..bf3cf6f1 100644 --- a/test/functional/pages/XMLImportPage.groovy +++ b/test/functional/pages/XMLImportPage.groovy @@ -2,6 +2,7 @@ package pages import geb.Page + /** * User: Raony Benjamim [RBAA] * Date: 29/08/13 @@ -20,6 +21,11 @@ class XMLImportPage extends Page { title ==~ currentTitle } + static content = { + readFlashMessage(){ $("div .message").text() } + readErrorsMessage() { $("div.errors").text() } + } + def selectButton(String name) { $('form').find('a', text: name).click() } @@ -27,4 +33,16 @@ class XMLImportPage extends Page { def uploadWithoutFile(){ $('input.save').click() } + + def selectFile(){ + $("fileInput").value("C:\\fakepath\\curriculo5.xml") + } + + def uploadClick(){ + $('input.save').click() + } + + boolean isRequiredEnabledOnToleranceSelect(){ + return $("#toleranceSelect").getAttribute("required") + } } diff --git a/test/functional/steps/TestDataAndOperationsMembers.groovy b/test/functional/steps/TestDataAndOperationsMembers.groovy new file mode 100644 index 00000000..27e7968d --- /dev/null +++ b/test/functional/steps/TestDataAndOperationsMembers.groovy @@ -0,0 +1,55 @@ +package steps + +import rgms.member.ResearchGroup +import rgms.member.ResearchGroupController + +/** + * Created with IntelliJ IDEA. + * User: Alberto Junior + * Date: 27/08/13 + * Time: 21:43 + * To change this template use File | Settings | File Templates. + */ +class TestDataAndOperationsMembers { + + static public void createResearchGroup(String name, description) { + def researchGroupController = new ResearchGroupController() + researchGroupController.params << [name: name] << [description: description] + researchGroupController.request.setContent(new byte[1000]) // Could also vary the request content. + researchGroupController.create() + researchGroupController.save() + researchGroupController.response.reset() + } + + static public void editResearchGroup(def researchGroup, String newName, String newDescription) { + def researchGroupController = new ResearchGroupController() + researchGroupController.params << [name: newName] << [description: newDescription] << [id: researchGroup.getId()] + researchGroupController.request.setContent(new byte[1000]) // Could also vary the request content. + researchGroupController.edit() + researchGroupController.save() + researchGroupController.response.reset() + } + + //#if($researchGroupHierarchy) + static public void editResearchGroupChildOf(ResearchGroup researchGroup, ResearchGroup researchGroupParent) { + def researchGroupController = new ResearchGroupController() + researchGroupController.params << [name: researchGroup.name] + researchGroupController.params << [description: researchGroup.description] + researchGroupController.params << [id: researchGroup.id] + researchGroupController.params << [childOf: researchGroupParent] + researchGroupController.request.setContent(new byte[1000]) // Could also vary the request content. + + try { + researchGroupController.update() + } catch (Exception e) {} + } + //#end + + static public void deleteResearchGroup(def researchGroup) { + def researchGroupController = new ResearchGroupController() + researchGroupController.params << [id: researchGroup.getId()] + researchGroupController.request.setContent(new byte[1000]) // Could also vary the request content. + researchGroupController.delete() + researchGroupController.response.reset() + } +} diff --git a/test/functional/steps/TestDataDissertacao.groovy b/test/functional/steps/TestDataDissertacao.groovy index a7e034fa..67496101 100644 --- a/test/functional/steps/TestDataDissertacao.groovy +++ b/test/functional/steps/TestDataDissertacao.groovy @@ -51,6 +51,14 @@ class TestDataDissertacao cont.response.reset() } + static public void uploadDissertacaoWithSimilarityAnalisys(filename) { + def cont = new XMLController() + def xml = new File(filename); + def records = new XmlParser() + cont.saveDissertationsWithSimilarityAnalisys(records.parse(xml)); + cont.response.reset() + } + static public void removeDissertacao(String title) { def testDissertation = Dissertacao.findByTitle(title) def cont = new DissertacaoController() @@ -59,4 +67,19 @@ class TestDataDissertacao cont.delete() } + static public void setSimilarityTolerance(int value) + { + XMLController.similarityTolerance = value + } + + static public boolean verifyDissertationXML(String title, String filename) + { + def cont = new XMLController() + def xml = new File(filename); + def records = new XmlParser() + boolean result = cont.verifyDissertations(title, records.parse(xml)); + cont.response.reset() + return result; + } + } \ No newline at end of file diff --git a/test/functional/steps/curriculo5.xml b/test/functional/steps/curriculo5.xml new file mode 100644 index 00000000..e9a18056 --- /dev/null +++ b/test/functional/steps/curriculo5.xml @@ -0,0 +1 @@ +Algebraic SemanticsTheorem Proving and AlgebraEngenharia de SoftwareIntroduo a Programao (Orientada a Objetos com Java)Programao Orientada a Objetos (e Java)Trabalho de Graduao em Engenharia de SoftwareEspecificao de Sistemas DistribudosIntroduo ao RUP--Rational Unified ProcessMtodos Formais (Especificaes Algbricas)Novos Conceitos de Modularidade de SoftwareParadigmas de Linguagens de ProgramaoProgramao Orientada a Aspectos com AspectJTrabalho Individual em Engenharia de SoftwareProgramao Orientada a Objetos (e Java)Orientao a Objetos com Java e J2ME (dezembro de 2002 e janeiro de 2003, junho e julho de 2003, janeiro e fevereiro de 2004, outubro de 2004, janeiro e fevereiro de 2005, junho e julho de 2005, maro de 2006, setembro e outubro de 2006, abril de 200Engenharia de Software (Programa de Capacitao Tecnolgica da Motorola)Introduo e Administrao de Sistemas UNIX (Extenso para a FISEPE)Orientao a Objetos e Java (InfoCampus, UFPE)Programming, Testing and Distribution with Java (Summer School on Object-Oriented Processes and Technologies) \ No newline at end of file