Example usage for org.eclipse.jgit.transport Transport register

List of usage examples for org.eclipse.jgit.transport Transport register

Introduction

In this page you can find the example usage for org.eclipse.jgit.transport Transport register.

Prototype

public static void register(TransportProtocol proto) 

Source Link

Document

Register a TransportProtocol instance for use during open.

Usage

From source file:com.google.gerrit.acceptance.AbstractDaemonTest.java

License:Apache License

protected void beforeTest(Description description) throws Exception {
    GerritServer.Description classDesc = GerritServer.Description.forTestClass(description, configName);
    GerritServer.Description methodDesc = GerritServer.Description.forTestMethod(description, configName);

    baseConfig.setString("gerrit", null, "tempSiteDir", tempSiteDir.getRoot().getPath());
    if (classDesc.equals(methodDesc)) {
        if (commonServer == null) {
            commonServer = GerritServer.start(classDesc, baseConfig);
        }//from ww w .  ja  v a  2 s .c  o m
        server = commonServer;
    } else {
        server = GerritServer.start(methodDesc, baseConfig);
    }

    server.getTestInjector().injectMembers(this);
    Transport.register(inProcessProtocol);
    toClose = Collections.synchronizedList(new ArrayList<Repository>());
    admin = accounts.admin();
    user = accounts.user();

    // Evict cached user state in case tests modify it.
    accountCache.evict(admin.getId());
    accountCache.evict(user.getId());

    adminSession = new RestSession(server, admin);
    userSession = new RestSession(server, user);
    initSsh(admin);
    db = reviewDbProvider.open();
    Context ctx = newRequestContext(admin);
    atrScope.set(ctx);
    sshSession = ctx.getSession();
    sshSession.open();
    resourcePrefix = UNSAFE_PROJECT_NAME
            .matcher(description.getClassName() + "_" + description.getMethodName() + "_").replaceAll("");

    project = createProject(projectInput(description));
    testRepo = cloneProject(project, getCloneAsAccount(description));
}