Issue 616:move integration tests to jboss as7

This commit is contained in:
Adrian Cole 2011-07-01 18:01:40 -07:00
parent b56f08b9a5
commit ceaffbf103
5 changed files with 142 additions and 70 deletions

View File

@ -30,9 +30,9 @@ import java.util.Map;
import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.predicates.OperatingSystemPredicates;
import org.jclouds.scriptbuilder.InitBuilder;
import org.jclouds.scriptbuilder.domain.AuthorizeRSAPublicKey;
import org.jclouds.scriptbuilder.domain.Statement;
import org.jclouds.scriptbuilder.domain.Statements;
import org.jclouds.scriptbuilder.statements.login.AdminAccess;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@ -66,25 +66,62 @@ public class RunScriptData {
exec("iptables-save"));
}
public static Statement createScriptInstallAndStartJBoss(String publicKey, OperatingSystem os) {
public static Statement createScriptInstallAndStartJBoss(OperatingSystem os) {
Map<String, String> envVariables = ImmutableMap.of("jbossHome", jbossHome);
Statement toReturn = new InitBuilder(
"jboss",
jbossHome,
jbossHome,
envVariables,
ImmutableList.<Statement> of(new AuthorizeRSAPublicKey(publicKey),//
ImmutableList.<Statement> of(AdminAccess.standard(),//
installJavaAndCurl(os),//
authorizePortInIpTables(8080),
extractTargzIntoDirectory(URI.create(System.getProperty("test.jboss-url",
"http://d37gkgjhl3prlk.cloudfront.net/jboss-6.0.0.Final.tar.gz")), "/usr/local"),//
"http://d37gkgjhl3prlk.cloudfront.net/jboss-7.0.0.CR1.tar.gz")), "/usr/local"),//
exec("{md} " + jbossHome), exec("mv /usr/local/jboss-*/* " + jbossHome),//
changeStandaloneConfigToListenOnAllIPAddresses(),
exec("chmod -R oug+r+w " + jbossHome)),//
//TODO http://community.jboss.org/wiki/AS7StartupTimeShowdown
ImmutableList
.<Statement> of(interpret("java -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.endorsed.dirs=lib/endorsed -classpath bin/run.jar org.jboss.Main -c jbossweb-standalone -b 0.0.0.0")));
.<Statement> of(interpret(new StringBuilder().append("java ").append(' ')
.append("-Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000").append(' ')
.append("-Djboss.modules.system.pkgs=org.jboss.byteman").append(' ')
.append("-Dorg.jboss.boot.log.file=$JBOSS_HOME/standalone/log/boot.log").append(' ')
.append("-Dlogging.configuration=file:$JBOSS_HOME/standalone/configuration/logging.properties").append(' ')
.append("-jar $JBOSS_HOME/jboss-modules.jar").append(' ')
.append("-mp $JBOSS_HOME/modules").append(' ')
.append("-logmodule org.jboss.logmanager").append(' ')
.append("-jaxpmodule javax.xml.jaxp-provider").append(' ')
.append("org.jboss.as.standalone").append(' ')
.append("-Djboss.home.dir=$JBOSS_HOME")
.toString())));
return toReturn;
}
public static Statement normalizeHostAndDNSConfig() {
return newStatementList(//
addHostnameToEtcHostsIfMissing(),//
addDnsToResolverIfMissing());
}
public static Statement addHostnameToEtcHostsIfMissing() {
return exec("grep `hostname` /etc/hosts >/dev/null || awk -v hostname=`hostname` 'END { print $1\" \"hostname }' /proc/net/arp >> /etc/hosts");
}
public static Statement addDnsToResolverIfMissing() {
return exec("nslookup yahoo.com >/dev/null || echo nameserver 208.67.222.222 >> /etc/resolv.conf");
}
public static Statement installSunJDKFromWhirrIfNotPresent() {
return newStatementList(exec("(which java && java -fullversion 2>&1|egrep -q 1.6 ) ||"),//
execHttpResponse(URI.create("http://whirr.s3.amazonaws.com/0.3.0-incubating/sun/java/install")));
}
// TODO make this a cli option
private static Statement changeStandaloneConfigToListenOnAllIPAddresses() {
return exec("(cd $JBOSS_HOME/standalone/configuration && sed 's~inet-address value=.*/~any-address/~g' standalone.xml > standalone.xml.new && mv standalone.xml.new standalone.xml)");
}
public static String aptInstall = "apt-get install -f -y -qq --force-yes";
public static String installAfterUpdatingIfNotPresent(String cmd) {
@ -93,28 +130,21 @@ public class RunScriptData {
}
public static final Statement APT_RUN_SCRIPT = newStatementList(//
normalizeHostAndDNSConfig(),//
exec(installAfterUpdatingIfNotPresent("curl")),//
exec("(which java && java -fullversion 2>&1|egrep -q 1.6 ) ||"),//
execHttpResponse(URI.create("http://whirr.s3.amazonaws.com/0.2.0-incubating-SNAPSHOT/sun/java/install")),//
exec(new StringBuilder()//
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")//
// jeos hasn't enough room!
.append("rm -rf /var/cache/apt /usr/lib/vmware-tools\n")//
.append("echo \"export PATH=\\\"\\$JAVA_HOME/bin/:\\$PATH\\\"\" >> /root/.bashrc")//
.toString()));
installSunJDKFromWhirrIfNotPresent(),//
exec("rm -rf /var/cache/apt /usr/lib/vmware-tools"),//
exec("echo \"export PATH=\\\"\\$JAVA_HOME/bin/:\\$PATH\\\"\" >> /root/.bashrc"));
public static final Statement YUM_RUN_SCRIPT = newStatementList(
exec("which curl ||yum --nogpgcheck -y install curl"),//
exec("(which java && java -fullversion 2>&1|egrep -q 1.6 ) ||"),//
execHttpResponse(URI.create("http://whirr.s3.amazonaws.com/0.2.0-incubating-SNAPSHOT/sun/java/install")),//
exec(new StringBuilder()//
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n") //
.append("echo \"export PATH=\\\"\\$JAVA_HOME/bin/:\\$PATH\\\"\" >> /root/.bashrc")//
.toString()));
public static final Statement YUM_RUN_SCRIPT = newStatementList(//
normalizeHostAndDNSConfig(),//
exec("which curl || yum --nogpgcheck -y install curl"),//
installSunJDKFromWhirrIfNotPresent(),//
exec("echo \"export PATH=\\\"\\$JAVA_HOME/bin/:\\$PATH\\\"\" >> /root/.bashrc"));
public static final Statement ZYPPER_RUN_SCRIPT = exec(new StringBuilder()//
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\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());
public static final Statement ZYPPER_RUN_SCRIPT = newStatementList(//
normalizeHostAndDNSConfig(),//
exec("which curl || zypper install curl"),//
exec("(which java && java -fullversion 2>&1|egrep -q 1.6 ) || zypper install java-1.6.0-openjdk"),//
exec("echo \"export PATH=\\\"\\$JAVA_HOME/bin/:\\$PATH\\\"\" >> /root/.bashrc"));
}

