Tidy up ExpandrecurringBillingEventsAction

Per nickfelt's suggestion on []
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127193451
This commit is contained in:
ctingue 2016-07-12 06:27:53 -07:00 committed by Ben McIlwain
parent 7b9752c99d
commit 2caba95d28
10 changed files with 12 additions and 41 deletions

View file

@ -241,11 +241,8 @@ public class ExpandRecurringBillingEventsAction implements Runnable {
.filter(new Predicate<BillingEvent.OneTime>() { .filter(new Predicate<BillingEvent.OneTime>() {
@Override @Override
public boolean apply(OneTime billingEvent) { public boolean apply(OneTime billingEvent) {
Key<? extends BillingEvent> cancellationMatchingBillingEvent = return Key.create(recurringEvent)
billingEvent.getCancellationMatchingBillingEvent(); .equals(billingEvent.getCancellationMatchingBillingEvent());
return cancellationMatchingBillingEvent != null
&& billingEvent.getCancellationMatchingBillingEvent().equals(
Key.create(recurringEvent));
}}) }})
.transform(new Function<OneTime, DateTime>() { .transform(new Function<OneTime, DateTime>() {
@Override @Override

View file

@ -50,6 +50,7 @@ import google.registry.testing.EppLoader;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeHttpSession; import google.registry.testing.FakeHttpSession;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import google.registry.testing.ShardableTestCase;
import google.registry.util.TypeUtils.TypeInstantiator; import google.registry.util.TypeUtils.TypeInstantiator;
import google.registry.xml.ValidationMode; import google.registry.xml.ValidationMode;
@ -68,7 +69,7 @@ import java.util.Map;
* @param <F> the flow type * @param <F> the flow type
*/ */
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public abstract class FlowTestCase<F extends Flow> { public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
/** Whether to actually write to the datastore or just simulate. */ /** Whether to actually write to the datastore or just simulate. */
public enum CommitMode { LIVE, DRY_RUN } public enum CommitMode { LIVE, DRY_RUN }

View file

@ -136,7 +136,4 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, C
persistContactResource(false); persistContactResource(false);
runFlow(); runFlow();
} }
// Extra methods so the test runner doesn't produce empty shards.
@Test public void testNothing1() {}
} }

View file

@ -163,8 +163,4 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
persistHostResource(false); persistHostResource(false);
runFlow(); runFlow();
} }
// Extra methods so the test runner doesn't produce empty shards.
@Test public void testNothing1() {}
} }

View file

@ -25,6 +25,7 @@ import org.junit.Test;
/** Unit tests for {@link HelloFlow}. */ /** Unit tests for {@link HelloFlow}. */
public class HelloFlowTest extends FlowTestCase<HelloFlow> { public class HelloFlowTest extends FlowTestCase<HelloFlow> {
@Test @Test
public void testHello() throws Exception { public void testHello() throws Exception {
setEppInput("hello.xml"); setEppInput("hello.xml");
@ -35,15 +36,4 @@ public class HelloFlowTest extends FlowTestCase<HelloFlow> {
"greeting_crr.xml", "greeting_crr.xml",
ImmutableMap.of("DATE", clock.nowUtc().toString(dateTimeNoMillis())))); ImmutableMap.of("DATE", clock.nowUtc().toString(dateTimeNoMillis()))));
} }
// Extra methods so the test runner doesn't produce empty shards.
@Test
public void testNothing1() {}
@Test
public void testNothing2() {}
@Test
public void testNothing3() {}
} }

View file

@ -52,8 +52,4 @@ public class LogoutFlowTest extends FlowTestCase<LogoutFlow> {
sessionMetadata.setClientId(null); // Turn off the implicit login sessionMetadata.setClientId(null); // Turn off the implicit login
runFlow(); runFlow();
} }
// Extra methods so the test runner doesn't produce empty shards.
@Test public void testNothing1() {}
@Test public void testNothing2() {}
} }

View file

@ -26,11 +26,11 @@ import com.google.common.io.CharStreams;
import google.registry.keyring.api.Keyring; import google.registry.keyring.api.Keyring;
import google.registry.testing.BouncyCastleProviderRule; import google.registry.testing.BouncyCastleProviderRule;
import google.registry.testing.GpgSystemCommandRule; import google.registry.testing.GpgSystemCommandRule;
import google.registry.testing.ShardableTestCase;
import org.bouncycastle.openpgp.PGPPublicKey; import org.bouncycastle.openpgp.PGPPublicKey;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.theories.DataPoints; import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory; import org.junit.experimental.theories.Theory;
@ -47,7 +47,7 @@ import java.io.OutputStream;
/** GnuPG integration tests for {@link Ghostryde}. */ /** GnuPG integration tests for {@link Ghostryde}. */
@RunWith(Theories.class) @RunWith(Theories.class)
@SuppressWarnings("resource") @SuppressWarnings("resource")
public class GhostrydeGpgIntegrationTest { public class GhostrydeGpgIntegrationTest extends ShardableTestCase {
@Rule @Rule
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule(); public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@ -170,7 +170,4 @@ public class GhostrydeGpgIntegrationTest {
return value; return value;
} }
} }
@Test public void makeShardingWork1() {}
@Test public void makeShardingWork2() {}
} }

View file

@ -27,6 +27,7 @@ import google.registry.model.registrar.RegistrarAddress;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import google.registry.testing.ShardableTestCase;
import google.registry.xjc.rderegistrar.XjcRdeRegistrar; import google.registry.xjc.rderegistrar.XjcRdeRegistrar;
import google.registry.xjc.rderegistrar.XjcRdeRegistrarAddrType; import google.registry.xjc.rderegistrar.XjcRdeRegistrarAddrType;
import google.registry.xjc.rderegistrar.XjcRdeRegistrarPostalInfoEnumType; import google.registry.xjc.rderegistrar.XjcRdeRegistrarPostalInfoEnumType;
@ -49,7 +50,7 @@ import java.io.ByteArrayOutputStream;
* some exceptional conditions. * some exceptional conditions.
*/ */
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class RegistrarToXjcConverterTest { public class RegistrarToXjcConverterTest extends ShardableTestCase {
@Rule @Rule
public final AppEngineRule appEngine = AppEngineRule.builder() public final AppEngineRule appEngine = AppEngineRule.builder()
@ -147,6 +148,4 @@ public class RegistrarToXjcConverterTest {
public void testMarshal() throws Exception { public void testMarshal() throws Exception {
marshalStrict(RegistrarToXjcConverter.convert(registrar), new ByteArrayOutputStream(), UTF_8); marshalStrict(RegistrarToXjcConverter.convert(registrar), new ByteArrayOutputStream(), UTF_8);
} }
@Test public void makeShardingWork1() {}
} }

View file

@ -27,13 +27,13 @@ import google.registry.keyring.api.Keyring;
import google.registry.testing.BouncyCastleProviderRule; import google.registry.testing.BouncyCastleProviderRule;
import google.registry.testing.GpgSystemCommandRule; import google.registry.testing.GpgSystemCommandRule;
import google.registry.testing.Providers; import google.registry.testing.Providers;
import google.registry.testing.ShardableTestCase;
import google.registry.util.FormattingLogger; import google.registry.util.FormattingLogger;
import org.bouncycastle.openpgp.PGPKeyPair; import org.bouncycastle.openpgp.PGPKeyPair;
import org.bouncycastle.openpgp.PGPPublicKey; import org.bouncycastle.openpgp.PGPPublicKey;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.theories.DataPoints; import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory; import org.junit.experimental.theories.Theory;
@ -51,7 +51,7 @@ import java.io.OutputStream;
/** GPG combinatorial integration tests for the Ryde classes. */ /** GPG combinatorial integration tests for the Ryde classes. */
@RunWith(Theories.class) @RunWith(Theories.class)
@SuppressWarnings("resource") @SuppressWarnings("resource")
public class RydeGpgIntegrationTest { public class RydeGpgIntegrationTest extends ShardableTestCase {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
@ -281,7 +281,4 @@ public class RydeGpgIntegrationTest {
return value; return value;
} }
} }
@Test public void makeShardingWork1() {}
@Test public void makeShardingWork2() {}
} }

View file

@ -23,6 +23,7 @@ import org.junit.Test;
* sure that we never produces empty shards. * sure that we never produces empty shards.
*/ */
public abstract class ShardableTestCase { public abstract class ShardableTestCase {
@Test @Test
public void testNothing1() {} public void testNothing1() {}