PageRenderTime 37ms CodeModel.GetById 26ms app.highlight 9ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://github.com/gnodet/jclouds
Java | 58 lines | 29 code | 7 blank | 22 comment | 0 complexity | 18d0b67af37fd969aa1a281dc08afdfa 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.ibm.smartcloud.config.IBMSmartCloudParserModule;
25import org.jclouds.ibm.smartcloud.domain.Key;
26import org.jclouds.json.BaseSetParserTest;
27import org.jclouds.json.config.GsonModule;
28import org.jclouds.rest.annotations.Unwrap;
29import org.testng.annotations.Test;
30
31import com.google.common.collect.ImmutableSet;
32import com.google.inject.Guice;
33import com.google.inject.Injector;
34
35/**
36 * 
37 * @author Adrian Cole
38 */
39@Test(groups = "unit", testName = "ListKeyesTest")
40public class ListKeysTest extends BaseSetParserTest<Key> {
41   
42   protected Injector injector() {
43      return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule());
44   }
45   
46   @Override
47   public String resource() {
48      return "/keys.json";
49   }
50
51   @Override
52   @Unwrap
53   public Set<Key> expected() {
54      return ImmutableSet.of(new Key(true, ImmutableSet.<String> of("1"), "AAAB3NzaC1yc2EAAAADAQABAAABAQCqBw7a+...",
55               "DEFAULT", new Date(1260428507510l)), new Key(false, ImmutableSet.<String> of(),
56               "AAAB3NzaC1yc2EAAAADAQABAAABAQCqBw7a+", "BEAR", new Date(1260428507511l)));
57   }
58}