PageRenderTime 38ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/providers/elastichosts-lon-p/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsPeer1LondonTemplateBuilderLiveTest.java

https://github.com/regularfry/jclouds
Java | 85 lines | 52 code | 11 blank | 22 comment | 10 complexity | 7bb0b1e66cd78cff38e07174289ae5a4 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.elastichosts.compute;
  20. import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
  21. import static org.testng.Assert.assertEquals;
  22. import java.util.Set;
  23. import org.jclouds.compute.BaseTemplateBuilderLiveTest;
  24. import org.jclouds.compute.domain.OsFamily;
  25. import org.jclouds.compute.domain.OsFamilyVersion64Bit;
  26. import org.jclouds.compute.domain.Template;
  27. import org.testng.annotations.Test;
  28. import com.google.common.base.Predicate;
  29. import com.google.common.base.Predicates;
  30. import com.google.common.collect.ImmutableSet;
  31. /**
  32. *
  33. * @author Adrian Cole
  34. */
  35. @Test(groups = "live")
  36. public class ElasticHostsPeer1LondonTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
  37. public ElasticHostsPeer1LondonTemplateBuilderLiveTest() {
  38. provider = "elastichosts-lon-p";
  39. }
  40. @Override
  41. protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
  42. return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
  43. @Override
  44. public boolean apply(OsFamilyVersion64Bit input) {
  45. switch (input.family) {
  46. case UBUNTU:
  47. return (input.version.equals("") || input.version.startsWith("10.")) && input.is64Bit;
  48. case DEBIAN:
  49. return (input.version.equals("") || input.version.matches("[56].0")) && input.is64Bit;
  50. case CENTOS:
  51. return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
  52. case WINDOWS:
  53. return (input.version.equals("") || input.version.equals("2008 R2") || input.version.equals("2008"))
  54. && input.is64Bit;
  55. default:
  56. return false;
  57. }
  58. }
  59. });
  60. }
  61. @Test
  62. public void testTemplateBuilder() {
  63. Template defaultTemplate = this.context.getComputeService().templateBuilder().build();
  64. assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
  65. assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.10");
  66. assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
  67. assertEquals(defaultTemplate.getLocation().getId(), "elastichosts-lon-p");
  68. assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
  69. }
  70. @Override
  71. protected Set<String> getIso3166Codes() {
  72. return ImmutableSet.<String> of("GB-LND");
  73. }
  74. }