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