View File

@ -113,7 +113,7 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
@Override
public Supplier<Map<String, String>> defaultAdminSshKeys() {
return Suppliers.<Map<String, String>> ofInstance(ImmutableMap.of("public", "publicKey", "private",
"privateKey"));
"privateKey"));
}
@Override
@ -134,66 +134,69 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
});
SshClient.Factory factory = createMock(SshClient.Factory.class);
SshClient client1 = createMock(SshClient.class);
SshClient client1New = createMock(SshClient.class);
SshClient client2 = createMock(SshClient.class);
SshClient client3 = createMock(SshClient.class);
SshClient client4 = createMock(SshClient.class);
SshClient client5 = createMock(SshClient.class);
expect(factory.create(new IPSocket("144.175.1.1", 22), new Credentials("root", "password1"))).andReturn(
client1);
runScriptAndService(client1, 1);
client1);
expect(factory.create(new IPSocket("144.175.1.1", 22), new Credentials("defaultAdminUsername", "privateKey"))).andReturn(
client1New);
runScriptAndService(client1, client1New);
expect(factory.create(new IPSocket("144.175.1.2", 22), new Credentials("root", "password2"))).andReturn(
client2).times(4);
client2).times(4);
expect(factory.create(new IPSocket("144.175.1.2", 22), new Credentials("root", "romeo"))).andThrow(
new SshException("Auth fail"));
new SshException("Auth fail"));
// run script without backgrounding (via predicate)
client2.connect();
expect(client2.exec("echo hello\n")).andReturn(new ExecResponse("hello\n", "", 0));
client2.disconnect();
// run script without backgrounding (via id)
client2.connect();
expect(client2.exec("echo hello\n")).andReturn(new ExecResponse("hello\n", "", 0));
client2.disconnect();
client2.connect();
try {
runScript(client2, "runScriptWithCreds",
Strings2.toStringAndClose(StubComputeServiceIntegrationTest.class
.getResourceAsStream("/runscript.sh")), 2);
Strings2.toStringAndClose(StubComputeServiceIntegrationTest.class
.getResourceAsStream("/runscript.sh")), 2);
} catch (IOException e) {
Throwables.propagate(e);
}
client2.disconnect();
expect(factory.create(new IPSocket("144.175.1.3", 22), new Credentials("root", "password3"))).andReturn(
client3).times(2);
client3).times(2);
expect(factory.create(new IPSocket("144.175.1.4", 22), new Credentials("root", "password4"))).andReturn(
client4).times(2);
client4).times(2);
expect(factory.create(new IPSocket("144.175.1.5", 22), new Credentials("root", "password5"))).andReturn(
client5).times(2);
client5).times(2);
runScriptAndInstallSsh(client3, "bootstrap", 3);
runScriptAndInstallSsh(client4, "bootstrap", 4);
runScriptAndInstallSsh(client5, "bootstrap", 5);
expect(
factory.create(eq(new IPSocket("144.175.1.1", 22)),
eq(new Credentials("defaultAdminUsername", "privateKey")))).andReturn(client1);
factory.create(eq(new IPSocket("144.175.1.1", 22)), eq(new Credentials("defaultAdminUsername",
"privateKey")))).andReturn(client1);
expect(
factory.create(eq(new IPSocket("144.175.1.2", 22)),
eq(new Credentials("defaultAdminUsername", "privateKey")))).andReturn(client2);
factory.create(eq(new IPSocket("144.175.1.2", 22)), eq(new Credentials("defaultAdminUsername",
"privateKey")))).andReturn(client2);
expect(
factory.create(eq(new IPSocket("144.175.1.3", 22)),
eq(new Credentials("defaultAdminUsername", "privateKey")))).andReturn(client3);
factory.create(eq(new IPSocket("144.175.1.3", 22)), eq(new Credentials("defaultAdminUsername",
"privateKey")))).andReturn(client3);
expect(
factory.create(eq(new IPSocket("144.175.1.4", 22)),
eq(new Credentials("defaultAdminUsername", "privateKey")))).andReturn(client4);
factory.create(eq(new IPSocket("144.175.1.4", 22)), eq(new Credentials("defaultAdminUsername",
"privateKey")))).andReturn(client4);
expect(
factory.create(eq(new IPSocket("144.175.1.5", 22)),
eq(new Credentials("defaultAdminUsername", "privateKey")))).andReturn(client5);
factory.create(eq(new IPSocket("144.175.1.5", 22)), eq(new Credentials("defaultAdminUsername",
"privateKey")))).andReturn(client5);
helloAndJava(client2);
helloAndJava(client3);
@ -202,6 +205,7 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
replay(factory);
replay(client1);
replay(client1New);
replay(client2);
replay(client3);
replay(client4);
@ -210,17 +214,34 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
bind(SshClient.Factory.class).toInstance(factory);
}
private void runScriptAndService(SshClient client, int nodeId) {
private void runScriptAndService(SshClient client, SshClient clientNew) {
client.connect();
try {
runScript(client, "jboss", Strings2.toStringAndClose(StubComputeServiceIntegrationTest.class
.getResourceAsStream("/initscript_with_jboss.sh")), nodeId);
String scriptName = "jboss";
client.put("/tmp/init-" + scriptName, Strings2.toStringAndClose(StubComputeServiceIntegrationTest.class
.getResourceAsStream("/initscript_with_jboss.sh")));
expect(client.exec("chmod 755 /tmp/init-" + scriptName)).andReturn(EXEC_GOOD);
expect(client.exec("ln -fs /tmp/init-" + scriptName + " " + scriptName)).andReturn(EXEC_GOOD);
expect(client.getUsername()).andReturn("root").atLeastOnce();
expect(client.getHostAddress()).andReturn(clientNew + "").atLeastOnce();
expect(client.exec("./" + scriptName + " init")).andReturn(EXEC_GOOD);
// note we have to reconnect here, as we updated the login user.
client.disconnect();
clientNew.connect();
expect(clientNew.getUsername()).andReturn("defaultAdminUsername").atLeastOnce();
expect(clientNew.getHostAddress()).andReturn(clientNew + "").atLeastOnce();
expect(clientNew.exec("ln -fs /tmp/init-" + scriptName + " " + scriptName)).andReturn(EXEC_GOOD);
expect(clientNew.exec("sudo ./" + scriptName + " start")).andReturn(EXEC_GOOD);
expect(clientNew.exec("sudo ./" + scriptName + " status")).andReturn(EXEC_GOOD);
// next status says the script is done, since not found.
expect(clientNew.exec("sudo ./" + scriptName + " status")).andReturn(EXEC_BAD);
expect(clientNew.exec("sudo ./" + scriptName + " tail")).andReturn(EXEC_GOOD);
expect(clientNew.exec("sudo ./" + scriptName + " tailerr")).andReturn(EXEC_GOOD);
} catch (IOException e) {
Throwables.propagate(e);
}
client.disconnect();
clientNew.disconnect();
}
@ -229,7 +250,7 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
try {
runScript(client, scriptName, Strings2.toStringAndClose(StubComputeServiceIntegrationTest.class
.getResourceAsStream("/initscript_with_java.sh")), nodeId);
.getResourceAsStream("/initscript_with_java.sh")), nodeId);
} catch (IOException e) {
Throwables.propagate(e);
}
@ -239,8 +260,9 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
}
private void runScript(SshClient client, String scriptName, String script, int nodeId) {
client.put(scriptName, script);
expect(client.exec("chmod 755 " + scriptName + "")).andReturn(EXEC_GOOD);
client.put("/tmp/init-" + scriptName, script);
expect(client.exec("chmod 755 /tmp/init-" + scriptName)).andReturn(EXEC_GOOD);
expect(client.exec("ln -fs /tmp/init-" + scriptName + " " + scriptName)).andReturn(EXEC_GOOD);
expect(client.getUsername()).andReturn("root").atLeastOnce();
expect(client.getHostAddress()).andReturn(nodeId + "").atLeastOnce();
expect(client.exec("./" + scriptName + " init")).andReturn(EXEC_GOOD);
@ -282,7 +304,7 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
public void testAssignability() throws Exception {
@SuppressWarnings("unused")
RestContext<ConcurrentMap<String, NodeMetadata>, ConcurrentMap<String, NodeMetadata>> stubContext = new ComputeServiceContextFactory()
.createContext(provider, identity, credential).getProviderSpecificContext();
.createContext(provider, identity, credential).getProviderSpecificContext();
}
private static class PayloadEquals implements IArgumentMatcher, Serializable {
@ -329,7 +351,7 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
return false;
PayloadEquals other = (PayloadEquals) o;
return this.expected == null && other.expected == null || this.expected != null
&& this.expected.equals(other.expected);
&& this.expected.equals(other.expected);
}
@Override

View File

@ -97,10 +97,11 @@ PermitRootLogin no
/etc/init.d/sshd reload||/etc/init.d/ssh reload
awk -v user=^${SUDO_USER:=${USER}}: -v password='crypt(randompassword)' 'BEGIN { FS=OFS=":" } $0 ~ user { $2 = password } 1' /etc/shadow >/etc/shadow.${SUDO_USER:=${USER}}
test -f /etc/shadow.${SUDO_USER:=${USER}} && mv /etc/shadow.${SUDO_USER:=${USER}} /etc/shadow
grep `hostname` /etc/hosts >/dev/null || awk -v hostname=`hostname` 'END { print $1" "hostname }' /proc/net/arp >> /etc/hosts
nslookup yahoo.com >/dev/null || echo nameserver 208.67.222.222 >> /etc/resolv.conf
which curl || (apt-get install -f -y -qq --force-yes curl || (apt-get update && apt-get install -f -y -qq --force-yes curl))
(which java && java -fullversion 2>&1|egrep -q 1.6 ) ||
curl -X GET -s --retry 20 http://whirr.s3.amazonaws.com/0.2.0-incubating-SNAPSHOT/sun/java/install |(bash)
echo nameserver 208.67.222.222 >> /etc/resolv.conf
curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -X GET http://whirr.s3.amazonaws.com/0.3.0-incubating/sun/java/install |(bash)
rm -rf /var/cache/apt /usr/lib/vmware-tools
echo "export PATH=\"\$JAVA_HOME/bin/:\$PATH\"" >> /root/.bashrc

View File

@ -58,23 +58,41 @@ case $1 in
init)
default || exit 1
jboss || exit 1
mkdir -p ~/.ssh
cat >> ~/.ssh/authorized_keys <<'END_OF_FILE'
ssh-rsa
rm /etc/sudoers
cat >> /etc/sudoers <<'END_OF_FILE'
root ALL = (ALL) ALL
%wheel ALL = (ALL) NOPASSWD:ALL
END_OF_FILE
chmod 600 ~/.ssh/authorized_keys
chmod 0440 /etc/sudoers
mkdir -p /home/users/defaultAdminUsername
groupadd -f wheel
useradd -s /bin/bash -g wheel -d /home/users/defaultAdminUsername -p 'crypt(randompassword)' defaultAdminUsername
mkdir -p /home/users/defaultAdminUsername/.ssh
cat >> /home/users/defaultAdminUsername/.ssh/authorized_keys <<'END_OF_FILE'
publicKey
END_OF_FILE
chmod 600 /home/users/defaultAdminUsername/.ssh/authorized_keys
chown -R defaultAdminUsername /home/users/defaultAdminUsername
exec 3<> /etc/ssh/sshd_config && awk -v TEXT="PasswordAuthentication no
PermitRootLogin no
" 'BEGIN {print TEXT}{print}' /etc/ssh/sshd_config >&3
/etc/init.d/sshd reload||/etc/init.d/ssh reload
awk -v user=^${SUDO_USER:=${USER}}: -v password='crypt(randompassword)' 'BEGIN { FS=OFS=":" } $0 ~ user { $2 = password } 1' /etc/shadow >/etc/shadow.${SUDO_USER:=${USER}}
test -f /etc/shadow.${SUDO_USER:=${USER}} && mv /etc/shadow.${SUDO_USER:=${USER}} /etc/shadow
grep `hostname` /etc/hosts >/dev/null || awk -v hostname=`hostname` 'END { print $1" "hostname }' /proc/net/arp >> /etc/hosts
nslookup yahoo.com >/dev/null || echo nameserver 208.67.222.222 >> /etc/resolv.conf
which curl || (apt-get install -f -y -qq --force-yes curl || (apt-get update && apt-get install -f -y -qq --force-yes curl))
(which java && java -fullversion 2>&1|egrep -q 1.6 ) ||
curl -X GET -s --retry 20 http://whirr.s3.amazonaws.com/0.2.0-incubating-SNAPSHOT/sun/java/install |(bash)
echo nameserver 208.67.222.222 >> /etc/resolv.conf
curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -X GET http://whirr.s3.amazonaws.com/0.3.0-incubating/sun/java/install |(bash)
rm -rf /var/cache/apt /usr/lib/vmware-tools
echo "export PATH=\"\$JAVA_HOME/bin/:\$PATH\"" >> /root/.bashrc
iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT
iptables -I RH-Firewall-1-INPUT 1 -p tcp --dport 8080 -j ACCEPT
iptables-save
curl -X GET -s --retry 20 http://d37gkgjhl3prlk.cloudfront.net/jboss-6.0.0.Final.tar.gz |(mkdir -p /usr/local &&cd /usr/local &&tar -xpzf -)
curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -X GET http://d37gkgjhl3prlk.cloudfront.net/jboss-7.0.0.CR1.tar.gz |(mkdir -p /usr/local &&cd /usr/local &&tar -xpzf -)
mkdir -p /usr/local/jboss
mv /usr/local/jboss-*/* /usr/local/jboss
(cd $JBOSS_HOME/standalone/configuration && sed 's~inet-address value=.*/~any-address/~g' standalone.xml > standalone.xml.new && mv standalone.xml.new standalone.xml)
chmod -R oug+r+w /usr/local/jboss
mkdir -p $INSTANCE_HOME
@ -96,7 +114,7 @@ END_OF_SCRIPT
# add desired commands from the user
cat >> $INSTANCE_HOME/jboss.sh <<'END_OF_SCRIPT'
cd $INSTANCE_HOME
java -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.endorsed.dirs=lib/endorsed -classpath bin/run.jar org.jboss.Main -c jbossweb-standalone -b 0.0.0.0
java -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Dorg.jboss.boot.log.file=$JBOSS_HOME/standalone/log/boot.log -Dlogging.configuration=file:$JBOSS_HOME/standalone/configuration/logging.properties -jar $JBOSS_HOME/jboss-modules.jar -mp $JBOSS_HOME/modules -logmodule org.jboss.logmanager -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=$JBOSS_HOME
END_OF_SCRIPT
# add runscript footer

View File

@ -76,10 +76,11 @@ END_OF_SCRIPT
# add desired commands from the user
cat >> $INSTANCE_HOME/runScriptWithCreds.sh <<'END_OF_SCRIPT'
cd $INSTANCE_HOME
grep `hostname` /etc/hosts >/dev/null || awk -v hostname=`hostname` 'END { print $1" "hostname }' /proc/net/arp >> /etc/hosts
nslookup yahoo.com >/dev/null || echo nameserver 208.67.222.222 >> /etc/resolv.conf
which curl || (apt-get install -f -y -qq --force-yes curl || (apt-get update && apt-get install -f -y -qq --force-yes curl))
(which java && java -fullversion 2>&1|egrep -q 1.6 ) ||
curl -X GET -s --retry 20 http://whirr.s3.amazonaws.com/0.2.0-incubating-SNAPSHOT/sun/java/install |(bash)
echo nameserver 208.67.222.222 >> /etc/resolv.conf
curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -X GET http://whirr.s3.amazonaws.com/0.3.0-incubating/sun/java/install |(bash)
rm -rf /var/cache/apt /usr/lib/vmware-tools
echo "export PATH=\"\$JAVA_HOME/bin/:\$PATH\"" >> /root/.bashrc