本文整理了Java中org.jclouds.domain.Credentials.<init>()
方法的一些代码示例,展示了Credentials.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Credentials.<init>()
方法的具体详情如下:
包路径:org.jclouds.domain.Credentials
类名称:Credentials
方法名:<init>
暂无
代码示例来源:origin: jclouds/legacy-jclouds
@SuppressWarnings("unchecked")
public T build() {
return (T) new Credentials(identity, credential);
}
}
代码示例来源:origin: org.jclouds/jclouds-core
@SuppressWarnings("unchecked")
public T build() {
return (T) new Credentials(identity, credential);
}
}
代码示例来源:origin: com.amysta.jclouds/jclouds-core
@SuppressWarnings("unchecked")
public T build() {
return (T) new Credentials(identity, credential);
}
}
代码示例来源:origin: jclouds/legacy-jclouds
protected Supplier<Credentials> buildCredentialsSupplier(Properties expanded) {
Credentials creds = new Credentials(getAndRemove(expanded, PROPERTY_IDENTITY), getAndRemove(expanded,
PROPERTY_CREDENTIAL));
Supplier<Credentials> credentialsSupplier;
if (credentialsSupplierOption.isPresent()) {
credentialsSupplier = credentialsSupplierOption.get();
} else {
credentialsSupplier = Suppliers.ofInstance(creds);
}
return credentialsSupplier;
}
代码示例来源:origin: org.jclouds/jclouds-core
protected Supplier<Credentials> buildCredentialsSupplier(Properties expanded) {
Credentials creds = new Credentials(getAndRemove(expanded, PROPERTY_IDENTITY), getAndRemove(expanded,
PROPERTY_CREDENTIAL));
Supplier<Credentials> credentialsSupplier;
if (credentialsSupplierOption.isPresent()) {
credentialsSupplier = credentialsSupplierOption.get();
} else {
credentialsSupplier = Suppliers.ofInstance(creds);
}
return credentialsSupplier;
}
代码示例来源:origin: jclouds/legacy-jclouds
@Provides
@Singleton
Supplier<Credentials> supplyCredentials(){
return Suppliers.ofInstance(new Credentials(identity, credential));
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test
public void testProviderMetadataWithCredentialsSetSupplier() {
ContextBuilder withCredsSupplier = testContextBuilder().credentialsSupplier(
ofInstance(new Credentials("foo", "BAR")));
Credentials creds = withCredsSupplier.buildInjector()
.getInstance(Key.get(new TypeLiteral<Supplier<Credentials>>() {
}, Provider.class)).get();
assertEquals(creds, new Credentials("foo", "BAR"));
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test
public void testNullBucketOwnedBy() {
BundleInstanceS3StorageOptions options = new BundleInstanceS3StorageOptions();
options.creds = Suppliers.ofInstance(new Credentials("foo", null));
assertEquals(options.buildFormParameters().get("Storage.S3.AWSAccessKeyId"), ImmutableList.of("foo"));
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test
public void testProviderMetadataWithCredentialsSetViaProperty() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_IDENTITY, "foo");
overrides.setProperty(Constants.PROPERTY_CREDENTIAL, "BAR");
ContextBuilder withCredsInProps = testContextBuilder().overrides(overrides);
Credentials creds = withCredsInProps.buildInjector()
.getInstance(Key.get(new TypeLiteral<Supplier<Credentials>>() {
}, Provider.class)).get();
assertEquals(creds, new Credentials("foo", "BAR"));
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public Map<String, Credentials> apply(HttpResponse arg0) {
Map<String, Credentials> serverNameToCredentials = Maps.newHashMap();
for (Password password : json.apply(arg0).getList()) {
if (null != password.getServer())
serverNameToCredentials.put(password.getServer().getName(),
new Credentials(password.getUserName(), password.getPassword()));
}
return serverNameToCredentials;
}
代码示例来源:origin: jclouds/legacy-jclouds
@BeforeTest
protected void setUpInjector() throws IOException {
utils = FormSignerTest.injector(new Credentials("identity", "credential")).getInstance(AWSUtils.class);
command = createMock(HttpCommand.class);
expect(command.getCurrentRequest()).andReturn(createMock(HttpRequest.class)).atLeastOnce();
replay(command);
}
代码示例来源:origin: jclouds/legacy-jclouds
public void testProvidedConsistentAcrossRepeatedWrites() throws IOException {
Map<String, InputStream> map = new CopyInputStreamInputSupplierMap(
new ConcurrentHashMap<String, InputSupplier<InputStream>>());
Injector injector = createInjectorWithProvidedMap(map);
assertEquals(injector.getInstance(Key.get(new TypeLiteral<Map<String, InputStream>>() {
})), map);
Map<String, Credentials> store = getStore(injector);
for (int i = 0; i < 10; i++)
check(map, store, "test" + i, new Credentials("user" + i, "pass" + i));
}
代码示例来源:origin: jclouds/legacy-jclouds
public void testProvidedMapWithValue() throws IOException {
Map<String, InputStream> map = new CopyInputStreamInputSupplierMap(
new ConcurrentHashMap<String, InputSupplier<InputStream>>());
map.put("test", new ByteArrayInputStream(json.toJson(new Credentials("user", "pass")).getBytes()));
checkConsistent(map, getStore(createInjectorWithProvidedMap(map)), "test", new Credentials("user", "pass"));
checkConsistent(map, getStore(createInjectorWithProvidedMap(map)), "test", new Credentials("user", "pass"));
remove(map, getStore(createInjectorWithProvidedMap(map)), "test");
}
代码示例来源:origin: jclouds/legacy-jclouds
public void testWhenCredentialsNotPresentInImageReturnsCredentialFromTemplateOptionsAndUserFromParameter() {
Credentials expected = new Credentials("ubuntu", "password");
Image image = createMock(Image.class);
Template template = createMock(Template.class);
expect(template.getImage()).andReturn(image);
expect(image.getDefaultCredentials()).andReturn(null);
expect(template.getOptions()).andReturn(TemplateOptions.Builder.overrideLoginUser("ubuntu"));
replay(template, image);
assertEquals(fn.apply(template, LoginCredentials.builder().user("foo").password("password").build()), expected);
verify(template);
verify(image);
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test
public void testWithSingleDomainname() {
LoginResponse response = createMock(LoginResponse.class);
SessionClient client = createMock(SessionClient.class);
expect(client.loginUserInDomainWithHashOfPassword(eq("User"), eq("Domain"), (String) anyObject())).andReturn(response);
replay(client);
LoginWithPasswordCredentials obj = new LoginWithPasswordCredentials(client);
Credentials cred = new Credentials("Domain/User", "koffiedik");
obj.load(cred);
}
代码示例来源:origin: jclouds/legacy-jclouds
public void testReturnRootWhenNotOnWindows() {
Image image = createMock(Image.class);
expect(image.getId()).andReturn("1");
expect(image.getOperatingSystem()).andReturn(
OperatingSystem.builder().family(OsFamily.LINUX).description("foo").build()).atLeastOnce();
replay(image);
Credentials creds = new Credentials("root", null);
assertEquals(new ReturnCredentialsBoundToImage(null, ImmutableMap.<String, Credentials> of(), ImmutableMap
.<OsFamily, LoginCredentials> of()).apply(image), creds);
verify(image);
}
代码示例来源:origin: jclouds/legacy-jclouds
public void testReturnLoginCredentialAssociatedToOsFamily() {
Image image = createMock(Image.class);
expect(image.getId()).andReturn("1");
expect(image.getOperatingSystem()).andReturn(
OperatingSystem.builder().family(OsFamily.WINDOWS).description("foo").build()).atLeastOnce();
replay(image);
Credentials creds = new Credentials("Administrator", null);
assertEquals(new ReturnCredentialsBoundToImage(null, ImmutableMap.<String, Credentials> of(), ImmutableMap.of(
OsFamily.WINDOWS, LoginCredentials.builder().user("Administrator").build())).apply(image), creds);
verify(image);
}
代码示例来源:origin: jclouds/legacy-jclouds
public void testWhenCredentialsPresentInImageOverridesIdentityFromCredentialsInTemplateOptionsAndNotParameter() {
Credentials expected = new Credentials("ubuntu", "password");
Image image = createMock(Image.class);
Template template = createMock(Template.class);
expect(template.getImage()).andReturn(image);
expect(image.getDefaultCredentials()).andReturn(LoginCredentials.builder().user("ubuntu").password("password").build());
expect(template.getOptions()).andReturn(TemplateOptions.Builder.overrideLoginUser("ubuntu"));
replay(template, image);
assertEquals(fn.apply(template, LoginCredentials.builder().user("foo").password("bar").build()), expected);
verify(template, image);
}
代码示例来源:origin: jclouds/legacy-jclouds
public void testProvidedConsistentAcrossMultipleInjectors() throws IOException {
Map<String, InputStream> map = new CopyInputStreamInputSupplierMap(
new ConcurrentHashMap<String, InputSupplier<InputStream>>());
put(map, getStore(createInjectorWithProvidedMap(map)), "test", new Credentials("user", "pass"));
checkConsistent(map, getStore(createInjectorWithProvidedMap(map)), "test", new Credentials("user", "pass"));
checkConsistent(map, getStore(createInjectorWithProvidedMap(map)), "test", new Credentials("user", "pass"));
remove(map, getStore(createInjectorWithProvidedMap(map)), "test");
}
代码示例来源:origin: jclouds/legacy-jclouds
public void testDefaultConsistentAcrossMultipleInjectors() throws IOException {
Map<String, InputStream> map = getMap(createInjector());
put(map, getStore(createInjector()), "test", new Credentials("user", "pass"));
checkConsistent(map, getStore(createInjector()), "test", new Credentials("user", "pass"));
checkConsistent(map, getStore(createInjector()), "test", new Credentials("user", "pass"));
remove(map, getStore(createInjector()), "test");
}
内容来源于网络,如有侵权,请联系作者删除!