Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Applying patch for user status. Rave-727
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/rave/trunk@1366203 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
ramindersingh committed Jul 26, 2012
1 parent a39aa23 commit ee3a6ff
Show file tree
Hide file tree
Showing 11 changed files with 231 additions and 155 deletions.
52 changes: 26 additions & 26 deletions rave-components/rave-jpa/src/test/resources/test_data.sql
Expand Up @@ -127,69 +127,69 @@ UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @p
-- ***********************************************************************************
--- start user data ---
set @user_id_1 = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @user_seq);
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name)
values (@user_id_1, 'canonical', '$2a$10$TkEgze5kLy9nRlfd8PT1zunh6P1ND8WPjLojFjAMNgZMu1D9D1n4.', FALSE, FALSE, TRUE,'canonical@example.com', @three_col_id, 'User', 'Canonical', 'Paul');
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, status)
values (@user_id_1, 'canonical', '$2a$10$TkEgze5kLy9nRlfd8PT1zunh6P1ND8WPjLojFjAMNgZMu1D9D1n4.', FALSE, FALSE, TRUE,'canonical@example.com', @three_col_id, 'User', 'Canonical', 'Paul', 'Single');
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @user_seq;

set @user_id_2 = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @user_seq);
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name)
values (@user_id_2, 'john.doe', '$2a$10$8Dir7boy3UyVqy6erfj6WuQXUTf.ejTldPSsVIty7.pPT3Krkly26', FALSE, FALSE, TRUE,'john.doe@example.com', @three_col_id, 'User', 'Doe', 'John');
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, status)
values (@user_id_2, 'john.doe', '$2a$10$8Dir7boy3UyVqy6erfj6WuQXUTf.ejTldPSsVIty7.pPT3Krkly26', FALSE, FALSE, TRUE,'john.doe@example.com', @three_col_id, 'User', 'Doe', 'John', 'Single');
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @user_seq;

set @user_id_3 = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @user_seq);
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name)
values (@user_id_3, 'jane.doe', '$2a$10$YP9cjZEA.gG/ng2YwTBIyucMpuiQ7Fvz0K8rOt14rIBhVwlOrh1tu', FALSE, FALSE, TRUE,'jane.doe@example.net', @three_col_id, 'User', 'Doe', 'Jane');
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, status)
values (@user_id_3, 'jane.doe', '$2a$10$YP9cjZEA.gG/ng2YwTBIyucMpuiQ7Fvz0K8rOt14rIBhVwlOrh1tu', FALSE, FALSE, TRUE,'jane.doe@example.net', @three_col_id, 'User', 'Doe', 'Jane', 'Single');
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @user_seq;

set @user_id_4 = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @user_seq);
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, forgotPasswordHash)
values (@user_id_4, 'george.doe', '$2a$10$0bcOUkQgAwE/qmdc1NcUveNzx/IYIcOUu4ydyT8DEicTCxGJF/vcW', FALSE, FALSE, TRUE,'george.doe@example.org', @three_col_id, 'User', 'Doe', 'George', 'ABC123');
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, status, forgotPasswordHash)
values (@user_id_4, 'george.doe', '$2a$10$0bcOUkQgAwE/qmdc1NcUveNzx/IYIcOUu4ydyT8DEicTCxGJF/vcW', FALSE, FALSE, TRUE,'george.doe@example.org', @three_col_id, 'User', 'Doe', 'George', 'Single', 'ABC123');
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @user_seq;

set @user_id_5 = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @user_seq);
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name)
values (@user_id_5,'mario.rossi', '$2a$10$HZ6WHAKQCs8waLooL98l6.fLzwh3D8u/V0.UebIjojawfXJhX1DQ2', FALSE, FALSE, TRUE,'mario.rossi@example.com', @three_col_id, 'User', 'Rossi', 'Mario');
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, status)
values (@user_id_5,'mario.rossi', '$2a$10$HZ6WHAKQCs8waLooL98l6.fLzwh3D8u/V0.UebIjojawfXJhX1DQ2', FALSE, FALSE, TRUE,'mario.rossi@example.com', @three_col_id, 'User', 'Rossi', 'Mario', 'Single');
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @user_seq;

