PageRenderTime 4964ms CodeModel.GetById 9ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/jclouds/jclouds
Java | 59 lines | 33 code | 10 blank | 16 comment | 0 complexity | 96c2fd617fe4bac05cdfb5f5838c8917 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.util.Map;
  19. import javax.ws.rs.Consumes;
  20. import javax.ws.rs.core.MediaType;
  21. import org.jclouds.json.BaseItemParserTest;
  22. import org.jclouds.json.config.GsonModule;
  23. import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
  24. import org.jclouds.rest.annotations.SelectJson;
  25. import org.testng.annotations.Test;
  26. import com.google.common.collect.ImmutableMap;
  27. import com.google.inject.Guice;
  28. import com.google.inject.Injector;
  29. @Test(groups = "unit", testName = "ParseMetadataListTest")
  30. public class ParseMetadataListTest extends BaseItemParserTest<Map<String, String>> {
  31. @Override
  32. public String resource() {
  33. return "/metadata_list.json";
  34. }
  35. @Override
  36. @SelectJson("metadata")
  37. @Consumes(MediaType.APPLICATION_JSON)
  38. public Map<String, String> expected() {
  39. ImmutableMap<String, String> metadata =
  40. new ImmutableMap.Builder<String, String>()
  41. .put("Server Label", "Web Head 1")
  42. .put("Image Version", "2.1")
  43. .build();
  44. return metadata;
  45. }
  46. protected Injector injector() {
  47. return Guice.createInjector(new NovaParserModule(), new GsonModule());
  48. }
  49. }