Skip to content

Commit

Permalink
Merge pull request zanata#928 from zanata/replace-seam-taglib
Browse files Browse the repository at this point in the history
Replace seam taglib
  • Loading branch information
Patrick Huang committed Sep 25, 2015
2 parents 98ec9d0 + 72208c1 commit 5cbc534
Show file tree
Hide file tree
Showing 133 changed files with 2,408 additions and 1,639 deletions.
1 change: 1 addition & 0 deletions functional-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@
<classifier>mysql.classifier</classifier>
<port>${mysql.port}</port>
<socket>${mysql.socket}</socket>
<clearexistingdata>false</clearexistingdata>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ public HomePage clickResendActivationEmail() {
}

public InactiveAccountPage enterNewEmail(String email) {
enterText(readyElement(By.id("inactiveAccountForm:emailField:email")), email);
enterText(readyElement(By.id("inactiveAccountForm:email:input:email"))
, email);
return new InactiveAccountPage(getDriver());
}

public HomePage clickUpdateEmail() {
clickElement(By.id("inactiveAccountForm:emailField:updateEmail"));
clickElement(By.id("inactiveAccountForm:email:input:updateEmail"));
return new HomePage(getDriver());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public class RegisterPage extends CorePage {
public static final String USERNAME_LENGTH_ERROR =
"size must be between 3 and 20";

private By nameField = By.id("loginForm:name");
private By emailField = By.id("loginForm:emailField:email");
public By usernameField = By.id("loginForm:usernameField:username");
private By passwordField = By.id("loginForm:passwordField:password");
private By nameField = By.id("loginForm:nameField:input:name");
private By emailField = By.id("loginForm:email:input:email");
public By usernameField = By.id("loginForm:username:input:username");
private By passwordField = By.id("loginForm:passwordField:input:password");
private By signUpButton = By.xpath("//input[@value='Sign Up']");
private By showHideToggleButton = By.className("js-form-password-toggle");
private By loginLink = By.linkText("Log In");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@Slf4j
public class ResetPasswordPage extends BasePage {

private By usernameEmailField = By.id("passwordResetRequestForm:usernameEmailField:usernameEmail");
private By usernameEmailField = By.id("passwordResetRequestForm:usernameEmail:input:usernameEmail");
private By submitButton = By.id("passwordResetRequestForm:submitRequest");

public ResetPasswordPage(WebDriver driver) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
@Slf4j
public class EditRoleAssignmentPage extends BasePage {

private By policySelect = By.id("role-rule-form:policyNameField:policyName");
private By patternField = By.id("role-rule-form:identityPatternField:identityPattern");
private By roleSelect = By.id("role-rule-form:roleField:roles");
private By policySelect = By.id("role-rule-form:policyName:input:policyName");
private By patternField = By.id("role-rule-form:identityPattern:input:identityPattern");
private By roleSelect = By.id("role-rule-form:role:input:roles");
private By saveButton = By.id("role-rule-form:save");
private By cancelButton = By.id("role-rule-form:cancel");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public class ManageUserAccountPage extends BasePage {

public static String PASSWORD_ERROR = "Passwords do not match";

private By passwordField = By.id("userdetailForm:passwordField:password");
private By passwordConfirmField = By.id("userdetailForm:passwordConfirmField:confirm");
private By passwordField = By.id("userdetailForm:password:input:password");
private By passwordConfirmField = By.id("userdetailForm:passwordConfirm:input:confirm");
private By enabledField = By.id("userdetailForm:enabled");
private By saveButton = By.id("userdetailForm:userdetailSave");
private By cancelButton = By.id("userdetailForm:userdetailCancel");
Expand Down Expand Up @@ -76,7 +76,7 @@ public ManageUserAccountPage clickEnabled() {

public ManageUserAccountPage clickRole(String role) {
log.info("Click role {}", role);
clickElement(readyElement(By.id("userdetailForm:rolesField:roles:"
clickElement(readyElement(By.id("userdetailForm:roles:input:roles:"
.concat(roleMap.get(role)))));
return new ManageUserAccountPage(getDriver());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@
@Slf4j
public class ServerConfigurationPage extends BasePage {

private By urlField = By.id("serverConfigForm:urlField:url");
public static By registerUrlField = By.id("serverConfigForm:registerField:registerUrl");
private By urlField = By.id("serverConfigForm:url:input:url");
public static By registerUrlField = By.id("serverConfigForm:register:input:registerUrl");
private By emailDomainField = By.id("serverConfigForm:emailDomainField:emailDomain");
private By adminEmailField = By.id("serverConfigForm:adminEmailField:adminEml");
public static By fromEmailField = By.id("serverConfigForm:fromEmailField:fromEml");
private By adminEmailField = By.id("serverConfigForm:adminEmail:input:adminEml");
public static By fromEmailField = By.id("serverConfigForm:fromEmail:input:fromEml");
private By enableLogCheck = By.id("serverConfigForm:enableLogCheck");
private By logLevelSelect = By.id("serverConfigForm:logEmailLvl");
private By emailDestinationField = By.id("serverConfigForm:logDestEmailField:logDestEml");
private By helpUrlField = By.id("serverConfigForm:helpUrlField:helpInput");
private By termsUrlField = By.id("serverConfigForm:termsOfUseUrlField:termsOfUseUrlEml");
private By piwikUrl = By.id("serverConfigForm:piwikUrlField:piwikUrlEml");
private By emailDestinationField = By.id("serverConfigForm:logDestEmail:input:logDestEml");
private By helpUrlField = By.id("serverConfigForm:helpUrl:input:helpInput");
private By termsUrlField = By.id("serverConfigForm:termsOfUseUrl:input:termsOfUseUrlEml");
private By piwikUrl = By.id("serverConfigForm:piwikUrl:input:piwikUrlEml");
private By piwikId = By.id("serverConfigForm:piwikIdSiteEml");
private By maxConcurrentField = By.id("serverConfigForm:maxConcurrentPerApiKeyField:maxConcurrentPerApiKeyEml");
private By maxActiveField = By.id("serverConfigForm:maxActiveRequestsPerApiKeyField:maxActiveRequestsPerApiKeyEml");
private By maxConcurrentField = By.id("serverConfigForm:maxConcurrentPerApiKey:input:maxConcurrentPerApiKeyEml");
private By maxActiveField = By.id("serverConfigForm:maxActiveRequestsPerApiKey:input:maxActiveRequestsPerApiKeyEml");
private By saveButton = By.id("serverConfigForm:save");

public ServerConfigurationPage(WebDriver driver) {
Expand All @@ -72,7 +72,7 @@ public ServerConfigurationPage inputRegisterURL(String url) {
}

public boolean expectFieldValue(final By by, final String expectedValue) {
log.info("Wait for field {} value", by.toString(), expectedValue);
log.info("Wait for field {} value {}", by.toString(), expectedValue);
return waitForAMoment().withMessage("text present: " + by.toString()).until(
ExpectedConditions.textToBePresentInElementValue(existingElement(by), expectedValue));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
@Slf4j
public class TranslationMemoryEditPage extends BasePage {

private By idField = By.id("tmForm:slugField:slug");
private By descriptionField = By.id("tmForm:descriptionField:description");
private By idField = By.id("tmForm:slug:input:slug");
private By descriptionField = By.id("tmForm:description:input:description");
private By saveButton = By.id("tmForm:save");
private By cancelButton = By.id("tmForm:cancel");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public class DashboardAccountTab extends DashboardBasePage {
public static final String EMAIL_TAKEN_ERROR =
"This email address is already taken";

private By emailField = By.id("email-update-form:emailField:email");
private By emailField = By.id("email-update-form:emailField:input:email");
private By updateEmailButton = By.id("email-update-form:updateEmailButton");
private By oldPasswordField = By.id("passwordChangeForm:oldPasswordField:oldPassword");
private By newPasswordField = By.id("passwordChangeForm:newPasswordField:newPassword");
private By oldPasswordField = By.id("passwordChangeForm:oldPasswordField:input:oldPassword");
private By newPasswordField = By.id("passwordChangeForm:newPasswordField:input:newPassword");
private By changePasswordButton = By.id("passwordChangeForm:changePasswordButton");

public DashboardAccountTab(WebDriver driver) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@Slf4j
public class DashboardProfileTab extends DashboardBasePage {

private By accountNameField = By.id("profileForm:nameField:accountName");
private By accountNameField = By.id("profileForm:nameField:input:accountName");
private By updateProfileButton = By.id("updateProfileButton");

public DashboardProfileTab(WebDriver driver) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public class CreateVersionGroupPage extends BasePage {
"must start and end with letter or number, and contain only " +
"letters, numbers, periods, underscores and hyphens.";

private By groupIdField = By.id("group-form:slugField:slug");
public By groupNameField = By.id("group-form:nameField:name");
private By groupDescriptionField = By.id("group-form:descriptionField:description");
private By groupIdField = By.id("group-form:slug:input:slug");
public By groupNameField = By.id("group-form:name:input:name");
private By groupDescriptionField = By.id("group-form:description:input:description");
private By saveButton = By.id("group-form:group-create-new");
private By createNewButton = By.id("group-form:group-create-new");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@Slf4j
public class ContactTeamPage extends BasePage {

private By messageField = By.id("contactCoordinatorForm:messageField:contact-coordinator-message");
private By messageField = By.id("contactCoordinatorForm:messageField:input:contact-coordinator-message");
private By sendButton = By.id("contact-coordinator-send-button");

public ContactTeamPage(WebDriver driver) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
@Slf4j
public class CreateProjectPage extends BasePage {

private By idField = By.id("project-form:slugField:slug");
private By nameField = By.id("project-form:nameField:name");
private By descriptionField = By.id("project-form:descriptionField:description");
private By idField = By.id("project-form:slug:input:slug");
private By nameField = By.id("project-form:name:input:name");
private By descriptionField = By.id("project-form:description:input:description");
private By projectTypeList = By.id("project-types");
private By createButton = By.id("project-form:create-new");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class ProjectsPage extends BasePage {

private By createProjectButton = By.id("createProjectLink");
private By mainContentDiv = By.id("main_body_content");
private By projectTable = By.id("main_content:form:projectList");
private By projectTable = By.id("form:projectList");
private By activeCheckBox = By.xpath("//*[@data-original-title='Filter active projects']");
private By readOnlyCheckBox = By.xpath("//*[@data-original-title='Filter read-only projects']");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
@Slf4j
public class ProjectGeneralTab extends ProjectBasePage {

private By projectIdField = By.id("settings-general-form:slugField:slug");
private By projectNameField = By.id("settings-general-form:nameField:name");
private By descriptionField = By.id("settings-general-form:descriptionField:description");
private By projectIdField = By.id("settings-general-form:slug:input:slug");
private By projectNameField = By.id("settings-general-form:name:input:name");
private By descriptionField = By.id("settings-general-form:description:input:description");
private By projectTypeList = By.id("project-types");
private By homepageField = By.id("settings-general-form:homePageField:homePage");
private By repoField = By.id("settings-general-form:repoField:repo");
private By homepageField = By.id("settings-general-form:homePage:input:homePage");
private By repoField = By.id("settings-general-form:repo:input:repo");
private By deleteButton = By.id("button-archive-project");
private By confirmDeleteButton = By.id("deleteButton");
private By confirmDeleteInput = By.id("confirmDeleteInput");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class CreateVersionPage extends BasePage {
"must start and end with letter or number, and contain only " +
"letters, numbers, periods, underscores and hyphens.";

public By projectVersionID = By.id("create-version-form:slugField:slug");
public By projectVersionID = By.id("create-version-form:slug:input:slug");
private By projectTypeSelection = By.id("create-version-form:project-type");
private By saveButton = By.id("create-version-form:button-create");
private By copyFromPreviousVersionChk = By.id("create-version-form:copy-from-version");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
public class ContactAdminFormPage extends BasePage {

private By subjectField = By.id("contactAdminForm:subjectField:subject");
private By messageField = By.id("contactAdminForm:messageField:contact-admin-message");
private By messageField = By.id("contactAdminForm:messageField:input:contact-admin-message");
private By sendButton = By.id("contact-admin-send-button");

public ContactAdminFormPage(WebDriver driver) {
Expand Down
1 change: 0 additions & 1 deletion zanata-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@
<usedDependency>com.google.guava:guava-gwt</usedDependency>
<!-- Used for StringUtils lib -->
<!-- Needed by ui rendering at runtime -->
<usedDependency>org.jboss.spec.javax.el:jboss-el-api_2.2_spec</usedDependency>
<usedDependency>javax.servlet.jsp:jsp-api</usedDependency>
<!-- Used for different content analyzers based on langugage for search. -->
<usedDependency>org.apache.solr:solr-core</usedDependency>
Expand Down
13 changes: 13 additions & 0 deletions zanata-war/src/main/java/org/zanata/action/GlossaryAction.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.zanata.action;

import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Collections;
Expand All @@ -15,6 +16,8 @@
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.richfaces.event.FileUploadEvent;
import org.richfaces.model.UploadedFile;
import org.zanata.common.LocaleId;
import org.zanata.dao.GlossaryDAO;
import org.zanata.dao.LocaleDAO;
Expand Down Expand Up @@ -157,6 +160,16 @@ private List<GlossaryEntry> getEntries(GlossaryDAO glossaryDAO) {
return getEntries();
}

public void glossaryFileUploaded(FileUploadEvent event) throws IOException {
UploadedFile uploadedFile = event.getUploadedFile();
glossaryFileUpload.setFileContents(uploadedFile.getInputStream());
glossaryFileUpload.setFileName(uploadedFile.getName());
}

public void clearGlossaryUpload() {
glossaryFileUpload = new GlossaryFileUploadHelper();
}

/**
* Helper class to upload glossary files.
*/
Expand Down
28 changes: 15 additions & 13 deletions zanata-war/src/main/java/org/zanata/action/RoleAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.List;

import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
Expand All @@ -16,14 +17,15 @@
import org.zanata.security.annotations.ZanataSecured;

import static org.jboss.seam.ScopeType.CONVERSATION;
import static org.jboss.seam.ScopeType.PAGE;
import static org.jboss.seam.annotations.Install.APPLICATION;

/**
* @author Patrick Huang
* <a href="mailto:[email protected]">[email protected]</a>
*/
@Name("zanataRoleAction")
@Scope(CONVERSATION)
@Scope(PAGE)
@Install(precedence = APPLICATION)
@ZanataSecured
@CheckLoggedIn
Expand All @@ -39,16 +41,14 @@ public class RoleAction implements Serializable {
@In
ZanataIdentity identity;

@Begin
public void createRole() {
groups = new ArrayList<>();
}

@Begin
public void editRole(String role) {
this.originalRole = role;
this.role = role;
groups = identityManager.getRoleGroups(role);
public void loadRole() {
if (role == null) {
// creating new role
groups = new ArrayList<>();
} else {
this.originalRole = role;
groups = identityManager.getRoleGroups(role);
}
}

public String save() {
Expand All @@ -72,7 +72,6 @@ private String saveNewRole() {
identityManager.addRoleToGroup(role, r);
}

Conversation.instance().end();
}

return "success";
Expand All @@ -95,7 +94,10 @@ private String saveExistingRole() {
}
}

Conversation.instance().end();
return "success";
}

public String cancel() {
return "success";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,6 @@ private void persistPropertyToDatabase(PropertyWithKey<String> property) {
}
}

public String cancel() {
return "cancel";
}

/**
* Associates a field of type T with a HApplicationConfiguration key,
* allowing abstraction around setting fields only if keys are bound.
Expand Down
Loading

0 comments on commit 5cbc534

Please sign in to comment.