set @user_id_6 = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @user_seq);
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name)
values (@user_id_6, 'maija.m', '$2a$10$3feYdjrW40hkqP4/xupKP.YMgdYmDsZZus./vK4FbBs9QZG2.FuNC', FALSE, FALSE, TRUE,'maijam@example.com', @three_col_id, 'User', 'M', 'Maija');
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, status)
values (@user_id_6, 'maija.m', '$2a$10$3feYdjrW40hkqP4/xupKP.YMgdYmDsZZus./vK4FbBs9QZG2.FuNC', FALSE, FALSE, TRUE,'maijam@example.com', @three_col_id, 'User', 'M', 'Maija', 'Single');
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @user_seq;

set @user_id_7 = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @user_seq);
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name)
values (@user_id_7, 'one.col', '$2a$10$5VqE2YEqT75pCVjKqjP2b.gNGly9fsTVUOMQR/JEjkHSbqvA3A6IO', FALSE, FALSE, TRUE,'one.col@example.com', @three_col_id, 'User', 'Column', 'One');
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, status)
values (@user_id_7, 'one.col', '$2a$10$5VqE2YEqT75pCVjKqjP2b.gNGly9fsTVUOMQR/JEjkHSbqvA3A6IO', FALSE, FALSE, TRUE,'one.col@example.com', @three_col_id, 'User', 'Column', 'One', 'Single');
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @user_seq;

set @user_id_8 = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @user_seq);
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name)
values (@user_id_8, 'twown.col', '$2a$10$Inpufv82TRUGYoPuXhYXVuMCKHkhLz44W6FijxW2e9n3T1hgyxcVq', FALSE, FALSE, TRUE,'twown.col@example.com', @three_col_id, 'User', 'Column', 'Two');
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, status)
values (@user_id_8, 'twown.col', '$2a$10$Inpufv82TRUGYoPuXhYXVuMCKHkhLz44W6FijxW2e9n3T1hgyxcVq', FALSE, FALSE, TRUE,'twown.col@example.com', @three_col_id, 'User', 'Column', 'Two', 'Single');
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @user_seq;

set @user_id_9 = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @user_seq);
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name)
values (@user_id_9, 'three.col', '$2a$10$ImRXq4gFC9teBstOBdQrZeEwBkCAJ0S6.CwI9/9r7fxWKTZ30pgVC', FALSE, FALSE, TRUE,'three.col@example.com', @three_col_id, 'User', 'Column', 'Three');
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, status)
values (@user_id_9, 'three.col', '$2a$10$ImRXq4gFC9teBstOBdQrZeEwBkCAJ0S6.CwI9/9r7fxWKTZ30pgVC', FALSE, FALSE, TRUE,'three.col@example.com', @three_col_id, 'User', 'Column', 'Three', 'Single');
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @user_seq;

set @user_id_10 = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @user_seq);
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name)
values (@user_id_10, 'threewn.col', '$2a$10$LLYTJoK6MCBpeDBbmdt7tu1LNt7Eenqe1IpMlfem8xVjzynn.HpxW', FALSE, FALSE, TRUE,'threewn.col@example.com', @three_col_id, 'User', 'Column2', 'Three');
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, status)
values (@user_id_10, 'threewn.col', '$2a$10$LLYTJoK6MCBpeDBbmdt7tu1LNt7Eenqe1IpMlfem8xVjzynn.HpxW', FALSE, FALSE, TRUE,'threewn.col@example.com', @three_col_id, 'User', 'Column2', 'Three', 'Single');
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @user_seq;

set @user_id_11 = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @user_seq);
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name)
values (@user_id_11, 'four.col', '$2a$10$tZgWcaG2EJPLtseZ339n7uTu3GZn31h3iTr20orwgbbRAI15uoIFK', FALSE, FALSE, TRUE,'four.col@example.com', @three_col_id, 'User', 'Column', 'Four');
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, status)
values (@user_id_11, 'four.col', '$2a$10$tZgWcaG2EJPLtseZ339n7uTu3GZn31h3iTr20orwgbbRAI15uoIFK', FALSE, FALSE, TRUE,'four.col@example.com', @three_col_id, 'User', 'Column', 'Four', 'Single');
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @user_seq;

