Don't use shaded APIs

This commit is contained in:
Robert Muir 2015-06-04 16:27:29 -04:00
parent 7efb36da54
commit 7d67dfd61d
10 changed files with 43 additions and 41 deletions

View File

@ -27,10 +27,10 @@ import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.compute.Compute;
import com.google.api.services.compute.model.Instance;
import com.google.api.services.compute.model.InstanceList;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.common.base.Function;
import org.elasticsearch.common.collect.Iterables;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.component.AbstractLifecycleComponent;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -38,6 +38,7 @@ import org.elasticsearch.common.settings.SettingsFilter;
import org.elasticsearch.common.unit.TimeValue;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -67,7 +68,7 @@ public class GceComputeServiceImpl extends AbstractLifecycleComponent<GceCompute
Compute.Instances.List list = client().instances().list(project, zoneId);
InstanceList instanceList = list.execute();
if (instanceList.isEmpty()) {
return Lists.newArrayList();
return new ArrayList();
}
return instanceList.getItems();
@ -75,7 +76,7 @@ public class GceComputeServiceImpl extends AbstractLifecycleComponent<GceCompute
logger.warn("Problem fetching instance list for zone {}", zoneId);
logger.debug("Full exception:", e);
return Lists.newArrayList();
return new ArrayList();
}
}
});

View File

