mirror of https://github.com/apache/jclouds.git
missing commits
This commit is contained in:
parent
535c035ae6
commit
3a8ea09fb9
|
@ -20,28 +20,34 @@ package org.jclouds.ec2.compute.strategy;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.compute.strategy.impl.ReturnCredentialsBoundToImage;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.domain.LoginCredentials.Builder;
|
||||
import org.jclouds.ec2.domain.Image;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* @author Oleksiy Yarmula
|
||||
*/
|
||||
@Singleton
|
||||
public class EC2PopulateDefaultLoginCredentialsForImageStrategy extends ReturnCredentialsBoundToImage {
|
||||
public EC2PopulateDefaultLoginCredentialsForImageStrategy() {
|
||||
this(null);
|
||||
this(null, ImmutableMap.<String, Credentials> of());
|
||||
}
|
||||
|
||||
@Inject
|
||||
public EC2PopulateDefaultLoginCredentialsForImageStrategy(@Nullable @Named("image") LoginCredentials creds) {
|
||||
super(creds);
|
||||
public EC2PopulateDefaultLoginCredentialsForImageStrategy(@Nullable @Named("image") LoginCredentials creds,
|
||||
Map<String, Credentials> credentialStore) {
|
||||
super(creds, credentialStore);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -83,7 +83,7 @@ public class EC2ImageParserTest {
|
|||
.getInstance(Json.class));
|
||||
|
||||
Set<Image> result = DescribeImagesResponseHandlerTest.parseImages(resource);
|
||||
EC2ImageParser parser = new EC2ImageParser(new EC2PopulateDefaultLoginCredentialsForImageStrategy(null), map,
|
||||
EC2ImageParser parser = new EC2ImageParser(new EC2PopulateDefaultLoginCredentialsForImageStrategy(), map,
|
||||
Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(defaultLocation)), Suppliers
|
||||
.ofInstance(defaultLocation), new ReviseParsedImage.NoopReviseParsedImage());
|
||||
return Sets.newLinkedHashSet(Iterables.filter(Iterables.transform(result, parser), Predicates.notNull()));
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.jclouds.trmk.vcloud_0_8.compute.strategy;
|
|||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -31,6 +32,7 @@ import javax.inject.Singleton;
|
|||
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.compute.strategy.impl.ReturnCredentialsBoundToImage;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
@ -42,8 +44,9 @@ import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
|
|||
@Singleton
|
||||
public class ParseVAppTemplateDescriptionToGetDefaultLoginCredentials extends ReturnCredentialsBoundToImage {
|
||||
@Inject
|
||||
public ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(@Nullable @Named("image") LoginCredentials creds) {
|
||||
super(creds);
|
||||
public ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(@Nullable @Named("image") LoginCredentials creds,
|
||||
Map<String, Credentials> credentialStore) {
|
||||
super(creds, credentialStore);
|
||||
}
|
||||
|
||||
@Resource
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.jclouds.trmk.vcloud_0_8.compute.strategy.ParseVAppTemplateDescription
|
|||
import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
/**
|
||||
|
@ -47,7 +48,8 @@ public class PopulateDefaultLoginCredentialsForVAppTemplateTest {
|
|||
VAppTemplate template = createMock(VAppTemplate.class);
|
||||
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||
replay(template);
|
||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(null);
|
||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(
|
||||
null, ImmutableMap.<String, Credentials> of());
|
||||
Credentials creds = converter.execute(template);
|
||||
assertEquals(creds.identity, "vcloud");
|
||||
assertEquals(creds.credential, "$Ep455l0ud!2");
|
||||
|
@ -61,7 +63,8 @@ public class PopulateDefaultLoginCredentialsForVAppTemplateTest {
|
|||
VAppTemplate template = createMock(VAppTemplate.class);
|
||||
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||
replay(template);
|
||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(null);
|
||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(
|
||||
null, ImmutableMap.<String, Credentials> of());
|
||||
Credentials creds = converter.execute(template);
|
||||
assertEquals(creds.identity, "ecloud");
|
||||
assertEquals(creds.credential, "$Ep455l0ud!2");
|
||||
|
@ -75,7 +78,8 @@ public class PopulateDefaultLoginCredentialsForVAppTemplateTest {
|
|||
VAppTemplate template = createMock(VAppTemplate.class);
|
||||
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||
replay(template);
|
||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(null);
|
||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(
|
||||
null, ImmutableMap.<String, Credentials> of());
|
||||
Credentials creds = converter.execute(template);
|
||||
assertEquals(creds.identity, "vpncubed");
|
||||
assertEquals(creds.credential, "vpncubed");
|
||||
|
@ -89,7 +93,8 @@ public class PopulateDefaultLoginCredentialsForVAppTemplateTest {
|
|||
VAppTemplate template = createMock(VAppTemplate.class);
|
||||
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||
replay(template);
|
||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(null);
|
||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(
|
||||
null, ImmutableMap.<String, Credentials> of());
|
||||
Credentials creds = converter.execute(template);
|
||||
assertEquals(creds.identity, "ecloud");
|
||||
assertEquals(creds.credential, "TmrkCl0ud1s#1!");
|
||||
|
@ -103,7 +108,8 @@ public class PopulateDefaultLoginCredentialsForVAppTemplateTest {
|
|||
VAppTemplate template = createMock(VAppTemplate.class);
|
||||
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||
replay(template);
|
||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(null);
|
||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(
|
||||
null, ImmutableMap.<String, Credentials> of());
|
||||
Credentials creds = converter.execute(template);
|
||||
assertEquals(creds.identity, "Administrator");
|
||||
assertEquals(creds.credential, null);
|
||||
|
|
|
@ -192,7 +192,7 @@ public class AWSEC2ImageParserTest {
|
|||
.getInstance(Json.class));
|
||||
|
||||
Set<Image> result = DescribeImagesResponseHandlerTest.parseImages(resource);
|
||||
EC2ImageParser parser = new EC2ImageParser(new EC2PopulateDefaultLoginCredentialsForImageStrategy(null), map,
|
||||
EC2ImageParser parser = new EC2ImageParser(new EC2PopulateDefaultLoginCredentialsForImageStrategy(), map,
|
||||
Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(defaultLocation)),
|
||||
Suppliers.ofInstance(defaultLocation), new AWSEC2ReviseParsedImage(map));
|
||||
return Sets.newLinkedHashSet(Iterables.filter(Iterables.transform(result, parser), Predicates.notNull()));
|
||||
|
|
|
@ -120,7 +120,7 @@ public class EucalyptusPartnerCloudReviseParsedImageTest {
|
|||
.getInstance(Json.class));
|
||||
|
||||
Set<Image> result = DescribeImagesResponseHandlerTest.parseImages(resource);
|
||||
EC2ImageParser parser = new EC2ImageParser(new EC2PopulateDefaultLoginCredentialsForImageStrategy(null), map,
|
||||
EC2ImageParser parser = new EC2ImageParser(new EC2PopulateDefaultLoginCredentialsForImageStrategy(), map,
|
||||
Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(defaultLocation)), Suppliers
|
||||
.ofInstance(defaultLocation), new EucalyptusPartnerCloudReviseParsedImage(map));
|
||||
return Sets.newLinkedHashSet(Iterables.filter(Iterables.transform(result, parser), Predicates.notNull()));
|
||||
|
|
Loading…
Reference in New Issue