set @user_id_12 = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @user_seq);
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name)
values (@user_id_12, 'fourwn.col', '$2a$10$4kPYhgowurWqXGVDigxOxOVj/M.rqLRwqbn0kT/OD4pISL6pDG/c2', FALSE, FALSE, TRUE,'fourwn.col@example.com', @three_col_id, 'User', 'Column2', 'Four');
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, status)
values (@user_id_12, 'fourwn.col', '$2a$10$4kPYhgowurWqXGVDigxOxOVj/M.rqLRwqbn0kT/OD4pISL6pDG/c2', FALSE, FALSE, TRUE,'fourwn.col@example.com', @three_col_id, 'User', 'Column2', 'Four', 'Single');
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @user_seq;

-- duplicate user id!!
set @user_id_13 = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @user_seq);
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name)
values (@user_id_13, 'http://rave2011.myopenid.com/', '$2a$10$dML97.rnOn4.iSlEEdju8OCB2NckuKw0Ki5yMVzzMmWQsWMvym3qC', FALSE, FALSE, TRUE,'rave2011_openid@example.org', @three_col_id, 'User', 'Openid', 'Rave');
insert into person (entity_id, username, password, expired, locked, enabled, email, default_page_layout_id, dtype, family_name, given_name, status)
values (@user_id_13, 'http://rave2011.myopenid.com/', '$2a$10$dML97.rnOn4.iSlEEdju8OCB2NckuKw0Ki5yMVzzMmWQsWMvym3qC', FALSE, FALSE, TRUE,'rave2011_openid@example.org', @three_col_id, 'User', 'Openid', 'Rave', 'Single');
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @user_seq;

