You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by fm...@apache.org on 2012/06/20 16:40:09 UTC
svn commit: r1352130 - in /incubator/syncope/trunk:
console/src/test/java/org/apache/syncope/console/RoleTestITCase.java
core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java
Author: fmartelli
Date: Wed Jun 20 14:40:09 2012
New Revision: 1352130
URL: http://svn.apache.org/viewvc?rev=1352130&view=rev
Log:
SYNCOPE-98 #comment fixed a selenium test
Modified:
incubator/syncope/trunk/console/src/test/java/org/apache/syncope/console/RoleTestITCase.java
incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java
Modified: incubator/syncope/trunk/console/src/test/java/org/apache/syncope/console/RoleTestITCase.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/test/java/org/apache/syncope/console/RoleTestITCase.java?rev=1352130&r1=1352129&r2=1352130&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/test/java/org/apache/syncope/console/RoleTestITCase.java (original)
+++ incubator/syncope/trunk/console/src/test/java/org/apache/syncope/console/RoleTestITCase.java Wed Jun 20 14:40:09 2012
@@ -28,15 +28,13 @@ public class RoleTestITCase extends Abst
selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='navigationPane']\");", "30000");
- selenium.click("//div[3]/span/div/div/table" + "/tbody/tr/td[2]/table/tbody/tr/td[2]/a");
+ selenium.click("//div[3]/span/div/div/table/tbody/tr/td[2]/table/tbody/tr/td[2]/a");
- selenium.waitForCondition("selenium.isElementPresent(" + "\"//div[3]/span[2]/span/div/p/span/span/a\");",
- "30000");
+ selenium.waitForCondition("selenium.isElementPresent(\"//div[3]/span[2]/span/div/p/span/span/a\");", "30000");
selenium.click("//div[3]/span[2]/span/div/p/span/span/a");
- selenium
- .waitForCondition("selenium.isElementPresent(" + "\"//span[contains(text(),'Attributes')]\");", "30000");
+ selenium.waitForCondition("selenium.isElementPresent(\"//span[contains(text(),'Attributes')]\");", "30000");
selenium.selectFrame("relative=up");
selenium.click("css=a.w_close");
@@ -48,7 +46,7 @@ public class RoleTestITCase extends Abst
selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='navigationPane']\");", "30000");
- selenium.click("//div[3]/span/div/div/table[3]/tbody/tr/td[4]/" + "table/tbody/tr/td[2]/a");
+ selenium.click("//div[3]/span/div/div/table[3]/tbody/tr/td[4]/table/tbody/tr/td[2]/a");
selenium.waitForCondition("selenium.isElementPresent("
+ "\"//div[3]/span[2]/span/span/div/p/span[2]/span/a\");", "30000");
@@ -59,7 +57,7 @@ public class RoleTestITCase extends Abst
selenium.selectFrame("relative=up");
- selenium.waitForCondition("selenium.isElementPresent(" + "\"//div[2]/form/div[2]/ul/li[1]/a/span\");", "30000");
+ selenium.waitForCondition("selenium.isElementPresent(\"//div[2]/form/div[2]/ul/li[1]/a/span\");", "30000");
selenium.click("//div[2]/form/div[2]/ul/li[1]/a/span");
selenium.click("//div[2]/form/div[2]/ul/li[2]/a/span");
@@ -77,7 +75,7 @@ public class RoleTestITCase extends Abst
selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='navigationPane']\");", "30000");
- selenium.click("//div[3]/span/div/div/table[3]/tbody/tr/td[4]/" + "table/tbody/tr/td[2]/a");
+ selenium.click("//div[3]/span/div/div/table[3]/tbody/tr/td[4]/table/tbody/tr/td[2]/a");
selenium.waitForCondition("selenium.isElementPresent("
+ "\"//div[3]/span[2]/span/span/div/p/span[2]/span/a[2]\");", "30000");
@@ -106,7 +104,7 @@ public class RoleTestITCase extends Abst
selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='navigationPane']\");", "30000");
- selenium.click("//div[3]/span/div/div/table[3]/tbody/tr/td[4]/" + "table/tbody/tr/td[2]/a");
+ selenium.click("//div[3]/span/div/div/table[3]/tbody/tr/td[4]/table/tbody/tr/td[2]/a");
selenium.waitForCondition("selenium.isElementPresent(\"//div/form/div[2]/ul/li[6]/a\");", "30000");
@@ -122,7 +120,7 @@ public class RoleTestITCase extends Abst
selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='navigationPane']\");", "30000");
- selenium.click("//div[3]/span/div/div/table[2]/tbody/tr/td[3]/" + "table/tbody/tr/td[2]/a");
+ selenium.click("//div[3]/span/div/div/table[2]/tbody/tr/td[3]/table/tbody/tr/td[2]/a");
selenium.waitForCondition("selenium.isElementPresent(\"//div/form/div[2]/ul/li[7]/a\");", "30000");
@@ -130,8 +128,7 @@ public class RoleTestITCase extends Abst
selenium.click("//input[@name=\"userListContainer:search\"]");
- selenium
- .waitForCondition("selenium.isElementPresent(" + "\"//table/tbody/tr/td[4]/span/span[7]/a\");", "30000");
+ selenium.waitForCondition("selenium.isElementPresent(\"//table/tbody/tr/td[4]/span/span[7]/a\");", "30000");
selenium.click("//div[3]/span[2]/span/span/div/form/div"
+ "[2]/div[2]/div/div/span/div/table/tbody/tr/td[4]/span/span[7]/a");
@@ -149,7 +146,7 @@ public class RoleTestITCase extends Abst
selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='navigationPane']\");", "30000");
- selenium.click("//div[3]/span/div/div/table[2]/tbody/tr/td[3]/" + "table/tbody/tr/td[2]/a");
+ selenium.click("//div[3]/span/div/div/table[2]/tbody/tr/td[3]/table/tbody/tr/td[2]/a");
selenium.waitForCondition("selenium.isElementPresent(\"//div/form/div[2]/ul/li[7]/a\");", "30000");
@@ -171,7 +168,7 @@ public class RoleTestITCase extends Abst
selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='navigationPane']\");", "30000");
- selenium.click("//div[3]/span/div/div/table[10]/tbody/tr/td[6]/" + "table/tbody/tr/td[2]/a");
+ selenium.click("//div[3]/span/div/div/table[12]/tbody/tr/td[6]/table/tbody/tr/td[2]/a");
selenium.waitForCondition("selenium.isElementPresent(\"//div/p/span[2]/span/a[3]\");", "30000");
Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java?rev=1352130&r1=1352129&r2=1352130&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java Wed Jun 20 14:40:09 2012
@@ -75,6 +75,7 @@ import org.apache.syncope.types.CipherAl
public class SyncopeUser extends AbstractAttributable {
private static final long serialVersionUID = -3905046855521446823L;
+
private static SecretKeySpec keySpec;
static {
@@ -84,69 +85,89 @@ public class SyncopeUser extends Abstrac
LOG.error("Error during key specification", e);
}
}
+
@Id
private Long id;
+
@NotNull
private String password;
+
@Transient
private String clearPassword;
+
@OneToMany(cascade = CascadeType.MERGE, mappedBy = "syncopeUser")
@Valid
private List<Membership> memberships;
+
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
@Valid
private List<UAttr> attributes;
+
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
@Valid
private List<UDerAttr> derivedAttributes;
+
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
@Valid
private List<UVirAttr> virtualAttributes;
+
private String workflowId;
+
@Column(nullable = true)
private String status;
+
@Lob
private String token;
+
@Temporal(TemporalType.TIMESTAMP)
private Date tokenExpireTime;
+
@Column(nullable = true)
@Enumerated(EnumType.STRING)
private CipherAlgorithm cipherAlgorithm;
+
@ElementCollection
private List<String> passwordHistory;
+
/**
* Subsequent failed logins.
*/
@Column(nullable = true)
private Integer failedLogins;
+
/**
* Username/Login.
*/
@Column(unique = true)
@NotNull
private String username;
+
/**
* Last successful login date.
*/
@Column(nullable = true)
@Temporal(TemporalType.TIMESTAMP)
private Date lastLoginDate;
+
/**
* Creation date.
*/
@NotNull
@Temporal(TemporalType.TIMESTAMP)
private Date creationDate;
+
/**
* Change password date.
*/
@Column(nullable = true)
@Temporal(TemporalType.TIMESTAMP)
private Date changePwdDate;
+
@Basic
@Min(0)
@Max(1)
private Integer suspended;
+
/**
* Provisioning external resources.
*/
@@ -307,7 +328,8 @@ public class SyncopeUser extends Abstrac
@Override
public <T extends AbstractDerAttr> boolean addDerivedAttribute(final T derivedAttribute) {
if (!(derivedAttribute instanceof UDerAttr)) {
- throw new ClassCastException("attribute is expected to be typed UDerAttr: " + derivedAttribute.getClass().getName());
+ throw new ClassCastException("attribute is expected to be typed UDerAttr: " + derivedAttribute.getClass().
+ getName());
}
return derivedAttributes.add((UDerAttr) derivedAttribute);
@@ -316,7 +338,8 @@ public class SyncopeUser extends Abstrac
@Override
public <T extends AbstractDerAttr> boolean removeDerivedAttribute(T derivedAttribute) {
if (!(derivedAttribute instanceof UDerAttr)) {
- throw new ClassCastException("attribute is expected to be typed UDerAttr: " + derivedAttribute.getClass().getName());
+ throw new ClassCastException("attribute is expected to be typed UDerAttr: " + derivedAttribute.getClass().
+ getName());
}
return derivedAttributes.remove((UDerAttr) derivedAttribute);
}
@@ -337,7 +360,8 @@ public class SyncopeUser extends Abstrac
@Override
public <T extends AbstractVirAttr> boolean addVirtualAttribute(final T virtualAttribute) {
if (!(virtualAttribute instanceof UVirAttr)) {
- throw new ClassCastException("attribute is expected to be typed UVirAttr: " + virtualAttribute.getClass().getName());
+ throw new ClassCastException("attribute is expected to be typed UVirAttr: " + virtualAttribute.getClass().
+ getName());
}
return virtualAttributes.add((UVirAttr) virtualAttribute);
}
@@ -345,7 +369,8 @@ public class SyncopeUser extends Abstrac
@Override
public <T extends AbstractVirAttr> boolean removeVirtualAttribute(final T virtualAttribute) {
if (!(virtualAttribute instanceof UVirAttr)) {
- throw new ClassCastException("attribute is expected to be typed UVirAttr: " + virtualAttribute.getClass().getName());
+ throw new ClassCastException("attribute is expected to be typed UVirAttr: " + virtualAttribute.getClass().
+ getName());
}
return virtualAttributes.remove((UVirAttr) virtualAttribute);
}
@@ -404,7 +429,11 @@ public class SyncopeUser extends Abstrac
}
public boolean checkToken(final String token) {
- return this.token == null || (this.token.equals(token) && tokenExpireTime.after(new Date()));
+ return this.token == null || this.token.equals(token) && !hasTokenExpired();
+ }
+
+ public boolean hasTokenExpired() {
+ return tokenExpireTime.before(new Date());
}
public CipherAlgorithm getCipherAlgoritm() {