-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refatorization #342
base: master
Are you sure you want to change the base?
Refatorization #342
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,11 @@ class TeseController extends ThesisOrDissertationController { | |
} | ||
|
||
def save() { | ||
saveThesisOrDissertation("Tese", params) | ||
String file = params['file'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VDDM: Implementação da issue #156 , atualmente apenas formatos do tipo doc e pdf. |
||
def format = file.substring(file.indexOf('.')+1,file.size()) | ||
if(format == 'doc' || format == 'pdf') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (mfl3) Aqui não seria melhor criar um método genérico para validar o formato do arquivo? E se no futuro for necessário alterar a definição de "formato válido" (e.g se eu passar a aceitar arquivos no formato .odt)? |
||
saveThesisOrDissertation("Tese", params) | ||
} | ||
} | ||
|
||
def show() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,8 +35,11 @@ class ThesisOrDissertationController { | |
|
||
def saveThesisOrDissertation(String thesisOrDissertation, params) { | ||
//noinspection GroovyAssignabilityCheck | ||
def instance = getClassByName(thesisOrDissertation).newInstance(params) | ||
PublicationController pb = new PublicationController() | ||
def instance = null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VDDM: Código mais claro There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (mfl3) Tem dois trechos de código com "if(thesisOrDissertation == 'Tese')". Uma possível melhora seria colocá-los em um único if. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Que tipo de refatoração é essa? |
||
if(thesisOrDissertation == 'Tese') | ||
instance = new Tese(params) | ||
else | ||
instance = new Dissertacao(params) | ||
def duplicated | ||
if (thesisOrDissertation == "Tese") { | ||
//noinspection GroovyAssignabilityCheck | ||
|
@@ -50,7 +53,10 @@ class ThesisOrDissertationController { | |
render(view: "create", model: [instance: instance]) | ||
return | ||
} | ||
if (!pb.upload(instance as Publication) || !instance.save(flush: true)) { | ||
if (!instance.save(flush: true)) { | ||
instance.errors.each { | ||
println it | ||
} | ||
render(view: "create", model: [instance: instance]) | ||
return | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,3 +83,23 @@ Feature: Ferramenta | |
And fill the others fields with valid values without Titulo | ||
Then I am still on create new ferramenta page | ||
And the ferramenta is not displayed in the ferramentas list page | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VDDM: Cenário novo implementado |
||
#if($ferramentaWithWebsite) | ||
@vddm | ||
Scenario: new ferramenta with website | ||
Given the system has no ferramenta entitled "Target" | ||
When I create the ferramenta "Target" with file name "target.pdf" with "www.targed.com" as its website | ||
Then the ferramenta "Target" is stored | ||
|
||
#if($list) | ||
@vddm | ||
Scenario: list ferramenta web | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Achei esse cenário muito grande |
||
Given I am at the publications menu | ||
When I select the "Ferramenta" option at the publications menu | ||
And I select the "create" option at the ferramenta page | ||
Then I can create a ferramenta with name "Joee" | ||
And I select the "create" option at the show page | ||
And I can create a ferramenta with name "Joee1" | ||
When I select the "list" option at the show page | ||
Then I can see all existing ferramentas in the system and the "Joee" and "Joee1" ferramentas | ||
#end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,14 @@ Feature: member | |
Given I am at the login page | ||
When I fill username and password with "admin" and "incorrectpassword" | ||
Then I am still on the login page with an error message | ||
|
||
|
||
#if($nonexisting) | ||
Scenario: login with nonexisting username | ||
Given I am at the login page | ||
When I fill username and password with "nonexistingusername" and "password" | ||
Then I am still on the login page with an error message | ||
#end | ||
|
||
Scenario: user registration | ||
Given I am at the register page | ||
When I fill the user details with a name, username, passoword1, password2, email, university, status "jose" "josesilva" "123456" "123456" "[email protected]" "UFPE" "Graduate Student" | ||
|
@@ -51,22 +58,39 @@ Feature: member | |
When I fill some user details with "jose" "josesilva" "[email protected]" "UFPE" | ||
Then I am still on the create member page with the error message | ||
|
||
Scenario: register user with invalid data | ||
#if($longUsername) | ||
Scenario: register user with long username | ||
Given I am at the create member page | ||
When I fill the user details with "jose" "josesilva" "jose@com" "UFPE" | ||
Then I am still on the create member page with the error message | ||
|
||
|
||
#Scenario: register member invalid aditional info | ||
# Given I am at the create member page | ||
# When I fill many user details with "berg" "bergU" "[email protected]" "UFPE" "ajsdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaajsdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaajsdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaajsdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaajsdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaajsdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | ||
# Then I am still on the create member page with the error message | ||
|
||
#Scenario: new member with invalid phone | ||
# Given the system has no member with username "userwithinvalidphone" | ||
# When I create a member with username "userwithinvalidphone" | ||
# Then I am still on the create member page with the error message | ||
When I fill the username with "josedmskejfjsdifejfje" | ||
Then I am still on the create member page | ||
#And a long username error message is displayed | ||
#end | ||
|
||
#if($invalidEmail) | ||
Scenario: register member with invalid email | ||
Given I am at the create member page | ||
When I fill the email with "lalala.la" | ||
Then I am still on the create member page | ||
And a invalid email error message is displayed | ||
#end | ||
|
||
#if($invalid info) | ||
Scenario: register member invalid info | ||
Given I am at the create member page | ||
When I fill city with "321" | ||
And I fill country with "123" | ||
Then I am still on the create member page | ||
And a "no numbers in city and country allowed" error message is displayed | ||
#end | ||
|
||
#if($invalidPhone) | ||
Scenario: new member with invalid phone | ||
Given I am at the create member page | ||
When I fill the phone with "camilasouto" | ||
Then I am still on the create member page | ||
And a invalid phone message is displayed | ||
#end | ||
|
||
#if ($contextualInformation) | ||
Scenario: new member filled with default data | ||
Given I am at the create member page | ||
|
@@ -75,4 +99,29 @@ Feature: member | |
Scenario: user registration with default data | ||
Given I am at the register page | ||
Then I see default data filled on register form | ||
#end | ||
#end | ||
|
||
#if($memberInfo) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VDDM: Cenário novo implementado |
||
@vddm | ||
Scenario: editing member information | ||
Given the system has member with "Victor Monteiro","rgmsTest", "[email protected]", "UFPE", "12345", "www.g.com.br", "Brazil", "Graduate Student" | ||
When I edit the "[email protected]"'s "email" for "[email protected]" | ||
Then "[email protected]"'s information is updated and saved in the system | ||
|
||
@vddm | ||
Scenario: editing member | ||
Given I am at the member page | ||
When I click the "1" member id | ||
And I Click the option "edit" on Member Edition Page | ||
And I change the member's "name" by "Victor Monteiro" | ||
Then I can see the member's name is now "Victor Monteiro" | ||
#end | ||
|
||
#if($loginfacebook) | ||
Scenario: new member with facebook account | ||
Given I am at the create member page | ||
And I am logged on "Camila Souto" facebook | ||
When I click on "register with facebook" | ||
Then the member "Camila Souto" is properly stored by the system | ||
#end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VDDM: Comentado porque não estava funcionando