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

https://github.com/regularfry/jclouds · Java · 80 lines · 51 code · 7 blank · 22 comment · 0 complexity · 6e7e9c3674f55825e3d18f217d6cbe88 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 java.util.Set;
  22. import org.jclouds.http.HttpUtils;
  23. import org.jclouds.ibm.smartcloud.config.IBMSmartCloudParserModule;
  24. import org.jclouds.ibm.smartcloud.domain.Image;
  25. import org.jclouds.ibm.smartcloud.domain.InstanceType;
  26. import org.jclouds.ibm.smartcloud.domain.Price;
  27. import org.jclouds.ibm.smartcloud.domain.Image.Visibility;
  28. import org.jclouds.json.BaseSetParserTest;
  29. import org.jclouds.json.config.GsonModule;
  30. import org.jclouds.rest.annotations.Unwrap;
  31. import org.testng.annotations.Test;
  32. import com.google.common.collect.ImmutableSet;
  33. import com.google.inject.Guice;
  34. import com.google.inject.Injector;
  35. /**
  36. *
  37. * @author Adrian Cole
  38. */
  39. @Test(groups = "unit", singleThreaded = true, testName = "ListImagesTest")
  40. public class ListImagesTest extends BaseSetParserTest<Image> {
  41. protected Injector injector() {
  42. return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule());
  43. }
  44. @Override
  45. public String resource() {
  46. return "/images.json";
  47. }
  48. @Override
  49. @Unwrap
  50. public Set<Image> expected() {
  51. return ImmutableSet
  52. .of(new Image(
  53. "SUSE Linux Enterprise Server 11 for x86",
  54. HttpUtils
  55. .createUri("https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{F006D027-02CC-9D08-D389-6C729D939D44}/1.0/parameters.xml"),
  56. Image.State.AVAILABLE,
  57. Visibility.PUBLIC,
  58. "SYSTEM",
  59. "SUSE Linux Enterprise Server/11",
  60. Image.Architecture.X86_64,
  61. new Date(1216944000000l),
  62. "41",
  63. ImmutableSet.<InstanceType> of(new InstanceType("Bronze 32 bit", new Price(0.17, "UHR ",
  64. "897", null, "USD", 1), "BRZ32.1/2048/175"), new InstanceType("Gold 32 bit",
  65. new Price(0.41, "UHR ", "897", null, "USD", 1), "GLD32.4/4096/350"),
  66. new InstanceType("Silver 32 bit", new Price(0.265, "UHR ", "897", null, "USD", 1),
  67. "SLV32.2/4096/350")),
  68. ImmutableSet.<String> of("ifeE7VOzRG6SGvoDlRPTQw"),
  69. HttpUtils
  70. .createUri("https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{F006D027-02CC-9D08-D389-6C729D939D44}/1.0/GettingStarted.html"),
  71. "20001150", "SUSE Linux Enterprise Server 11 for x86 Base OS 32-bit with pay for use licensing"));
  72. }
  73. }