Make helper classes in gerrit-acceptance-tests public
Make the helper classes in gerrit-acceptance-tests public so that they can be used from other packages. This allows us to sort the test classes into different packages, e.g. all tests of the REST API could be in one package. Change-Id: Ia03756d40763f159a62974cd4b20693316c9e73b Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -36,7 +36,7 @@ import com.jcraft.jsch.JSch;
|
||||
import com.jcraft.jsch.JSchException;
|
||||
import com.jcraft.jsch.KeyPair;
|
||||
|
||||
class AccountCreator {
|
||||
public class AccountCreator {
|
||||
|
||||
private SchemaFactory<ReviewDb> reviewDbProvider;
|
||||
private GroupCache groupCache;
|
||||
@@ -55,7 +55,7 @@ class AccountCreator {
|
||||
this.byEmailCache = byEmailCache;
|
||||
}
|
||||
|
||||
TestAccount create(String username, String email, String fullName,
|
||||
public TestAccount create(String username, String email, String fullName,
|
||||
String... groups)
|
||||
throws OrmException, UnsupportedEncodingException, JSchException {
|
||||
ReviewDb db = reviewDbProvider.open();
|
||||
|
||||
@@ -24,16 +24,16 @@ import org.apache.http.auth.UsernamePasswordCredentials;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
|
||||
class RestSession {
|
||||
public class RestSession {
|
||||
|
||||
private final TestAccount account;
|
||||
DefaultHttpClient client;
|
||||
|
||||
RestSession(TestAccount account) {
|
||||
public RestSession(TestAccount account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
Reader get(String endPoint) throws IOException {
|
||||
public Reader get(String endPoint) throws IOException {
|
||||
HttpGet get = new HttpGet("http://localhost:8080/a" + endPoint);
|
||||
HttpResponse response = getClient().execute(get);
|
||||
Reader reader = new InputStreamReader(response.getEntity().getContent());
|
||||
@@ -41,7 +41,7 @@ class RestSession {
|
||||
return reader;
|
||||
}
|
||||
|
||||
Reader post(String endPoint) {
|
||||
public Reader post(String endPoint) {
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -23,16 +23,16 @@ import com.jcraft.jsch.JSch;
|
||||
import com.jcraft.jsch.JSchException;
|
||||
import com.jcraft.jsch.Session;
|
||||
|
||||
class SshSession {
|
||||
public class SshSession {
|
||||
|
||||
private final TestAccount account;
|
||||
private Session session;
|
||||
|
||||
SshSession(TestAccount account) {
|
||||
public SshSession(TestAccount account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
String exec(String command) throws JSchException, IOException {
|
||||
public String exec(String command) throws JSchException, IOException {
|
||||
ChannelExec channel = (ChannelExec) getSession().openChannel("exec");
|
||||
try {
|
||||
channel.setCommand(command);
|
||||
@@ -47,7 +47,7 @@ class SshSession {
|
||||
}
|
||||
}
|
||||
|
||||
void close() {
|
||||
public void close() {
|
||||
if (session != null) {
|
||||
session.disconnect();
|
||||
session = null;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TestAccount {
|
||||
this.httpPassword = httpPassword;
|
||||
}
|
||||
|
||||
byte[] privateKey() {
|
||||
public byte[] privateKey() {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
sshKey.writePrivateKey(out);
|
||||
return out.toByteArray();
|
||||
|
||||
Reference in New Issue
Block a user