Examples of GitServlet


Examples of org.eclipse.jgit.http.server.GitServlet

    final TestRepository<Repository> src = createTestRepository();
    final String srcName = src.getRepository().getDirectory().getName();

    ServletContextHandler app = server.addContext("/git");
    GitServlet gs = new GitServlet();
    gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
      public Repository open(HttpServletRequest req, String name)
          throws RepositoryNotFoundException,
          ServiceNotEnabledException {
        if (!name.equals(srcName))
          throw new RepositoryNotFoundException(name);
View Full Code Here

Examples of org.eclipse.jgit.http.server.GitServlet

    final TestRepository<Repository> src = createTestRepository();
    final String srcName = src.getRepository().getDirectory().getName();

    ServletContextHandler app = server.addContext("/git");
    GitServlet gs = new GitServlet();
    gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
      public Repository open(HttpServletRequest req, String name)
          throws RepositoryNotFoundException,
          ServiceNotEnabledException {
        if (!name.equals(srcName))
          throw new RepositoryNotFoundException(name);
View Full Code Here

Examples of org.eclipse.jgit.http.server.GitServlet

    final TestRepository<Repository> src = createTestRepository();
    final String srcName = src.getRepository().getDirectory().getName();

    ServletContextHandler app = server.addContext("/git");
    GitServlet gs = new GitServlet();
    gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
      public Repository open(HttpServletRequest req, String name)
          throws RepositoryNotFoundException,
          ServiceNotEnabledException {
        if (!name.equals(srcName))
          throw new RepositoryNotFoundException(name);

        final Repository db = src.getRepository();
        db.incrementOpen();
        return db;
      }
    });
    gs.setReceivePackFactory(new DefaultReceivePackFactory() {
      public ReceivePack create(HttpServletRequest req, Repository db)
          throws ServiceNotEnabledException,
          ServiceNotAuthorizedException {
        ReceivePack recv = super.create(req, db);
        recv.setPreReceiveHook(new PreReceiveHook() {
View Full Code Here

Examples of org.eclipse.jgit.http.server.GitServlet

    final TestRepository<Repository> src = createTestRepository();
    final String srcName = src.getRepository().getDirectory().getName();

    ServletContextHandler app = server.addContext("/git");
    GitServlet gs = new GitServlet();
    gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
      public Repository open(HttpServletRequest req, String name)
          throws RepositoryNotFoundException,
          ServiceNotEnabledException {
        if (!name.equals(srcName))
          throw new RepositoryNotFoundException(name);

        final Repository db = src.getRepository();
        db.incrementOpen();
        return db;
      }
    });
    gs.setReceivePackFactory(new DefaultReceivePackFactory() {
      public ReceivePack create(HttpServletRequest req, Repository db)
          throws ServiceNotEnabledException,
          ServiceNotAuthorizedException {
        ReceivePack rp = super.create(req, db);
        rp.sendError("message line 1");
View Full Code Here

Examples of org.eclipse.jgit.http.server.GitServlet

  public URIish getUri() {
    return uri;
  }

  private ServletContextHandler smart(final String path) {
    GitServlet gs = new GitServlet();
    gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
      public Repository open(HttpServletRequest req, String name)
          throws RepositoryNotFoundException,
          ServiceNotEnabledException {
        if (!name.equals(nameOf(db)))
          throw new RepositoryNotFoundException(name);
View Full Code Here

Examples of org.eclipse.jgit.http.server.GitServlet

    holder.setInitParameter("aliases", "true");
    return ctx;
  }

  private ServletContextHandler smart(final String path) {
    GitServlet gs = new GitServlet();
    gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
      public Repository open(HttpServletRequest req, String name)
          throws RepositoryNotFoundException,
          ServiceNotEnabledException {
        final Repository db = remoteRepository.getRepository();
        if (!name.equals(nameOf(db)))
View Full Code Here

Examples of org.eclipse.jgit.http.server.GitServlet

    }
  }

  @Test
  public void testDefaultConstructor_NoBasePath() throws Exception {
    GitServlet s = new GitServlet();
    try {
      s.init(new MockServletConfig());
      fail("Init did not crash due to missing parameter");
    } catch (ServletException e) {
      assertTrue(e.getMessage().contains("base-path"));
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.http.server.GitServlet

  public void testDefaultConstructor_WithBasePath() throws Exception {
    MockServletConfig c = new MockServletConfig();
    c.setInitParameter("base-path", ".");
    c.setInitParameter("export-all", "false");

    GitServlet s = new GitServlet();
    s.init(c);
    s.destroy();
  }
View Full Code Here

Examples of org.eclipse.jgit.http.server.GitServlet

    final TestRepository<Repository> src = createTestRepository();
    final String srcName = src.getRepository().getDirectory().getName();

    ServletContextHandler app = server.addContext("/git");
    GitServlet gs = new GitServlet();
    gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
      public Repository open(HttpServletRequest req, String name)
          throws RepositoryNotFoundException,
          ServiceNotEnabledException {
        if (!name.equals(srcName))
          throw new RepositoryNotFoundException(name);
View Full Code Here

Examples of org.eclipse.jgit.http.server.GitServlet

    final TestRepository<Repository> src = createTestRepository();
    final String srcName = src.getRepository().getDirectory().getName();

    ServletContextHandler app = server.addContext("/git");
    GitServlet gs = new GitServlet();
    gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
      public Repository open(HttpServletRequest req, String name)
          throws RepositoryNotFoundException,
          ServiceNotEnabledException {
        if (!name.equals(srcName))
          throw new RepositoryNotFoundException(name);

        final Repository db = src.getRepository();
        db.incrementOpen();
        return db;
      }
    });
    gs.setReceivePackFactory(new DefaultReceivePackFactory() {
      public ReceivePack create(HttpServletRequest req, Repository db)
          throws ServiceNotEnabledException,
          ServiceNotAuthorizedException {
        ReceivePack recv = super.create(req, db);
        recv.setPostReceiveHook(new PostReceiveHook() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.