Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implemented the DydraRepositoryManager#isAuthenticated() method.

  • Loading branch information...
commit 9f97474e486ff99afd6f80268a906fd818648fbc 1 parent 4f1bca4
@bendiken bendiken authored
View
10 src/com/dydra/sesame/DydraRepositoryManager.java
@@ -21,7 +21,8 @@
public static final String SERVER_BASE_URL_PROPERTY = "com.dydra.sesame.url";
public static final String SERVER_BASE_URL = "http://api.dydra.com/sesame2";
- private final String accountName;
+ protected final String accountName;
+ protected boolean isAuthenticated;
public DydraRepositoryManager(@NotNull final String accountName) {
this(accountName, System.getProperty(SERVER_BASE_URL_PROPERTY, SERVER_BASE_URL));
@@ -40,6 +41,11 @@ public DydraRepositoryManager(@NotNull final String accountName,
}
public void setPassword(@Nullable final String password) {
- this.setUsernameAndPassword((password != null) ? this.accountName : null, password);
+ this.isAuthenticated = (password != null);
+ this.setUsernameAndPassword(this.isAuthenticated ? this.accountName : null, password);
+ }
+
+ public boolean isAuthenticated() {
+ return this.isAuthenticated;
}
}
View
3  test/com/dydra/sesame/DydraRepositoryManagerTest.java
@@ -45,10 +45,13 @@ public void testGetServerURL() {
@Test
public void testSetPassword() {
+ assertFalse(manager.isAuthenticated());
if (this.password != null) {
manager.setPassword(this.password);
+ assertTrue(manager.isAuthenticated());
}
manager.setPassword(null);
+ assertFalse(manager.isAuthenticated());
}
@Test
Please sign in to comment.
Something went wrong with that request. Please try again.