From 371dda1ac2b0f601a43014cea25f76c7ef5b944e Mon Sep 17 00:00:00 2001 From: Eamonn Mansour <47121388+eamansour@users.noreply.github.com> Date: Tue, 2 Jul 2024 09:24:35 +0100 Subject: [PATCH] Use IInternalAuthToken interface in CouchDB auth store Signed-off-by: Eamonn Mansour <47121388+eamansour@users.noreply.github.com> --- .../galasa/auth/couchdb/internal/CouchdbAuthStore.java | 8 ++++---- .../galasa/auth/couchdb/internal/CouchdbAuthToken.java | 4 ++-- .../dev/galasa/auth/couchdb/TestCouchdbAuthStore.java | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/galasa-extensions-parent/dev.galasa.auth.couchdb/src/main/java/dev/galasa/auth/couchdb/internal/CouchdbAuthStore.java b/galasa-extensions-parent/dev.galasa.auth.couchdb/src/main/java/dev/galasa/auth/couchdb/internal/CouchdbAuthStore.java index ad5ec834..46461ce7 100644 --- a/galasa-extensions-parent/dev.galasa.auth.couchdb/src/main/java/dev/galasa/auth/couchdb/internal/CouchdbAuthStore.java +++ b/galasa-extensions-parent/dev.galasa.auth.couchdb/src/main/java/dev/galasa/auth/couchdb/internal/CouchdbAuthStore.java @@ -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; @@ -61,10 +61,10 @@ public CouchdbAuthStore( } @Override - public List getTokens() throws AuthStoreException { + public List getTokens() throws AuthStoreException { logger.info("Retrieving tokens from CouchDB"); List tokenDocuments = new ArrayList<>(); - List tokens = new ArrayList<>(); + List tokens = new ArrayList<>(); try { // Get all of the documents in the tokens database @@ -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); } } diff --git a/galasa-extensions-parent/dev.galasa.auth.couchdb/src/main/java/dev/galasa/auth/couchdb/internal/CouchdbAuthToken.java b/galasa-extensions-parent/dev.galasa.auth.couchdb/src/main/java/dev/galasa/auth/couchdb/internal/CouchdbAuthToken.java index ecedc0a0..b5bea8f2 100644 --- a/galasa-extensions-parent/dev.galasa.auth.couchdb/src/main/java/dev/galasa/auth/couchdb/internal/CouchdbAuthToken.java +++ b/galasa-extensions-parent/dev.galasa.auth.couchdb/src/main/java/dev/galasa/auth/couchdb/internal/CouchdbAuthToken.java @@ -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; diff --git a/galasa-extensions-parent/dev.galasa.auth.couchdb/src/test/java/dev/galasa/auth/couchdb/TestCouchdbAuthStore.java b/galasa-extensions-parent/dev.galasa.auth.couchdb/src/test/java/dev/galasa/auth/couchdb/TestCouchdbAuthStore.java index 0e85b0f1..6026bc03 100644 --- a/galasa-extensions-parent/dev.galasa.auth.couchdb/src/test/java/dev/galasa/auth/couchdb/TestCouchdbAuthStore.java +++ b/galasa-extensions-parent/dev.galasa.auth.couchdb/src/test/java/dev/galasa/auth/couchdb/TestCouchdbAuthStore.java @@ -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 { @@ -148,12 +148,12 @@ public void testGetTokensReturnsTokensFromCouchdbOK() throws Exception { CouchdbAuthStore authStore = new CouchdbAuthStore(authStoreUri, httpClientFactory, new HttpRequestFactoryImpl(), logFactory, new MockCouchdbValidator(), mockTimeService); // When... - List tokens = authStore.getTokens(); + List tokens = authStore.getTokens(); // Then... assertThat(tokens).hasSize(1); - IAuthToken actualToken = tokens.get(0); + IInternalAuthToken actualToken = tokens.get(0); assertThat(actualToken).usingRecursiveComparison().isEqualTo(mockToken); }