Email service WIP; altered Live tests so Email test has access to createServer and createDomain

This commit is contained in:
Adam Lowe 2011-12-22 21:57:23 +00:00
parent 68820d5d61
commit ae5d27e9fd
27 changed files with 1247 additions and 91 deletions

View File

@ -18,10 +18,7 @@
*/
package org.jclouds.glesys;
import org.jclouds.glesys.features.ArchiveAsyncClient;
import org.jclouds.glesys.features.DomainAsyncClient;
import org.jclouds.glesys.features.IpAsyncClient;
import org.jclouds.glesys.features.ServerAsyncClient;
import org.jclouds.glesys.features.*;
import org.jclouds.rest.annotations.Delegate;
/**
@ -58,4 +55,10 @@ public interface GleSYSAsyncClient {
@Delegate
DomainAsyncClient getDomainClient();
/**
* Provides asynchronous access to E-Mail features.
*/
@Delegate
EmailAsyncClient getEmailClient();
}

View File

@ -19,10 +19,7 @@
package org.jclouds.glesys;
import org.jclouds.concurrent.Timeout;
import org.jclouds.glesys.features.ArchiveClient;
import org.jclouds.glesys.features.DomainClient;
import org.jclouds.glesys.features.IpClient;
import org.jclouds.glesys.features.ServerClient;
import org.jclouds.glesys.features.*;
import org.jclouds.rest.annotations.Delegate;
import java.util.concurrent.TimeUnit;
@ -61,4 +58,11 @@ public interface GleSYSClient {
*/
@Delegate
DomainClient getDomainClient();
/**
* Provides synchronous access to E-Mail features.
*/
@Delegate
EmailClient getEmailClient();
}

View File

