//try to exchange token using the first tenant
if(tenants.getList().size() > 0) {
access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute();
Swift swift = new Swift(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "object-store", null, "public"));
swift.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId()));
//swiftClient.execute(new DeleteContainer("navidad2"));
swift.containers().create("navidad2").execute();
System.out.println(swift.containers().list());
ObjectForUpload upload = new ObjectForUpload();
upload.setContainer("navidad2");
upload.setName("example2");
upload.setInputStream(new FileInputStream(TEST_FILE));
swift.containers().container("navidad2").upload(upload).execute();
// System.out.println(swiftClient.execute(new ListObjects("navidad2", new HashMap<String, String>() {{
// put("path", "");
// }})).get(0).getContentType());
ObjectDownload download = swift.containers().container("navidad").download("example2").execute();
write(download.getInputStream(), "example2");
}
}