PageRenderTime 3009ms CodeModel.GetById 28ms RepoModel.GetById 20ms app.codeStats 0ms

/apis/cloudstack/src/test/java/org/jclouds/cloudstack/parse/ListTagsResponseTest.java

http://github.com/jclouds/jclouds
Java | 66 lines | 41 code | 9 blank | 16 comment | 0 complexity | c9826cb434ed48fe09cd4ecb09fe2afe MD5 | raw file
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. package org.jclouds.cloudstack.parse;
  18. import java.util.Set;
  19. import com.google.common.collect.ImmutableSet;
  20. import com.google.inject.Guice;
  21. import com.google.inject.Injector;
  22. import org.jclouds.cloudstack.domain.Tag;
  23. import org.jclouds.json.BaseSetParserTest;
  24. import org.jclouds.json.config.GsonModule;
  25. import org.jclouds.rest.annotations.SelectJson;
  26. import org.testng.annotations.Test;
  27. @Test(groups = "unit")
  28. public class ListTagsResponseTest extends BaseSetParserTest<Tag> {
  29. @Override
  30. protected Injector injector() {
  31. return Guice.createInjector(new GsonModule() {
  32. @Override
  33. protected void configure() {
  34. bind(DateAdapter.class).to(Iso8601DateAdapter.class);
  35. super.configure();
  36. }
  37. });
  38. }
  39. @Override
  40. public String resource() {
  41. return "/listtagsresponse.json";
  42. }
  43. @Override
  44. @SelectJson("tag")
  45. public Set<Tag> expected() {
  46. return ImmutableSet.<Tag>of(
  47. Tag.builder()
  48. .account("admin")
  49. .domain("ROOT")
  50. .domainId("79dc06c4-4432-11e4-b70d-000c29e19aa0")
  51. .key("test-tag")
  52. .resourceId("54fe1d53-5d73-4184-8b62-948b9d8e08fb")
  53. .resourceType(Tag.ResourceType.TEMPLATE)
  54. .value("true").build()
  55. );
  56. }
  57. }