Run automatic Java 8 conversion over codebase

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171174380
This commit is contained in:
mcilwain 2017-10-05 10:48:38 -07:00 committed by Ben McIlwain
parent 44df5da771
commit 5edb7935ed
190 changed files with 2312 additions and 3096 deletions

View file

@ -16,6 +16,7 @@ package google.registry.tools.server;
import static com.google.common.base.Predicates.instanceOf;
import static com.google.common.base.Predicates.not;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy;
@ -27,10 +28,9 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static java.util.Arrays.asList;
import com.google.appengine.api.datastore.Entity;
import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Streams;
import google.registry.model.ImmutableObject;
import google.registry.model.ofy.CommitLogBucket;
import google.registry.model.ofy.CommitLogCheckpoint;
@ -81,13 +81,10 @@ public class KillAllCommitLogsActionTest extends MapreduceTestCase<KillAllCommit
for (Class<?> clazz : AFFECTED_TYPES) {
assertThat(ofy().load().type(clazz)).named("entities of type " + clazz).isNotEmpty();
}
ImmutableList<?> otherStuff = FluentIterable.from(ofy().load())
.filter(new Predicate<Object>() {
@Override
public boolean apply(Object obj) {
return !AFFECTED_TYPES.contains(obj.getClass());
}})
.toList();
ImmutableList<?> otherStuff =
Streams.stream(ofy().load())
.filter(obj -> !AFFECTED_TYPES.contains(obj.getClass()))
.collect(toImmutableList());
assertThat(otherStuff).isNotEmpty();
runMapreduce();
for (Class<?> clazz : AFFECTED_TYPES) {

View file

@ -17,6 +17,7 @@ package google.registry.tools.server;
import static com.google.common.base.Predicates.in;
import static com.google.common.base.Predicates.instanceOf;
import static com.google.common.base.Predicates.not;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static com.google.common.collect.Multimaps.filterKeys;
import static com.google.common.collect.Sets.difference;
import static com.google.common.truth.Truth.assertThat;
@ -32,7 +33,6 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static java.util.Arrays.asList;
import com.google.appengine.api.datastore.Entity;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
@ -53,6 +53,7 @@ import google.registry.model.poll.PollMessage;
import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.FakeResponse;
import google.registry.testing.mapreduce.MapreduceTestCase;
import java.util.stream.Stream;
import org.joda.money.CurrencyUnit;
import org.joda.money.Money;
import org.junit.Test;
@ -64,22 +65,21 @@ import org.junit.runners.JUnit4;
public class KillAllEppResourcesActionTest extends MapreduceTestCase<KillAllEppResourcesAction> {
static final ImmutableSet<String> AFFECTED_KINDS =
FluentIterable.from(
asList(
EppResourceIndex.class,
ForeignKeyContactIndex.class,
ForeignKeyDomainIndex.class,
ForeignKeyHostIndex.class,
DomainApplicationIndex.class,
DomainBase.class,
ContactResource.class,
HostResource.class,
HistoryEntry.class,
PollMessage.class,
BillingEvent.OneTime.class,
BillingEvent.Recurring.class))
.transform(CLASS_TO_KIND_FUNCTION)
.toSet();
Stream.of(
EppResourceIndex.class,
ForeignKeyContactIndex.class,
ForeignKeyDomainIndex.class,
ForeignKeyHostIndex.class,
DomainApplicationIndex.class,
DomainBase.class,
ContactResource.class,
HostResource.class,
HistoryEntry.class,
PollMessage.class,
BillingEvent.OneTime.class,
BillingEvent.Recurring.class)
.map(CLASS_TO_KIND_FUNCTION)
.collect(toImmutableSet());
private void runMapreduce() throws Exception {
action = new KillAllEppResourcesAction();