Refactor AppEngineConnection

AppEngineConnection can now connect to all services and not just the tools.

The default is still the tools.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218734983
This commit is contained in:
guyben 2018-10-25 12:57:16 -07:00 committed by jianglai
parent 97aa98eb35
commit b48061b792
31 changed files with 269 additions and 329 deletions

View file

@ -28,7 +28,6 @@ import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.net.MediaType;
import google.registry.tools.CommandWithConnection.Connection;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
@ -38,7 +37,7 @@ import org.mockito.Mock;
public abstract class ListObjectsCommandTestCase<C extends ListObjectsCommand>
extends CommandTestCase<C> {
@Mock Connection connection;
@Mock AppEngineConnection connection;
/** Where to find the servlet task; set by the subclass. */
abstract String getTaskPath();
@ -62,7 +61,7 @@ public abstract class ListObjectsCommandTestCase<C extends ListObjectsCommand>
.collect(toImmutableList());
}
command.setConnection(connection);
when(connection.send(
when(connection.sendPostRequest(
eq(getTaskPath()),
anyMapOf(String.class, Object.class),
eq(MediaType.PLAIN_TEXT_UTF_8),
@ -82,7 +81,7 @@ public abstract class ListObjectsCommandTestCase<C extends ListObjectsCommand>
fullFieldNames.ifPresent(aBoolean -> params.put(FULL_FIELD_NAMES_PARAM, aBoolean));
params.putAll(getOtherParameters());
verify(connection)
.send(
.sendPostRequest(
eq(getTaskPath()), eq(params.build()), eq(MediaType.PLAIN_TEXT_UTF_8), eq(new byte[0]));
}