mirror of https://github.com/apache/jclouds.git
JCLOUDS-368: Remove methods which are not exposed to public and hence not used.
This commit is contained in:
parent
3724ee6749
commit
a08b91af73
|
@ -19,12 +19,10 @@ package org.jclouds.chef.strategy;
|
||||||
import org.jclouds.chef.domain.Client;
|
import org.jclouds.chef.domain.Client;
|
||||||
import org.jclouds.chef.strategy.internal.ListClientsImpl;
|
import org.jclouds.chef.strategy.internal.ListClientsImpl;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||||
import com.google.inject.ImplementedBy;
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
@ -33,13 +31,5 @@ public interface ListClients {
|
||||||
|
|
||||||
Iterable<? extends Client> execute();
|
Iterable<? extends Client> execute();
|
||||||
|
|
||||||
Iterable<? extends Client> execute(Predicate<String> clientNameSelector);
|
|
||||||
|
|
||||||
Iterable<? extends Client> execute(Iterable<String> toGet);
|
|
||||||
|
|
||||||
Iterable<? extends Client> execute(ListeningExecutorService executor);
|
Iterable<? extends Client> execute(ListeningExecutorService executor);
|
||||||
|
|
||||||
Iterable<? extends Client> execute(ListeningExecutorService executor, Predicate<String> clientNameSelector);
|
|
||||||
|
|
||||||
Iterable<? extends Client> execute(ListeningExecutorService executor, Iterable<String> toGet);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,10 @@ package org.jclouds.chef.strategy;
|
||||||
import org.jclouds.chef.domain.CookbookVersion;
|
import org.jclouds.chef.domain.CookbookVersion;
|
||||||
import org.jclouds.chef.strategy.internal.ListCookbookVersionsImpl;
|
import org.jclouds.chef.strategy.internal.ListCookbookVersionsImpl;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||||
import com.google.inject.ImplementedBy;
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
@ -33,13 +31,5 @@ public interface ListCookbookVersions {
|
||||||
|
|
||||||
Iterable<? extends CookbookVersion> execute();
|
Iterable<? extends CookbookVersion> execute();
|
||||||
|
|
||||||
Iterable<? extends CookbookVersion> execute(Predicate<String> cookbookNameSelector);
|
|
||||||
|
|
||||||
Iterable<? extends CookbookVersion> execute(Iterable<String> cookbookNames);
|
|
||||||
|
|
||||||
Iterable<? extends CookbookVersion> execute(ListeningExecutorService executor);
|
Iterable<? extends CookbookVersion> execute(ListeningExecutorService executor);
|
||||||
|
|
||||||
Iterable<? extends CookbookVersion> execute(ListeningExecutorService executor, Predicate<String> cookbookNameSelector);
|
|
||||||
|
|
||||||
Iterable<? extends CookbookVersion> execute(ListeningExecutorService executor, Iterable<String> cookbookNames);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.jclouds.chef.strategy;
|
||||||
import org.jclouds.chef.domain.Environment;
|
import org.jclouds.chef.domain.Environment;
|
||||||
import org.jclouds.chef.strategy.internal.ListEnvironmentsImpl;
|
import org.jclouds.chef.strategy.internal.ListEnvironmentsImpl;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||||
import com.google.inject.ImplementedBy;
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
|
@ -28,13 +27,5 @@ public interface ListEnvironments {
|
||||||
|
|
||||||
Iterable<? extends Environment> execute();
|
Iterable<? extends Environment> execute();
|
||||||
|
|
||||||
Iterable<? extends Environment> execute(Predicate<String> environmentNameSelector);
|
|
||||||
|
|
||||||
Iterable<? extends Environment> execute(Iterable<String> toGet);
|
|
||||||
|
|
||||||
Iterable<? extends Environment> execute(ListeningExecutorService executor);
|
Iterable<? extends Environment> execute(ListeningExecutorService executor);
|
||||||
|
|
||||||
Iterable<? extends Environment> execute(ListeningExecutorService executor, Predicate<String> environmentNameSelector);
|
|
||||||
|
|
||||||
Iterable<? extends Environment> execute(ListeningExecutorService executor, Iterable<String> toGet);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,10 @@ package org.jclouds.chef.strategy;
|
||||||
import org.jclouds.chef.domain.Node;
|
import org.jclouds.chef.domain.Node;
|
||||||
import org.jclouds.chef.strategy.internal.ListNodesImpl;
|
import org.jclouds.chef.strategy.internal.ListNodesImpl;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||||
import com.google.inject.ImplementedBy;
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
@ -33,13 +31,5 @@ public interface ListNodes {
|
||||||
|
|
||||||
Iterable<? extends Node> execute();
|
Iterable<? extends Node> execute();
|
||||||
|
|
||||||
Iterable<? extends Node> execute(Predicate<String> nodeNameSelector);
|
|
||||||
|
|
||||||
Iterable<? extends Node> execute(Iterable<String> toGet);
|
|
||||||
|
|
||||||
Iterable<? extends Node> execute(ListeningExecutorService executor);
|
Iterable<? extends Node> execute(ListeningExecutorService executor);
|
||||||
|
|
||||||
Iterable<? extends Node> execute(ListeningExecutorService executor, Predicate<String> nodeNameSelector);
|
|
||||||
|
|
||||||
Iterable<? extends Node> execute(ListeningExecutorService executor, Iterable<String> toGet);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,10 @@ package org.jclouds.chef.strategy;
|
||||||
import org.jclouds.chef.domain.Node;
|
import org.jclouds.chef.domain.Node;
|
||||||
import org.jclouds.chef.strategy.internal.ListNodesInEnvironmentImpl;
|
import org.jclouds.chef.strategy.internal.ListNodesInEnvironmentImpl;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||||
import com.google.inject.ImplementedBy;
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* @author Noorul Islam K M
|
* @author Noorul Islam K M
|
||||||
*/
|
*/
|
||||||
|
@ -33,13 +31,5 @@ public interface ListNodesInEnvironment {
|
||||||
|
|
||||||
Iterable<? extends Node> execute(String environmentName);
|
Iterable<? extends Node> execute(String environmentName);
|
||||||
|
|
||||||
Iterable<? extends Node> execute(String environmentName, Predicate<String> nodeNameSelector);
|
|
||||||
|
|
||||||
Iterable<? extends Node> execute(String environmentName, Iterable<String> toGet);
|
|
||||||
|
|
||||||
Iterable<? extends Node> execute(ListeningExecutorService executor, String environmentName);
|
Iterable<? extends Node> execute(ListeningExecutorService executor, String environmentName);
|
||||||
|
|
||||||
Iterable<? extends Node> execute(ListeningExecutorService executor, String environmentName, Predicate<String> nodeNameSelector);
|
|
||||||
|
|
||||||
Iterable<? extends Node> execute(ListeningExecutorService executor, String environmentName, Iterable<String> toGet);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,25 +72,24 @@ public class CleanupStaleNodesAndClientsImpl implements CleanupStaleNodesAndClie
|
||||||
final Calendar expired = Calendar.getInstance();
|
final Calendar expired = Calendar.getInstance();
|
||||||
expired.setTime(new Date());
|
expired.setTime(new Date());
|
||||||
expired.add(Calendar.SECOND, -secondsStale);
|
expired.add(Calendar.SECOND, -secondsStale);
|
||||||
Iterable<? extends Node> staleNodes = filter(nodeLister.execute(new Predicate<String>() {
|
Iterable<? extends Node> staleNodes = filter(
|
||||||
|
nodeLister.execute(), and(notNull(), new Predicate<Node>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(String input) {
|
public boolean apply(Node input) {
|
||||||
return input.startsWith(prefix);
|
return input.getName().startsWith(prefix);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
}), and(notNull(), new Predicate<Node>() {
|
new Predicate<Node>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Node input) {
|
public boolean apply(Node input) {
|
||||||
JsonBall dateLong = input.getAutomaticAttributes().get("ohai_time");
|
JsonBall dateLong = input.getAutomaticAttributes().get("ohai_time");
|
||||||
if (dateLong == null)
|
if (dateLong == null)
|
||||||
return true;
|
return true;
|
||||||
Calendar nodeUpdate = Calendar.getInstance();
|
Calendar nodeUpdate = Calendar.getInstance();
|
||||||
nodeUpdate.setTime(fromOhaiTime(dateLong));
|
nodeUpdate.setTime(fromOhaiTime(dateLong));
|
||||||
return expired.after(nodeUpdate);
|
return expired.after(nodeUpdate);
|
||||||
}
|
}
|
||||||
|
}));
|
||||||
}));
|
|
||||||
Iterable<String> nodeNames = transform(staleNodes, new Function<Node, String>() {
|
Iterable<String> nodeNames = transform(staleNodes, new Function<Node, String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package org.jclouds.chef.strategy.internal;
|
package org.jclouds.chef.strategy.internal;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.collect.Iterables.filter;
|
|
||||||
import static com.google.common.collect.Iterables.transform;
|
import static com.google.common.collect.Iterables.transform;
|
||||||
import static com.google.common.util.concurrent.Futures.allAsList;
|
import static com.google.common.util.concurrent.Futures.allAsList;
|
||||||
import static com.google.common.util.concurrent.Futures.getUnchecked;
|
import static com.google.common.util.concurrent.Futures.getUnchecked;
|
||||||
|
@ -38,13 +37,11 @@ import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
@ -68,28 +65,12 @@ public class ListClientsImpl implements ListClients {
|
||||||
return execute(userExecutor);
|
return execute(userExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends Client> execute(Predicate<String> clientNameSelector) {
|
|
||||||
return execute(userExecutor, clientNameSelector);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends Client> execute(Iterable<String> toGet) {
|
|
||||||
return execute(userExecutor, toGet);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<? extends Client> execute(ListeningExecutorService executor) {
|
public Iterable<? extends Client> execute(ListeningExecutorService executor) {
|
||||||
return execute(executor, api.listClients());
|
return execute(executor, api.listClients());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private Iterable<? extends Client> execute(final ListeningExecutorService executor, Iterable<String> toGet) {
|
||||||
public Iterable<? extends Client> execute(ListeningExecutorService executor, Predicate<String> clientNameSelector) {
|
|
||||||
return execute(executor, filter(api.listClients(), clientNameSelector));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends Client> execute(final ListeningExecutorService executor, Iterable<String> toGet) {
|
|
||||||
ListenableFuture<List<Client>> futures = allAsList(transform(toGet,
|
ListenableFuture<List<Client>> futures = allAsList(transform(toGet,
|
||||||
new Function<String, ListenableFuture<Client>>() {
|
new Function<String, ListenableFuture<Client>>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,7 +18,6 @@ package org.jclouds.chef.strategy.internal;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.collect.Iterables.concat;
|
import static com.google.common.collect.Iterables.concat;
|
||||||
import static com.google.common.collect.Iterables.filter;
|
|
||||||
import static com.google.common.collect.Iterables.transform;
|
import static com.google.common.collect.Iterables.transform;
|
||||||
import static com.google.common.util.concurrent.Futures.allAsList;
|
import static com.google.common.util.concurrent.Futures.allAsList;
|
||||||
import static com.google.common.util.concurrent.Futures.getUnchecked;
|
import static com.google.common.util.concurrent.Futures.getUnchecked;
|
||||||
|
@ -39,13 +38,11 @@ import org.jclouds.chef.strategy.ListCookbookVersions;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
@ -69,29 +66,12 @@ public class ListCookbookVersionsImpl implements ListCookbookVersions {
|
||||||
return execute(userExecutor);
|
return execute(userExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends CookbookVersion> execute(Predicate<String> cookbookNameSelector) {
|
|
||||||
return execute(userExecutor, cookbookNameSelector);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends CookbookVersion> execute(Iterable<String> toGet) {
|
|
||||||
return execute(userExecutor, toGet);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<? extends CookbookVersion> execute(ListeningExecutorService executor) {
|
public Iterable<? extends CookbookVersion> execute(ListeningExecutorService executor) {
|
||||||
return execute(executor, api.listCookbooks());
|
return execute(executor, api.listCookbooks());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private Iterable<? extends CookbookVersion> execute(final ListeningExecutorService executor,
|
||||||
public Iterable<? extends CookbookVersion> execute(ListeningExecutorService executor,
|
|
||||||
Predicate<String> cookbookNameSelector) {
|
|
||||||
return execute(executor, filter(api.listCookbooks(), cookbookNameSelector));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends CookbookVersion> execute(final ListeningExecutorService executor,
|
|
||||||
Iterable<String> cookbookNames) {
|
Iterable<String> cookbookNames) {
|
||||||
return concat(transform(cookbookNames, new Function<String, Iterable<? extends CookbookVersion>>() {
|
return concat(transform(cookbookNames, new Function<String, Iterable<? extends CookbookVersion>>() {
|
||||||
|
|
||||||
|
@ -112,7 +92,7 @@ public class ListCookbookVersionsImpl implements ListCookbookVersions {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
logger.trace(String.format("getting versions of cookbook: " + cookbook));
|
logger.trace(String.format("getting versions of cookbook: %s", cookbook));
|
||||||
return getUnchecked(futures);
|
return getUnchecked(futures);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package org.jclouds.chef.strategy.internal;
|
package org.jclouds.chef.strategy.internal;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.collect.Iterables.filter;
|
|
||||||
import static com.google.common.collect.Iterables.transform;
|
import static com.google.common.collect.Iterables.transform;
|
||||||
import static com.google.common.util.concurrent.Futures.allAsList;
|
import static com.google.common.util.concurrent.Futures.allAsList;
|
||||||
import static com.google.common.util.concurrent.Futures.getUnchecked;
|
import static com.google.common.util.concurrent.Futures.getUnchecked;
|
||||||
|
@ -38,7 +37,6 @@ import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
@ -63,29 +61,12 @@ public class ListEnvironmentsImpl implements ListEnvironments {
|
||||||
return execute(userExecutor);
|
return execute(userExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends Environment> execute(Predicate<String> environmentNameSelector) {
|
|
||||||
return execute(userExecutor, environmentNameSelector);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends Environment> execute(Iterable<String> toGet) {
|
|
||||||
return execute(userExecutor, toGet);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<? extends Environment> execute(ListeningExecutorService executor) {
|
public Iterable<? extends Environment> execute(ListeningExecutorService executor) {
|
||||||
return execute(executor, api.listEnvironments());
|
return execute(executor, api.listEnvironments());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private Iterable<? extends Environment> execute(final ListeningExecutorService executor, Iterable<String> toGet) {
|
||||||
public Iterable<? extends Environment> execute(ListeningExecutorService executor,
|
|
||||||
Predicate<String> environmentNameSelector) {
|
|
||||||
return execute(executor, filter(api.listEnvironments(), environmentNameSelector));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends Environment> execute(final ListeningExecutorService executor, Iterable<String> toGet) {
|
|
||||||
ListenableFuture<List<Environment>> futures = allAsList(transform(toGet,
|
ListenableFuture<List<Environment>> futures = allAsList(transform(toGet,
|
||||||
new Function<String, ListenableFuture<Environment>>() {
|
new Function<String, ListenableFuture<Environment>>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package org.jclouds.chef.strategy.internal;
|
package org.jclouds.chef.strategy.internal;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.collect.Iterables.filter;
|
|
||||||
import static com.google.common.collect.Iterables.transform;
|
import static com.google.common.collect.Iterables.transform;
|
||||||
import static com.google.common.util.concurrent.Futures.allAsList;
|
import static com.google.common.util.concurrent.Futures.allAsList;
|
||||||
import static com.google.common.util.concurrent.Futures.getUnchecked;
|
import static com.google.common.util.concurrent.Futures.getUnchecked;
|
||||||
|
@ -38,13 +37,11 @@ import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
@ -68,28 +65,12 @@ public class ListNodesImpl implements ListNodes {
|
||||||
return execute(userExecutor);
|
return execute(userExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends Node> execute(Predicate<String> nodeNameSelector) {
|
|
||||||
return execute(userExecutor, nodeNameSelector);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends Node> execute(Iterable<String> toGet) {
|
|
||||||
return execute(userExecutor, toGet);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<? extends Node> execute(ListeningExecutorService executor) {
|
public Iterable<? extends Node> execute(ListeningExecutorService executor) {
|
||||||
return execute(executor, api.listNodes());
|
return execute(executor, api.listNodes());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private Iterable<? extends Node> execute(final ListeningExecutorService executor, Iterable<String> toGet) {
|
||||||
public Iterable<? extends Node> execute(ListeningExecutorService executor, Predicate<String> nodeNameSelector) {
|
|
||||||
return execute(executor, filter(api.listNodes(), nodeNameSelector));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends Node> execute(final ListeningExecutorService executor, Iterable<String> toGet) {
|
|
||||||
ListenableFuture<List<Node>> futures = allAsList(transform(toGet, new Function<String, ListenableFuture<Node>>() {
|
ListenableFuture<List<Node>> futures = allAsList(transform(toGet, new Function<String, ListenableFuture<Node>>() {
|
||||||
@Override
|
@Override
|
||||||
public ListenableFuture<Node> apply(final String input) {
|
public ListenableFuture<Node> apply(final String input) {
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package org.jclouds.chef.strategy.internal;
|
package org.jclouds.chef.strategy.internal;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.collect.Iterables.filter;
|
|
||||||
import static com.google.common.collect.Iterables.transform;
|
import static com.google.common.collect.Iterables.transform;
|
||||||
import static com.google.common.util.concurrent.Futures.allAsList;
|
import static com.google.common.util.concurrent.Futures.allAsList;
|
||||||
import static com.google.common.util.concurrent.Futures.getUnchecked;
|
import static com.google.common.util.concurrent.Futures.getUnchecked;
|
||||||
|
@ -38,13 +37,11 @@ import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* @author Noorul Islam K M
|
* @author Noorul Islam K M
|
||||||
*/
|
*/
|
||||||
|
@ -68,28 +65,12 @@ public class ListNodesInEnvironmentImpl implements ListNodesInEnvironment {
|
||||||
return execute(userExecutor, environmentName);
|
return execute(userExecutor, environmentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends Node> execute(String environmentName, Predicate<String> nodeNameSelector) {
|
|
||||||
return execute(userExecutor, environmentName, nodeNameSelector);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends Node> execute(String environmentName, Iterable<String> toGet) {
|
|
||||||
return execute(userExecutor, environmentName, toGet);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<? extends Node> execute(ListeningExecutorService executor, String environmentName) {
|
public Iterable<? extends Node> execute(ListeningExecutorService executor, String environmentName) {
|
||||||
return execute(executor, environmentName, api.listNodesInEnvironment(environmentName));
|
return execute(executor, environmentName, api.listNodesInEnvironment(environmentName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private Iterable<? extends Node> execute(final ListeningExecutorService executor, String environmentName, Iterable<String> toGet) {
|
||||||
public Iterable<? extends Node> execute(ListeningExecutorService executor, String environmentName, Predicate<String> nodeNameSelector) {
|
|
||||||
return execute(executor, environmentName, filter(api.listNodesInEnvironment(environmentName), nodeNameSelector));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<? extends Node> execute(final ListeningExecutorService executor, String environmentName, Iterable<String> toGet) {
|
|
||||||
ListenableFuture<List<Node>> futures = allAsList(transform(toGet, new Function<String, ListenableFuture<Node>>() {
|
ListenableFuture<List<Node>> futures = allAsList(transform(toGet, new Function<String, ListenableFuture<Node>>() {
|
||||||
@Override
|
@Override
|
||||||
public ListenableFuture<Node> apply(final String input) {
|
public ListenableFuture<Node> apply(final String input) {
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package org.jclouds.chef.strategy.internal;
|
package org.jclouds.chef.strategy.internal;
|
||||||
|
|
||||||
import static com.google.common.collect.Iterables.size;
|
import static com.google.common.collect.Iterables.size;
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
import org.jclouds.chef.ChefApi;
|
import org.jclouds.chef.ChefApi;
|
||||||
|
@ -25,7 +24,6 @@ import org.jclouds.chef.internal.BaseChefLiveTest;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,22 +58,4 @@ public class ListNodesImplLiveTest extends BaseChefLiveTest<ChefApi> {
|
||||||
public void testExecute() {
|
public void testExecute() {
|
||||||
assertTrue(size(strategy.execute()) > 0, "Expected one or more elements");
|
assertTrue(size(strategy.execute()) > 0, "Expected one or more elements");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testExecutePredicateOfString() {
|
|
||||||
assertEquals(size(strategy.execute(new Predicate<String>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(String input) {
|
|
||||||
return input.startsWith(prefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
})), 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testExecuteIterableOfString() {
|
|
||||||
assertEquals(size(strategy.execute(ImmutableSet.of(prefix, prefix + 1))), 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package org.jclouds.chef.strategy.internal;
|
package org.jclouds.chef.strategy.internal;
|
||||||
|
|
||||||
import static com.google.common.collect.Iterables.size;
|
import static com.google.common.collect.Iterables.size;
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
import org.jclouds.chef.ChefApi;
|
import org.jclouds.chef.ChefApi;
|
||||||
|
@ -25,7 +24,6 @@ import org.jclouds.chef.internal.BaseChefLiveTest;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,22 +58,4 @@ public class ListNodesInEnvironmentImplLiveTest extends BaseChefLiveTest<ChefApi
|
||||||
public void testExecute() {
|
public void testExecute() {
|
||||||
assertTrue(size(strategy.execute("_default")) > 0, "Expected one or more elements");
|
assertTrue(size(strategy.execute("_default")) > 0, "Expected one or more elements");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testExecutePredicateOfString() {
|
|
||||||
assertEquals(size(strategy.execute("_default", new Predicate<String>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(String input) {
|
|
||||||
return input.startsWith(prefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
})), 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testExecuteIterableOfString() {
|
|
||||||
assertEquals(size(strategy.execute("_default", ImmutableSet.of(prefix, prefix + 1))), 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue