Examples of apply()


Examples of org.jclouds.compute.config.PersistNodeCredentialsModule.RefreshCredentialsForNode.apply()

      replay(credstore);

      NodeMetadata node = new NodeMetadataBuilder().ids("id").status(Status.RUNNING).credentials(credentials).build();
      RefreshCredentialsForNode fn = new PersistNodeCredentialsModule.RefreshCredentialsForNode(credstore, null);
      assertEquals(node, fn.apply(node));

      verify(credstore);

   }
View Full Code Here

Examples of org.jclouds.compute.config.PersistNodeCredentialsModule.RefreshCredentialsForNodeIfRanAdminAccess.apply()

      replay(credstore);

      NodeMetadata node = new NodeMetadataBuilder().ids("id").status(Status.RUNNING).build();
      RefreshCredentialsForNodeIfRanAdminAccess fn = new PersistNodeCredentialsModule.RefreshCredentialsForNodeIfRanAdminAccess(
            credstore, null);
      assertEquals(node, fn.apply(node));

      verify(credstore);

   }
View Full Code Here

Examples of org.jclouds.config.ValueOfConfigurationKeyOrNull.apply()

      Credentials expected = null;

      ValueOfConfigurationKeyOrNull config = createMock(ValueOfConfigurationKeyOrNull.class);

      expect(credstore.containsKey("image")).andReturn(false);
      expect(config.apply("provider.image.login-user")).andReturn(null);
      expect(config.apply("jclouds.image.login-user")).andReturn(null);
      expect(config.apply("provider.image.authenticate-sudo")).andReturn(null);
      expect(config.apply("jclouds.image.authenticate-sudo")).andReturn(null);

      replay(config);
View Full Code Here

Examples of org.jclouds.digitalocean.compute.config.DigitalOceanComputeServiceContextModule.EventDonePredicate.apply()

      replay(eventApi, api);

      EventDonePredicate predicate = new EventDonePredicate(api);

      try {
         predicate.apply(1);
         fail("Method should have thrown an IllegalStateException");
      } catch (IllegalStateException ex) {
         assertEquals(ex.getMessage(), "Resource is in invalid status: ERROR");
      }
   }
View Full Code Here

Examples of org.jclouds.ec2.compute.functions.EC2ImageParser.apply()

      Image image = createNiceMock(Image.class);
      Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);

      expect(caller.getAMIServices()).andReturn(client).atLeastOnce();
      expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
      expect(parser.apply(ec2Image)).andReturn(image);

      replay(caller);
      replay(image);
      replay(parser);
      replay(client);
View Full Code Here

Examples of org.jclouds.ec2.compute.functions.EC2SecurityGroupIdFromName.apply()

                      .tenantIdGroupNamePair("ownerId", "sg-123456")
                      .build());
     
      client.createSecurityGroupInRegion("region", "group", "group");
      expect(group.getOwnerId()).andReturn("ownerId");
      expect(groupIdFromName.apply("region/group")).andReturn("sg-123456");
      client.authorizeSecurityGroupIngressInRegion("region", "sg-123456", permissions.build());
      expect(client.describeSecurityGroupsInRegion("region", "group")).andReturn(Set.class.cast(groups));


      replay(client);
View Full Code Here

Examples of org.jclouds.ec2.compute.functions.WindowsLoginCredentialsFromEncryptedData.apply()

      // Now we can get the password data, decrypt it, and get a LoginCredentials instance
      PasswordDataAndPrivateKey dataAndKey = new PasswordDataAndPrivateKey(
         ec2Client.getWindowsServices().getPasswordDataInRegion(region, node.getProviderId()),
         node.getCredentials().getPrivateKey());
      WindowsLoginCredentialsFromEncryptedData f = context.getUtils().getInjector().getInstance(WindowsLoginCredentialsFromEncryptedData.class);
      LoginCredentials credentials = f.apply(dataAndKey);

      // Send to the log the details you need to log in to the instance with RDP
      String publicIp = Iterables.getFirst(node.getPublicAddresses(), null);
      logger.info("IP address: %s", publicIp);
      logger.info("Login name: %s", credentials.getUser());
View Full Code Here

Examples of org.jclouds.joyent.cloudapi.v6_5.compute.functions.DatasetInDatacenterToImage.apply()

            "My Test OS", true);
      DatasetInDatacenterToImage converter = new DatasetInDatacenterToImage(constant(operatingSystem), locationIndex);

      DatasetInDatacenter datasetInZoneToConvert = new DatasetInDatacenter(datasetToConvert, "us-sw-1");

      org.jclouds.compute.domain.Image convertedImage = converter.apply(datasetInZoneToConvert);

      assertEquals(convertedImage.getId(), "us-sw-1/" + datasetToConvert.getUrn());
      assertEquals(convertedImage.getProviderId(), datasetToConvert.getUrn());
      assertEquals(convertedImage.getLocation(), locationIndex.get().get("us-sw-1"));
View Full Code Here

Examples of org.jclouds.joyent.cloudapi.v6_5.compute.functions.MachineInDatacenterToNodeMetadata.apply()

      MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
            JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex,
            Suppliers.<Set<? extends Image>> ofInstance(images),
            Suppliers.<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);

      NodeMetadata convertedNodeMetadata = converter.apply(machineInDatacenterToConvert);

      assertEquals(machineInDatacenterToConvert.slashEncode(), convertedNodeMetadata.getId());
      assertEquals(machineToConvert.getId(), convertedNodeMetadata.getProviderId());

      assertEquals(convertedNodeMetadata.getLocation().getScope(), LocationScope.ZONE);
View Full Code Here

Examples of org.jclouds.logging.config.BindLoggersAnnotatedWithResource.LoggerFieldsAnnotatedWithResource.apply()

   @Test
   public void testLoggerFieldsAnnotatedWithResource() throws SecurityException,
            NoSuchFieldException {
      LoggerFieldsAnnotatedWithResource predicate = new LoggerFieldsAnnotatedWithResource();
      assert predicate.apply(A.class.getDeclaredField("logger"));
   }

   public static class C {
      @Inject
      private Logger logger = Logger.NULL;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.