PageRenderTime 5373ms CodeModel.GetById 19ms RepoModel.GetById 7ms app.codeStats 0ms

/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListNormalTest.java

http://github.com/jclouds/jclouds
Java | 76 lines | 51 code | 9 blank | 16 comment | 0 complexity | 301f3d78f83fdf9b0242a0384d3b1a6c 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.openstack.nova.v2_0.parse;
  18. import java.net.URI;
  19. import java.util.Set;
  20. import javax.ws.rs.Consumes;
  21. import javax.ws.rs.core.MediaType;
  22. import org.jclouds.date.internal.SimpleDateFormatDateService;
  23. import org.jclouds.json.BaseSetParserTest;
  24. import org.jclouds.json.config.GsonModule;
  25. import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
  26. import org.jclouds.openstack.v2_0.domain.Extension;
  27. import org.jclouds.openstack.v2_0.domain.Link;
  28. import org.jclouds.rest.annotations.SelectJson;
  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. @Test(groups = "unit", testName = "ParseExtensionListNormalTest")
  34. public class ParseExtensionListNormalTest extends BaseSetParserTest<Extension> {
  35. @Override
  36. public String resource() {
  37. return "/extension_list_normal.json";
  38. }
  39. @Override
  40. @SelectJson("extensions")
  41. @Consumes(MediaType.APPLICATION_JSON)
  42. public Set<Extension> expected() {
  43. return ImmutableSet.of(
  44. Extension.builder().alias("os-keypairs").name("Keypairs").namespace(URI.create("http://docs.openstack.org/ext/keypairs/api/v1.1"))
  45. .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-08-08T00:00:00+00:00")).description("Keypair Support")
  46. .links(Link.builder().relation(Link.Relation.SELF).href(URI.create("http://docs.openstack.org/ext/keypairs/api/v1.1")).build())
  47. .build(),
  48. Extension.builder().alias("os-volumes").name("Volumes").namespace(URI.create("http://docs.openstack.org/ext/volumes/api/v1.1"))
  49. .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-03-25T00:00:00+00:00")).description("Volumes support")
  50. .links(Link.builder().relation(Link.Relation.SELF).href(URI.create("http://docs.openstack.org/ext/volumes/api/v1.1")).build())
  51. .build(),
  52. Extension.builder().alias("security_groups").name("SecurityGroups")
  53. .namespace(URI.create("http://docs.openstack.org/ext/securitygroups/api/v1.1"))
  54. .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-07-21T00:00:00+00:00"))
  55. .description("Security group support")
  56. .links(Link.builder().relation(Link.Relation.SELF).href(URI.create("http://docs.openstack.org/ext/securitygroups/api/v1.1")).build())
  57. .build(),
  58. Extension.builder().alias("os-floating-ips").name("Floating_ips")
  59. .namespace(URI.create("http://docs.openstack.org/ext/floating_ips/api/v1.1"))
  60. .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-06-16T00:00:00+00:00")).description("Floating IPs support")
  61. .links(Link.builder().relation(Link.Relation.SELF).href(URI.create("http://docs.openstack.org/ext/floating_ips/api/v1.1")).build())
  62. .build());
  63. }
  64. protected Injector injector() {
  65. return Guice.createInjector(new NovaParserModule(), new GsonModule());
  66. }
  67. }