Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.Template


                                                              Set<NodeMetadata> goodNodes,
                                                              Map<NodeMetadata, Exception> badNodes,
                                                              Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {

      String sharedResourceName = namingConvention.create().sharedNameForGroup(group);
      Template mutableTemplate = template.clone();
      GoogleComputeEngineTemplateOptions templateOptions = GoogleComputeEngineTemplateOptions.class.cast(mutableTemplate
              .getOptions());
      assert template.getOptions().equals(templateOptions) : "options didn't clone properly";

      // get or create the network and create a firewall with the users configuration
      Network network = getOrCreateNetwork(templateOptions, sharedResourceName);
View Full Code Here


      });
   }

   @Test
   public void testTemplateBuilder() {
      Template defaultTemplate = this.view.getComputeService().templateBuilder().build();
      assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "12.04");
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
      assertEquals(defaultTemplate.getImage().getName(), "Ubuntu 12.04 LTS (Precise Pangolin)");
      assertEquals(defaultTemplate.getImage().getDefaultCredentials().getUser(), "root");
      assertEquals(defaultTemplate.getLocation().getId(), "LON");
      assertEquals(defaultTemplate.getImage().getLocation().getId(), "LON");
      assertEquals(defaultTemplate.getHardware().getLocation().getId(), "LON");
      assertEquals(defaultTemplate.getOptions().as(NovaTemplateOptions.class).shouldAutoAssignFloatingIp(), false);
      assertNull(defaultTemplate.getOptions().as(NovaTemplateOptions.class).getDiskConfig());
      assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
   }
View Full Code Here

   public void testDefaultTemplateOpenStack() throws Exception {

      ComputeService apiForOpenStack = requestsSendResponses(defaultTemplateOpenStack);

      Template defaultTemplate = apiForOpenStack.templateBuilder().imageId("RegionOne/15").build();
      checkTemplate(defaultTemplate);
      checkTemplate(apiForOpenStack.templateBuilder().fromTemplate(defaultTemplate).build());

   }
View Full Code Here

  
      InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn starter = compute.getContext()
               .utils().injector().getInstance(
                        InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.class);

      Template template = compute.templateBuilder().build();
      template.getOptions().as(VCloudTemplateOptions.class).parentNetwork(parentNetwork).fenceMode(fenceMode);
      starter.instantiateVAppFromTemplate(name, template);

   }
View Full Code Here

      assert availableTester.apply(group) : group;
   }

   public void testStartCCInstance() throws Exception {

      Template template = view.getComputeService().templateBuilder()
               .fromHardware(EC2HardwareBuilder.cc2_8xlarge().build()).osFamily(OsFamily.AMZN_LINUX).build();
      assert template != null : "The returned template was null, but it should have a value.";
      assertEquals(template.getHardware().getProviderId(), InstanceType.CC2_8XLARGE);
      assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
      assertEquals(template.getImage().getUserMetadata().get("virtualizationType"), "hvm");
      assertEquals(template.getImage().getUserMetadata().get("hypervisor"), "xen");

      template.getOptions().runScript(Statements.newStatementList(AdminAccess.standard(), InstallJDK.fromOpenJDK()));

      String group = PREFIX + "cccluster";
      view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
      // TODO make this not lookup an explicit region
      client.getPlacementGroupServices().deletePlacementGroupInRegion(null, "jclouds#" + group + "#us-east-1");
View Full Code Here

   @Override
   public Map<?, ListenableFuture<Void>> execute(String group, int count, Template template, Set<NodeMetadata> goodNodes,
         Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {

      Template mutableTemplate = template.clone();

      Set<RunningInstance> started = runInstancesAndWarnOnInvisible(group, count, mutableTemplate);
      if (started.size() == 0) {
         logger.warn("<< unable to start instances(%s)", mutableTemplate);
         return ImmutableMap.of();
      }
      populateCredentials(started, template.getOptions());

      if (autoAllocateElasticIps) // before customization as the elastic ips may be needed
         blockUntilRunningAndAssignElasticIpsToInstancesOrPutIntoBadMap(started, badNodes);

      return utils.customizeNodesAndAddToGoodMapOrPutExceptionIntoBadMap(mutableTemplate.getOptions(),
            transform(started, runningInstanceToNodeMetadata), goodNodes, badNodes, customizationResponses);
   }
View Full Code Here

                        TemplateOptions.class),
                  CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod(
                        "getSecurityGroupsForTagAndOptions", String.class, String.class, TemplateOptions.class) });

      EC2TemplateOptions options = createMock(EC2TemplateOptions.class);
      Template template = createMock(Template.class);

      // setup expectations
      expect(strategy.getOptionsProvider()).andReturn(OPTIONS_PROVIDER);
      expect(template.getHardware()).andReturn(size).atLeastOnce();
      expect(template.getOptions()).andReturn(options).atLeastOnce();
      expect(options.getBlockDeviceMappings()).andReturn(ImmutableSet.<BlockDeviceMapping> of()).atLeastOnce();
      expect(strategy.createNewKeyPairUnlessUserSpecifiedOtherwise(region, group, options)).andReturn(
            systemGeneratedKeyPairName);
      expect(strategy.getSecurityGroupsForTagAndOptions(region, group, options)).andReturn(generatedGroups);
      expect(options.getUserData()).andReturn(null);
View Full Code Here

                        TemplateOptions.class),
                  CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class.getDeclaredMethod(
                        "getSecurityGroupsForTagAndOptions", String.class, String.class, TemplateOptions.class) });

      EC2TemplateOptions options = createMock(EC2TemplateOptions.class);
      Template template = createMock(Template.class);

      // setup expectations
      expect(strategy.getOptionsProvider()).andReturn(OPTIONS_PROVIDER);
      expect(template.getHardware()).andReturn(size).atLeastOnce();
      expect(template.getOptions()).andReturn(options).atLeastOnce();
      expect(options.getBlockDeviceMappings()).andReturn(ImmutableSet.<BlockDeviceMapping> of()).atLeastOnce();
      expect(strategy.createNewKeyPairUnlessUserSpecifiedOtherwise(region, group, options)).andReturn(
            systemGeneratedKeyPairName);
      expect(strategy.getSecurityGroupsForTagAndOptions(region, group, options)).andReturn(generatedGroups);
      expect(options.getUserData()).andReturn("hello".getBytes());
View Full Code Here

      ec2Client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
      runningTester = retry(new InstanceStateRunning(ec2Client), 600, 5, SECONDS);

      client = ec2Client.getAMIServices();
      if (ebsTemplate != null) {
         Template template = view.getComputeService().templateBuilder().from(ebsTemplate).build();
         regionId = template.getLocation().getId();
         imageId = template.getImage().getProviderId();
         for (Image image : client.describeImagesInRegion(regionId)) {
            if (ebsBackedImageName.equals(image.getName()))
               client.deregisterImageInRegion(regionId, image.getId());
         }
      }
View Full Code Here

      }
   }

   @Test(enabled = true, dependsOnMethods = "testCorrectAuthException")
   public void testImagesResolveCorrectly() {
      Template defaultTemplate = client.templateBuilder().build();
      assertEquals(defaultTemplate.getImage().getId(), defaultTemplate.getImage().getLocation().getId() + "/"
               + defaultTemplate.getImage().getProviderId());
      Template byId = client.templateBuilder().imageId(defaultTemplate.getImage().getId()).build();
      assertEquals(byId.getImage(), defaultTemplate.getImage());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.compute.domain.Template

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.