cleaned up test cases and allowed basic auth to be instantiated via new

This commit is contained in:
Adrian Cole 2010-10-01 16:08:15 +01:00
parent 3a09b2ab6b
commit 17e4b779b4
3 changed files with 7 additions and 8 deletions

View File

@ -91,4 +91,5 @@ public class ComputeTestUtils {
}
}
}
}

View File

@ -43,7 +43,7 @@ public class RunScriptData {
private static String jbossHome = "/usr/local/jboss";
public static String createScriptInstallBase(OperatingSystem os) {
public static String installJavaAndCurl(OperatingSystem os) {
if (os == null || OperatingSystemPredicates.supportsApt().apply(os))
return APT_RUN_SCRIPT;
else if (OperatingSystemPredicates.supportsYum().apply(os))
@ -63,7 +63,7 @@ public class RunScriptData {
envVariables,
ImmutableList.<Statement> of(
new AuthorizeRSAPublicKey(publicKey),
exec(createScriptInstallBase(os)),
exec(installJavaAndCurl(os)),
exec("rm -rf /var/cache/apt /usr/lib/vmware-tools"),// jeos hasn't enough room!
extractTargzIntoDirectory(
URI.create("http://commondatastorage.googleapis.com/jclouds-repo/jboss-as-distribution-6.0.0.20100911-M5.tar.gz"),
@ -92,7 +92,6 @@ public class RunScriptData {
.append(
"echo \"baseurl=http://ec2-us-east-mirror.rightscale.com/epel/5/i386/\" >> /etc/yum.repos.d/CentOS-Base.repo\n")//
.append("echo \"enabled=1\" >> /etc/yum.repos.d/CentOS-Base.repo\n")//
// .append("which unzip ||yum --nogpgcheck -y install unzip\n")//
.append("which curl ||yum --nogpgcheck -y install curl\n")//
.append(
"(which java && java -fullversion 2>&1|egrep -q 1.6 ) || yum --nogpgcheck -y install java-1.6.0-openjdk&&")//
@ -101,7 +100,6 @@ public class RunScriptData {
public static final String ZYPPER_RUN_SCRIPT = new StringBuilder()//
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")//
// .append("which unzip ||sudo zypper install unzip\n")//
.append("which curl || zypper install curl\n")//
.append("(which java && java -fullversion 2>&1|egrep -q 1.6 ) || zypper install java-1.6.0-openjdk\n")//
.toString();

View File

@ -52,11 +52,11 @@ public class BasicAuthentication implements HttpRequestFilter {
private final Set<String> credentialList;
@Inject
BasicAuthentication(@Named(PROPERTY_IDENTITY) String user, @Named(PROPERTY_CREDENTIAL) String password, Crypto crypto)
throws UnsupportedEncodingException {
public BasicAuthentication(@Named(PROPERTY_IDENTITY) String user, @Named(PROPERTY_CREDENTIAL) String password,
Crypto crypto) throws UnsupportedEncodingException {
this.credentialList = ImmutableSet.of("Basic "
+ CryptoStreams.base64(String.format("%s:%s", checkNotNull(user, "user"),
checkNotNull(password, "password")).getBytes("UTF-8")));
+ CryptoStreams.base64(String.format("%s:%s", checkNotNull(user, "user"),
checkNotNull(password, "password")).getBytes("UTF-8")));
}
public void filter(HttpRequest request) throws HttpException {