From 8352d50b8a9969b7d4d2aa42183d6c394457e0d2 Mon Sep 17 00:00:00 2001 From: srishti Date: Tue, 17 Dec 2024 10:16:02 +0100 Subject: [PATCH 1/6] EA-4015 move IT --- set-integration-testing/pom.xml | 5 +++++ .../integration/client}/BaseAPIConnectionTest.java | 4 +--- .../integration/client}/BaseWebUserSetProtocol.java | 2 +- .../client}/ClientConfigurationTest.java | 2 +- .../client}/WebUserSetProtocolExceptionsTest.java | 3 +-- .../integration/client}/WebUserSetProtocolTest.java | 13 ++++++------- .../resources/content/userset-open.json | 0 .../resources/content/userset.json | 0 .../resources/content/usersetupdate.json | 0 9 files changed, 15 insertions(+), 14 deletions(-) rename {set-client/src/test/java/eu/europeana/set/client/integration/web => set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client}/BaseAPIConnectionTest.java (89%) rename {set-client/src/test/java/eu/europeana/set/client/integration/web => set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client}/BaseWebUserSetProtocol.java (98%) rename {set-client/src/test/java/eu/europeana/set/client/integration/web => set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client}/ClientConfigurationTest.java (93%) rename {set-client/src/test/java/eu/europeana/set/client/integration/web => set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client}/WebUserSetProtocolExceptionsTest.java (98%) rename {set-client/src/test/java/eu/europeana/set/client/integration/web => set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client}/WebUserSetProtocolTest.java (82%) rename {set-client/src/test => set-integration-testing/src/integration-test}/resources/content/userset-open.json (100%) rename {set-client/src/test => set-integration-testing/src/integration-test}/resources/content/userset.json (100%) rename {set-client/src/test => set-integration-testing/src/integration-test}/resources/content/usersetupdate.json (100%) diff --git a/set-integration-testing/pom.xml b/set-integration-testing/pom.xml index 10951584..d2046cde 100644 --- a/set-integration-testing/pom.xml +++ b/set-integration-testing/pom.xml @@ -48,6 +48,11 @@ set-common 1.0-SNAPSHOT + + eu.europeana.set + set-client + 1.0-SNAPSHOT + org.springframework.boot spring-boot-starter-web diff --git a/set-client/src/test/java/eu/europeana/set/client/integration/web/BaseAPIConnectionTest.java b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseAPIConnectionTest.java similarity index 89% rename from set-client/src/test/java/eu/europeana/set/client/integration/web/BaseAPIConnectionTest.java rename to set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseAPIConnectionTest.java index 615f5155..b0bb0c77 100644 --- a/set-client/src/test/java/eu/europeana/set/client/integration/web/BaseAPIConnectionTest.java +++ b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseAPIConnectionTest.java @@ -1,14 +1,12 @@ -package eu.europeana.set.client.integration.web; +package eu.europeana.api.set.integration.client; import eu.europeana.set.client.connection.BaseApiConnection; import eu.europeana.set.definitions.model.vocabulary.WebUserSetFields; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -@Disabled("needs configuration file") public class BaseAPIConnectionTest { private static final String SERVICE_URI = "testUri"; private static final String API_KEY_1 = "api_key"; diff --git a/set-client/src/test/java/eu/europeana/set/client/integration/web/BaseWebUserSetProtocol.java b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseWebUserSetProtocol.java similarity index 98% rename from set-client/src/test/java/eu/europeana/set/client/integration/web/BaseWebUserSetProtocol.java rename to set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseWebUserSetProtocol.java index 32475a8d..26eaeb75 100644 --- a/set-client/src/test/java/eu/europeana/set/client/integration/web/BaseWebUserSetProtocol.java +++ b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseWebUserSetProtocol.java @@ -1,4 +1,4 @@ -package eu.europeana.set.client.integration.web; +package eu.europeana.api.set.integration.client; import java.io.BufferedReader; import java.io.IOException; diff --git a/set-client/src/test/java/eu/europeana/set/client/integration/web/ClientConfigurationTest.java b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/ClientConfigurationTest.java similarity index 93% rename from set-client/src/test/java/eu/europeana/set/client/integration/web/ClientConfigurationTest.java rename to set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/ClientConfigurationTest.java index d75d23eb..819cf486 100644 --- a/set-client/src/test/java/eu/europeana/set/client/integration/web/ClientConfigurationTest.java +++ b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/ClientConfigurationTest.java @@ -1,4 +1,4 @@ -package eu.europeana.set.client.integration.web; +package eu.europeana.api.set.integration.client; import eu.europeana.set.client.config.ClientConfiguration; import org.apache.commons.lang3.StringUtils; diff --git a/set-client/src/test/java/eu/europeana/set/client/integration/web/WebUserSetProtocolExceptionsTest.java b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolExceptionsTest.java similarity index 98% rename from set-client/src/test/java/eu/europeana/set/client/integration/web/WebUserSetProtocolExceptionsTest.java rename to set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolExceptionsTest.java index 80ec719d..5c9a340c 100644 --- a/set-client/src/test/java/eu/europeana/set/client/integration/web/WebUserSetProtocolExceptionsTest.java +++ b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolExceptionsTest.java @@ -1,4 +1,4 @@ -package eu.europeana.set.client.integration.web; +package eu.europeana.api.set.integration.client; import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; @@ -14,7 +14,6 @@ * * @author GrafR */ -@Disabled public class WebUserSetProtocolExceptionsTest extends BaseWebUserSetProtocol { public String CORRUPTED_JSON = diff --git a/set-client/src/test/java/eu/europeana/set/client/integration/web/WebUserSetProtocolTest.java b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolTest.java similarity index 82% rename from set-client/src/test/java/eu/europeana/set/client/integration/web/WebUserSetProtocolTest.java rename to set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolTest.java index 138b8920..8ffe6469 100644 --- a/set-client/src/test/java/eu/europeana/set/client/integration/web/WebUserSetProtocolTest.java +++ b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolTest.java @@ -1,4 +1,4 @@ -package eu.europeana.set.client.integration.web; +package eu.europeana.api.set.integration.client; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -14,12 +14,11 @@ * This is an integration test, and it is ignored for unit testing * @author GrafR */ -@Disabled public class WebUserSetProtocolTest extends BaseWebUserSetProtocol { @Test public void createUserSet() throws SetApiClientException, IOException { - String setId = createTestUserSet(USER_SET_CONTENT, null); + String setId = createTestUserSet(BaseWebUserSetProtocol.USER_SET_CONTENT, null); assertNotNull(setId); apiClient.getWebUserSetApi().deleteUserSet(setId); } @@ -31,7 +30,7 @@ public void createUserSet() throws SetApiClientException, IOException { */ @Test public void retrieveUserSet() throws IllegalArgumentException, IOException, SetApiClientException { - String testSetId = createTestUserSet(USER_SET_CONTENT, null); + String testSetId = createTestUserSet(BaseWebUserSetProtocol.USER_SET_CONTENT, null); assertNotNull(testSetId); // get user set by ID and user identifier UserSet userSet = apiClient.getWebUserSetApi().getUserSet(testSetId, null); @@ -41,10 +40,10 @@ public void retrieveUserSet() throws IllegalArgumentException, IOException, SetA @Test public void updateUserSet() throws IOException, SetApiClientException { - String testSetId = createTestUserSet(USER_SET_CONTENT, null); + String testSetId = createTestUserSet(BaseWebUserSetProtocol.USER_SET_CONTENT, null); assertNotNull(testSetId); // updated user set value - String requestBody = getJsonStringInput(USER_SET_UPDATE_CONTENT); + String requestBody = getJsonStringInput(BaseWebUserSetProtocol.USER_SET_UPDATE_CONTENT); assertNotNull(requestBody); // update user set by identifier URL UserSet updateResponse = apiClient.getWebUserSetApi().updateUserSet( @@ -55,7 +54,7 @@ public void updateUserSet() throws IOException, SetApiClientException { @Test public void deleteUserSet() throws IOException, SetApiClientException { - String testSetId = createTestUserSet(USER_SET_CONTENT,null); + String testSetId = createTestUserSet(BaseWebUserSetProtocol.USER_SET_CONTENT,null); assertNotNull(testSetId); // delete user set by identifier URL String deleteResponse = apiClient.getWebUserSetApi().deleteUserSet(testSetId); diff --git a/set-client/src/test/resources/content/userset-open.json b/set-integration-testing/src/integration-test/resources/content/userset-open.json similarity index 100% rename from set-client/src/test/resources/content/userset-open.json rename to set-integration-testing/src/integration-test/resources/content/userset-open.json diff --git a/set-client/src/test/resources/content/userset.json b/set-integration-testing/src/integration-test/resources/content/userset.json similarity index 100% rename from set-client/src/test/resources/content/userset.json rename to set-integration-testing/src/integration-test/resources/content/userset.json diff --git a/set-client/src/test/resources/content/usersetupdate.json b/set-integration-testing/src/integration-test/resources/content/usersetupdate.json similarity index 100% rename from set-client/src/test/resources/content/usersetupdate.json rename to set-integration-testing/src/integration-test/resources/content/usersetupdate.json From 4fa53c0ffb119479077bd7f476ec0b05e6cbfd13 Mon Sep 17 00:00:00 2001 From: srishti Date: Tue, 17 Dec 2024 10:16:47 +0100 Subject: [PATCH 2/6] EA-4015 remove disabled --- .../api/set/integration/client/ClientConfigurationTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/ClientConfigurationTest.java b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/ClientConfigurationTest.java index 819cf486..90a83250 100644 --- a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/ClientConfigurationTest.java +++ b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/ClientConfigurationTest.java @@ -2,11 +2,9 @@ import eu.europeana.set.client.config.ClientConfiguration; import org.apache.commons.lang3.StringUtils; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertTrue; -@Disabled("needs configuration file") public class ClientConfigurationTest { @Test From 447f75f1caafba27a00d0ec7c6f58f74ae35bbc2 Mon Sep 17 00:00:00 2001 From: srishti Date: Tue, 17 Dec 2024 10:52:56 +0100 Subject: [PATCH 3/6] EA-4015 test properties --- .../resources/set-client.properties | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 set-integration-testing/src/integration-test/resources/set-client.properties diff --git a/set-integration-testing/src/integration-test/resources/set-client.properties b/set-integration-testing/src/integration-test/resources/set-client.properties new file mode 100644 index 00000000..3856eafd --- /dev/null +++ b/set-integration-testing/src/integration-test/resources/set-client.properties @@ -0,0 +1,14 @@ +# the uri of the user set service (REST API) => +# for testing within the development environment a local URI can be used e.g. localhost:8080/set-web/sets +set.service.uri = http://localhost:8080/set + +# the user key used to access Europeana API. For more information see http://pro.europeana.eu/api +set.api.key =test123 + +#the URL for the endpoint of OAuth service +oauth.service.uri=https://test/token + +#The parameters sent for retrieving a new ticket +oauth.token.request.params=test=test + + From 9408a3f26cc05588d78847a2313cbfad39f4adf4 Mon Sep 17 00:00:00 2001 From: srishti Date: Tue, 17 Dec 2024 11:09:53 +0100 Subject: [PATCH 4/6] EA-4015 test properties --- .../resources/set-client.properties | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 set-integration-testing/src/integration-test/resources/set-client.properties diff --git a/set-integration-testing/src/integration-test/resources/set-client.properties b/set-integration-testing/src/integration-test/resources/set-client.properties deleted file mode 100644 index 3856eafd..00000000 --- a/set-integration-testing/src/integration-test/resources/set-client.properties +++ /dev/null @@ -1,14 +0,0 @@ -# the uri of the user set service (REST API) => -# for testing within the development environment a local URI can be used e.g. localhost:8080/set-web/sets -set.service.uri = http://localhost:8080/set - -# the user key used to access Europeana API. For more information see http://pro.europeana.eu/api -set.api.key =test123 - -#the URL for the endpoint of OAuth service -oauth.service.uri=https://test/token - -#The parameters sent for retrieving a new ticket -oauth.token.request.params=test=test - - From fa778b19a1d5e5d1acdf7b11bd4fb2085c2e3ec0 Mon Sep 17 00:00:00 2001 From: srishti Date: Wed, 18 Dec 2024 09:47:32 +0100 Subject: [PATCH 5/6] EA-4015 add token --- .../integration/client/BaseAPIConnectionTest.java | 10 ++++++---- .../integration/client/BaseWebUserSetProtocol.java | 3 ++- .../integration/client/WebUserSetProtocolTest.java | 13 +++++++------ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseAPIConnectionTest.java b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseAPIConnectionTest.java index b0bb0c77..dd675406 100644 --- a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseAPIConnectionTest.java +++ b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseAPIConnectionTest.java @@ -1,21 +1,23 @@ package eu.europeana.api.set.integration.client; +import eu.europeana.api.set.integration.IntegrationTestSetup; import eu.europeana.set.client.connection.BaseApiConnection; import eu.europeana.set.definitions.model.vocabulary.WebUserSetFields; -import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -public class BaseAPIConnectionTest { +public class BaseAPIConnectionTest extends IntegrationTestSetup { private static final String SERVICE_URI = "testUri"; private static final String API_KEY_1 = "api_key"; private BaseApiConnection baseApiConnection; - @BeforeEach + @BeforeAll void setup() { - baseApiConnection = new BaseApiConnection(SERVICE_URI, API_KEY_1, null); + initRegularUserToken(); + baseApiConnection = new BaseApiConnection(SERVICE_URI, API_KEY_1, regularUserToken); } @Test diff --git a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseWebUserSetProtocol.java b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseWebUserSetProtocol.java index 26eaeb75..0dacbfb4 100644 --- a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseWebUserSetProtocol.java +++ b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseWebUserSetProtocol.java @@ -5,6 +5,7 @@ import java.io.InputStream; import java.io.InputStreamReader; +import eu.europeana.api.set.integration.IntegrationTestSetup; import eu.europeana.set.client.config.ClientConfiguration; import eu.europeana.set.client.exception.SetApiClientException; import org.apache.hc.core5.http.HttpStatus; @@ -15,7 +16,7 @@ import eu.europeana.set.definitions.model.UserSet; import static org.junit.jupiter.api.Assertions.assertEquals; -public class BaseWebUserSetProtocol { +public class BaseWebUserSetProtocol extends IntegrationTestSetup { protected Logger log = LogManager.getLogger(getClass()); diff --git a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolTest.java b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolTest.java index 8ffe6469..2f654046 100644 --- a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolTest.java +++ b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolTest.java @@ -4,6 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.IOException; import org.apache.hc.core5.http.HttpStatus; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import eu.europeana.set.client.exception.SetApiClientException; @@ -14,11 +15,11 @@ * This is an integration test, and it is ignored for unit testing * @author GrafR */ -public class WebUserSetProtocolTest extends BaseWebUserSetProtocol { +public class WebUserSetProtocolTest extends BaseWebUserSetProtocol{ @Test public void createUserSet() throws SetApiClientException, IOException { - String setId = createTestUserSet(BaseWebUserSetProtocol.USER_SET_CONTENT, null); + String setId = createTestUserSetForClient(BaseWebUserSetProtocol.USER_SET_CONTENT, null); assertNotNull(setId); apiClient.getWebUserSetApi().deleteUserSet(setId); } @@ -30,7 +31,7 @@ public void createUserSet() throws SetApiClientException, IOException { */ @Test public void retrieveUserSet() throws IllegalArgumentException, IOException, SetApiClientException { - String testSetId = createTestUserSet(BaseWebUserSetProtocol.USER_SET_CONTENT, null); + String testSetId = createTestUserSetForClient(BaseWebUserSetProtocol.USER_SET_CONTENT, null); assertNotNull(testSetId); // get user set by ID and user identifier UserSet userSet = apiClient.getWebUserSetApi().getUserSet(testSetId, null); @@ -40,7 +41,7 @@ public void retrieveUserSet() throws IllegalArgumentException, IOException, SetA @Test public void updateUserSet() throws IOException, SetApiClientException { - String testSetId = createTestUserSet(BaseWebUserSetProtocol.USER_SET_CONTENT, null); + String testSetId = createTestUserSetForClient(BaseWebUserSetProtocol.USER_SET_CONTENT, null); assertNotNull(testSetId); // updated user set value String requestBody = getJsonStringInput(BaseWebUserSetProtocol.USER_SET_UPDATE_CONTENT); @@ -54,7 +55,7 @@ public void updateUserSet() throws IOException, SetApiClientException { @Test public void deleteUserSet() throws IOException, SetApiClientException { - String testSetId = createTestUserSet(BaseWebUserSetProtocol.USER_SET_CONTENT,null); + String testSetId = createTestUserSetForClient(BaseWebUserSetProtocol.USER_SET_CONTENT,null); assertNotNull(testSetId); // delete user set by identifier URL String deleteResponse = apiClient.getWebUserSetApi().deleteUserSet(testSetId); @@ -68,7 +69,7 @@ public void deleteUserSet() throws IOException, SetApiClientException { * @return id of created user set * @throws IOException */ - private String createTestUserSet(String content, String profile) throws SetApiClientException, IOException { + private String createTestUserSetForClient(String content, String profile) throws SetApiClientException, IOException { UserSet response = storeTestUserSet(content, profile); return response.getIdentifier(); } From 169da295cb92dccdf8f3baabaa726b3e6007610a Mon Sep 17 00:00:00 2001 From: srishti Date: Wed, 18 Dec 2024 10:15:23 +0100 Subject: [PATCH 6/6] EA-4015 fix failures --- .../client/BaseAPIConnectionTest.java | 10 ++++------ .../client/BaseWebUserSetProtocol.java | 18 +++++++++++++++++- .../client/ClientConfigurationTest.java | 15 ++++++++++++++- .../client/WebUserSetProtocolTest.java | 2 +- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseAPIConnectionTest.java b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseAPIConnectionTest.java index dd675406..b0bb0c77 100644 --- a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseAPIConnectionTest.java +++ b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseAPIConnectionTest.java @@ -1,23 +1,21 @@ package eu.europeana.api.set.integration.client; -import eu.europeana.api.set.integration.IntegrationTestSetup; import eu.europeana.set.client.connection.BaseApiConnection; import eu.europeana.set.definitions.model.vocabulary.WebUserSetFields; -import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -public class BaseAPIConnectionTest extends IntegrationTestSetup { +public class BaseAPIConnectionTest { private static final String SERVICE_URI = "testUri"; private static final String API_KEY_1 = "api_key"; private BaseApiConnection baseApiConnection; - @BeforeAll + @BeforeEach void setup() { - initRegularUserToken(); - baseApiConnection = new BaseApiConnection(SERVICE_URI, API_KEY_1, regularUserToken); + baseApiConnection = new BaseApiConnection(SERVICE_URI, API_KEY_1, null); } @Test diff --git a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseWebUserSetProtocol.java b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseWebUserSetProtocol.java index 0dacbfb4..00f17f72 100644 --- a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseWebUserSetProtocol.java +++ b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/BaseWebUserSetProtocol.java @@ -4,8 +4,10 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.util.Properties; import eu.europeana.api.set.integration.IntegrationTestSetup; +import eu.europeana.api.set.integration.config.SetIntegrationConfiguration; import eu.europeana.set.client.config.ClientConfiguration; import eu.europeana.set.client.exception.SetApiClientException; import org.apache.hc.core5.http.HttpStatus; @@ -30,7 +32,21 @@ public class BaseWebUserSetProtocol extends IntegrationTestSetup { @BeforeEach public void initObjects() throws SetApiClientException { - apiClient = new UserSetApiClient(new ClientConfiguration()); + apiClient = new UserSetApiClient( new ClientConfiguration(loadProperties())); + } + + /** + * Create properties for set api localhost and regilar user token + * @return + */ + private Properties loadProperties() { + Properties properties = new Properties(); + properties.put(ClientConfiguration.PROP_SET_SERVICE_URI, "localhost:8080/set"); + properties.put(ClientConfiguration.PROP_SET_API_KEY, "test"); + properties.put(ClientConfiguration.PROP_OAUTH_SERVICE_URI, SetIntegrationConfiguration.getInstance().getOauthServiceUri()); + properties.put(ClientConfiguration.PROP_OAUTH_REQUEST_PARAMS, SetIntegrationConfiguration.getInstance().getOauthRequestParamsRegular()); + + return properties; } /** diff --git a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/ClientConfigurationTest.java b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/ClientConfigurationTest.java index 90a83250..fed4448a 100644 --- a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/ClientConfigurationTest.java +++ b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/ClientConfigurationTest.java @@ -3,15 +3,28 @@ import eu.europeana.set.client.config.ClientConfiguration; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; + +import java.util.Properties; + import static org.junit.jupiter.api.Assertions.assertTrue; public class ClientConfigurationTest { @Test public void clientConfiguration_loadProperties() { - ClientConfiguration configuration = new ClientConfiguration(); + ClientConfiguration configuration = new ClientConfiguration(loadProperties()); assertTrue(StringUtils.isNotEmpty(configuration.getOauthRequestParams())); assertTrue(StringUtils.isNotEmpty(configuration.getServiceUri())); assertTrue(StringUtils.isNotEmpty(configuration.getOauthServiceUri())); } + + private Properties loadProperties() { + Properties properties = new Properties(); + properties.put(ClientConfiguration.PROP_SET_SERVICE_URI, "service-ur-test"); + properties.put(ClientConfiguration.PROP_SET_API_KEY, "test"); + properties.put(ClientConfiguration.PROP_OAUTH_SERVICE_URI, "outh-test"); + properties.put(ClientConfiguration.PROP_OAUTH_REQUEST_PARAMS, "params-test"); + + return properties; + } } diff --git a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolTest.java b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolTest.java index 2f654046..d40731ed 100644 --- a/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolTest.java +++ b/set-integration-testing/src/integration-test/java/eu/europeana/api/set/integration/client/WebUserSetProtocolTest.java @@ -15,7 +15,7 @@ * This is an integration test, and it is ignored for unit testing * @author GrafR */ -public class WebUserSetProtocolTest extends BaseWebUserSetProtocol{ +public class WebUserSetProtocolTest extends BaseWebUserSetProtocol { @Test public void createUserSet() throws SetApiClientException, IOException {