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

https://github.com/andreisavu/jclouds · Java · 73 lines · 43 code · 8 blank · 22 comment · 0 complexity · 33d8e46ea20a6529a60201ab226942eb 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.cloudstack.parse;
  20. import java.util.Calendar;
  21. import java.util.Date;
  22. import java.util.Set;
  23. import java.util.TimeZone;
  24. import org.jclouds.cloudstack.config.CloudStackParserModule;
  25. import org.jclouds.cloudstack.domain.StoragePool;
  26. import org.jclouds.json.BaseItemParserTest;
  27. import org.jclouds.json.config.GsonModule;
  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. /**
  34. *
  35. * @author Richard Downer
  36. */
  37. @Test(groups = "unit", testName = "ListStoragePoolsResponseTest")
  38. public class ListStoragePoolsResponseTest extends BaseItemParserTest<Set<StoragePool>> {
  39. @Override
  40. public String resource() {
  41. return "/liststoragepoolsresponse.json";
  42. }
  43. @Override
  44. @SelectJson("storagepool")
  45. public Set<StoragePool> expected() {
  46. Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT+02:00"));
  47. c.set(Calendar.YEAR, 2011);
  48. c.set(Calendar.MONTH, Calendar.NOVEMBER);
  49. c.set(Calendar.DAY_OF_MONTH, 26);
  50. c.set(Calendar.HOUR_OF_DAY, 23);
  51. c.set(Calendar.MINUTE, 33);
  52. c.set(Calendar.SECOND, 6);
  53. Date created = c.getTime();
  54. StoragePool storagePool = StoragePool.builder().id("201").zoneId("1").zoneName("Dev Zone 1").podId("1")
  55. .podName("Dev Pod 1").name("NFS Pri 1").ipAddress("10.26.26.165").path("/mnt/nfs/cs_pri")
  56. .created(created).type(StoragePool.Type.NETWORK_FILESYSTEM).clusterId("1").clusterName("Xen Clust 1")
  57. .diskSizeTotal(898356445184L).diskSizeAllocated(18276679680L).tag("tag1").state(StoragePool.State.UP)
  58. .build();
  59. return ImmutableSet.of(storagePool);
  60. }
  61. @Override
  62. protected Injector injector() {
  63. return Guice.createInjector(new GsonModule(), new CloudStackParserModule());
  64. }
  65. }