Skip to content

Commit

Permalink
Merge do pull request spgroup#254
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloborba committed Feb 4, 2014
1 parent 6dc10b1 commit 0007fd8
Show file tree
Hide file tree
Showing 27 changed files with 1,406 additions and 280 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ target/test-reports/plain/TEST-functional-cucumber-Visit.txt

.idea/*

target/test-reports/*

target/test-reports/TEST-functional-cucumber-orientations.xml

target/test-reports/html/11_orientations.html
Expand All @@ -441,3 +443,5 @@ target/test-reports/plain/TEST-functional-cucumber-orientations-err.txt
target/test-reports/plain/TEST-functional-cucumber-orientations-out.txt

target/test-reports/plain/TEST-functional-cucumber-orientations.txt


Binary file modified chromedrivers/chromedriverwindows.exe
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
package rgms.publication

import org.apache.shiro.SecurityUtils
import org.springframework.dao.DataIntegrityViolationException
//#if($XMLUpload && $BookChapter)
import rgms.XMLService
//#end
import org.xml.sax.SAXParseException
import rgms.authentication.User
import rgms.member.Member


class BookChapterController {

static allowedMethods = [save: "POST", update: "POST", delete: "POST"]
AuxiliarController aux = new AuxiliarController()
AuxiliarController aux = new AuxiliarController()

def index() {
redirect(action: "list", params: params)
Expand All @@ -34,7 +25,7 @@ class BookChapterController {

def save() {
def bookChapterInstance = new BookChapter(params)
PublicationController pb = new PublicationController()
PublicationController pb = new PublicationController()
if (!pb.upload(bookChapterInstance) || !bookChapterInstance.save(flush: true)) {
render(view: "create", model: [bookChapterInstance: bookChapterInstance])
return
Expand All @@ -47,10 +38,11 @@ class BookChapterController {
flash.message = message(code: 'default.created.message', args: [message(code: 'bookChapter.label', default: 'BookChapter'), bookChapterInstance.id])
redirect(action: "show", id: bookChapterInstance.id)
}

def accessBookChapter(Long id) {
def bookChapterInstance = BookChapter.get(id)
boolean isReturned = aux.check(id, bookChapterInstance, 'bookChapter.label', 'BookChapter');
if(!isReturned){
if (!isReturned) {
[bookChapterInstance: bookChapterInstance]
}
}
Expand All @@ -66,10 +58,10 @@ class BookChapterController {
def update(Long id, Long version) {
def bookChapterInstance = BookChapter.get(id)
boolean isReturned = aux.check(id, bookChapterInstance, 'bookChapter.label', 'BookChapter')
if(!isReturned){
if (!isReturned) {
if (version != null && bookChapterInstance.version > version) {
outdatedVersionError((BookChapter) bookChapterInstance)
}else{
} else {
saveUpdate((BookChapter) bookChapterInstance)
}
}
Expand All @@ -82,7 +74,7 @@ class BookChapterController {
render(view: "edit", model: [bookChapterInstance: bookChapterInstance])
}

def saveUpdate(BookChapter bookChapterInstance){
def saveUpdate(BookChapter bookChapterInstance) {
bookChapterInstance.properties = params
if (!bookChapterInstance.save(flush: true)) {
render(view: "edit", model: [bookChapterInstance: bookChapterInstance])
Expand All @@ -92,8 +84,10 @@ class BookChapterController {
}
}

def delete(Long id) {
def bookChapterInstance = BookChapter.get(id)
aux.delete(id, bookChapterInstance, 'bookChapter.label', 'BookChapter');
}
def delete(Long id) {
def bookChapterInstance = BookChapter.get(id)
aux.delete(id, bookChapterInstance, 'bookChapter.label', 'BookChapter');
}


}
21 changes: 11 additions & 10 deletions grails-app/domain/rgms/member/Orientation.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,23 @@ class Orientation {
String instituicao
String curso


static constraints = {
tipo(nullable: false, blank: false, inList: ["Mestrado","Doutorado","Iniciação Científica"])
tipo(nullable: false, blank: false, inList: ["Mestrado", "Doutorado", "Iniciação Científica"])
orientando(nullable: false)
orientador(nullable: false)
tituloTese(nullable: false, blank: false,unique: true)
anoPublicacao(nullable: false)
tituloTese(nullable: false, blank: false, unique: true)
anoPublicacao(nullable: false, min: 0)
instituicao(nullable: false, blank: false)
curso(nullable: true)
}

boolean Equals(Orientation other)
{
boolean Equals(Orientation other) {
return (other != null && this.anoPublicacao == other.anoPublicacao
&& this.orientador == other.orientador
&& this.orientando == other.orientando
&& this.tipo == other.tipo
&& this.tituloTese == other.tituloTese)
&& this.orientador == other.orientador
&& this.orientando == other.orientando
&& this.tipo == other.tipo
&& this.tituloTese == other.tituloTese)
}
}
//#end
//#end
8 changes: 4 additions & 4 deletions grails-app/domain/rgms/publication/BookChapter.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ package rgms.publication
class BookChapter extends Publication {

String publisher
int chapter
int chapter

static constraints = {
publisher nullable: false, blank: false
chapter nullable: false, blank: false, min: 1
publisher nullable: false, blank: false, unique: ['title', 'file', 'chapter']
chapter nullable: false, blank: false, min: 1
}

//#if($Bibtex)
Expand Down
15 changes: 12 additions & 3 deletions test/cucumber/BookChapter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,33 @@ Feature: BookChapter

Scenario: register book chapter with invalid data
Given I am at the book chapter page
And I select the Novo BookChapter option at the book chapter page
And I select the new book chapter option at the book chapter page
And I fill only the title field with the value "Next Generation Software Product Line Engineering"
Then A failure message is displayed
And I still on the book chapter create page

Scenario: new book chapter web
Given I am at the book chapter page
And the system has no book chapter entitled "Next Generation Software Product Line Engineering"
When I go to NewBookChapter page
When I go to new book chapter page
And I use the webpage to create the book chapter "Next Generation Software Product Line Engineering" with file name "Ngs.pdf"
Then the book chapter "Next Generation Software Product Line Engineering" was stored by the system
And it is shown in the book chapter list with title "Next Generation Software Product Line Engineering"

#4
Scenario: new duplicate book chapter web
Given I am at the book chapter page
And the system has a book chapter entitled "Next Generation Software Product Line Engineering" with file name "Ngs.pdf"
When I go to new book chapter page
And I use the webpage to create the book chapter "Next Generation Software Product Line Engineering" with file name "Ngs.pdf"
Then the book chapter "Next Generation Software Product Line Engineering" is not stored twice
And the system shows an error message

#if ($contextualInformation)

Scenario: new book chapter filled with user data by default
Given I am at the book chapter page
And I select the Novo BookChapter option at the book chapter page
And I select the new book chapter option at the book chapter page
Then I see my user listed as a member of book chapter by default
#end

Expand Down
92 changes: 63 additions & 29 deletions test/cucumber/Orientation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,78 @@ Feature: orientations
so that I can generate web pages and reports containing these orientations

Scenario: new orientation
Given the system has no orientations entitled "The Book is on the table 2"
When I create an orientation for the thesis "The Book is on the table 2"
Then the orientation "The Book is on the table 2" is properly stored by the system
Given the system has no orientations entitled "The Book is on the table"
When I create a new orientation entitled "The Book is on the table"
Then the orientation "The Book is on the table" is properly stored by the system

Scenario: remove existing orientation
Given the system has thesis entitled "The Book is on the table" supervised by someone
Given the system has an orientation entitled "The Book is on the table" supervised by someone
When I delete the orientation for "The Book is on the table"
Then the orientation for "The Book is on the table" is properly removed by the system

Scenario: create orientation web
Given I am at the create orientation page
When I fill the orientation title with "The Book is on the table"
Then I am on the orientation show page
When I fill the orientation title with "The Book of Web Software"
And I select the list orientation option
Then the orientation "The Book of Web Software" is properly stored by the system

Scenario: edit existing orientation web
Given I am at the orientation page and the orientation "The Book is on the table" is stored in the system
When I select to view orientation "The Book is on the table" in resulting list
And I change the orientation tituloTese to "Hexa"
And I select the "Alterar" option
Then I am on the orientation show page
Given I am at the orientation page
And the orientation "The Book of Software Engineering" is stored in the system
When I select to view orientation "The Book of Software Engineering" in resulting list
And I change the orientation title to "Hexa"
And I select the change option at the orientation edit page
Then the edited orientation "Hexa" is properly stored by the system

#1 This scenario test are not working well, please check they implementation before undo the comment

#Scenario: new orientation with registered member orientated
# Given the system has no orientations entitled "The Book is on the table 2"
# And Exists a member "Rubens Lopes" with username "rlfs" that has been an registered member
#When I create a orientation for the thesis "The Book is on the table 2" with registered member "rlfs"
#Then the orientation "The Book is on the table 2" is properly stored by the system


#2
Scenario: duplicate orientation
Given the system has an orientation entitled "The Book is on the table" supervised by someone
When I create a new orientation entitled "The Book is on the table"
Then the orientation for the thesis "The Book is on the table" is not stored twice

Scenario: create duplicated orientation
#3
Scenario: create orientation web with invalid year
Given I am at the create orientation page
And the system has thesis entitled "The Book is on the table" supervised by someone
When I fill the orientation title with "The Book is on the table"
Then I am on the orientation show page with the error message

#if ($XMLUpload)
Scenario: upload orientation with a file
Given the system has some orientations stored
When I upload a new orientation "testelattes.xml"
Then the system has more orientations now

Scenario: upload orientations with a file
Given I am at the publications menu
When I select the "Orientation" option at the program menu
And I select the upload button at the orientations page
Then I'm still on orientations page
And the orientations are not stored by the system
#end
When I fill the orientation title with "The Book is on the table" and the year with -1
Then I am still on the create orientation page with an error message

#5
Scenario: edit existing orientation web with invalid year
Given I am at the orientation page
And the orientation "The Book is on the table" is stored in the system
When I select to view orientation "The Book is on the table" in resulting list
And I change the orientation title to "Hexa"
And I fill the orientation publication year with -1
And I select the change option at the orientation edit page
Then I am still on the change orientation page with an error message

#9 extra
Scenario: remove orientation web
Given I am at the orientation page
And the orientation "Hexa2" is stored in the system
When I select to view "Hexa2" in the list of orientations
And I select the option remove at the orientation show page
Then The orientation "Hexa2" is properly removed by the system

#if ($XMLUpload)
Scenario: upload orientation with a file
Given the system has some orientations stored
When I upload a new orientation "testelattes.xml"
Then the system has more orientations now

Scenario: upload orientations with a file
Given I am at the publications menu
When I select the "Orientation" option at the program menu
And I select the upload button at the orientations page
Then I'm still on orientations page
And the orientations are not stored by the system
#end
17 changes: 15 additions & 2 deletions test/cucumber/Thesis.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
Feature: Thesis Tests
As a member of a research group
I want to add, remove and modify theses I have added

Scenario: new thesis duplicated
Given The thesis "Thesis duplicated" is stored in the system with file name "Thesisduplicated.txt"
When I create the thesis "Thesis duplicated" with file name "Thesisduplicated2.txt" and school "UFPE"
Then The thesis "Thesis duplicated" is not stored twice

Scenario: new thesis
Given The system has no thesis entitled "New thesis"
When I create the thesis "New thesis" with file name "Newthesis.txt" and school "UFPE"
Then The thesis "New thesis" is properly stored by the system

#6
Scenario: remove existing thesis
Given the system has thesis entitled "New thesis2"
When I delete the thesis "New thesis2"
Then the thesis "New thesis2" is properly removed by the system

Scenario: create thesis web
Given I am at the create thesis page
When I fill the thesis details with "Software Engineering", "10", "8", "1998", "UFPE" and "Recife"
Expand All @@ -24,6 +30,13 @@ Feature: Thesis Tests
When I fill some thesis details with "Tese002", "10", "8", "1998", "UFPE" and "Recife"
Then I am still on the create thesis page with the error message

#7
Scenario: remove existing thesis web
Given I am at the thesis page and the thesis "Software Enginnering2" is stored in the system
When I select to view thesis "Software Enginnering2" in resulting list
And I select the remover option at the thesis show page
Then the thesis "Software Enginnering2" is removed from the system

#if ($contextualInformation)
Scenario: Add a new thesis with user data already filled by default
Given I am at the publications menu
Expand Down
Loading

0 comments on commit 0007fd8

Please sign in to comment.