@ -50,6 +50,7 @@ public class GleSYSRestClientModule extends RestClientModule<GleSYSClient, GleSY
.put(IpClient.class, IpAsyncClient.class)//
.put(ArchiveClient.class, ArchiveAsyncClient.class)//
.put(DomainClient.class, DomainAsyncClient.class)//
.put(EmailClient.class, EmailAsyncClient.class)//
.build();
public GleSYSRestClientModule() {

View File

@ -7,7 +7,7 @@ import com.google.gson.annotations.SerializedName;
* Information about an archive
*
* @author Adam Lowe
* @see <a href= "https://customer.glesys.com/api.php?a=doc#archive_details" />
* @see <a href= "https://customer.glesys.com/api.php?a=doc#archive_list" />
*/
public class Archive implements Comparable<Archive> {
public static Builder builder() {

View File

@ -27,6 +27,7 @@ import java.util.Date;
* Domain data for a Glesys account.
*
* @author Adam Lowe
* @see <a href= "https://customer.glesys.com/api.php?a=doc#domain_list" />
*/
public class Domain implements Comparable<Domain> {
public static Builder builder() {

View File

@ -24,6 +24,7 @@ import com.google.common.base.Objects;
* DNS record data.
*
* @author Adam Lowe
* @see <a href= "https://customer.glesys.com/api.php?a=doc#domain_list_records" />
*/
public class DomainRecord implements Comparable<DomainRecord> {
public static Builder builder() {

View File

@ -0,0 +1,213 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.glesys.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
import java.util.Date;
/**
* Detailed information on an Email Account
*
* @author Adam Lowe
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_list" />
*/
public class Email implements Comparable<Email> {
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String account;
private String quota;
private String usedQuota;
private int antispamLevel;
private boolean antiVirus;
private boolean autoRespond;
private String autoRespondMessage;
private boolean autoRespondSaveEmail;
private Date created;
private Date modified;
public Builder account(String account) {
this.account = account;
return this;
}
public Builder quota(String quota) {
this.quota = quota;
return this;
}
public Builder usedQuota(String usedQuota) {
this.usedQuota = usedQuota;
return this;
}
public Builder antispamLevel(int antispamLevel) {
this.antispamLevel = antispamLevel;
return this;
}
public Builder antiVirus(boolean antiVirus) {
this.antiVirus = antiVirus;
return this;
}
public Builder autoRespond(boolean autoRespond) {
this.autoRespond = autoRespond;
return this;
}
public Builder autoRespondMessage(String autoRespondMessage) {
this.autoRespondMessage = autoRespondMessage;
return this;
}
public Builder autoRespondSaveEmail(boolean autoRespondSaveEmail) {
this.autoRespondSaveEmail = autoRespondSaveEmail;
return this;
}
public Builder created(Date created) {
this.created = created;
return this;
}
public Builder modified(Date modified) {
this.modified = modified;
return this;
}
public Email build() {
return new Email(account, quota, usedQuota, antispamLevel, antiVirus, autoRespond, autoRespondMessage,
autoRespondSaveEmail, created, modified);
}
public Builder fromEmail(Email in) {
return account(in.getAccount()).quota(in.getQuota()).usedQuota(in.getUsedQuota()).antispamLevel(in.getAntispamLevel()).
antiVirus(in.getAntiVirus()).autoRespond(in.getAutoRespond()).autoRespondMessage(in.getAutoRespondMessage()).
autoRespondSaveEmail(in.getAutoRespondSaveEmail()).created(in.getCreated()).modified(in.getModified());
}
}
@SerializedName("emailaccount")
private final String account;
private final String quota;
@SerializedName("usedquota")
private final String usedQuota;
@SerializedName("antispamlevel")
private final int antispamLevel;
@SerializedName("antivirus")
private final boolean antiVirus;
@SerializedName("autorespond")
private final boolean autoRespond;
@SerializedName("autorespondmessage")
private final String autoRespondMessage;
@SerializedName("autorespondsaveemail")
private final boolean autoRespondSaveEmail;
private final Date created;
private final Date modified;
public Email(String account, String quota, String usedQuota, int antispamLevel, boolean antiVirus, boolean autoRespond, String autoRespondMessage, boolean autoRespondSaveEmail, Date created, Date modified) {
this.account = account;
this.quota = quota;
this.usedQuota = usedQuota;
this.antispamLevel = antispamLevel;
this.antiVirus = antiVirus;
this.autoRespond = autoRespond;
this.autoRespondMessage = autoRespondMessage;
this.autoRespondSaveEmail = autoRespondSaveEmail;
this.created = created;
this.modified = modified;
}
public String getAccount() {
return account;
}
public String getQuota() {
return quota;
}
public String getUsedQuota() {
return usedQuota;
}
public int getAntispamLevel() {
return antispamLevel;
}
public boolean getAntiVirus() {
return antiVirus;
}
public boolean getAutoRespond() {
return autoRespond;
}
public String getAutoRespondMessage() {
return autoRespondMessage;
}
public boolean getAutoRespondSaveEmail() {
return autoRespondSaveEmail;
}
public Date getCreated() {
return created;
}
public Date getModified() {
return modified;
}
@Override
public int compareTo(Email other) {
return account.compareTo(other.getAccount());
}
@Override
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (object instanceof Email) {
Email other = (Email) object;
return Objects.equal(account, other.account);
} else {
return false;
}
}
@Override
public int hashCode() {
return Objects.hashCode(account);
}
@Override
public String toString() {
return String.format("account=%s, quota=%s, usedquota=%s, antispamLevel=%d, " +
"antiVirus=%b, autoRespond=%b, autoRespondMessage=%s, autoRespondSaveEmail=%b, " +
"created=%s, modified=%s", account, quota, usedQuota, antispamLevel, antiVirus, autoRespond, autoRespondMessage,
autoRespondSaveEmail, created.toString(), modified.toString());
}
}

View File

@ -0,0 +1,86 @@
package org.jclouds.glesys.domain;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
/**
* @author Adam Lowe
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_overview" />
*/
public class EmailOverview {
public static Builder builder() {
return new Builder();
}
public static class Builder {
private EmailOverviewSummary summary;
private Set<EmailOverviewDomain> domains;
public Builder summary(EmailOverviewSummary summary) {
this.summary = summary;
return this;
}
public Builder domains(Set<EmailOverviewDomain> domains) {
this.domains = domains;
return this;
}
public Builder domains(EmailOverviewDomain... domains) {
return domains(ImmutableSet.copyOf(domains));
}
public EmailOverview build() {
return new EmailOverview(summary, domains);
}
public Builder fromEmailOverview(EmailOverview in) {
return summary(in.getSummary()).domains(in.getDomains());
}
}
private EmailOverviewSummary summary;
private Set<EmailOverviewDomain> domains;
public EmailOverview(EmailOverviewSummary summary, Set<EmailOverviewDomain> domains) {
this.summary = summary;
this.domains = domains;
}
public EmailOverviewSummary getSummary() {
return summary;
}
public Set<EmailOverviewDomain> getDomains() {
return domains == null ? ImmutableSet.<EmailOverviewDomain>of() : domains;
}
@Override
public int hashCode() {
return Objects.hashCode(summary, domains);
}
@Override
public boolean equals(Object object) {
if (object == this) {
return true;
}
if (object instanceof EmailOverview) {
EmailOverview other = (EmailOverview) object;
return Objects.equal(summary, other.summary)
&& Objects.equal(domains, other.domains);
} else {
return false;
}
}
@Override
public String toString() {
Joiner commaJoiner = Joiner.on(", ");
return String.format("summary=%s, domains=[%s]", summary, commaJoiner.join(getDomains()));
}
}

View File

@ -0,0 +1,88 @@
package org.jclouds.glesys.domain;
import com.google.common.base.Objects;
/**
* @author Adam Lowe
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_overview" />
*/
public class EmailOverviewDomain {
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String domain;
private int accounts;
private int aliases;
public Builder domain(String domain) {
this.domain = domain;
return this;
}
public Builder accounts(int accounts) {
this.accounts = accounts;
return this;
}
public Builder aliases(int aliases) {
this.aliases = aliases;
return this;
}
public EmailOverviewDomain build() {
return new EmailOverviewDomain(domain, accounts, aliases);
}
public Builder fromEmailOverview(EmailOverviewDomain in) {
return domain(domain).accounts(in.getAccounts()).aliases(in.getAliases());
}
}
private final String domain;
private final int accounts;
private final int aliases;
public EmailOverviewDomain(String domain, int accounts, int aliases) {
this.domain = domain;
this.accounts = accounts;
this.aliases = aliases;
}
public String getDomain() {
return domain;
}
public int getAccounts() {
return accounts;
}
public int getAliases() {
return aliases;
}
@Override
public int hashCode() {
return Objects.hashCode(domain);
}
@Override
public boolean equals(Object object) {
if (object == this) {
return true;
}
if (object instanceof EmailOverviewDomain) {
EmailOverviewDomain other = (EmailOverviewDomain) object;
return Objects.equal(domain, other.domain);
} else {
return false;
}
}
@Override
public String toString() {
return String.format("domain=%s, accounts=%d, aliases=%d", domain, accounts, aliases);
}
}

View File

@ -0,0 +1,108 @@
package org.jclouds.glesys.domain;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
* @author Adam Lowe
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_overview" />
*/
public class EmailOverviewSummary {
public static Builder builder() {
return new Builder();
}
public static class Builder {
private int accounts;
private int maxAccounts;
private int aliases;
private int maxAliases;
public Builder accounts(int accounts) {
this.accounts = accounts;
return this;
}
public Builder maxAccounts(int maxAccounts) {
this.maxAccounts = maxAccounts;
return this;
}
public Builder aliases(int aliases) {
this.aliases = aliases;
return this;
}
public Builder maxAliases(int maxAliases) {
this.maxAliases = maxAliases;
return this;
}
public EmailOverviewSummary build() {
return new EmailOverviewSummary(accounts, maxAccounts, aliases, maxAliases);
}
public Builder fromEmailOverview(EmailOverviewSummary in) {
return accounts(in.getAccounts()).maxAccounts(in.getMaxAccounts()).aliases(in.getAliases()).maxAliases(in.getMaxAliases());
}
}
private final int accounts;
@SerializedName("maxaccounts")
private final int maxAccounts;
private final int aliases;
@SerializedName("maxaliases")
private final int maxAliases;
public EmailOverviewSummary(int accounts, int maxAccounts, int aliases, int maxAliases) {
this.accounts = accounts;
this.maxAccounts = maxAccounts;
this.aliases = aliases;
this.maxAliases = maxAliases;
}
public int getAccounts() {
return accounts;
}
public int getMaxAccounts() {
return maxAccounts;
}
public int getAliases() {
return aliases;
}
public int getMaxAliases() {
return maxAliases;
}
@Override
public int hashCode() {
return Objects.hashCode(accounts, maxAccounts, aliases, maxAliases);
}
@Override
public boolean equals(Object object) {
if (object == this) {
return true;
}
if (object instanceof EmailOverviewSummary) {
EmailOverviewSummary other = (EmailOverviewSummary) object;
return Objects.equal(accounts, other.accounts)
&& Objects.equal(maxAccounts, other.maxAccounts)
&& Objects.equal(aliases, other.aliases)
&& Objects.equal(maxAliases, other.maxAliases);
} else {
return false;
}
}
@Override
public String toString() {
Joiner commaJoiner = Joiner.on(", ");
return String.format("accounts=%d, maxAccounts=%d, aliases=%d, maxAliases=%d", accounts, maxAccounts, aliases, maxAliases);
}
}

View File

@ -15,7 +15,7 @@ import org.jclouds.javax.annotation.Nullable;
* Connection information to connect to a server with VNC.
*
* @author Adam Lowe
* @see <a href="https://customer.glesys.com/api.php?a=doc#server_console" />
* @see <a href="https://customer.glesys.com/api.php?a=doc#server_create" />
*/
public class ServerCreated {
public static Builder builder() {

View File

@ -38,11 +38,19 @@ public class ServerCreatedIp {
protected int version;
protected double cost;
public Builder version(int version) {
protected Builder version(int version) {
this.version = version;
return this;
}
public Builder version4() {
return version(4);
}
public Builder version6() {
return version(6);
}
public Builder ip(String ip) {
this.ip = ip;
return this;

View File

@ -0,0 +1,102 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.glesys.features;
import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.glesys.domain.*;
import org.jclouds.glesys.options.EmailCreateOptions;
import org.jclouds.glesys.options.EmailEditOptions;
import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.Set;
/**
* Provides asynchronous access to E-Mail data via the Glesys REST API.
* <p/>
*
* @author Adam Lowe
* @see org.jclouds.glesys.features.EmailClient
* @see <a href="https://customer.glesys.com/api.php" />
*/
@RequestFilters(BasicAuthentication.class)
public interface EmailAsyncClient {
/**
* @see org.jclouds.glesys.features.EmailClient#emailOverview
*/
@POST
@Path("/email/overview/format/json")
@SelectJson("response")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<EmailOverview> emailOverview();
/**
* @see org.jclouds.glesys.features.EmailClient#listAccounts
*/
@POST
@Path("/email/list/format/json")
@SelectJson("emailaccounts")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Email>> listAccounts(@FormParam("domain") String domain);
/**
* @see org.jclouds.glesys.features.EmailClient#createAccount
*/
@POST
@Path("/email/createaccount/format/json")
ListenableFuture<Void> createAccount(@FormParam("emailaccount") String accountAddress, @FormParam("password") String password, EmailCreateOptions... options);
/**
* @see org.jclouds.glesys.features.EmailClient#createAlias
*/
@POST
@Path("/email/createalias/format/json")
ListenableFuture<Void> createAlias(@FormParam("emailalias") String aliasAddress, @FormParam("goto") String toEmailAddress);
/**
* @see org.jclouds.glesys.features.EmailClient#editAccount
*/
@POST
@Path("/email/editaccount/format/json")
ListenableFuture<Void> editAccount(@FormParam("emailaccount") String accountAddress, EmailEditOptions... options);
/**
* @see org.jclouds.glesys.features.EmailClient#editAlias
*/
@POST
@Path("/email/editalias/format/json")
ListenableFuture<Void> editAlias(@FormParam("emailalias") String aliasAddress, @FormParam("goto") String toEmailAddress);
/**
* @see org.jclouds.glesys.features.EmailClient#delete
*/
@POST
@Path("/email/delete/format/json")
ListenableFuture<Void> delete(@FormParam("email") String accountAddress);
}

View File

@ -0,0 +1,65 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.glesys.features;
import org.jclouds.concurrent.Timeout;
import org.jclouds.glesys.domain.Email;
import org.jclouds.glesys.domain.EmailOverview;
import org.jclouds.glesys.options.EmailCreateOptions;
import org.jclouds.glesys.options.EmailEditOptions;
import javax.ws.rs.FormParam;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* Provides synchronous access to E-Mail requests.
* <p/>
*
* @author Adam Lowe
* @see org.jclouds.glesys.features.DomainAsyncClient
* @see <a href="https://customer.glesys.com/api.php" />
*/
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
public interface EmailClient {
/**
* Get a summary of e-mail accounts associated with this Glesys account
*
* @return the relevant summary data
*/
EmailOverview emailOverview();
/**
*
* @return
*/
Set<Email> listAccounts(String domain);
void createAccount(String accountAddress, String password, EmailCreateOptions... options);
void createAlias(String aliasAddress, String toEmailAddress);
void editAccount(String accountAddress, EmailEditOptions... options);
void editAlias(String aliasAddress, String toEmailAddress);
void delete(String accountAddress);
}

View File

@ -0,0 +1,76 @@
package org.jclouds.glesys.options;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
import org.jclouds.http.options.BaseHttpRequestOptions;
import java.util.Date;
/**
* @author Adam Lowe
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_createaccount" />
*/
public class EmailCreateOptions extends BaseHttpRequestOptions {
public static class Builder {
/**
* @see EmailCreateOptions#antispamLevel
*/
public static EmailCreateOptions antispamLevel(int antispamLevel) {
return new EmailCreateOptions().antispamLevel(antispamLevel);
}
/**
* @see EmailCreateOptions#antiVirus
*/
public static EmailCreateOptions antiVirus(boolean antiVirus) {
return new EmailCreateOptions().antiVirus(antiVirus);
}
/**
* @see EmailCreateOptions#autorespond
*/
public static EmailCreateOptions autorespond(boolean autorespond) {
return new EmailCreateOptions().autorespond(autorespond);
}
/**
* @see EmailCreateOptions#autorespondSaveEmail
*/
public static EmailCreateOptions autorespondSaveEmail(boolean autorespondSaveEmail) {
return new EmailCreateOptions().autorespondSaveEmail(autorespondSaveEmail);
}
/**
* @see EmailCreateOptions#autorespondMessage
*/
public static EmailCreateOptions autorespondMessage(boolean autorespondMessage) {
return new EmailCreateOptions().autorespondMessage(autorespondMessage);
}
}
public EmailCreateOptions antispamLevel(int antispamLevel) {
formParameters.put("antispamlevel", Integer.toString(antispamLevel));
return this;
}
public EmailCreateOptions antiVirus(boolean antiVirus) {
formParameters.put("antivirus", Integer.toString(antiVirus ? 1 : 0));
return this;
}
public EmailCreateOptions autorespond(boolean autorespond) {
formParameters.put("autorespond", Integer.toString(autorespond ? 1 : 0));
return this;
}
public EmailCreateOptions autorespondSaveEmail(boolean autorespondSaveEmail) {
formParameters.put("autorespondsaveemail", Integer.toString(autorespondSaveEmail ? 1 : 0));
return this;
}
public EmailCreateOptions autorespondMessage(boolean autorespondMessage) {
formParameters.put("autorespondmessage", Integer.toString(autorespondMessage ? 1 : 0));
return this;
}
}

View File

@ -0,0 +1,41 @@
package org.jclouds.glesys.options;
import org.jclouds.http.options.BaseHttpRequestOptions;
/**
* @author Adam Lowe
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_editaccount" />
*/
public class EmailEditOptions extends EmailCreateOptions {
public static class Builder {
public static EmailEditOptions antispamLevel(int antispamLevel) {
return EmailEditOptions.class.cast(new EmailEditOptions().antispamLevel(antispamLevel));
}
public static EmailEditOptions antiVirus(boolean antiVirus) {
return EmailEditOptions.class.cast(new EmailEditOptions().antiVirus(antiVirus));
}
public static EmailEditOptions autorespond(boolean autorespond) {
return EmailEditOptions.class.cast(new EmailEditOptions().autorespond(autorespond));
}
public static EmailEditOptions autorespondSaveEmail(boolean autorespondSaveEmail) {
return EmailEditOptions.class.cast(new EmailEditOptions().autorespondSaveEmail(autorespondSaveEmail));
}
public static EmailEditOptions autorespondMessage(boolean autorespondMessage) {
return EmailEditOptions.class.cast(new EmailEditOptions().autorespondMessage(autorespondMessage));
}
public static EmailEditOptions autorespondMessage(String password) {
return new EmailEditOptions().password(password);
}
}
public EmailEditOptions password(String password) {
formParameters.put("password", password);
return this;
}
}

View File

@ -30,6 +30,7 @@ import org.jclouds.http.options.BaseHttpRequestOptions;
import org.jclouds.rest.RestClientTest;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.rest.RestContextSpec;
import org.jclouds.util.Strings2;
import java.lang.reflect.Method;
import java.util.ArrayList;
@ -66,8 +67,6 @@ public abstract class BaseGleSYSAsyncClientTest<T> extends RestClientTest<T> {
/**
* Test that a method call is annotated correctly.
* <p/>
* TODO de-code ampersands and spaces in args properly
*
* @param localMethod the method to call in asyncClientClass
* @param remoteCall the name of the expected call on the remote server
* @param httpMethod "GET" or "POST"
@ -87,7 +86,7 @@ public abstract class BaseGleSYSAsyncClientTest<T> extends RestClientTest<T> {
argValues.add(arg);
} else {
Map.Entry<String, String> entry = (Map.Entry<String, String>) arg;
argStrings.add(entry.getKey() + "=" + entry.getValue());
argStrings.add(entry.getKey() + "=" + Strings2.urlEncode(entry.getValue()));
argValues.add(entry.getValue());
}
}

View File

@ -19,10 +19,17 @@
package org.jclouds.glesys.features;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.*;
import com.google.common.base.Predicate;
import org.jclouds.glesys.GleSYSAsyncClient;
import org.jclouds.glesys.GleSYSClient;
import org.jclouds.glesys.domain.ServerCreated;
import org.jclouds.glesys.domain.ServerState;
import org.jclouds.glesys.domain.ServerStatus;
import org.jclouds.glesys.options.ServerStatusOptions;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.rest.RestContext;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.sshj.config.SshjSshClientModule;
@ -33,10 +40,12 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
import java.util.concurrent.TimeUnit;
/**
* Tests behavior of {@code GleSYSClient}
*
* @author Adrian Cole
* @author Adrian Cole, Adam Lowe
*/
@Test(groups = "live")
public class BaseGleSYSClientLiveTest {
@ -45,18 +54,67 @@ public class BaseGleSYSClientLiveTest {
@BeforeGroups(groups = { "live" })
public void setupClient() {
if (context == null) {
String identity = checkNotNull(System.getProperty("test.glesys.identity"), "test.glesys.identity");
String credential = checkNotNull(System.getProperty("test.glesys.credential"), "test.glesys.credential");
context = new RestContextFactory().createContext("glesys", identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()));
}
}
@AfterGroups(groups = "live")
protected void tearDown() {
if (context != null)
if (context != null) {
context.close();
context = null;
}
}
protected void createDomain(String domain) {
final DomainClient client = context.getApi().getDomainClient();
int before = client.listDomains().size();
client.addDomain(domain);
RetryablePredicate<Integer> result = new RetryablePredicate<Integer>(
new Predicate<Integer>() {
public boolean apply(Integer value) {
return client.listDomains().size() == value;
}
}, 30, 1, TimeUnit.SECONDS);
assertTrue(result.apply(before + 1));
}
protected ServerStatusChecker createServer(String hostName) {
ServerClient client = context.getApi().getServerClient();
ServerCreated testServer = client.createServer("Falkenberg", "OpenVZ", hostName, "Ubuntu 10.04 LTS 32-bit", 5, 512, 1, "password", 50);
assertNotNull(testServer.getId());
assertEquals(testServer.getHostname(), hostName);
assertFalse(testServer.getIps().isEmpty());
ServerStatusChecker runningServerCounter = new ServerStatusChecker(client, testServer.getId(), 300, 10, TimeUnit.SECONDS);
assertTrue(runningServerCounter.apply(ServerState.RUNNING));
return runningServerCounter;
}
public static class ServerStatusChecker extends RetryablePredicate<ServerState> {
private final String serverId;
public String getServerId() {
return serverId;
}
public ServerStatusChecker(final ServerClient client, final String serverId, long maxWait, long period, TimeUnit unit) {
super(new Predicate<ServerState>() {
public boolean apply(ServerState value) {
ServerStatus status = client.getServerStatus(serverId, ServerStatusOptions.Builder.state());
return status.getState() == value;
}
}, maxWait, period, unit);
this.serverId = serverId;
}
}
}

View File

@ -37,6 +37,7 @@ import static org.testng.Assert.assertTrue;
*/
@Test(groups = "live", testName = "DomainClientLiveTest")
public class DomainClientLiveTest extends BaseGleSYSClientLiveTest {
public final String testDomain = "glesystest.jclouds.org";
@BeforeGroups(groups = {"live"})
public void setupClient() {
@ -55,6 +56,13 @@ public class DomainClientLiveTest extends BaseGleSYSClientLiveTest {
return client.listRecords(testDomain).size() == value;
}
}, 30, 1, TimeUnit.SECONDS);
try {
client.deleteDomain(testDomain);
} catch (Exception ex) {
}
createDomain(testDomain);
}
@AfterGroups(groups = {"live"})
@ -67,24 +75,11 @@ public class DomainClientLiveTest extends BaseGleSYSClientLiveTest {
}
private DomainClient client;
private String testDomain = "glesystest.jclouds.org";
private String testRecordId;
private RetryablePredicate<Integer> domainCounter;
private RetryablePredicate<Integer> recordCounter;
@Test
public void testCreateDomain() throws Exception {
try {
client.deleteDomain(testDomain);
} catch (Exception ex) {
}
int before = client.listDomains().size();
client.addDomain(testDomain);
assertTrue(domainCounter.apply(before + 1));
}
@Test(dependsOnMethods = "testCreateDomain")
public void testCreateRecord() throws Exception {
int before = client.listRecords(testDomain).size();
@ -93,7 +88,7 @@ public class DomainClientLiveTest extends BaseGleSYSClientLiveTest {
assertTrue(recordCounter.apply(before + 1));
}
@Test(dependsOnMethods = "testCreateRecord")
@Test
public void testDeleteRecord() throws Exception {
Set<DomainRecord> domainRecords = client.listRecords(testDomain);

View File

@ -0,0 +1,70 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.glesys.features;
import com.google.inject.TypeLiteral;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
import java.util.Map;
/**
* Tests annotation parsing of {@code ArchiveAsyncClient}
*
* @author Adam Lowe
*/
@Test(groups = "unit", testName = "EmailAsyncClientTest")
public class EmailAsyncClientTest extends BaseGleSYSAsyncClientTest<EmailAsyncClient> {
public EmailAsyncClientTest() {
asyncClientClass = EmailAsyncClient.class;
remoteServicePrefix = "email";
}
public void testList() throws Exception {
testMethod("listAccounts", "list", "POST", true, ReturnEmptySetOnNotFoundOr404.class, newEntry("domain","test"));
}
public void testOverview() throws Exception {
testMethod("emailOverview", "overview", "POST", true, ReturnEmptySetOnNotFoundOr404.class);
}
public void testCreateAccount() throws Exception {
testMethod("createAccount", "createaccount", "POST", false, MapHttp4xxCodesToExceptions.class,
newEntry("emailaccount", "jclouds.org"), newEntry("password", "test@jclouds.org"));
}
public void testCreateAlias() throws Exception {
testMethod("createAlias", "createalias", "POST", false, MapHttp4xxCodesToExceptions.class,
newEntry("emailalias", "test2@jclouds.org"), newEntry("goto", "test@jclouds.org"));
}
public void testEditAlias() throws Exception {
testMethod("editAlias", "editalias", "POST", false, MapHttp4xxCodesToExceptions.class,
newEntry("emailalias", "test2@jclouds.org"), newEntry("goto", "test1@jclouds.org"));
}
@Override
protected TypeLiteral<RestAnnotationProcessor<EmailAsyncClient>> createTypeLiteral() {
return new TypeLiteral<RestAnnotationProcessor<EmailAsyncClient>>() {
};
}
}

View File

@ -0,0 +1,119 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.glesys.features;
import com.google.common.base.Predicate;
import org.jclouds.glesys.domain.*;
import org.jclouds.glesys.options.EmailEditOptions;
import org.jclouds.predicates.RetryablePredicate;
import org.testng.annotations.AfterGroups;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import static org.testng.Assert.*;
/**
* Tests behavior of {@code EmailClient}
*
* @author Adam Lowe
*/
@Test(groups = "live", testName = "EmailClientLiveTest")
public class EmailClientLiveTest extends BaseGleSYSClientLiveTest {
@BeforeGroups(groups = {"live"})
public void setupClient() {
super.setupClient();
client = context.getApi().getEmailClient();
try {
client.delete("test@" + testDomain);
context.getApi().getDomainClient().deleteDomain(testDomain);
} catch(Exception e) {
}
serverId = createServer("test-email-jclouds").getServerId();
createDomain(testDomain);
domainCounter = new RetryablePredicate<Integer>(
new Predicate<Integer>() {
public boolean apply(Integer value) {
return client.listAccounts(testDomain).size() == value;
}
}, 30, 1, TimeUnit.SECONDS);
}
@AfterGroups(groups = {"live"})
public void tearDown() {
client.delete("test@" + testDomain);
context.getApi().getDomainClient().deleteDomain(testDomain);
context.getApi().getServerClient().destroyServer(serverId, 0);
super.tearDown();
}
private EmailClient client;
private String serverId;
private final String testDomain = "email-test.jclouds.org";
private RetryablePredicate<Integer> domainCounter;
@Test
public void createEmail() {
int before = client.listAccounts(testDomain).size();
client.createAccount("test@" + testDomain, "password");
assertTrue(domainCounter.apply(before + 1));
}
@Test(dependsOnMethods = "createEmail")
public void testOverview() throws Exception {
EmailOverview overview = client.emailOverview();
assertNotNull(overview.getSummary());
assertTrue(overview.getSummary().getAccounts() >= 1);
assertTrue(overview.getSummary().getAliases() == 0);
assertTrue(overview.getSummary().getMaxAccounts() > 0);
assertTrue(overview.getSummary().getMaxAliases() > 0);
assertNotNull(overview.getDomains());
assertFalse(overview.getDomains().isEmpty());
EmailOverviewDomain domain = EmailOverviewDomain.builder().domain(testDomain).accounts(1).build();
assertTrue(overview.getDomains().contains(domain));
}
@Test(dependsOnMethods = "createEmail")
public void testListAccounts() throws Exception {
Set<Email> accounts = client.listAccounts(testDomain);
assertTrue(accounts.size() >= 1);
}
@Test(dependsOnMethods = "createEmail")
public void testEditAccount() throws Exception {
client.editAccount("test@" + testDomain, EmailEditOptions.Builder.antiVirus(false));
Set<Email> accounts = client.listAccounts(testDomain);
for(Email account : accounts) {
if (account.getAccount().equals("test@" + testDomain)) {
assertFalse(account.getAntiVirus());
}
}
}
}

View File

@ -41,40 +41,30 @@ import static org.testng.Assert.*;
*/
@Test(groups = "live", testName = "ServerClientLiveTest")
public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
public static final String testHostName1 = "jclouds-test";
public static final String testHostName2 = "jclouds-test2";
@BeforeGroups(groups = {"live"})
public void setupClient() {
super.setupClient();
client = context.getApi().getServerClient();
runningServerCounter = createServer(testHostName1);
testServerId = runningServerCounter.getServerId();
}
@AfterGroups(groups = {"live"})
public void tearDown() {
client.destroyServer(testServer.getId(), 0);
if (testServer2 != null) {
client.destroyServer(testServer2.getId(), 0);
client.destroyServer(testServerId, 0);
if (testServerId2 != null) {
client.destroyServer(testServerId2, 0);
}
super.tearDown();
}
private ServerClient client;
private ServerCreated testServer;
private ServerCreated testServer2;
// note this is initialized by testCreateServer()
private RetryablePredicate<ServerState> runningServerCounter;
@Test
public void testCreateServer() throws Exception {
testServer = client.createServer("Falkenberg", "OpenVZ", "jclouds-test", "Ubuntu 10.04 LTS 32-bit", 5, 512, 1, "password", 50);
assertNotNull(testServer.getId());
assertEquals(testServer.getHostname(), "jclouds-test");
assertFalse(testServer.getIps().isEmpty());
runningServerCounter = new ServerStatusChecker(testServer.getId(), 120, 2, TimeUnit.SECONDS);
assertTrue(runningServerCounter.apply(ServerState.RUNNING));
}
private ServerStatusChecker runningServerCounter;
private String testServerId;
private String testServerId2;
@Test
public void testAllowedArguments() throws Exception {
@ -125,7 +115,7 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
assert t.getMinMemSize() > 0 : t;
}
@Test(dependsOnMethods = "testCreateServer")
@Test
public void testListServers() throws Exception {
Set<Server> response = client.listServers();
assertNotNull(response);
@ -141,35 +131,46 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
}
}
@Test(dependsOnMethods = "testCreateServer")
@Test
public void testServerDetails() throws Exception {
ServerStatus newStatus = client.getServerStatus(testServer.getId());
ServerStatus newStatus = client.getServerStatus(testServerId);
checkStatus(newStatus);
}
@Test(dependsOnMethods = "testCreateServer")
@Test(enabled=false) // TODO tricksy
public void testRebootServer() throws Exception {
client.rebootServer(testServer.getId());
long uptime = 0;
while(uptime < 20) {
uptime = client.getServerStatus(testServerId).getUptime();
}
assertTrue(uptime > 19);
client.rebootServer(testServerId);
uptime = client.getServerStatus(testServerId).getUptime();
assertTrue(uptime < 20);
assertTrue(runningServerCounter.apply(ServerState.STOPPED));
assertTrue(runningServerCounter.apply(ServerState.RUNNING));
}
@Test(dependsOnMethods = "testCreateServer")
@Test
public void testStopAndStartServer() throws Exception {
client.stopServer(testServer.getId());
client.stopServer(testServerId);
assertTrue(runningServerCounter.apply(ServerState.STOPPED));
client.startServer(testServer.getId());
client.startServer(testServerId);
assertTrue(runningServerCounter.apply(ServerState.RUNNING));
}
@Test(dependsOnMethods = "testCreateServer")
@Test
public void testServerLimits() throws Exception {
Map<String, ServerLimit> limits = client.getServerLimits(testServer.getId());
Map<String, ServerLimit> limits = client.getServerLimits(testServerId);
assertNotNull(limits);
for (Map.Entry<String, ServerLimit> entry : limits.entrySet()) {
assertNotNull(entry.getKey());
@ -184,9 +185,9 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
}
// TODO in progress
@Test(enabled=false, dependsOnMethods = "testCreateServer")
@Test(enabled=false)
public void testServerConsole() throws Exception {
ServerConsole console = client.getServerConsole(testServer.getId());
ServerConsole console = client.getServerConsole(testServerId);
assertNotNull(console);
assertNotNull(console.getHost());
assertTrue(console.getPort() > 0 && console.getPort() < 65537);
@ -194,15 +195,17 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
}
// takes a few minutes
@Test(enabled=false, dependsOnMethods = "testCreateServer")
@Test(enabled=false)
public void testCloneServer() throws Exception {
testServer2 = client.cloneServer(testServer.getId(), "jclouds-test2", ServerCloneOptions.Builder.cpucores(1));
ServerCreated testServer2 = client.cloneServer(testServerId, testHostName2, ServerCloneOptions.Builder.cpucores(1));
assertNotNull(testServer2.getId());
assertEquals(testServer2.getHostname(), "jclouds-test2");
assertTrue(testServer2.getIps().isEmpty());
RetryablePredicate<ServerState> cloneChecker = new ServerStatusChecker(testServer2.getId(), 300, 10, TimeUnit.SECONDS);
testServerId2 = testServer2.getId();
RetryablePredicate<ServerState> cloneChecker = new ServerStatusChecker(client, testServerId2, 300, 10, TimeUnit.SECONDS);
assertTrue(cloneChecker.apply(ServerState.STOPPED));
@ -213,12 +216,12 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
new Predicate<ServerState>() {
public boolean apply(ServerState value) {
ServerStatus status = client.getServerStatus(testServer2.getId(), ServerStatusOptions.Builder.state());
ServerStatus status = client.getServerStatus(testServerId2, ServerStatusOptions.Builder.state());
if (status.getState() == value) {
return true;
}
client.startServer(testServer2.getId());
client.startServer(testServerId2);
return false;
}
@ -265,17 +268,4 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
assert status.getMemory().getUsage() >= 0 : status;
assertNotNull(status.getMemory().getUnit());
}
private class ServerStatusChecker extends RetryablePredicate<ServerState> {
public ServerStatusChecker(final String serverId, long maxWait, long period, TimeUnit unit) {
super(new Predicate<ServerState>() {
public boolean apply(ServerState value) {
ServerStatus status = client.getServerStatus(serverId, ServerStatusOptions.Builder.state());
return status.getState() == value;
}
}, maxWait, period, unit);
}
}
}

View File

@ -0,0 +1,69 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.glesys.parse;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.jclouds.glesys.config.GleSYSParserModule;
import org.jclouds.glesys.domain.Email;
import org.jclouds.json.BaseSetParserTest;
import org.jclouds.json.config.GsonModule;
import org.jclouds.rest.annotations.SelectJson;
import org.testng.annotations.Test;
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Set;
/**
* @author Adam Lowe
*/
@Test(groups = "unit", testName = "ParseEmailListTest")
public class ParseEmailListTest extends BaseSetParserTest<Email> {
@Override
public String resource() {
return "/email_list.json";
}
@Override
@SelectJson("emailaccounts")
@Consumes(MediaType.APPLICATION_JSON)
public Set<Email> expected() {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Email.Builder builder = Email.builder().quota("200 MB").usedQuota("0 MB").antispamLevel(3).antiVirus(true).autoRespond(false).autoRespondSaveEmail(true).autoRespondMessage("false");
try {
return ImmutableSet.of(
builder.account("test@adamlowe.net").created(dateFormat.parse("2011-12-22T12:13:14")).modified(dateFormat.parse("2011-12-22T12:13:35")).build(),
builder.account("test2@adamlowe.net").created(dateFormat.parse("2011-12-22T12:14:29")).modified(dateFormat.parse("2011-12-22T12:14:31")).build()
);
} catch(ParseException ex) {
throw new RuntimeException(ex);
}
}
protected Injector injector() {
return Guice.createInjector(new GleSYSParserModule(), new GsonModule());
}
}

View File

@ -0,0 +1,57 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.glesys.parse;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.jclouds.glesys.config.GleSYSParserModule;
import org.jclouds.glesys.domain.EmailOverview;
import org.jclouds.glesys.domain.EmailOverviewDomain;
import org.jclouds.glesys.domain.EmailOverviewSummary;
import org.jclouds.json.BaseItemParserTest;
import org.jclouds.json.config.GsonModule;
import org.jclouds.rest.annotations.SelectJson;
import org.testng.annotations.Test;
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
/**
* @author Adam Lowe
*/
@Test(groups = "unit", testName = "ParseEmailListTest")
public class ParseEmailOverviewTest extends BaseItemParserTest<EmailOverview> {
@Override
public String resource() {
return "/email_overview.json";
}
@Override
@SelectJson("response")
@Consumes(MediaType.APPLICATION_JSON)
public EmailOverview expected() {
return EmailOverview.builder().summary(EmailOverviewSummary.builder().accounts(2).aliases(0).maxAccounts(50).maxAliases(1000).build()).domains(EmailOverviewDomain.builder().accounts(2).aliases(0).domain("adamlowe.net").build()).build();
}
protected Injector injector() {
return Guice.createInjector(new GleSYSParserModule(), new GsonModule());
}
}

View File

@ -47,7 +47,7 @@ public class ParseServerCreatedTest extends BaseItemParserTest<ServerCreated> {
@SelectJson("server")
@Consumes(MediaType.APPLICATION_JSON)
public ServerCreated expected() {
return ServerCreated.builder().id("xm3630641").hostname("jclouds-test-host").ips(ServerCreatedIp.builder().ip("109.74.10.27").version(4).cost(2.00).build()).build();
return ServerCreated.builder().id("xm3630641").hostname("jclouds-test-host").ips(ServerCreatedIp.builder().ip("109.74.10.27").version4().cost(2.00).build()).build();
}

View File

@ -0,0 +1 @@
{"response":{"status":{"code":"200","text":"OK"},"list":{"emailaccounts":[{"emailaccount":"test2@adamlowe.net","quota":"200 MB","usedquota":"0 MB","antispamlevel":3,"antivirus":true,"autorespond":false,"autorespondmessage":false,"autorespondsaveemail":true,"created":"2011-12-22 12:14:29","modified":"2011-12-22 12:14:31"},{"emailaccount":"test@adamlowe.net","quota":"200 MB","usedquota":"0 MB","antispamlevel":3,"antivirus":true,"autorespond":false,"autorespondmessage":false,"autorespondsaveemail":true,"created":"2011-12-22 12:13:14","modified":"2011-12-22 12:13:35"}]},"debug":{"input":{"domain":"adamlowe.net"}}}}

View File

@ -0,0 +1 @@
{"response":{"status":{"code":"200","text":"OK"},"summary":{"accounts":2,"maxaccounts":"50","aliases":0,"maxaliases":1000},"domains":[{"domain":"adamlowe.net","accounts":2,"aliases":0}],"debug":{"input":[]}}}