Issue 273: updated to latest opscode platform api

This commit is contained in:
Adrian Cole 2010-08-03 14:33:16 -04:00
parent c2c15ce633
commit 21b1246e0e
9 changed files with 300 additions and 174 deletions

View File

@ -46,6 +46,7 @@ import org.jclouds.opscodeplatform.domain.User;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Headers;
import org.jclouds.rest.annotations.ParamParser; import org.jclouds.rest.annotations.ParamParser;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.ResponseParser;
@ -66,6 +67,7 @@ import com.google.common.util.concurrent.ListenableFuture;
*/ */
@RequestFilters(SignedHeaderAuth.class) @RequestFilters(SignedHeaderAuth.class)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Headers(keys = "X-Chef-Version", values = ChefAsyncClient.VERSION)
public interface OpscodePlatformAsyncClient { public interface OpscodePlatformAsyncClient {
/** /**
* @see ChefCookbooks#listCookbooksInOrganization * @see ChefCookbooks#listCookbooksInOrganization

View File

@ -32,7 +32,7 @@ import com.google.common.base.Function;
public class OrganizationName implements Function<Object, String> { public class OrganizationName implements Function<Object, String> {
public String apply(Object from) { public String apply(Object from) {
return ((Organization) from).getName(); return ((Organization) from).getFullName();
} }
} }

View File

@ -18,74 +18,56 @@
*/ */
package org.jclouds.opscodeplatform.domain; package org.jclouds.opscodeplatform.domain;
import static com.google.common.base.Preconditions.checkNotNull;
import java.security.PrivateKey; import java.security.PrivateKey;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
/** /**
* User object. * Organization object.
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class Organization implements Comparable<Organization> { public class Organization {
public interface Type {
public static final String BUSINESS = "Business";
public static final String NON_PROFIT = "Non-Profit";
public static final String PERSONAL = "Personal";
}
private String guid;
@SerializedName("name")
private String name; private String name;
@SerializedName("full_name") @SerializedName("full_name")
private String fullName; private String fullName;
private String clientname;
@SerializedName("org_type") @SerializedName("org_type")
private String orgType; private String orgType;
private String clientname;
@SerializedName("private_key") @SerializedName("private_key")
private PrivateKey privateKey; private PrivateKey privateKey;
public Organization(String name) {
this();
this.name = name;
}
// hidden but needs to be here for json deserialization to work
Organization() { Organization() {
super();
} }
@Override public Organization(String name, String fullName, String clientname, String orgType) {
public int compareTo(Organization o) { this(null, name, fullName, clientname, orgType, null);
return name.compareTo(o.name);
} }
public String getName() { public Organization(String name, String orgType) {
return name; this(null, name, name, name + "-validator", orgType, null);
} }
public void setName(String name) { public Organization(String guid, String name, String fullName, String clientname, String orgType,
PrivateKey privateKey) {
this.guid = guid;
this.name = name; this.name = name;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName; this.fullName = fullName;
} this.clientname = checkNotNull(clientname, "clientname");
this.orgType = checkNotNull(orgType, "orgType");
public String getOrgType() { this.privateKey = privateKey;
return orgType;
}
public void setOrgType(String orgType) {
this.orgType = orgType;
}
public String getClientname() {
return clientname;
}
public void setClientname(String clientname) {
this.clientname = clientname;
}
public PrivateKey getPrivateKey() {
return privateKey;
} }
@Override @Override
@ -94,8 +76,10 @@ public class Organization implements Comparable<Organization> {
int result = 1; int result = 1;
result = prime * result + ((clientname == null) ? 0 : clientname.hashCode()); result = prime * result + ((clientname == null) ? 0 : clientname.hashCode());
result = prime * result + ((fullName == null) ? 0 : fullName.hashCode()); result = prime * result + ((fullName == null) ? 0 : fullName.hashCode());
result = prime * result + ((guid == null) ? 0 : guid.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((orgType == null) ? 0 : orgType.hashCode()); result = prime * result + ((orgType == null) ? 0 : orgType.hashCode());
result = prime * result + ((privateKey == null) ? 0 : privateKey.hashCode());
return result; return result;
} }
@ -118,6 +102,11 @@ public class Organization implements Comparable<Organization> {
return false; return false;
} else if (!fullName.equals(other.fullName)) } else if (!fullName.equals(other.fullName))
return false; return false;
if (guid == null) {
if (other.guid != null)
return false;
} else if (!guid.equals(other.guid))
return false;
if (name == null) { if (name == null) {
if (other.name != null) if (other.name != null)
return false; return false;
@ -128,13 +117,42 @@ public class Organization implements Comparable<Organization> {
return false; return false;
} else if (!orgType.equals(other.orgType)) } else if (!orgType.equals(other.orgType))
return false; return false;
if (privateKey == null) {
if (other.privateKey != null)
return false;
} else if (!privateKey.equals(other.privateKey))
return false;
return true; return true;
} }
public String getGuid() {
return guid;
}
public String getName() {
return name;
}
public String getFullName() {
return fullName;
}
public String getClientname() {
return clientname;
}
public String getOrgType() {
return orgType;
}
public PrivateKey getPrivateKey() {
return privateKey;
}
@Override @Override
public String toString() { public String toString() {
return "Organization [clientname=" + clientname + ", fullName=" + fullName + ", name=" + name + ", orgType=" return "[name=" + name + ", clientname=" + clientname + ", fullName=" + fullName + ", guid=" + guid
+ orgType + "]"; + ", orgType=" + orgType + ", privateKey=" + (privateKey != null) + "]";
} }
} }

View File

@ -19,6 +19,9 @@
package org.jclouds.opscodeplatform.domain; package org.jclouds.opscodeplatform.domain;
import java.security.PrivateKey; import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
@ -27,7 +30,7 @@ import com.google.gson.annotations.SerializedName;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class User implements Comparable<User> { public class User {
private String username; private String username;
@SerializedName("first_name") @SerializedName("first_name")
private String firstName; private String firstName;
@ -38,94 +41,62 @@ public class User implements Comparable<User> {
@SerializedName("display_name") @SerializedName("display_name")
private String displayName; private String displayName;
private String email; private String email;
@SerializedName("twitter_account")
private String twitterAccount;
private String city;
private String country;
@SerializedName("image_file_name")
private String imageFileName;
private String password; private String password;
@SerializedName("public_key")
private PublicKey publicKey;
@SerializedName("private_key") @SerializedName("private_key")
private PrivateKey privateKey; private PrivateKey privateKey;
private X509Certificate certificate;
private String salt;
public User(String username) { public User(String username) {
this.username = username; this.username = username;
} }
// hidden but needs to be here for json deserialization to work public User(String username, String firstName, String middleName, String lastName, String displayName, String email,
User() { String twitterAccount, String city, String country, String imageFileName, String password,
super(); PublicKey publicKey, PrivateKey privateKey, X509Certificate certificate, String salt) {
}
@Override
public int compareTo(User o) {
return username.compareTo(o.username);
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username; this.username = username;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName; this.firstName = firstName;
}
public String getMiddleName() {
return middleName;
}
public void setMiddleName(String middleName) {
this.middleName = middleName; this.middleName = middleName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName; this.lastName = lastName;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName; this.displayName = displayName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email; this.email = email;
} this.twitterAccount = twitterAccount;
this.city = city;
public void setPassword(String password) { this.country = country;
this.imageFileName = imageFileName;
this.password = password; this.password = password;
} this.publicKey = publicKey;
this.privateKey = privateKey;
public String getPassword() { this.certificate = certificate;
return password; this.salt = salt;
}
public PrivateKey getPrivateKey() {
return privateKey;
} }
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((certificate == null) ? 0 : certificate.hashCode());
result = prime * result + ((city == null) ? 0 : city.hashCode());
result = prime * result + ((country == null) ? 0 : country.hashCode());
result = prime * result + ((displayName == null) ? 0 : displayName.hashCode()); result = prime * result + ((displayName == null) ? 0 : displayName.hashCode());
result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((email == null) ? 0 : email.hashCode());
result = prime * result + ((firstName == null) ? 0 : firstName.hashCode()); result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
result = prime * result + ((imageFileName == null) ? 0 : imageFileName.hashCode());
result = prime * result + ((lastName == null) ? 0 : lastName.hashCode()); result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
result = prime * result + ((middleName == null) ? 0 : middleName.hashCode()); result = prime * result + ((middleName == null) ? 0 : middleName.hashCode());
result = prime * result + ((password == null) ? 0 : password.hashCode()); result = prime * result + ((password == null) ? 0 : password.hashCode());
result = prime * result + ((privateKey == null) ? 0 : privateKey.hashCode());
result = prime * result + ((publicKey == null) ? 0 : publicKey.hashCode());
result = prime * result + ((salt == null) ? 0 : salt.hashCode());
result = prime * result + ((twitterAccount == null) ? 0 : twitterAccount.hashCode());
result = prime * result + ((username == null) ? 0 : username.hashCode()); result = prime * result + ((username == null) ? 0 : username.hashCode());
return result; return result;
} }
@ -139,6 +110,21 @@ public class User implements Comparable<User> {
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
User other = (User) obj; User other = (User) obj;
if (certificate == null) {
if (other.certificate != null)
return false;
} else if (!certificate.equals(other.certificate))
return false;
if (city == null) {
if (other.city != null)
return false;
} else if (!city.equals(other.city))
return false;
if (country == null) {
if (other.country != null)
return false;
} else if (!country.equals(other.country))
return false;
if (displayName == null) { if (displayName == null) {
if (other.displayName != null) if (other.displayName != null)
return false; return false;
@ -154,6 +140,11 @@ public class User implements Comparable<User> {
return false; return false;
} else if (!firstName.equals(other.firstName)) } else if (!firstName.equals(other.firstName))
return false; return false;
if (imageFileName == null) {
if (other.imageFileName != null)
return false;
} else if (!imageFileName.equals(other.imageFileName))
return false;
if (lastName == null) { if (lastName == null) {
if (other.lastName != null) if (other.lastName != null)
return false; return false;
@ -169,6 +160,26 @@ public class User implements Comparable<User> {
return false; return false;
} else if (!password.equals(other.password)) } else if (!password.equals(other.password))
return false; return false;
if (privateKey == null) {
if (other.privateKey != null)
return false;
} else if (!privateKey.equals(other.privateKey))
return false;
if (publicKey == null) {
if (other.publicKey != null)
return false;
} else if (!publicKey.equals(other.publicKey))
return false;
if (salt == null) {
if (other.salt != null)
return false;
} else if (!salt.equals(other.salt))
return false;
if (twitterAccount == null) {
if (other.twitterAccount != null)
return false;
} else if (!twitterAccount.equals(other.twitterAccount))
return false;
if (username == null) { if (username == null) {
if (other.username != null) if (other.username != null)
return false; return false;
@ -177,10 +188,78 @@ public class User implements Comparable<User> {
return true; return true;
} }
// only for deserialization
User() {
}
public String getUsername() {
return username;
}
public String getFirstName() {
return firstName;
}
public String getMiddleName() {
return middleName;
}
public String getLastName() {
return lastName;
}
public String getDisplayName() {
return displayName;
}
public String getEmail() {
return email;
}
public String getTwitterAccount() {
return twitterAccount;
}
public String getCity() {
return city;
}
public String getCountry() {
return country;
}
public String getImageFileName() {
return imageFileName;
}
public String getPassword() {
return password;
}
public PublicKey getPublicKey() {
return publicKey;
}
@Override @Override
public String toString() { public String toString() {
return "User [displayName=" + displayName + ", email=" + email + ", firstName=" + firstName + ", lastName=" return "[certificate=" + certificate + ", city=" + city + ", country=" + country + ", displayName=" + displayName
+ lastName + ", middleName=" + middleName + ", password=" + password + ", username=" + username + "]"; + ", email=" + email + ", firstName=" + firstName + ", imageFileName=" + imageFileName + ", lastName="
+ lastName + ", middleName=" + middleName + ", password=" + (password != null) + ", privateKey="
+ (privateKey != null) + ", publicKey=" + publicKey + ", salt=" + salt + ", twitterAccount="
+ twitterAccount + ", username=" + username + "]";
}
public PrivateKey getPrivateKey() {
return privateKey;
}
public Certificate getCertificate() {
return certificate;
}
public String getSalt() {
return salt;
} }
} }

View File

@ -104,7 +104,7 @@ public class OpscodePlatformAsyncClientTest extends RestClientTest<OpscodePlatfo
GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method); GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method);
assertRequestLineEquals(httpRequest, "GET https://api.opscode.com/users HTTP/1.1"); assertRequestLineEquals(httpRequest, "GET https://api.opscode.com/users HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: 0.9.8\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
assertResponseParserClassEquals(method, httpRequest, ParseKeySetFromJson.class); assertResponseParserClassEquals(method, httpRequest, ParseKeySetFromJson.class);
@ -119,7 +119,7 @@ public class OpscodePlatformAsyncClientTest extends RestClientTest<OpscodePlatfo
Method method = OpscodePlatformAsyncClient.class.getMethod("userExists", String.class); Method method = OpscodePlatformAsyncClient.class.getMethod("userExists", String.class);
GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, "user"); GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, "user");
assertRequestLineEquals(httpRequest, "HEAD https://api.opscode.com/users/user HTTP/1.1"); assertRequestLineEquals(httpRequest, "HEAD https://api.opscode.com/users/user HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: 0.9.8\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
assertResponseParserClassEquals(method, httpRequest, ReturnTrueIf2xx.class); assertResponseParserClassEquals(method, httpRequest, ReturnTrueIf2xx.class);
@ -134,7 +134,7 @@ public class OpscodePlatformAsyncClientTest extends RestClientTest<OpscodePlatfo
Method method = OpscodePlatformAsyncClient.class.getMethod("organizationExists", String.class); Method method = OpscodePlatformAsyncClient.class.getMethod("organizationExists", String.class);
GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, "organization"); GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, "organization");
assertRequestLineEquals(httpRequest, "HEAD https://api.opscode.com/organizations/organization HTTP/1.1"); assertRequestLineEquals(httpRequest, "HEAD https://api.opscode.com/organizations/organization HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: 0.9.8\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
assertResponseParserClassEquals(method, httpRequest, ReturnTrueIf2xx.class); assertResponseParserClassEquals(method, httpRequest, ReturnTrueIf2xx.class);
@ -145,13 +145,12 @@ public class OpscodePlatformAsyncClientTest extends RestClientTest<OpscodePlatfo
} }
public void testListOrganizations() throws SecurityException, NoSuchMethodException, IOException { public void testListOrganizations() throws SecurityException, NoSuchMethodException, IOException {
Method method = OpscodePlatformAsyncClient.class.getMethod("listOrganizations"); Method method = OpscodePlatformAsyncClient.class.getMethod("listOrganizations");
GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method); GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method);
assertRequestLineEquals(httpRequest, "GET https://api.opscode.com/organizations HTTP/1.1"); assertRequestLineEquals(httpRequest, "GET https://api.opscode.com/organizations HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: 0.9.8\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
assertResponseParserClassEquals(method, httpRequest, ParseKeySetFromJson.class); assertResponseParserClassEquals(method, httpRequest, ParseKeySetFromJson.class);
@ -168,7 +167,7 @@ public class OpscodePlatformAsyncClientTest extends RestClientTest<OpscodePlatfo
.createRequest(method, new User("myuser")); .createRequest(method, new User("myuser"));
assertRequestLineEquals(httpRequest, "POST https://api.opscode.com/users HTTP/1.1"); assertRequestLineEquals(httpRequest, "POST https://api.opscode.com/users HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: 0.9.8\n");
assertPayloadEquals(httpRequest, "{\"username\":\"myuser\"}", "application/json", false); assertPayloadEquals(httpRequest, "{\"username\":\"myuser\"}", "application/json", false);
// now make sure request filters apply by replaying // now make sure request filters apply by replaying
@ -177,6 +176,7 @@ public class OpscodePlatformAsyncClientTest extends RestClientTest<OpscodePlatfo
assertRequestLineEquals(httpRequest, "POST https://api.opscode.com/users HTTP/1.1"); assertRequestLineEquals(httpRequest, "POST https://api.opscode.com/users HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, new StringBuilder("Accept: application/json").append("\n").append( assertNonPayloadHeadersEqual(httpRequest, new StringBuilder("Accept: application/json").append("\n").append(
"X-Chef-Version: 0.9.8").append("\n").append(
"X-Ops-Authorization-1: kfrkDpfgNU26k70R1vl1bEWk0Q0f9Fs/3kxOX7gHd7iNoJq03u7RrcrAOSgL").append("\n").append( "X-Ops-Authorization-1: kfrkDpfgNU26k70R1vl1bEWk0Q0f9Fs/3kxOX7gHd7iNoJq03u7RrcrAOSgL").append("\n").append(
"X-Ops-Authorization-2: ETj5JNeCk18BmFkHMAbCA9hXVo1T4rlHCpbuzAzFlFxUGAT4wj8UoO7V886X").append("\n").append( "X-Ops-Authorization-2: ETj5JNeCk18BmFkHMAbCA9hXVo1T4rlHCpbuzAzFlFxUGAT4wj8UoO7V886X").append("\n").append(
"X-Ops-Authorization-3: Kf8DvihP6ElthCNuu1xuhN0B4GEmWC9+ut7UMLe0L2T34VzkbCtuInGbf42/").append("\n").append( "X-Ops-Authorization-3: Kf8DvihP6ElthCNuu1xuhN0B4GEmWC9+ut7UMLe0L2T34VzkbCtuInGbf42/").append("\n").append(
@ -202,7 +202,7 @@ public class OpscodePlatformAsyncClientTest extends RestClientTest<OpscodePlatfo
.createRequest(method, new User("myuser")); .createRequest(method, new User("myuser"));
assertRequestLineEquals(httpRequest, "PUT https://api.opscode.com/users/myuser HTTP/1.1"); assertRequestLineEquals(httpRequest, "PUT https://api.opscode.com/users/myuser HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: 0.9.8\n");
assertPayloadEquals(httpRequest, "{\"username\":\"myuser\"}", "application/json", false); assertPayloadEquals(httpRequest, "{\"username\":\"myuser\"}", "application/json", false);
assertResponseParserClassEquals(method, httpRequest, ParseJson.class); assertResponseParserClassEquals(method, httpRequest, ParseJson.class);
@ -218,7 +218,7 @@ public class OpscodePlatformAsyncClientTest extends RestClientTest<OpscodePlatfo
GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, "myuser"); GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, "myuser");
assertRequestLineEquals(httpRequest, "GET https://api.opscode.com/users/myuser HTTP/1.1"); assertRequestLineEquals(httpRequest, "GET https://api.opscode.com/users/myuser HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: 0.9.8\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
assertResponseParserClassEquals(method, httpRequest, ParseJson.class); assertResponseParserClassEquals(method, httpRequest, ParseJson.class);
@ -234,7 +234,7 @@ public class OpscodePlatformAsyncClientTest extends RestClientTest<OpscodePlatfo
GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, "myuser"); GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, "myuser");
assertRequestLineEquals(httpRequest, "DELETE https://api.opscode.com/users/myuser HTTP/1.1"); assertRequestLineEquals(httpRequest, "DELETE https://api.opscode.com/users/myuser HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: 0.9.8\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
assertResponseParserClassEquals(method, httpRequest, ParseJson.class); assertResponseParserClassEquals(method, httpRequest, ParseJson.class);
@ -248,11 +248,13 @@ public class OpscodePlatformAsyncClientTest extends RestClientTest<OpscodePlatfo
public void testCreateOrg() throws SecurityException, NoSuchMethodException, IOException { public void testCreateOrg() throws SecurityException, NoSuchMethodException, IOException {
Method method = OpscodePlatformAsyncClient.class.getMethod("createOrganization", Organization.class); Method method = OpscodePlatformAsyncClient.class.getMethod("createOrganization", Organization.class);
GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, new Organization( GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, new Organization(
"myorganization")); "myorganization", "myorganization", "myorganization-validator", Organization.Type.BUSINESS));
assertRequestLineEquals(httpRequest, "POST https://api.opscode.com/organizations HTTP/1.1"); assertRequestLineEquals(httpRequest, "POST https://api.opscode.com/organizations HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: 0.9.8\n");
assertPayloadEquals(httpRequest, "{\"name\":\"myorganization\"}", "application/json", false); assertPayloadEquals(httpRequest,
"{\"name\":\"myorganization\",\"full_name\":\"myorganization\",\"clientname\":\"myorganization-validator\",\"org_type\":\"Business\"}",
"application/json", false);
assertResponseParserClassEquals(method, httpRequest, ParseJson.class); assertResponseParserClassEquals(method, httpRequest, ParseJson.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
@ -265,11 +267,13 @@ public class OpscodePlatformAsyncClientTest extends RestClientTest<OpscodePlatfo
public void testUpdateOrg() throws SecurityException, NoSuchMethodException, IOException { public void testUpdateOrg() throws SecurityException, NoSuchMethodException, IOException {
Method method = OpscodePlatformAsyncClient.class.getMethod("updateOrganization", Organization.class); Method method = OpscodePlatformAsyncClient.class.getMethod("updateOrganization", Organization.class);
GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, new Organization( GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, new Organization(
"myorganization")); "myorganization", "myorganization", "myorganization-validator", Organization.Type.BUSINESS));
assertRequestLineEquals(httpRequest, "PUT https://api.opscode.com/organizations/myorganization HTTP/1.1"); assertRequestLineEquals(httpRequest, "PUT https://api.opscode.com/organizations/myorganization HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: 0.9.8\n");
assertPayloadEquals(httpRequest, "{\"name\":\"myorganization\"}", "application/json", false); assertPayloadEquals(httpRequest,
"{\"name\":\"myorganization\",\"full_name\":\"myorganization\",\"clientname\":\"myorganization-validator\",\"org_type\":\"Business\"}",
"application/json", false);
assertResponseParserClassEquals(method, httpRequest, ParseJson.class); assertResponseParserClassEquals(method, httpRequest, ParseJson.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
@ -284,7 +288,7 @@ public class OpscodePlatformAsyncClientTest extends RestClientTest<OpscodePlatfo
GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, "myorganization"); GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, "myorganization");
assertRequestLineEquals(httpRequest, "GET https://api.opscode.com/organizations/myorganization HTTP/1.1"); assertRequestLineEquals(httpRequest, "GET https://api.opscode.com/organizations/myorganization HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: 0.9.8\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
assertResponseParserClassEquals(method, httpRequest, ParseJson.class); assertResponseParserClassEquals(method, httpRequest, ParseJson.class);
@ -300,7 +304,7 @@ public class OpscodePlatformAsyncClientTest extends RestClientTest<OpscodePlatfo
GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, "myorganization"); GeneratedHttpRequest<OpscodePlatformAsyncClient> httpRequest = processor.createRequest(method, "myorganization");
assertRequestLineEquals(httpRequest, "DELETE https://api.opscode.com/organizations/myorganization HTTP/1.1"); assertRequestLineEquals(httpRequest, "DELETE https://api.opscode.com/organizations/myorganization HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: 0.9.8\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
assertResponseParserClassEquals(method, httpRequest, ParseJson.class); assertResponseParserClassEquals(method, httpRequest, ParseJson.class);

View File

@ -26,6 +26,7 @@ package org.jclouds.opscodeplatform;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -35,12 +36,13 @@ import java.util.Set;
import org.jclouds.chef.BaseChefClientLiveTest; import org.jclouds.chef.BaseChefClientLiveTest;
import org.jclouds.chef.ChefClient; import org.jclouds.chef.ChefClient;
import org.jclouds.chef.config.ChefParserModule; import org.jclouds.chef.config.ChefParserModule;
import org.jclouds.http.HttpResponseException; import org.jclouds.crypto.Pems;
import org.jclouds.json.Json; import org.jclouds.json.Json;
import org.jclouds.json.config.GsonModule; import org.jclouds.json.config.GsonModule;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.opscodeplatform.domain.Organization; import org.jclouds.opscodeplatform.domain.Organization;
import org.jclouds.opscodeplatform.domain.User; import org.jclouds.opscodeplatform.domain.User;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.HttpClient; import org.jclouds.rest.HttpClient;
import org.jclouds.rest.RestContextFactory; import org.jclouds.rest.RestContextFactory;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
@ -124,8 +126,8 @@ public class OpscodePlatformClientLiveTest extends BaseChefClientLiveTest {
protected void closeContexts() { protected void closeContexts() {
if (orgUser != null) if (orgUser != null)
adminConnection.getApi().deleteUser(PREFIX); adminConnection.getApi().deleteUser(PREFIX);
if (org != null) if (createdOrgname != null)
adminConnection.getApi().deleteOrganization(PREFIX); adminConnection.getApi().deleteOrganization(createdOrgname);
if (clientConnection != null) if (clientConnection != null)
clientConnection.close(); clientConnection.close();
if (validatorConnection != null) if (validatorConnection != null)
@ -137,52 +139,60 @@ public class OpscodePlatformClientLiveTest extends BaseChefClientLiveTest {
private String orgname; private String orgname;
private Organization org; private Organization org;
private User orgUser; private User orgUser;
private String createdOrgname;
// http://tickets.corp.opscode.com/browse/PL-524 // @Test(expectedExceptions = AuthorizationException.class)
@Test(expectedExceptions = HttpResponseException.class)
public void testListOrganizations() throws Exception { public void testListOrganizations() throws Exception {
Set<String> orgs = adminConnection.getApi().listOrganizations(); Set<String> orgs = adminConnection.getApi().listOrganizations();
assertNotNull(orgs); assertNotNull(orgs);
} }
// http://tickets.corp.opscode.com/browse/PL-524 /**
@Test(expectedExceptions = HttpResponseException.class) * this test only works when you have a super user not yet supported in the
* official api
*/
@Test(enabled = false, expectedExceptions = AuthorizationException.class)
public void testCreateOrganization() throws Exception { public void testCreateOrganization() throws Exception {
adminConnection.getApi().deleteOrganization(PREFIX); createdOrgname = orgname + 1;
adminConnection.getApi().createOrganization(new Organization(PREFIX)); adminConnection.getApi().deleteOrganization(createdOrgname);
org = adminConnection.getApi().getOrganization(PREFIX); org = adminConnection.getApi().createOrganization(new Organization(createdOrgname, Organization.Type.BUSINESS));
assertNotNull(org); assertNotNull(org);
assertEquals(org.getName(), PREFIX); assertNull(org.getName());
assertEquals(org.getClientname(), PREFIX + "-validator"); assertNull(org.getFullName());
assertEquals(org.getClientname(), createdOrgname + "-validator");
assertNull(org.getOrgType());
assertNotNull(org.getPrivateKey());
OpscodePlatformContext connection = null;
try {
connection = createConnection(org.getClientname(), Pems.pem(org.getPrivateKey()));
} finally {
if (connection != null)
connection.close();
}
} }
// http://tickets.corp.opscode.com/browse/PL-524
@Test(expectedExceptions = HttpResponseException.class)
public void testOrganizationExists() throws Exception { public void testOrganizationExists() throws Exception {
assertNotNull(adminConnection.getApi().organizationExists(orgname)); assertNotNull(adminConnection.getApi().organizationExists(orgname));
} }
@Test(enabled = false, dependsOnMethods = "testCreateOrganization") @Test(enabled = false, dependsOnMethods = "testCreateOrganization", expectedExceptions = AuthorizationException.class)
public void testUpdateOrganization() throws Exception { public void testUpdateOrganization() throws Exception {
Organization org = adminConnection.getApi().getOrganization(PREFIX); Organization org = adminConnection.getApi().getOrganization(createdOrgname);
adminConnection.getApi().updateOrganization(org); adminConnection.getApi().updateOrganization(org);
} }
// http://tickets.corp.opscode.com/browse/PL-524
@Test(expectedExceptions = HttpResponseException.class)
public void testGetOrganization() throws Exception { public void testGetOrganization() throws Exception {
adminConnection.getApi().getOrganization(orgname); adminConnection.getApi().getOrganization(orgname);
} }
// http://tickets.corp.opscode.com/browse/PL-524 @Test(expectedExceptions = AuthorizationException.class)
@Test(expectedExceptions = HttpResponseException.class)
public void testListUsers() throws Exception { public void testListUsers() throws Exception {
Set<String> orgs = adminConnection.getApi().listUsers(); Set<String> orgs = adminConnection.getApi().listUsers();
assertNotNull(orgs); assertNotNull(orgs);
} }
// http://tickets.corp.opscode.com/browse/PL-524 // @Test(expectedExceptions = HttpResponseException.class)
@Test(expectedExceptions = HttpResponseException.class) @Test(enabled = false, expectedExceptions = AuthorizationException.class)
public void testCreateUser() throws Exception { public void testCreateUser() throws Exception {
adminConnection.getApi().deleteUser(PREFIX); adminConnection.getApi().deleteUser(PREFIX);
adminConnection.getApi().createUser(new User(PREFIX)); adminConnection.getApi().createUser(new User(PREFIX));
@ -192,30 +202,27 @@ public class OpscodePlatformClientLiveTest extends BaseChefClientLiveTest {
assertNotNull(orgUser.getPrivateKey()); assertNotNull(orgUser.getPrivateKey());
} }
// http://tickets.corp.opscode.com/browse/PL-524
@Test(expectedExceptions = HttpResponseException.class)
public void testUserExists() throws Exception { public void testUserExists() throws Exception {
assertNotNull(adminConnection.getApi().userExists(user)); assertNotNull(adminConnection.getApi().userExists(user));
} }
// http://tickets.corp.opscode.com/browse/PL-524
@Test(expectedExceptions = HttpResponseException.class)
public void testGetUser() throws Exception { public void testGetUser() throws Exception {
adminConnection.getApi().getUser(user); adminConnection.getApi().getUser(user);
} }
@Test(enabled = false, dependsOnMethods = "testCreateUser") // disabled while create user fails
@Test(dependsOnMethods = "testCreateUser", enabled = false)
public void testUpdateUser() throws Exception { public void testUpdateUser() throws Exception {
User user = adminConnection.getApi().getUser(PREFIX); User user = adminConnection.getApi().getUser(PREFIX);
adminConnection.getApi().updateUser(user); adminConnection.getApi().updateUser(user);
} }
@Test(expectedExceptions = HttpResponseException.class) @Test(expectedExceptions = AuthorizationException.class)
public void testGetOrganizationFailsForValidationKey() throws Exception { public void testGetOrganizationFailsForValidationKey() throws Exception {
validatorConnection.getApi().getOrganization(orgname); validatorConnection.getApi().getOrganization(orgname);
} }
@Test(dependsOnMethods = "testGenerateKeyForClient", expectedExceptions = HttpResponseException.class) @Test(dependsOnMethods = "testGenerateKeyForClient", expectedExceptions = AuthorizationException.class)
public void testGetOrganizationFailsForClient() throws Exception { public void testGetOrganizationFailsForClient() throws Exception {
clientConnection.getApi().getOrganization(orgname); clientConnection.getApi().getOrganization(orgname);
} }

View File

@ -55,13 +55,10 @@ public class ParseOrganizationFromJsonTest {
public void test() { public void test() {
Organization org = new Organization("opscode"); Organization org = new Organization("486ca3ac66264fea926aa0b4ff74341c", "jclouds", "jclouds",
org.setFullName("Opscode, Inc."); "jclouds-validator", "Business", null);
org.setOrgType("Business");
org.setClientname("opscode-validator");
String toParse = "{\"name\": \"opscode\",\"full_name\": \"Opscode, Inc.\", \"org_type\": \"Business\",\"clientname\": \"opscode-validator\" }";
String toParse = "{\"guid\":\"486ca3ac66264fea926aa0b4ff74341c\",\"name\":\"jclouds\",\"full_name\":\"jclouds\",\"clientname\":\"jclouds-validator\",\"org_type\":\"Business\",\"name\":\"jclouds\"}";
assertEquals(handler.apply(new HttpResponse(200, "ok", Payloads.newStringPayload(toParse))), org); assertEquals(handler.apply(new HttpResponse(200, "ok", Payloads.newStringPayload(toParse))), org);
} }
} }

View File

@ -3,14 +3,17 @@ package org.jclouds.opscodeplatform.functions;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.IOException; import java.io.IOException;
import java.security.cert.CertificateException;
import java.security.spec.InvalidKeySpecException;
import org.jclouds.chef.config.ChefParserModule; import org.jclouds.chef.config.ChefParserModule;
import org.jclouds.crypto.Crypto;
import org.jclouds.crypto.Pems;
import org.jclouds.http.HttpResponse; import org.jclouds.http.HttpResponse;
import org.jclouds.http.functions.ParseJson; import org.jclouds.http.functions.ParseJson;
import org.jclouds.io.Payloads; import org.jclouds.io.Payloads;
import org.jclouds.json.config.GsonModule; import org.jclouds.json.config.GsonModule;
import org.jclouds.opscodeplatform.domain.User; import org.jclouds.opscodeplatform.domain.User;
import org.jclouds.util.Utils;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -28,25 +31,40 @@ import com.google.inject.TypeLiteral;
public class ParseUserFromJsonTest { public class ParseUserFromJsonTest {
private ParseJson<User> handler; private ParseJson<User> handler;
private Crypto crypto;
@BeforeTest @BeforeTest
protected void setUpInjector() throws IOException { protected void setUpInjector() throws IOException {
Injector injector = Guice.createInjector(new ChefParserModule(), new GsonModule()); Injector injector = Guice.createInjector(new ChefParserModule(), new GsonModule());
handler = injector.getInstance(Key.get(new TypeLiteral<ParseJson<User>>() { handler = injector.getInstance(Key.get(new TypeLiteral<ParseJson<User>>() {
})); }));
crypto = injector.getInstance(Crypto.class);
} }
public void test() { public void test() throws InvalidKeySpecException, CertificateException, IOException {
User user = new User(
"dopey",
"Adrian",
"",
"Cole",
"Adrian Cole",
"adrian+dopey@opscode.com",
null,
null,
null,
null,
"abcdef",
crypto
.rsaKeyFactory()
.generatePublic(
Pems
.publicKeySpec("-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAvCKTqPdHv7GsHTjk02g91Aw3T6xQmdRaI70X6E6GGFxZtcH+tb1X\nqHxwhFydECVXhu0WVjTcWvxZ1aMFzn9BLHQYWzZxU/fIKVNR6ujyZ3jRxDXRFpX5\n/zvMdvNbdsJ+8foEbdoP1iujUMZuy6ZMvcbTDCgWjYVQ2omR9CkH/5Fwlbk3cSrF\n6qfGaM7340OGknKUfXdvhCq4vxydlOwfHJyNDWY0PW+8rDKHWxxNtYDDDeIMw2z/\nYC34f1bcAkR+/lyx5b25RwDomZNqXJqp1hjOVJVlo+UMvzWfXph5hgjcgtwzc5Iu\nmWWMUdxLcdw+/iQm6NW9cmU28bvHu0q7FwIDAQAB\n-----END RSA PUBLIC KEY-----\n")),
null,
Pems
.x509Certificate("-----BEGIN CERTIFICATE-----\nMIIClzCCAgCgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBnjELMAkGA1UEBhMCVVMx\nEzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1NlYXR0bGUxFjAUBgNVBAoM\nDU9wc2NvZGUsIEluYy4xHDAaBgNVBAsME0NlcnRpZmljYXRlIFNlcnZpY2UxMjAw\nBgNVBAMMKW9wc2NvZGUuY29tL2VtYWlsQWRkcmVzcz1hdXRoQG9wc2NvZGUuY29t\nMB4XDTEwMDgwMzA0MDUzNVoXDTIwMDczMTA0MDUzNVowADCCASIwDQYJKoZIhvcN\nAQEBBQADggEPADCCAQoCggEBALwik6j3R7+xrB045NNoPdQMN0+sUJnUWiO9F+hO\nhhhcWbXB/rW9V6h8cIRcnRAlV4btFlY03Fr8WdWjBc5/QSx0GFs2cVP3yClTUero\n8md40cQ10RaV+f87zHbzW3bCfvH6BG3aD9Yro1DGbsumTL3G0wwoFo2FUNqJkfQp\nB/+RcJW5N3EqxeqnxmjO9+NDhpJylH13b4QquL8cnZTsHxycjQ1mND1vvKwyh1sc\nTbWAww3iDMNs/2At+H9W3AJEfv5cseW9uUcA6JmTalyaqdYYzlSVZaPlDL81n16Y\neYYI3ILcM3OSLplljFHcS3HcPv4kJujVvXJlNvG7x7tKuxcCAwEAATANBgkqhkiG\n9w0BAQUFAAOBgQBcoSP/2tFhP8yjF/dRDRdDed0/Cg0xnpp2wvM38gBRgvhpZbQ3\nI2rqpw5THNzrzBVnrYxd57uAa+y2MMG57XnvNWOmyL6WIYXLfN1QI3nHdpHS/QVF\nCRWpDWxLM1TkqAD9xQZOpUDdByF2exiCDNTzSYYg/ISLlIEzicNJeoPNbA==\n-----END CERTIFICATE-----\n"),
"xBOmipWikVEicS7tNOPdQzPsPmsROMgPme5O19ZHh6R7N9MQT7d5olDiGFpO");
User user = new User("bobo"); assertEquals(handler.apply(new HttpResponse(200, "ok", Payloads.newPayload(ParseUserFromJsonTest.class
user.setFirstName("Bobo"); .getResourceAsStream("/user.json")))), user);
user.setMiddleName("Tiberion");
user.setLastName("Clown");
user.setDisplayName("Bobo T. Clown");
user.setEmail("bobo@clownco.com");
String toParse = "{\n\"username\": \"bobo\",\n\"first_name\": \"Bobo\",\n\"middle_name\": \"Tiberion\",\n\"last_name\": \"Clown\",\n\"display_name\": \"Bobo T. Clown\",\n\"email\": \"bobo@clownco.com\" \n}";
assertEquals(handler.apply(new HttpResponse(200, "ok", Payloads.newPayload(Utils.toInputStream(toParse)))), user);
} }
} }

View File

@ -0,0 +1 @@
{"public_key":"-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAvCKTqPdHv7GsHTjk02g91Aw3T6xQmdRaI70X6E6GGFxZtcH+tb1X\nqHxwhFydECVXhu0WVjTcWvxZ1aMFzn9BLHQYWzZxU/fIKVNR6ujyZ3jRxDXRFpX5\n/zvMdvNbdsJ+8foEbdoP1iujUMZuy6ZMvcbTDCgWjYVQ2omR9CkH/5Fwlbk3cSrF\n6qfGaM7340OGknKUfXdvhCq4vxydlOwfHJyNDWY0PW+8rDKHWxxNtYDDDeIMw2z/\nYC34f1bcAkR+/lyx5b25RwDomZNqXJqp1hjOVJVlo+UMvzWfXph5hgjcgtwzc5Iu\nmWWMUdxLcdw+/iQm6NW9cmU28bvHu0q7FwIDAQAB\n-----END RSA PUBLIC KEY-----\n","middle_name":"","certificate":"-----BEGIN CERTIFICATE-----\nMIIClzCCAgCgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBnjELMAkGA1UEBhMCVVMx\nEzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1NlYXR0bGUxFjAUBgNVBAoM\nDU9wc2NvZGUsIEluYy4xHDAaBgNVBAsME0NlcnRpZmljYXRlIFNlcnZpY2UxMjAw\nBgNVBAMMKW9wc2NvZGUuY29tL2VtYWlsQWRkcmVzcz1hdXRoQG9wc2NvZGUuY29t\nMB4XDTEwMDgwMzA0MDUzNVoXDTIwMDczMTA0MDUzNVowADCCASIwDQYJKoZIhvcN\nAQEBBQADggEPADCCAQoCggEBALwik6j3R7+xrB045NNoPdQMN0+sUJnUWiO9F+hO\nhhhcWbXB/rW9V6h8cIRcnRAlV4btFlY03Fr8WdWjBc5/QSx0GFs2cVP3yClTUero\n8md40cQ10RaV+f87zHbzW3bCfvH6BG3aD9Yro1DGbsumTL3G0wwoFo2FUNqJkfQp\nB/+RcJW5N3EqxeqnxmjO9+NDhpJylH13b4QquL8cnZTsHxycjQ1mND1vvKwyh1sc\nTbWAww3iDMNs/2At+H9W3AJEfv5cseW9uUcA6JmTalyaqdYYzlSVZaPlDL81n16Y\neYYI3ILcM3OSLplljFHcS3HcPv4kJujVvXJlNvG7x7tKuxcCAwEAATANBgkqhkiG\n9w0BAQUFAAOBgQBcoSP/2tFhP8yjF/dRDRdDed0/Cg0xnpp2wvM38gBRgvhpZbQ3\nI2rqpw5THNzrzBVnrYxd57uAa+y2MMG57XnvNWOmyL6WIYXLfN1QI3nHdpHS/QVF\nCRWpDWxLM1TkqAD9xQZOpUDdByF2exiCDNTzSYYg/ISLlIEzicNJeoPNbA==\n-----END CERTIFICATE-----\n","city":null,"email":"adrian+dopey@opscode.com","country":null,"first_name":"Adrian","password":"abcdef","twitter_account":null,"salt":"xBOmipWikVEicS7tNOPdQzPsPmsROMgPme5O19ZHh6R7N9MQT7d5olDiGFpO","display_name":"Adrian Cole","last_name":"Cole","image_file_name":null,"username":"dopey"}