Migrate InputSupplier callers to ByteSource

A future version of Guava will remove InputSupplier.
This commit is contained in:
Andrew Gaul 2014-05-17 00:39:09 -07:00
parent c94d11f900
commit be792abf5e
1 changed files with 4 additions and 4 deletions

View File

@ -27,7 +27,6 @@ import static org.jclouds.crypto.Pems.privateKeySpec;
import static org.jclouds.crypto.Pems.publicKeySpec; import static org.jclouds.crypto.Pems.publicKeySpec;
import static org.jclouds.crypto.PemsTest.PRIVATE_KEY; import static org.jclouds.crypto.PemsTest.PRIVATE_KEY;
import static org.jclouds.crypto.PemsTest.PUBLIC_KEY; import static org.jclouds.crypto.PemsTest.PUBLIC_KEY;
import static org.jclouds.io.Payloads.newStringPayload;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
@ -61,6 +60,7 @@ import org.jclouds.util.Strings2;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
import com.google.common.base.Suppliers; import com.google.common.base.Suppliers;
import com.google.common.io.ByteSource;
import com.google.inject.Binder; import com.google.inject.Binder;
import com.google.inject.Module; import com.google.inject.Module;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
@ -106,9 +106,9 @@ public class BaseGoogleComputeEngineExpectTest<T> extends BaseRestApiExpectTest<
binder.bind(new TypeLiteral<Supplier<Long>>() {}).toInstance(Suppliers.ofInstance(0L)); binder.bind(new TypeLiteral<Supplier<Long>>() {}).toInstance(Suppliers.ofInstance(0L));
try { try {
KeyFactory keyfactory = KeyFactory.getInstance("RSA"); KeyFactory keyfactory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = keyfactory.generatePrivate(privateKeySpec(newStringPayload PrivateKey privateKey = keyfactory.generatePrivate(privateKeySpec(ByteSource.wrap(
(PRIVATE_KEY))); PRIVATE_KEY.getBytes(UTF_8))));
PublicKey publicKey = keyfactory.generatePublic(publicKeySpec(newStringPayload(PUBLIC_KEY))); PublicKey publicKey = keyfactory.generatePublic(publicKeySpec(ByteSource.wrap(PUBLIC_KEY.getBytes(UTF_8))));
KeyPair keyPair = new KeyPair(publicKey, privateKey); KeyPair keyPair = new KeyPair(publicKey, privateKey);
openSshKey = SshKeys.encodeAsOpenSSH(RSAPublicKey.class.cast(publicKey)); openSshKey = SshKeys.encodeAsOpenSSH(RSAPublicKey.class.cast(publicKey));
final Crypto crypto = createMock(Crypto.class); final Crypto crypto = createMock(Crypto.class);