Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Use IInternalAuthToken interface in CouchDB auth store
Browse files Browse the repository at this point in the history
Signed-off-by: Eamonn Mansour <[email protected]>
  • Loading branch information
eamansour committed Jul 2, 2024
1 parent 1a3c7cb commit 371dda1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import dev.galasa.extensions.common.couchdb.CouchdbValidator;
import dev.galasa.extensions.common.couchdb.pojos.ViewRow;
import dev.galasa.extensions.common.api.HttpRequestFactory;
import dev.galasa.framework.spi.auth.IAuthToken;
import dev.galasa.framework.spi.auth.IInternalAuthToken;
import dev.galasa.framework.spi.auth.IAuthStore;
import dev.galasa.framework.spi.auth.User;
import dev.galasa.framework.spi.utils.ITimeService;
Expand Down Expand Up @@ -61,10 +61,10 @@ public CouchdbAuthStore(
}

@Override
public List<IAuthToken> getTokens() throws AuthStoreException {
public List<IInternalAuthToken> getTokens() throws AuthStoreException {
logger.info("Retrieving tokens from CouchDB");
List<ViewRow> tokenDocuments = new ArrayList<>();
List<IAuthToken> tokens = new ArrayList<>();
List<IInternalAuthToken> tokens = new ArrayList<>();

try {
// Get all of the documents in the tokens database
Expand Down Expand Up @@ -124,7 +124,7 @@ public void deleteToken(String tokenId) throws AuthStoreException {
* @return the auth token stored within the given document
* @throws AuthStoreException if there was a problem accessing the auth store or its response
*/
private IAuthToken getAuthTokenFromDocument(String documentId) throws CouchdbException {
private IInternalAuthToken getAuthTokenFromDocument(String documentId) throws CouchdbException {
return getDocumentFromDatabase(TOKENS_DATABASE_NAME, documentId, CouchdbAuthToken.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import java.time.Instant;

import dev.galasa.framework.spi.auth.IAuthToken;
import dev.galasa.framework.spi.auth.IInternalAuthToken;
import dev.galasa.framework.spi.auth.User;

public class CouchdbAuthToken implements IAuthToken {
public class CouchdbAuthToken implements IInternalAuthToken {

private String _id;
private String dexClientId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import dev.galasa.extensions.mocks.MockTimeService;
import dev.galasa.extensions.mocks.couchdb.MockCouchdbValidator;
import dev.galasa.framework.spi.auth.AuthStoreException;
import dev.galasa.framework.spi.auth.IAuthToken;
import dev.galasa.framework.spi.auth.IInternalAuthToken;
import dev.galasa.framework.spi.auth.User;

public class TestCouchdbAuthStore {
Expand Down Expand Up @@ -148,12 +148,12 @@ public void testGetTokensReturnsTokensFromCouchdbOK() throws Exception {
CouchdbAuthStore authStore = new CouchdbAuthStore(authStoreUri, httpClientFactory, new HttpRequestFactoryImpl(), logFactory, new MockCouchdbValidator(), mockTimeService);

// When...
List<IAuthToken> tokens = authStore.getTokens();
List<IInternalAuthToken> tokens = authStore.getTokens();

// Then...
assertThat(tokens).hasSize(1);

IAuthToken actualToken = tokens.get(0);
IInternalAuthToken actualToken = tokens.get(0);
assertThat(actualToken).usingRecursiveComparison().isEqualTo(mockToken);
}

Expand Down

0 comments on commit 371dda1

Please sign in to comment.