JCLOUDS-643: Fix Google and OAuth tests

This commit is contained in:
Chris Custine 2014-07-31 01:57:19 -06:00
parent 5c1e36e5d1
commit 00d9edc1e6
3 changed files with 15 additions and 5 deletions

View File

@ -92,6 +92,12 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<configuration>
<skipTests>true</skipTests>
</configuration>
</execution>
<execution>
<id>integration</id>
<phase>integration-test</phase>
@ -105,7 +111,7 @@
<test.oauth.endpoint>${test.oauth.endpoint}</test.oauth.endpoint>
<test.oauth.api-version>${test.oauth.api-version}</test.oauth.api-version>
<test.oauth.build-version>${test.oauth.build-version}</test.oauth.build-version>
<test.jclouds.oauth.signature-or-mac-algorithm>${test.jclouds.oauth.signature-or-mac-algorithm&gt;}</test.jclouds.oauth.signature-or-mac-algorithm>
<test.jclouds.oauth.signature-or-mac-algorithm>${test.jclouds.oauth.signature-or-mac-algorithm}</test.jclouds.oauth.signature-or-mac-algorithm>
<test.jclouds.oauth.audience>${test.jclouds.oauth.audience}</test.jclouds.oauth.audience>
<test.jclouds.oauth.scopes>${test.jclouds.oauth.scopes}</test.jclouds.oauth.scopes>
</systemPropertyVariables>

View File

@ -46,7 +46,7 @@ public class OAuthTestUtils {
}
}
public static String setCredentialFromPemFile(Properties overrides, String key) {
public static String setCredential(Properties overrides, String key) {
String val = null;
String credentialFromFile = null;
String testKey = "test." + key;
@ -54,7 +54,11 @@ public class OAuthTestUtils {
if (System.getProperties().containsKey(testKey)) {
val = System.getProperty(testKey);
}
checkNotNull(val, String.format("the property %s must be set (pem private key path)", testKey));
checkNotNull(val, String.format("the property %s must be set (pem private key file path or private key as a string)", testKey));
if (val.startsWith("-----BEGIN")) {
return val;
}
try {
credentialFromFile = Files.toString(new File(val), Charsets.UTF_8);

View File

@ -17,7 +17,7 @@
package org.jclouds.oauth.v2.internal;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.oauth.v2.OAuthTestUtils.setCredentialFromPemFile;
import static org.jclouds.oauth.v2.OAuthTestUtils.setCredential;
import static org.jclouds.oauth.v2.config.OAuthProperties.AUDIENCE;
import static org.jclouds.oauth.v2.config.OAuthProperties.SCOPES;
import static org.jclouds.oauth.v2.config.OAuthProperties.SIGNATURE_OR_MAC_ALGORITHM;
@ -40,7 +40,7 @@ public class BaseOAuthApiLiveTest extends BaseApiLiveTest<OAuthApi> {
@Override
protected Properties setupProperties() {
Properties props = super.setupProperties();
setCredentialFromPemFile(props, "oauth.credential");
setCredential(props, "oauth.credential");
checkNotNull(setIfTestSystemPropertyPresent(props, "oauth.endpoint"), "test.oauth.endpoint must be set");
checkNotNull(setIfTestSystemPropertyPresent(props, AUDIENCE), "test.jclouds.oauth.audience must be set");
setIfTestSystemPropertyPresent(props, SCOPES);