/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetImageTest.java

https://github.com/regularfry/jclouds · Java · 76 lines · 46 code · 8 blank · 22 comment · 0 complexity · b251227e5106787ac0cb3d198172aa08 MD5 · raw file

  1. /**
  2. * Licensed to jclouds, Inc. (jclouds) under one or more
  3. * contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. jclouds licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. package org.jclouds.ibm.smartcloud.parse;
  20. import java.util.Date;
  21. import org.jclouds.http.HttpUtils;
  22. import org.jclouds.ibm.smartcloud.config.IBMSmartCloudParserModule;
  23. import org.jclouds.ibm.smartcloud.domain.Image;
  24. import org.jclouds.ibm.smartcloud.domain.InstanceType;
  25. import org.jclouds.ibm.smartcloud.domain.Price;
  26. import org.jclouds.ibm.smartcloud.domain.Image.Visibility;
  27. import org.jclouds.json.BaseItemParserTest;
  28. import org.jclouds.json.config.GsonModule;
  29. import org.testng.annotations.Test;
  30. import com.google.common.collect.ImmutableSet;
  31. import com.google.inject.Guice;
  32. import com.google.inject.Injector;
  33. /**
  34. *
  35. * @author Adrian Cole
  36. */
  37. @Test(groups = "unit", testName = "GetImageTest")
  38. public class GetImageTest extends BaseItemParserTest<Image> {
  39. protected Injector injector() {
  40. return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule());
  41. }
  42. @Override
  43. public String resource() {
  44. return "/image.json";
  45. }
  46. @Override
  47. public Image expected() {
  48. return new Image(
  49. "SUSE Linux Enterprise Server 11 for x86",
  50. HttpUtils
  51. .createUri("https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{F006D027-02CC-9D08-D389-6C729D939D44}/1.0/parameters.xml"),
  52. Image.State.AVAILABLE,
  53. Visibility.PUBLIC,
  54. "SYSTEM",
  55. "SUSE Linux Enterprise Server/11",
  56. Image.Architecture.I386,
  57. new Date(1216944000000l),
  58. "41",
  59. ImmutableSet.<InstanceType> of(new InstanceType("Bronze 32 bit", new Price(0.17, "UHR ", "897", null,
  60. "USD", 1), "BRZ32.1/2048/175"), new InstanceType("Gold 32 bit", new Price(0.41, "UHR ", "897",
  61. null, "USD", 1), "GLD32.4/4096/350"), new InstanceType("Silver 32 bit", new Price(0.265,
  62. "UHR ", "897", null, "USD", 1), "SLV32.2/4096/350")),
  63. ImmutableSet.<String> of("ifeE7VOzRG6SGvoDlRPTQw"),
  64. HttpUtils
  65. .createUri("https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{F006D027-02CC-9D08-D389-6C729D939D44}/1.0/GettingStarted.html"),
  66. "20001150", "SUSE Linux Enterprise Server 11 for x86 Base OS 32-bit with pay for use licensing");
  67. }
  68. }