Commit cb256fb5d44dfac3573971cfeaa1309194e84cec

Authored by Paulo Graça
1 parent b678b06e6f
Exists in tests

Include default test orcid client

ptcrisync-test/src/pt/ptcris/test/preparation/DefaultTestOrcidClient.java
... ... @@ -0,0 +1,35 @@
  1 +package pt.ptcris.test.preparation;
  2 +
  3 +import java.util.Properties;
  4 +
  5 +import org.um.dsi.gavea.orcid.client.OrcidAccessToken;
  6 +
  7 +import pt.ptcris.ORCIDClient;
  8 +import pt.ptcris.ORCIDClientImpl;
  9 +import pt.ptcris.test.properties.TestPropertiesLoader;
  10 +
  11 +public class DefaultTestOrcidClient {
  12 + private static Properties properties = TestPropertiesLoader.getInstance().getProperties();
  13 +
  14 + private DefaultTestOrcidClient(){}
  15 +
  16 + public static ORCIDClient getDefaultClient () {
  17 + ORCIDClientImpl orcidClient = new ORCIDClientImpl(properties.getProperty("orcid_login_uri"),
  18 + properties.getProperty("orcid_api_uri"),
  19 + properties.getProperty("orcid_client_id"),
  20 + properties.getProperty("orcid_client_secret"),
  21 + properties.getProperty("orcid_redirect_uri"), DefaultTestOrcidClient.getDefaultAccessToken());
  22 +
  23 + return orcidClient;
  24 + }
  25 +
  26 + public static OrcidAccessToken getDefaultAccessToken () {
  27 + OrcidAccessToken orcidToken = new OrcidAccessToken();
  28 +
  29 + orcidToken.setAccess_token(properties.getProperty("orcid_access_token"));
  30 + orcidToken.setOrcid(properties.getProperty("orcid_id"));
  31 +
  32 + return orcidToken;
  33 + }
  34 +
  35 +}
... ...