method2testcases stringlengths 118 6.63k |
|---|
### Question:
InstanceToNodeMetadata implements Function<Instance, NodeMetadata> { public static Hardware machineTypeURIToCustomHardware(URI machineType) { String uri = machineType.toString(); String values = uri.substring(uri.lastIndexOf('/') + 8); List<String> hardwareValues = Splitter.on('-') .trimResults() .splitTo... |
### Question:
RetryOnRenew implements HttpRetryHandler { @Override public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { boolean retry = false; switch (response.getStatusCode()) { case 401: Multimap<String, String> headers = command.getCurrentRequest().getHeaders(); if (headers != null && head... |
### Question:
SimpleDateFormatDateService implements DateService { @Override public final Date iso8601DateParse(String toParse) { if (toParse.length() < 10) throw new IllegalArgumentException("incorrect date format " + toParse); String tz = findTZ(toParse); toParse = trimToMillis(toParse); toParse = trimTZ(toParse); to... |
### Question:
MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier extends ForwardingObject implements
Supplier<T> { @Override public T get() { try { return cache.get("FOO").orNull(); } catch (UncheckedExecutionException e) { throw propagate(e.getCause()); } catch (ExecutionException e) { throw propagate(... |
### Question:
BindMapToStringPayload implements MapBinder { @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { checkNotNull(postParams, "postParams"); GeneratedHttpRequest r = GeneratedHttpRequest.class.cast(checkNotNull(request, "request... |
### Question:
ParseBlobFromHeadersAndHttpContent implements Function<HttpResponse, Blob>,
InvocationContext<ParseBlobFromHeadersAndHttpContent> { public Blob apply(HttpResponse from) { checkNotNull(from, "request"); MutableBlobMetadata metadata = metadataParser.apply(from); Blob blob = blobFactory.create(metadata... |
### Question:
RestAnnotationProcessor implements Function<Invocation, HttpRequest> { @VisibleForTesting static URI getEndpointInParametersOrNull(Invocation invocation, Injector injector) { Collection<Parameter> endpointParams = parametersWithAnnotation(invocation.getInvokable(), EndpointParam.class); if (endpointParams... |
### Question:
ParseSystemAndUserMetadataFromHeaders implements Function<HttpResponse, MutableBlobMetadata>,
InvocationContext<ParseSystemAndUserMetadataFromHeaders> { public MutableBlobMetadata apply(HttpResponse from) { checkNotNull(from, "request"); checkState(name != null, "name must be initialized by now")... |
### Question:
RestAnnotationProcessor implements Function<Invocation, HttpRequest> { @VisibleForTesting static URI addHostIfMissing(URI original, URI withHost) { checkNotNull(withHost, "URI withHost cannot be null"); checkArgument(withHost.getHost() != null, "URI withHost must have host:" + withHost); if (original == n... |
### Question:
InputParamValidator { public void validateMethodParametersOrThrow(Invocation invocation, List<Parameter> parameters) { try { performMethodValidation(checkNotNull(invocation, "invocation")); performParameterValidation(invocation, checkNotNull(parameters, "parameters")); } catch (IllegalArgumentException e)... |
### Question:
Pems { public static KeySpec privateKeySpec(ByteSource supplier) throws IOException { return fromPem( supplier, new PemProcessor<KeySpec>(ImmutableMap.<String, PemProcessor.ResultParser<KeySpec>> of( PRIVATE_PKCS1_MARKER, DecodeRSAPrivateCrtKeySpec.INSTANCE, PRIVATE_PKCS8_MARKER, new PemProcessor.ResultPa... |
### Question:
Pems { public static KeySpec publicKeySpec(ByteSource supplier) throws IOException { return fromPem( supplier, new PemProcessor<KeySpec>(ImmutableMap.<String, PemProcessor.ResultParser<KeySpec>> of(PUBLIC_PKCS1_MARKER, DecodeRSAPublicKeySpec.INSTANCE, PUBLIC_X509_MARKER, new PemProcessor.ResultParser<KeyS... |
### Question:
Pems { public static X509Certificate x509Certificate(ByteSource supplier, @Nullable CertificateFactory certFactory) throws IOException, CertificateException { final CertificateFactory certs = certFactory != null ? certFactory : CertificateFactory.getInstance("X.509"); try { return fromPem( supplier, new P... |
### Question:
BackoffLimitedRetryHandler implements HttpRetryHandler, IOExceptionRetryHandler { public boolean shouldRetryRequest(HttpCommand command, IOException error) { return ifReplayableBackoffAndReturnTrue(command); } boolean shouldRetryRequest(HttpCommand command, IOException error); boolean shouldRetryRequest(... |
### Question:
GetOptions extends BaseHttpRequestOptions { public String getRange() { return (!ranges.isEmpty()) ? String.format("bytes=%s", Joiner.on(",").join(ranges)) : null; } @Override Multimap<String, String> buildRequestHeaders(); GetOptions range(long start, long end); GetOptions startAt(long start); GetOptions... |
### Question:
GetOptions extends BaseHttpRequestOptions { public GetOptions ifETagMatches(String eTag) { checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifETagMatches()"); checkArgument(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifETagMatches()"); this.he... |
### Question:
GetOptions extends BaseHttpRequestOptions { public GetOptions ifETagDoesntMatch(String eTag) { checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifETagDoesntMatch()"); checkArgument(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifETagDoesntMatch()");... |
### Question:
Uris { public static UriBuilder uriBuilder(CharSequence template) { return new UriBuilder(template); } static UriBuilder uriBuilder(CharSequence template); static UriBuilder uriBuilder(URI uri); static boolean lastCharIsToken(CharSequence left, char token); static char lastChar(CharSequence in); static c... |
### Question:
ParseSystemAndUserMetadataFromHeaders implements Function<HttpResponse, MutableBlobMetadata>,
InvocationContext<ParseSystemAndUserMetadataFromHeaders> { @VisibleForTesting void addUserMetadataTo(HttpResponse from, MutableBlobMetadata metadata) { for (Entry<String, String> header : from.getHeaders... |
### Question:
ParseSax implements Function<HttpResponse, T>, InvocationContext<ParseSax<T>> { public T addDetailsAndPropagate(HttpResponse response, Exception e) { return addDetailsAndPropagate(response, e, null); } ParseSax(XMLReader parser, HandlerWithResult<T> handler); T apply(HttpResponse from); T parse(String fro... |
### Question:
DeserializationConstructorAndReflectiveTypeAdapterFactory implements TypeAdapterFactory { public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { com.google.common.reflect.TypeToken<T> token = typeToken(type.getType()); Invokable<T, T> deserializationTarget = constructorFieldNamingPolicy.getDeser... |
### Question:
BlobName implements Function<Blob, String> { public String apply(Blob input) { return checkNotNull(checkNotNull(input, "input").getMetadata().getName(), "blobName"); } String apply(Blob input); }### Answer:
@Test public void testCorrect() throws SecurityException, NoSuchMethodException { Blob blob = BLO... |
### Question:
Suppliers2 { public static <K, V> Supplier<V> getLastValueInMap(final Supplier<Map<K, Supplier<V>>> input) { return new Supplier<V>() { @Override public V get() { Supplier<V> last = Iterables.getLast(input.get().values()); return last != null ? last.get() : null; } @Override public String toString() { ret... |
### Question:
Suppliers2 { public static <K, V> Supplier<V> getValueInMapOrNull(final Supplier<Map<K, Supplier<V>>> input, final K keyValue) { return new Supplier<V>() { @Override public V get() { Map<K, Supplier<V>> map = input.get(); return map.containsKey(keyValue) ? map.get(keyValue).get() : null; } @Override publi... |
### Question:
Suppliers2 { public static <X> Function<X, Supplier<X>> ofInstanceFunction() { return new Function<X, Supplier<X>>() { @Override public Supplier<X> apply(X arg0) { return Suppliers.ofInstance(arg0); } @Override public String toString() { return "Suppliers.ofInstance()"; } }; } static Supplier<V> getLastV... |
### Question:
Suppliers2 { @Beta public static <T> Supplier<T> or(final Supplier<T> unlessNull, final Supplier<T> fallback) { return new Supplier<T>() { @Override public T get() { T val = unlessNull.get(); if (val != null) return val; return fallback.get(); } @Override public String toString() { return MoreObjects.toSt... |
### Question:
Suppliers2 { @Beta public static <T, X extends Throwable> Supplier<T> onThrowable(final Supplier<T> unlessThrowable, final Class<X> throwable, final Supplier<T> fallback) { return new Supplier<T>() { @Override public T get() { try { return unlessThrowable.get(); } catch (Throwable t) { if (Throwables2.get... |
### Question:
PasswordGenerator { public String generate() { StringBuilder sb = new StringBuilder(); sb.append(lower.fragment()); sb.append(upper.fragment()); sb.append(numbers.fragment()); sb.append(symbols.fragment()); return shuffleAndJoin(sb.toString().toCharArray()); } Config lower(); Config upper(); Config numbe... |
### Question:
BindLoggersAnnotatedWithResource implements TypeListener { public <I> void hear(TypeLiteral<I> injectableType, TypeEncounter<I> encounter) { Class<? super I> type = injectableType.getRawType(); Set<Field> loggerFields = getLoggerFieldsAnnotatedWithResource(type); if (loggerFields.isEmpty()) return; Logger... |
### Question:
HeaderToRetryAfterException implements PropagateIfRetryAfter { @Override public Object createOrPropagate(Throwable t) throws Exception { if (!(t instanceof HttpResponseException)) throw propagate(t); HttpResponse response = HttpResponseException.class.cast(t).getResponse(); if (response == null) { return ... |
### Question:
MapHttp4xxCodesToExceptions implements Fallback<Object> { @Override public Object createOrPropagate(Throwable t) throws Exception { propagateIfRetryAfter.createOrPropagate(t); if (t instanceof HttpResponseException) { HttpResponseException responseException = HttpResponseException.class.cast(t); if (respo... |
### Question:
Providers { public static ProviderMetadata withId(String id) throws NoSuchElementException { return find(all(), ProviderPredicates.id(id)); } static Function<ProviderMetadata, String> idFunction(); static Function<ProviderMetadata, ApiMetadata> apiMetadataFunction(); static Iterable<ProviderMetadata> fro... |
### Question:
UpdateProviderMetadataFromProperties implements Function<Properties, ProviderMetadata> { @Override public ProviderMetadata apply(Properties input) { Properties mutable = new Properties(); mutable.putAll(input); ApiMetadata apiMetadata = this.apiMetadata.toBuilder() .name(getAndRemove(mutable, PROPERTY_API... |
### Question:
ContextLinking { public static Module linkView(final String id, final Supplier<View> view) { return new AbstractModule() { @Override protected void configure() { bind(VIEW_SUPPLIER).annotatedWith(Names.named(id)).toInstance(view); bind(CONTEXT_SUPPLIER).annotatedWith(Names.named(id)).toInstance(Suppliers.... |
### Question:
ContextLinking { public static Module linkContext(final String id, final Supplier<Context> context) { return new AbstractModule() { @Override protected void configure() { bind(CONTEXT_SUPPLIER).annotatedWith(Names.named(id)).toInstance(context); } }; } static Module linkView(final String id, final Suppli... |
### Question:
ArgsToPagedIterable implements
Function<IterableWithMarker<T>, PagedIterable<T>>, InvocationContext<I> { @Override public PagedIterable<T> apply(IterableWithMarker<T> input) { return input.nextMarker().isPresent() ? advance(input, markerToNextForArgs(getArgs(request))) : onlyPage(input); } @Overrid... |
### Question:
ExecutorServiceModule extends AbstractModule { static <T extends ListeningExecutorService> T shutdownOnClose(final T service, Closer closer) { closer.addToClose(new ShutdownExecutorOnClose(service)); return service; } ExecutorServiceModule(); @Deprecated ExecutorServiceModule(@Named(PROPERTY_USER_THREADS... |
### Question:
ZoneToProvider implements LocationsSupplier { @Override public Set<? extends Location> get() { Location provider = Iterables.getOnlyElement(justProvider.get()); Set<String> zoneIds = zoneIdsSupplier.get(); checkState(!zoneIds.isEmpty(), "no zones found for provider %s, using supplier %s", provider, zoneId... |
### Question:
RegionToProvider implements LocationsSupplier { @Override public Set<? extends Location> get() { Builder<Location> locations = ImmutableSet.builder(); Location provider = Iterables.getOnlyElement(justProvider.get()); Set<String> regions = regionsSupplier.get(); checkState(!regions.isEmpty(), "no regions f... |
### Question:
ZoneToRegionToProviderOrJustProvider implements LocationsSupplier { @Override public Set<? extends Location> get() { Set<? extends Location> regionsOrJustProvider = regionToProviderOrJustProvider.get(); Set<String> zoneIds = zoneIdsSupplier.get(); if (zoneIds.isEmpty()) return regionsOrJustProvider; Map<S... |
### Question:
ZoneIdToURIFromJoinOnRegionIdToURI implements ZoneIdToURISupplier { @Override public Map<String, Supplier<URI>> get() { Map<String, Supplier<Set<String>>> regionIdToZoneIds = this.regionIdToZoneIds.get(); Builder<String, Supplier<URI>> builder = ImmutableMap.builder(); for (Entry<String, Supplier<URI>> re... |
### Question:
JodaDateService implements DateService { public final String rfc822DateFormat(Date dateTime) { return rfc822DateFormatter.print(new DateTime(dateTime)); } final Date fromSeconds(long seconds); final String cDateFormat(Date dateTime); final String cDateFormat(); final Date cDateParse(String toParse); fina... |
### Question:
ZoneToEndpoint implements Function<Object, URI> { @Override public URI apply(Object from) { Map<String, Supplier<URI>> zoneToEndpoint = zoneToEndpoints.get(); checkState(!zoneToEndpoint.isEmpty(), "no zone name to endpoint mappings configured!"); checkArgument(zoneToEndpoint.containsKey(from), "requested ... |
### Question:
RegionToEndpointOrProviderIfNull implements Function<Object, URI> { @Override public URI apply(@Nullable Object from) { if (from == null) return defaultUri.get(); Map<String, Supplier<URI>> regionToEndpoint = regionToEndpointSupplier.get(); if (from.equals(defaultProvider)) { if (regionToEndpoint.contains... |
### Question:
RegionToEndpoint implements Function<Object, URI> { @Override public URI apply(Object from) { Map<String, Supplier<URI>> regionToEndpoint = regionToEndpoints.get(); checkState(!regionToEndpoint.isEmpty(), "no region name to endpoint mappings configured!"); checkArgument(regionToEndpoint.containsKey(from),... |
### Question:
JodaDateService implements DateService { public final Date rfc822DateParse(String toParse) { return rfc822DateFormatter.parseDateTime(toParse).toDate(); } final Date fromSeconds(long seconds); final String cDateFormat(Date dateTime); final String cDateFormat(); final Date cDateParse(String toParse); fina... |
### Question:
ExpandProperties implements Function<Properties, Properties> { @Override public Properties apply(final Properties properties) { checkNotNull(properties, "properties cannot be null"); Map<String, String> stringProperties = Maps.toMap(properties.stringPropertyNames(), new Function<String, String>() { @Overr... |
### Question:
ExpandProperties implements Function<Properties, Properties> { @SuppressModernizer private boolean resolveProperties(Map<String, String> properties, Map<String, String> variables) { boolean anyReplacementDone = false; for (Map.Entry<String, String> entry : properties.entrySet()) { String key = entry.getKe... |
### Question:
JoinOnComma implements Function<Object, String> { public String apply(Object o) { checkNotNull(o, "input cannot be null"); if (o.getClass().isArray()) { Builder<Object> builder = ImmutableList.builder(); for (int i = 0; i < Array.getLength(o); i++) builder.add(Array.get(o, i)); o = builder.build(); } chec... |
### Question:
SshjSshClient implements SshClient { @VisibleForTesting SshException propagate(Exception e, String message) { message += ": " + e.getMessage(); logger.error(e, "<< " + message); if (e instanceof UserAuthException) throw new AuthorizationException("(" + toString() + ") " + message, e); throw e instanceof S... |
### Question:
ContextBuilder { @VisibleForTesting static void addExecutorServiceIfNotPresent(List<Module> modules) { if (!any(modules, new Predicate<Module>() { public boolean apply(Module input) { return input.getClass().isAnnotationPresent(ConfiguresExecutorService.class); } } )) { if (any(modules, new Predicate<Modu... |
### Question:
Apis { public static ApiMetadata withId(String id) throws NoSuchElementException { return find(all(), ApiPredicates.id(id)); } static Function<ApiMetadata, String> idFunction(); static Iterable<ApiMetadata> all(); static ApiMetadata withId(String id); static Iterable<ApiMetadata> contextAssignableFrom(Ty... |
### Question:
IpPermissions extends IpPermission { public static ToSourceSelection permitAnyProtocol() { return new ToSourceSelection(IpProtocol.ALL, 1, 65535); } protected IpPermissions(IpProtocol ipProtocol, int fromPort, int toPort,
Multimap<String, String> tenantIdGroupPairs, Iterable<String> groupIds, It... |
### Question:
ConvertToJcloudsResponse implements Function<HTTPResponse, HttpResponse> { @Override public HttpResponse apply(HTTPResponse gaeResponse) { Payload payload = gaeResponse.getContent() != null ? Payloads.newByteArrayPayload(gaeResponse.getContent()) : null; Multimap<String, String> headers = LinkedHashMultim... |
### Question:
InitScriptConfigurationForTasks { @Inject(optional = true) public InitScriptConfigurationForTasks initScriptPattern( @Named(PROPERTY_INIT_SCRIPT_PATTERN) String initScriptPattern) { this.initScriptPattern = checkNotNull(initScriptPattern, "initScriptPattern ex. /tmp/init-%s"); checkArgument(this.initScrip... |
### Question:
ImageCacheSupplier implements Supplier<Set<? extends Image>>, ValueLoadedCallback<Set<? extends Image>> { public void registerImage(Image image) { checkNotNull(image, "image"); imageCache.put(image.getId(), image); } ImageCacheSupplier(Supplier<Set<? extends Image>> imageSupplier, long sessionIntervalSeco... |
### Question:
ImageCacheSupplier implements Supplier<Set<? extends Image>>, ValueLoadedCallback<Set<? extends Image>> { public void removeImage(String imageId) { imageCache.invalidate(checkNotNull(imageId, "imageId")); } ImageCacheSupplier(Supplier<Set<? extends Image>> imageSupplier, long sessionIntervalSeconds,
... |
### Question:
ConvertToGaeRequest implements Function<HttpRequest, HTTPRequest> { @Override public HTTPRequest apply(HttpRequest request) { URL url = null; try { url = request.getEndpoint().toURL(); } catch (MalformedURLException e) { Throwables.propagate(e); } FetchOptions options = disallowTruncate(); options.doNotFo... |
### Question:
ImageCacheSupplier implements Supplier<Set<? extends Image>>, ValueLoadedCallback<Set<? extends Image>> { @Override public Set<? extends Image> get() { memoizedImageSupplier.get(); return ImmutableSet.copyOf(imageCache.asMap().values()); } ImageCacheSupplier(Supplier<Set<? extends Image>> imageSupplier, l... |
### Question:
ConcurrentOpenSocketFinder implements OpenSocketFinder { @VisibleForTesting static FluentIterable<String> checkNodeHasIps(NodeMetadata node, AllowedInterfaces allowedInterfaces) { ImmutableSet.Builder<String> ipsBuilder = ImmutableSet.builder(); if (allowedInterfaces.scanPublic) { ipsBuilder.addAll(node.g... |
### Question:
ComputeServiceUtils { public static String formatStatus(ComputeMetadataIncludingStatus<?> resource) { if (resource.getBackendStatus() == null) return resource.getStatus().toString(); return String.format("%s[%s]", resource.getStatus(), resource.getBackendStatus()); } static String formatStatus(ComputeMet... |
### Question:
ComputeServiceUtils { public static Map<String, String> metadataAndTagsAsValuesOfEmptyString(TemplateOptions options) { Builder<String, String> builder = ImmutableMap.<String, String> builder(); builder.putAll(options.getUserMetadata()); for (String tag : options.getTags()) builder.put(tag, ""); return bu... |
### Question:
ComputeServiceUtils { public static Map<String, String> metadataAndTagsAsCommaDelimitedValue(TemplateOptions options) { Builder<String, String> builder = ImmutableMap.<String, String> builder(); builder.putAll(options.getUserMetadata()); if (!options.getTags().isEmpty()) builder.put("jclouds_tags", Joiner... |
### Question:
ComputeServiceUtils { public static String parseVersionOrReturnEmptyString(org.jclouds.compute.domain.OsFamily family, String in, Map<OsFamily, Map<String, String>> osVersionMap) { if (osVersionMap.containsKey(family)) { if (osVersionMap.get(family).containsKey(in)) return osVersionMap.get(family).get(in)... |
### Question:
ComputeServiceUtils { public static Statement execHttpResponse(HttpRequest request) { return pipeHttpResponseToBash(request.getMethod(), request.getEndpoint(), request.getHeaders()); } static String formatStatus(ComputeMetadataIncludingStatus<?> resource); static Statement execHttpResponse(HttpRequest re... |
### Question:
ComputeServiceUtils { public static Statement extractTargzIntoDirectory(HttpRequest targz, String directory) { return Statements .extractTargzIntoDirectory(targz.getMethod(), targz.getEndpoint(), targz.getHeaders(), directory); } static String formatStatus(ComputeMetadataIncludingStatus<?> resource); sta... |
### Question:
ComputeServiceUtils { public static Map<Integer, Integer> getPortRangesFromList(int... ports) { Set<Integer> sortedPorts = ImmutableSortedSet.copyOf(Ints.asList(ports)); RangeSet<Integer> ranges = TreeRangeSet.create(); for (Integer port : sortedPorts) { ranges.add(Range.closedOpen(port, port + 1)); } Map... |
### Question:
AutomaticHardwareIdSpec { public static boolean isAutomaticId(String id) { return id.startsWith("automatic:"); } static boolean isAutomaticId(String id); static AutomaticHardwareIdSpec parseId(String hardwareId); static AutomaticHardwareIdSpec automaticHardwareIdSpecBuilder(double cores, int ram, Optiona... |
### Question:
AutomaticHardwareIdSpec { public static AutomaticHardwareIdSpec parseId(String hardwareId) { AutomaticHardwareIdSpec spec = new AutomaticHardwareIdSpec(); String hardwareSpec = hardwareId.substring(10); Map<String, String> specValues = Splitter.on(';') .trimResults() .omitEmptyStrings() .withKeyValueSepar... |
### Question:
AutomaticHardwareIdSpec { public static AutomaticHardwareIdSpec automaticHardwareIdSpecBuilder(double cores, int ram, Optional<Float> disk) { AutomaticHardwareIdSpec spec = new AutomaticHardwareIdSpec(); if (cores <= 0 || ram == 0) { throw new IllegalArgumentException(String.format("Omitted or wrong minCo... |
### Question:
TemplateOptions extends RunScriptOptions implements Cloneable { public TemplateOptions installPrivateKey(String privateKey) { checkArgument(checkNotNull(privateKey, "privateKey").startsWith("-----BEGIN RSA PRIVATE KEY-----"), "key should start with -----BEGIN RSA PRIVATE KEY-----"); this.privateKey = priv... |
### Question:
TemplateOptions extends RunScriptOptions implements Cloneable { public String getPrivateKey() { return privateKey; } @Override TemplateOptions clone(); void copyTo(TemplateOptions to); boolean equals(Object o); @Override int hashCode(); @Override ToStringHelper string(); int[] getInboundPorts(); Statemen... |
### Question:
TemplateOptions extends RunScriptOptions implements Cloneable { public TemplateOptions authorizePublicKey(String publicKey) { checkArgument(checkNotNull(publicKey, "publicKey").startsWith("ssh-rsa"), "key should start with ssh-rsa"); this.publicKey = publicKey; return this; } @Override TemplateOptions cl... |
### Question:
TemplateOptions extends RunScriptOptions implements Cloneable { public String getPublicKey() { return publicKey; } @Override TemplateOptions clone(); void copyTo(TemplateOptions to); boolean equals(Object o); @Override int hashCode(); @Override ToStringHelper string(); int[] getInboundPorts(); Statement ... |
### Question:
TemplateOptions extends RunScriptOptions implements Cloneable { @Override public TemplateOptions blockOnPort(int port, int seconds) { return TemplateOptions.class.cast(super.blockOnPort(port, seconds)); } @Override TemplateOptions clone(); void copyTo(TemplateOptions to); boolean equals(Object o); @Overr... |
### Question:
TemplateOptions extends RunScriptOptions implements Cloneable { public TemplateOptions inboundPorts(int... ports) { for (int port : ports) checkArgument(port > 0 && port < 65536, "port must be a positive integer < 65535"); this.inboundPorts = ImmutableSet.copyOf(Ints.asList(ports)); return this; } @Overr... |
### Question:
TemplateOptions extends RunScriptOptions implements Cloneable { public int[] getInboundPorts() { return Ints.toArray(inboundPorts); } @Override TemplateOptions clone(); void copyTo(TemplateOptions to); boolean equals(Object o); @Override int hashCode(); @Override ToStringHelper string(); int[] getInbound... |
### Question:
TemplateOptions extends RunScriptOptions implements Cloneable { public boolean shouldBlockUntilRunning() { return blockUntilRunning; } @Override TemplateOptions clone(); void copyTo(TemplateOptions to); boolean equals(Object o); @Override int hashCode(); @Override ToStringHelper string(); int[] getInboun... |
### Question:
TemplateOptions extends RunScriptOptions implements Cloneable { public TemplateOptions blockUntilRunning(boolean blockUntilRunning) { this.blockUntilRunning = blockUntilRunning; if (!blockUntilRunning) port = seconds = -1; return this; } @Override TemplateOptions clone(); void copyTo(TemplateOptions to);... |
### Question:
TemplateOptions extends RunScriptOptions implements Cloneable { public TemplateOptions nodeNames(Iterable<String> nodeNames) { this.nodeNames = ImmutableSet.copyOf(checkNotNull(nodeNames, "nodeNames")); return this; } @Override TemplateOptions clone(); void copyTo(TemplateOptions to); boolean equals(Obje... |
### Question:
TemplateOptions extends RunScriptOptions implements Cloneable { public TemplateOptions networks(Iterable<String> networks) { this.networks = ImmutableSet.copyOf(checkNotNull(networks, "networks")); return this; } @Override TemplateOptions clone(); void copyTo(TemplateOptions to); boolean equals(Object o)... |
### Question:
NodeAndTemplateOptionsToStatementWithoutPublicKey implements NodeAndTemplateOptionsToStatement { @Override public Statement apply(NodeMetadata node, TemplateOptions options) { ImmutableList.Builder<Statement> builder = ImmutableList.builder(); if (options.getRunScript() != null) { builder.add(options.getR... |
### Question:
PollNodeRunning implements Function<AtomicReference<NodeMetadata>, AtomicReference<NodeMetadata>> { @Override public AtomicReference<NodeMetadata> apply(AtomicReference<NodeMetadata> node) throws IllegalStateException { String originalId = node.get().getId(); NodeMetadata originalNode = node.get(); try { ... |
### Question:
JschSshClient implements SshClient { SshException propagate(Exception e, String message) { message += ": " + e.getMessage(); if (e.getMessage() != null && e.getMessage().indexOf("Auth fail") != -1) throw new AuthorizationException("(" + toString() + ") " + message, e); throw e instanceof SshException ? Ss... |
### Question:
DelegatingImageExtension implements ImageExtension { public boolean deleteImage(String id) { boolean success = delegate.deleteImage(id); if (success) { imageCache.removeImage(id); } return success; } @Inject DelegatingImageExtension(@Assisted ImageCacheSupplier imageCache, @Assisted ImageExtension delega... |
### Question:
ProfitBricksSoapMessageEnvelope implements HttpRequestFilter { @Override public HttpRequest filter(HttpRequest request) throws HttpException { checkNotNull(request.getPayload(), "HTTP Request must contain payload message."); return createSoapRequest(request); } @Override HttpRequest filter(HttpRequest re... |
### Question:
NullEqualToIsParentOrIsGrandparentOfCurrentLocation implements Predicate<ComputeMetadata> { @Override public boolean apply(ComputeMetadata input) { Location current = locationSupplier.get(); if (current == null) return true; if (input.getLocation() == null) return true; Location parent = current.getParent... |
### Question:
SshKeys { public static String fingerprint(BigInteger publicExponent, BigInteger modulus) { byte[] keyBlob = keyBlob(publicExponent, modulus); return hexColonDelimited(Hashing.md5().hashBytes(keyBlob)); } static RSAPublicKeySpec publicKeySpecFromOpenSSH(String idRsaPub); static RSAPublicKeySpec publicKey... |
### Question:
SshKeys { public static boolean privateKeyHasFingerprint(RSAPrivateCrtKeySpec privateKey, String fingerprint) { return fingerprint(privateKey.getPublicExponent(), privateKey.getModulus()).equals(fingerprint); } static RSAPublicKeySpec publicKeySpecFromOpenSSH(String idRsaPub); static RSAPublicKeySpec pub... |
### Question:
SshKeys { public static boolean privateKeyHasSha1(RSAPrivateCrtKeySpec privateKey, String fingerprint) { return sha1(privateKey).equals(fingerprint); } static RSAPublicKeySpec publicKeySpecFromOpenSSH(String idRsaPub); static RSAPublicKeySpec publicKeySpecFromOpenSSH(ByteSource supplier); static KeyPair ... |
### Question:
SshKeys { public static boolean privateKeyMatchesPublicKey(String privateKeyPEM, String publicKeyOpenSSH) { KeySpec privateKeySpec = privateKeySpec(privateKeyPEM); checkArgument(privateKeySpec instanceof RSAPrivateCrtKeySpec, "incorrect format expected RSAPrivateCrtKeySpec was %s", privateKeySpec); return... |
### Question:
SshKeys { public static String encodeAsOpenSSH(RSAPublicKey key) { byte[] keyBlob = keyBlob(key.getPublicExponent(), key.getModulus()); return "ssh-rsa " + base64().encode(keyBlob); } static RSAPublicKeySpec publicKeySpecFromOpenSSH(String idRsaPub); static RSAPublicKeySpec publicKeySpecFromOpenSSH(ByteS... |
### Question:
MacAddresses { public static boolean isMacAddress(String in) { return MAC_ADDR_PATTERN.matcher(in).matches(); } static boolean isMacAddress(String in); }### Answer:
@Test public void testIsMacAddress() { for (String addr : expectedValidAddresses) assertTrue(isMacAddress(addr)); for (String addr : expect... |
### Question:
DeregisterLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.DeregisterPayload> { @Override protected String createPayload(LoadBalancer.Request.DeregisterPayload payload) { requestBuilder.append("<ws:deregisterServersOnLoadBalancer>"); for (String s : payload.serverIds())... |
### Question:
BackoffOnNotFoundWhenGetBucketACL extends CacheLoader<String, AccessControlList> { @Override public AccessControlList load(String bucketName) { ResourceNotFoundException last = null; for (int currentTries = 0; currentTries < maxTries; currentTries++) { try { return client.getBucketACL(bucketName); } catch... |
### Question:
CopyObjectOptions extends BaseHttpRequestOptions { public CopyObjectOptions overrideMetadataWith(Map<String, String> metadata) { checkNotNull(metadata, "metadata"); this.metadata = metadata; return this; } @Inject void setMetadataPrefix(@Named(PROPERTY_USER_METADATA_PREFIX) String metadataPrefix); @Injec... |
### Question:
CopyObjectOptions extends BaseHttpRequestOptions { public String getIfModifiedSince() { return getFirstHeaderOrNull(COPY_SOURCE_IF_MODIFIED_SINCE); } @Inject void setMetadataPrefix(@Named(PROPERTY_USER_METADATA_PREFIX) String metadataPrefix); @Inject void setHeaderTag(@Named(PROPERTY_HEADER_TAG) String h... |
### Question:
CopyObjectOptions extends BaseHttpRequestOptions { public CopyObjectOptions ifSourceModifiedSince(Date ifModifiedSince) { checkState(getIfMatch() == null, "ifETagMatches() is not compatible with ifModifiedSince()"); checkState(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifM... |
### Question:
CopyObjectOptions extends BaseHttpRequestOptions { public CopyObjectOptions ifSourceUnmodifiedSince(Date ifUnmodifiedSince) { checkState(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifUnmodifiedSince()"); checkState(getIfModifiedSince() == null, "ifModifiedSince() is not compatibl... |
### Question:
CreateLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.CreatePayload> { @Override protected String createPayload(LoadBalancer.Request.CreatePayload payload) { requestBuilder.append("<ws:createLoadBalancer>") .append("<request>") .append(format("<dataCenterId>%s</dataCen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.