Skip to content

Instantly share code, notes, and snippets.

@hgdeoro
Created March 13, 2011 05:03
Show Gist options
  • Save hgdeoro/867879 to your computer and use it in GitHub Desktop.
Save hgdeoro/867879 to your computer and use it in GitHub Desktop.
Testea login y cuenta containers disponibles en Object Storage
import java.io.IOException;
import java.net.URL;
import org.apache.http.HttpException;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.testng.annotations.Test;
import com.rackspacecloud.client.cloudfiles.FilesAccountInfo;
import com.rackspacecloud.client.cloudfiles.FilesClient;
public class TestConexionObjectStorage2 {
@Test
public void testConnect() throws IOException, HttpException {
URL jssecacertsUrl = this.getClass().getResource("/jssecacerts");
System.setProperty("javax.net.ssl.trustStore", jssecacertsUrl.getPath());
BasicConfigurator.configure();
Logger.getRootLogger().setLevel(Level.INFO);
Logger logger = Logger.getLogger(this.getClass());
FilesClient client = new FilesClient("system:root", "testpass",
"https://192.168.122.233:11000/v1.0");
client.login();
FilesAccountInfo info = client.getAccountInfo();
logger.info("Hay " + info.getContainerCount() + " containers disponibles.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment