Permalink
Browse files

Merge pull request #337 from aplowe/master

GleSYS provider: updates to match GleSYS API Beta v0.1.6
  • Loading branch information...
2 parents bf02dd9 + 5074835 commit 8be10543e35228b02469172bcc881263e1001d42 Adrian Cole committed Jan 28, 2012
Showing with 443 additions and 1,818 deletions.
  1. +11 −0 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/GleSYSPropertiesBuilder.java
  2. +3 −3 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/GleSYSProviderMetadata.java
  3. +1 −2 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSParserModule.java
  4. +0 −119 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/Bandwidth.java
  5. +0 −153 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/Cpu.java
  6. +0 −119 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/Disk.java
  7. +28 −29 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/{Memory.java → ResourceUsage.java}
  8. +22 −6 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/ServerConsole.java
  9. +0 −126 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/ServerCreated.java
  10. +32 −29 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/ServerDetails.java
  11. +23 −39 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/ServerStatus.java
  12. +3 −2 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/ServerTemplate.java
  13. +42 −44 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/ServerUptime.java
  14. +29 −14 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/features/ServerAsyncClient.java
  15. +30 −22 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/features/ServerClient.java
  16. +0 −11 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/functions/internal/GleSYSTypeAdapters.java
  17. +32 −0 sandbox-providers/glesys/src/main/java/org/jclouds/glesys/reference/GleSYSConstants.java
  18. +2 −2 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/features/BaseGleSYSClientLiveTest.java
  19. +40 −1 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/features/DomainClientExpectTest.java
  20. +119 −32 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/features/ServerClientExpectTest.java
  21. +20 −31 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/features/ServerClientLiveTest.java
  22. +0 −59 ...box-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseArchiveAllowedArgumentsTest.java
  23. +0 −57 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseArchiveDetailsTest.java
  24. +0 −60 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseArchiveListTest.java
  25. +0 −71 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseDomainListTest.java
  26. +0 −71 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseDomainRecordListTest.java
  27. +0 −69 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseEmailListTest.java
  28. +0 −57 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseEmailOverviewTest.java
  29. +0 −81 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseServerAllowedArgumentsTest.java
  30. +0 −56 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseServerConsoleTest.java
  31. +0 −57 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseServerCreatedTest.java
  32. +0 −61 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseServerDetailsTest.java
  33. +0 −62 ...box-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseServerDetailsWithoutIPsTest.java
  34. +0 −61 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseServerListTest.java
  35. +0 −67 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseServerStatusTest.java
  36. +0 −80 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseServerTemplatesTest.java
  37. +0 −59 sandbox-providers/glesys/src/test/java/org/jclouds/glesys/parse/ParseSimpleIpDetailsTest.java
  38. +1 −1 sandbox-providers/glesys/src/test/resources/server_allowed_arguments.json
  39. +1 −1 sandbox-providers/glesys/src/test/resources/server_console.json
  40. +1 −1 sandbox-providers/glesys/src/test/resources/server_details.json
  41. +1 −1 sandbox-providers/glesys/src/test/resources/server_noip.json
  42. +1 −1 sandbox-providers/glesys/src/test/resources/server_status.json
  43. +1 −1 sandbox-providers/glesys/src/test/resources/server_templates.json
@@ -20,22 +20,33 @@
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
+import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
+import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES;
+import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONE;
import java.util.Properties;
import org.jclouds.PropertiesBuilder;
+import static org.jclouds.glesys.reference.GleSYSConstants.PROPERTY_GLESYS_DEFAULT_DC;
/**
* Builds properties used in GleSYS Clients
*
* @author Adrian Cole
+ * @author Adam Lowe
*/
public class GleSYSPropertiesBuilder extends PropertiesBuilder {
@Override
protected Properties defaultProperties() {
Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_ENDPOINT, "https://api.glesys.com");
properties.setProperty(PROPERTY_API_VERSION, "1");
+ properties.setProperty(PROPERTY_ISO3166_CODES, "US-CA,US-VA,BR-SP");
+ properties.setProperty(PROPERTY_ZONE + ".Amsterdam." + ISO3166_CODES, "NL-NH");
+ properties.setProperty(PROPERTY_ZONE + ".Falkenberg." + ISO3166_CODES, "SE-N");
+ properties.setProperty(PROPERTY_ZONE + ".New York City." + ISO3166_CODES, "US-NY");
+ properties.setProperty(PROPERTY_ZONE + ".Stockholm." + ISO3166_CODES, "SE-AB");
+ properties.setProperty(PROPERTY_GLESYS_DEFAULT_DC, "Falkenberg");
return properties;
}
@@ -105,11 +105,11 @@ public URI getApiDocumentation() {
}
/**
- * {@inheritDoc}
- */
+ * {@inheritDoc}
+ */
@Override
public Set<String> getIso3166Codes() {
- return ImmutableSet.of();
+ return ImmutableSet.of("NL-NH","SE-N","US-NY","SE-AB");
}
}
@@ -41,8 +41,7 @@
@Provides
@Singleton
public Map<Type, Object> provideCustomAdapterBindings() {
- return ImmutableMap.<Type, Object> of(ServerState.class, new GleSYSTypeAdapters.ServerStateAdapter(),
- ServerUptime.class, new GleSYSTypeAdapters.ServerUptimeAdapter());
+ return ImmutableMap.<Type, Object> of(ServerState.class, new GleSYSTypeAdapters.ServerStateAdapter());
}
@Override
@@ -1,119 +0,0 @@
-/**
- * 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;
-
-/**
- * Detailed information on Server bandwidth
- *
- * @author Adam Lowe
- * @see ServerStatus
- */
-public class Bandwidth {
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private long today;
- private long last30Days;
- private long max;
-
- public Builder today(long today) {
- this.today = today;
- return this;
- }
-
- public Builder last30Days(long last30Days) {
- this.last30Days = last30Days;
- return this;
- }
-
- public Builder max(long max) {
- this.max = max;
- return this;
- }
-
- public Bandwidth build() {
- return new Bandwidth(today, last30Days, max);
- }
-
- public Builder fromBandwidth(Bandwidth in) {
- return today(in.getToday()).last30Days(in.getLast30Days()).max(in.getMax());
- }
- }
-
- private final long today;
- private final long last30Days;
- private final long max;
-
- public Bandwidth(long today, long last30Days, long max) {
- this.today = today;
- this.last30Days = last30Days;
- this.max = max;
- }
-
- /**
- * @return the bandwidth used today in MB
- */
- public long getToday() {
- return today;
- }
-
- /**
- * @return the bandwidth used in the past 30 days in GB
- */
- public long getLast30Days() {
- return last30Days;
- }
-
- /**
- * @return the max bandwidth allowed over a 30 day period in GB
- */
- public long getMax() {
- return max;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(today, last30Days, max);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof Bandwidth) {
- Bandwidth other = (Bandwidth) object;
- return Objects.equal(today, other.today)
- && Objects.equal(last30Days, other.last30Days)
- && Objects.equal(max, other.max);
- } else {
- return false;
- }
- }
-
- @Override
- public String toString() {
- return String.format("[today=%d, last30Days=%d, max=%d]", today, last30Days, max);
- }
-
-}
@@ -1,153 +0,0 @@
-/**
- * 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 org.jclouds.javax.annotation.Nullable;
-
-/**
- * Detailed information on Server cpu usage
- *
- * @author Adam Lowe
- * @see ServerStatus
- */
-
-public class Cpu {
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private double system;
- private double user;
- private Double nice;
- private double idle;
- private String unit;
-
- public Builder system(double system) {
- this.system = system;
- return this;
- }
-
- public Builder user(double user) {
- this.user = user;
- return this;
- }
-
- public Builder nice(Double nice) {
- this.nice = nice;
- return this;
- }
-
- public Builder idle(double idle) {
- this.idle = idle;
- return this;
- }
-
- public Builder unit(String unit) {
- this.unit = unit;
- return this;
- }
-
- public Cpu build() {
- return new Cpu(system, user, nice, idle, unit);
- }
-
- public Builder fromCpu(Cpu in) {
- return system(in.getSystem()).user(in.getUser()).nice(in.getNice()).idle(in.getIdle()).unit(in.getUnit());
- }
- }
-
- private final double system;
- private final double user;
- private final Double nice;
- private final double idle;
- private final String unit;
-
- public Cpu(double system, double user, @Nullable Double nice, double idle, String unit) {
- this.system = system;
- this.user = user;
- this.nice = nice;
- this.idle = idle;
- this.unit = unit;
- }
-
- /**
- * @return the system time in use in #unit
- */
- public double getSystem() {
- return system;
- }
-
- /**
- * @return the user time in use in #unit
- */
- public double getUser() {
- return user;
- }
-
- /**
- * @return the nice setting
- */
- public Double getNice() {
- return nice;
- }
-
- /**
- * @return the idle time in #unit
- */
- public double getIdle() {
- return idle;
- }
-
- /**
- * @return the unit used
- */
- public String getUnit() {
- return unit;
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof Cpu) {
- Cpu other = (Cpu) object;
- return Objects.equal(system, other.system)
- && Objects.equal(user, other.user)
- && Objects.equal(nice, other.nice)
- && Objects.equal(idle, other.idle)
- && Objects.equal(unit, other.unit);
- } else {
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(system, user, nice, idle, unit);
- }
-
- @Override
- public String toString() {
- return String.format("[system=%f, user=%f, nice=%f, idle=%f, unit=%s]",
- system, user, nice, idle, unit);
- }
-}
Oops, something went wrong.

0 comments on commit 8be1054

Please sign in to comment.