@ -26,7 +26,6 @@ import org.elasticsearch.Version;
import org.elasticsearch.cloud.gce.GceComputeService;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.network.NetworkService;
@ -38,6 +37,8 @@ import org.elasticsearch.transport.TransportService;
import java.io.IOException;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@ -86,7 +87,7 @@ public class GceUnicastHostsProvider extends AbstractComponent implements Unicas
this.tags = settings.getAsArray(Fields.TAGS);
if (logger.isDebugEnabled()) {
logger.debug("using tags {}", Lists.newArrayList(this.tags));
logger.debug("using tags {}", Arrays.asList(this.tags));
}
}
@ -108,7 +109,7 @@ public class GceUnicastHostsProvider extends AbstractComponent implements Unicas
}
logger.debug("start building nodes list using GCE API");
cachedDiscoNodes = Lists.newArrayList();
cachedDiscoNodes = new ArrayList<>();
String ipAddress = null;
try {
InetAddress inetAddress = networkService.resolvePublishHostAddress(null);

View File

@ -20,12 +20,12 @@
package org.elasticsearch.plugin.cloud.gce;
import org.elasticsearch.cloud.gce.GceModule;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.component.LifecycleComponent;
import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.AbstractPlugin;
import java.util.ArrayList;
import java.util.Collection;
/**
@ -51,7 +51,7 @@ public class CloudGcePlugin extends AbstractPlugin {
@Override
public Collection<Class<? extends Module>> modules() {
Collection<Class<? extends Module>> modules = Lists.newArrayList();
Collection<Class<? extends Module>> modules = new ArrayList<>();
if (settings.getAsBoolean("cloud.enabled", true)) {
modules.add(GceModule.class);
}
@ -60,7 +60,7 @@ public class CloudGcePlugin extends AbstractPlugin {
@Override
public Collection<Class<? extends LifecycleComponent>> services() {
Collection<Class<? extends LifecycleComponent>> services = Lists.newArrayList();
Collection<Class<? extends LifecycleComponent>> services = new ArrayList<>();
if (settings.getAsBoolean("cloud.enabled", true)) {
// services.add(GceComputeServiceImpl.class);
}

View File

@ -19,10 +19,10 @@
package org.elasticsearch.discovery.gce;
import com.google.common.collect.Lists;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
import org.elasticsearch.cloud.gce.GceComputeService;
import org.elasticsearch.cloud.gce.GceComputeService.Fields;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.discovery.gce.mock.*;
import org.elasticsearch.plugins.PluginsService;

View File

@ -23,9 +23,9 @@ import com.google.api.services.compute.model.Instance;
import com.google.api.services.compute.model.Metadata;
import com.google.api.services.compute.model.NetworkInterface;
import com.google.api.services.compute.model.Tags;
import com.google.common.collect.Lists;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.cloud.gce.GceComputeService;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.component.AbstractLifecycleComponent;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.discovery.gce.GceComputeEngineTest;
@ -42,7 +42,7 @@ import static com.carrotsearch.randomizedtesting.RandomizedTest.randomInt;
public abstract class GceComputeServiceAbstractMock extends AbstractLifecycleComponent<GceComputeServiceAbstractMock>
implements GceComputeService {
protected abstract List<ArrayList<String>> getTags();
protected abstract List<List<String>> getTags();
protected abstract List<String> getZones();
private final List<String> zoneList;

View File

@ -19,29 +19,29 @@
package org.elasticsearch.discovery.gce.mock;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
*
*/
public class GceComputeServiceTwoNodesDifferentTagsMock extends GceComputeServiceAbstractMock {
private static List<ArrayList<String>> tags = Lists.newArrayList(
Lists.newArrayList("dev"),
Lists.newArrayList("elasticsearch","dev"));
private static List<List<String>> tags = Arrays.asList(
Arrays.asList("dev"),
Arrays.asList("elasticsearch", "dev"));
@Override
protected List<ArrayList<String>> getTags() {
protected List<List<String>> getTags() {
return tags;
}
@Override
protected List<String> getZones() {
return Lists.newArrayList();
return new ArrayList();
}
@Inject

View File

@ -19,22 +19,22 @@
package org.elasticsearch.discovery.gce.mock;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
*
*/
public class GceComputeServiceTwoNodesOneZoneMock extends GceComputeServiceAbstractMock {
private static List<String> zones = Lists.newArrayList("us-central1-a","us-central1-a");
private static List<String> zones = Arrays.asList("us-central1-a", "us-central1-a");
@Override
protected List<ArrayList<String>> getTags() {
return Lists.newArrayList();
protected List<List<String>> getTags() {
return new ArrayList<>();
}
@Override

View File

@ -19,30 +19,30 @@
package org.elasticsearch.discovery.gce.mock;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
*
*/
public class GceComputeServiceTwoNodesSameTagsMock extends GceComputeServiceAbstractMock {
private static List<ArrayList<String>> tags = Lists.newArrayList(
Lists.newArrayList("elasticsearch","dev"),
Lists.newArrayList("elasticsearch","dev"));
private static List<List<String>> tags = Arrays.asList(
Arrays.asList("elasticsearch", "dev"),
Arrays.asList("elasticsearch", "dev"));
@Override
protected List<ArrayList<String>> getTags() {
protected List<List<String>> getTags() {
return tags;
}
@Override
protected List<String> getZones() {
return Lists.newArrayList();
return new ArrayList<>();
}
@Inject

View File

@ -19,22 +19,22 @@
package org.elasticsearch.discovery.gce.mock;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
*
*/
public class GceComputeServiceTwoNodesTwoZonesMock extends GceComputeServiceAbstractMock {
private static List<String> zones = Lists.newArrayList("us-central1-a","europe-west1-a");
private static List<String> zones = Arrays.asList("us-central1-a", "europe-west1-a");
@Override
protected List<ArrayList<String>> getTags() {
return Lists.newArrayList();
protected List<List<String>> getTags() {
return new ArrayList();
}
@Override

View File

@ -20,9 +20,9 @@
package org.elasticsearch.discovery.gce.mock;
import com.google.api.services.compute.model.Instance;
import org.elasticsearch.common.base.Function;
import org.elasticsearch.common.collect.Iterables;
import org.elasticsearch.common.collect.Lists;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -36,13 +36,13 @@ import java.util.List;
public class GceComputeServiceZeroNodeMock extends GceComputeServiceAbstractMock {
@Override
protected List<ArrayList<String>> getTags() {
return Lists.newArrayList();
protected List<List<String>> getTags() {
return new ArrayList();
}
@Override
protected List<String> getZones() {
return Lists.newArrayList();
return new ArrayList();
}
private final List<String> zoneList;
@ -55,7 +55,7 @@ public class GceComputeServiceZeroNodeMock extends GceComputeServiceAbstractMock
@Override
public List<Instance> apply(String zoneId) {
// If we return null here we will get a trace as explained in issue 43
return Lists.newArrayList();
return new ArrayList();
}
});