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

@ -21,7 +21,6 @@ import static org.mockito.Mockito.verify;
import com.google.common.collect.ImmutableMap;
import com.google.common.net.MediaType;
import google.registry.tools.CommandWithConnection.Connection;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@ -30,8 +29,7 @@ import org.mockito.Mock;
public class CreateRegistrarGroupsCommandTest extends
CommandTestCase<CreateRegistrarGroupsCommand> {
@Mock
private Connection connection;
@Mock private AppEngineConnection connection;
@Before
public void init() {
@ -41,16 +39,18 @@ public class CreateRegistrarGroupsCommandTest extends
@Test
public void test_createGroupsForTwoRegistrars() throws Exception {
runCommandForced("NewRegistrar", "TheRegistrar");
verify(connection).send(
eq("/_dr/admin/createGroups"),
eq(ImmutableMap.of("clientId", "NewRegistrar")),
eq(MediaType.PLAIN_TEXT_UTF_8),
eq(new byte[0]));
verify(connection).send(
eq("/_dr/admin/createGroups"),
eq(ImmutableMap.of("clientId", "TheRegistrar")),
eq(MediaType.PLAIN_TEXT_UTF_8),
eq(new byte[0]));
verify(connection)
.sendPostRequest(
eq("/_dr/admin/createGroups"),
eq(ImmutableMap.of("clientId", "NewRegistrar")),
eq(MediaType.PLAIN_TEXT_UTF_8),
eq(new byte[0]));
verify(connection)
.sendPostRequest(
eq("/_dr/admin/createGroups"),
eq(ImmutableMap.of("clientId", "TheRegistrar")),
eq(MediaType.PLAIN_TEXT_UTF_8),
eq(new byte[0]));
assertInStdout("Success!");
}