PageRenderTime 4144ms CodeModel.GetById 34ms RepoModel.GetById 5ms app.codeStats 0ms

/labs/smartos-ssh/src/test/java/org/jclouds/smartos/compute/parse/ParseVmSpecificationTest.java

http://github.com/jclouds/jclouds
Java | 73 lines | 45 code | 7 blank | 21 comment | 0 complexity | d7a4cdf0d6f9f817492fdd378ae6c62f 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. */
  19. package org.jclouds.smartos.compute.parse;
  20. import javax.ws.rs.Consumes;
  21. import javax.ws.rs.core.MediaType;
  22. import org.jclouds.json.BaseItemParserTest;
  23. import org.jclouds.json.config.GsonModule;
  24. import org.jclouds.smartos.compute.config.SmartOSParserModule;
  25. import org.jclouds.smartos.compute.domain.DataSet;
  26. import org.jclouds.smartos.compute.domain.VmNIC;
  27. import org.jclouds.smartos.compute.domain.VmSpecification;
  28. import org.testng.annotations.Test;
  29. import com.google.inject.Guice;
  30. import com.google.inject.Injector;
  31. /**
  32. * @author Adrian Cole
  33. */
  34. @Test(groups = "unit", testName = "ParseVmSpecificationTest")
  35. public class ParseVmSpecificationTest extends BaseItemParserTest<VmSpecification> {
  36. @Override
  37. public String resource() {
  38. return "/vmspec.json";
  39. }
  40. @Override
  41. @Consumes(MediaType.APPLICATION_JSON)
  42. public VmSpecification expected() {
  43. return VmSpecification.builder()
  44. .alias("small")
  45. .brand("joyent")
  46. .dataset(DataSet.builder()
  47. .uuid("56108678-1183-11e1-83c3-ff3185a5b47f")
  48. .os("linux")
  49. .published("2011-11-18")
  50. .urn("sdc:sdc:ubuntu10.04:0.1.0").build())
  51. .nic(VmNIC.builder()
  52. .ip("192.168.1.4")
  53. .gateway("192.168.1.1")
  54. .netmask("255.255.255.0")
  55. .tag("eth0").build())
  56. .dnsDomain("local")
  57. .quota("0")
  58. .maxPhysicalMemory(256)
  59. .maxLockedMemory(256)
  60. .maxSwap(256)
  61. .tmpFs(256).build();
  62. }
  63. protected Injector injector() {
  64. return Guice.createInjector(new SmartOSParserModule(), new GsonModule());
  65. }
  66. }