Example #1
0
  @Before
  public void setUp() throws Exception {
    util = new Util();
    load(
        "gerrit",
        "gerrit_common_test.pl",
        new AbstractModule() {
          @Override
          protected void configure() {
            Config cfg = new Config();
            cfg.setInt("rules", null, "reductionLimit", 1300);
            cfg.setInt("rules", null, "compileReductionLimit", (int) 1e6);
            bind(PrologEnvironment.Args.class)
                .toInstance(new PrologEnvironment.Args(null, null, null, null, null, null, cfg));
          }
        });

    local = new ProjectConfig(localKey);
    local.load(InMemoryRepositoryManager.newRepository(localKey));
    Q.setRefPatterns(Arrays.asList("refs/heads/develop"));

    local.getLabelSections().put(V.getName(), V);
    local.getLabelSections().put(Q.getName(), Q);
    util.add(local);
    allow(local, LABEL + V.getName(), -1, +1, SystemGroupBackend.REGISTERED_USERS, "refs/heads/*");
    allow(
        local,
        LABEL + Q.getName(),
        -1,
        +1,
        SystemGroupBackend.REGISTERED_USERS,
        "refs/heads/master");
  }
 protected TestRepository<Repo> createProject(String name) throws Exception {
   gApi.projects().create(name).get();
   return new TestRepository<>(repoManager.openRepository(new Project.NameKey(name)));
 }