Package org.eclipse.jgit.http.server.resolver

Examples of org.eclipse.jgit.http.server.resolver.FileResolver


  public void testNotAGitRepository() throws IOException,
      ServiceNotEnabledException {
    final Repository a = createBareRepository();
    final String name = a.getDirectory().getName() + "-not-a-git";
    final File base = a.getDirectory().getParentFile();
    FileResolver resolver = new FileResolver(base, false);

    try {
      resolver.open(null, name);
    } catch (RepositoryNotFoundException e) {
      assertEquals("repository not found: " + name, e.getMessage());

      Throwable why = e.getCause();
      assertNotNull("has cause", why);
View Full Code Here


    super.init(config);

    if (resolver == null) {
      final File root = getFile("base-path");
      final boolean exportAll = getBoolean("export-all");
      setRepositoryResolver(new FileResolver(root, exportAll));
    }

    initialized = true;

    if (uploadPackFactory != UploadPackFactory.DISABLED) {
View Full Code Here

      assertUnreasonable("C:/windows");
  }

  private void assertUnreasonable(String name)
      throws ServiceNotEnabledException {
    FileResolver r = new FileResolver(new File("."), false);
    try {
      r.open(null, name);
      fail("Opened unreasonable name \"" + name + "\"");
    } catch (RepositoryNotFoundException e) {
      assertEquals("repository not found: " + name, e.getMessage());
      assertNull("has no cause", e.getCause());
    }
View Full Code Here

  public void testExportOk() throws IOException {
    final Repository a = createBareRepository();
    final String name = a.getDirectory().getName();
    final File base = a.getDirectory().getParentFile();
    final File export = new File(a.getDirectory(), "git-daemon-export-ok");
    FileResolver resolver;

    assertFalse("no git-daemon-export-ok", export.exists());
    resolver = new FileResolver(base, false /* require flag */);
    try {
      resolver.open(null, name);
      fail("opened non-exported repository");
    } catch (ServiceNotEnabledException e) {
      assertEquals("Service not enabled", e.getMessage());
    }

    resolver = new FileResolver(base, true /* export all */);
    try {
      resolver.open(null, name).close();
    } catch (ServiceNotEnabledException e) {
      fail("did not honor export-all flag");
    }

    export.createNewFile();
    assertTrue("has git-daemon-export-ok", export.exists());
    resolver = new FileResolver(base, false /* require flag */);
    try {
      resolver.open(null, name).close();
    } catch (ServiceNotEnabledException e) {
      fail("did not honor git-daemon-export-ok");
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.http.server.resolver.FileResolver

Copyright © 2018 www.massapicom. 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.