--- end user data ---
Expand Down
Expand Up @@ -83,9 +83,9 @@ public String viewProfile(@PathVariable String username, ModelMap model, @Reques
public String updateProfile(ModelMap model,
@RequestParam(required = false) Long referringPageId,
@ModelAttribute("updatedUser") UserForm updatedUser) {
logger.info("Updating " + updatedUser.getUsername() + " profile information");

User user = userService.getAuthenticatedUser();
logger.info("Updating " + user.getUsername() + " profile information");

//set the updated fields for optional information
user.setGivenName(updatedUser.getGivenName());
Expand Down
Expand Up @@ -24,6 +24,7 @@
import org.jbehave.core.annotations.When;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import org.springframework.beans.factory.annotation.Autowired;

import static org.hamcrest.CoreMatchers.equalTo;
Expand Down Expand Up @@ -78,9 +79,10 @@ public void changeAboutMe(String aboutMe) {
changeFieldValue("aboutMeField", aboutMe);
}

@When("I change the status to \"$status\"")
@When("I choose the status as \"$status\"")
public void changeStatus(String status) {
changeFieldValue("statusField", status);
final Select relationshipStatus = new Select(portal.findElement(By.id("statusField")));
relationshipStatus.selectByValue(status);
}

private void changeFieldValue(String fieldId, String value) {
Expand Down
Expand Up @@ -37,33 +37,33 @@ When I log in with username "john.doe" and password "john.doe"
And I go to "http://localhost:8080/portal/app/person/john.doe"
Then I see the email address "john.doe@example.com" on the profile page
And I see the about me "" on the profile page
And I see the status "" on the profile page
And I see the status "Single" on the profile page
When I click on the "profileEdit" button
Then I can edit the email address
When I change the email address to "john.doe@example.net"
And I change the about me to "I'm a test user"
And I change the status to "It's complicated"
And I choose the status as "Committed"
And I submit the edit profile form
Then I see the email address "john.doe@example.net" on the profile page
And I see the about me "I'm a test user" on the profile page
And I see the status "It's complicated" on the profile page
And I see the status "Committed" on the profile page
When I log out

Scenario: John Doe reverts his profile after logging out and in
When I log in with username "john.doe" and password "john.doe"
And I go to "http://localhost:8080/portal/app/person/john.doe"
Then I see the email address "john.doe@example.net" on the profile page
And I see the about me "I'm a test user" on the profile page
And I see the status "It's complicated" on the profile page
And I see the status "Committed" on the profile page
When I click on the "profileEdit" button
Then I can edit the email address
When I change the email address to "john.doe@example.com"
And I change the about me to ""
And I change the status to ""
And I choose the status as "Single"
And I submit the edit profile form
Then I see the email address "john.doe@example.com" on the profile page
And I see the about me "" on the profile page
And I see the status "" on the profile page
And I see the status "Single" on the profile page
When I log out

Scenario: John Doe adds a new page
Expand Down
41 changes: 23 additions & 18 deletions rave-portal-resources/src/main/resources/messages.properties
Expand Up @@ -73,11 +73,16 @@ page.general.toadmininterface=Admin interface
page.general.username=Username:
page.general.login.information=Enter Login Information
page.general.personal.information=Enter Personal Information (optional)
page.general.first.name=First Name:
page.general.last.name=Last Name:
page.general.display.name=Name seen by other users:
page.general.status=Status:
page.general.about.me=Describe Yourself:
page.general.first.name=First Name:
page.general.last.name=Last Name:
page.general.display.name=Name seen by other users:
page.general.relation.status=Relationship Status:
page.general.about.me=Describe Yourself:

page.general.relation.single=Single
page.general.relation.committed=Committed
page.general.relation.married=Married
page.general.relation.other=Other

page.general.addpage.title=Title
page.general.addpage.layout.columns_1=One Column
Expand Down Expand Up @@ -179,14 +184,14 @@ page.addwidget.result.success=The widget was successfully added.

page.profile.title={0}''s Profile
page.profile.personal.info=Personal Information
page.profile.first.name=First Name:
page.profile.last.name=Last Name:
page.profile.display.name=Display Name:
page.profile.first.name=First Name:
page.profile.last.name=Last Name:
page.profile.display.name=Display Name:
page.profile.basic.info=Basic Information
page.profile.about.me=About Me:
page.profile.status=Status:
page.profile.about.me=About Me:
page.profile.status=Relationship Status:
page.profile.contact.info=Contact Information
page.profile.email=Email ID:
page.profile.email=Email ID:
page.profile.posts=Posts
page.profile.posts.page=/WEB-INF/jsp/views/profile_posts.jsp
page.profile.about=About
Expand All @@ -202,14 +207,14 @@ page.profile.cancel=Cancel

page.personProfile.title={0}''s Profile
page.personProfile.personal.info=Personal Information
page.personProfile.first.name=First Name:
page.personProfile.last.name=Last Name:
page.personProfile.display.name=Display Name:
page.personProfile.first.name=First Name:
page.personProfile.last.name=Last Name:
page.personProfile.display.name=Display Name:
page.personProfile.basic.info=Basic Information
page.personProfile.about.me=About Me:
page.personProfile.status=Status:
page.personProfile.about.me=About Me:
page.personProfile.status=Relationship Status:
page.personProfile.contact.info=Contact Information
page.personProfile.email=Email ID:
page.personProfile.email=Email ID:
page.personProfile.posts=Posts
page.personProfile.posts.page=/WEB-INF/jsp/views/profile_posts.jsp
page.personProfile.about=About
Expand Down Expand Up @@ -360,7 +365,7 @@ _rave_client.common.accept=Accept
_rave_client.common.decline=Decline
_rave_client.common.username=Username
_rave_client.common.sharing=Sharing
_rave_client.common.editing.auth=Edit Permission
_rave_client.common.editing.auth=Edit Permission
_rave_client.form.password.invalid_match=The password does not match
_rave_client.opensocial.render_error=Unable to render OpenSocial Gadget:
_rave_client.page.add=Add a New Page
Expand Down
Expand Up @@ -81,6 +81,11 @@ page.general.display.name=Nombre que ver\u00E1n los otros Usuarios\:
page.general.status=Estado Marital\:
page.general.about.me=Describase\:

page.general.relation.single=Soltero
page.general.relation.committed=Comprometido
page.general.relation.married=Casado
page.general.relation.other=Otro

page.general.addpage.title=Titulo
page.general.addpage.layout.columns_1=Una Columna
page.general.addpage.layout.columns_2=Dos Columnas
Expand Down

0 comments on commit ee3a6ff

Please sign in to comment.