use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserIT method followAnotherBranch.
@Test
public void followAnotherBranch() throws Exception {
Project.NameKey p = createProject("a");
Config cfg = new Config();
cfg.fromText("" + "[submodule \"a\"]\n" + "path = a\n" + "url = ssh://localhost/" + p.get() + "\n" + "branch = anotherbranch\n");
Branch.NameKey targetBranch = new Branch.NameKey(new Project.NameKey("project"), "master");
Set<SubmoduleSubscription> res = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch).parseAllSections();
Set<SubmoduleSubscription> expected = Sets.newHashSet(new SubmoduleSubscription(targetBranch, new Branch.NameKey(p, "anotherbranch"), "a"));
assertThat(res).containsExactlyElementsIn(expected);
}
use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserIT method withAnInvalidSection.
@Test
public void withAnInvalidSection() throws Exception {
Project.NameKey p1 = createProject("a");
Project.NameKey p2 = createProject("b");
Project.NameKey p3 = createProject("d");
Project.NameKey p4 = createProject("e");
Config cfg = new Config();
cfg.fromText("\n" + "[submodule \"a\"]\n" + " path = a\n" + " url = ssh://localhost/" + p1.get() + "\n" + " branch = .\n" + "[submodule \"b\"]\n" + // path missing
" url = http://localhost:80/" + p2.get() + "\n" + " branch = master\n" + "[submodule \"c\"]\n" + " path = c\n" + // url missing
" branch = .\n" + "[submodule \"d\"]\n" + " path = d-parent/the-d-folder\n" + " url = ssh://localhost/" + p3.get() + "\n" + // branch missing
"[submodule \"e\"]\n" + " path = e\n" + " url = ssh://localhost/" + p4.get() + "\n" + " branch = refs/heads/master\n");
Branch.NameKey targetBranch = new Branch.NameKey(new Project.NameKey("project"), "master");
Set<SubmoduleSubscription> res = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch).parseAllSections();
Set<SubmoduleSubscription> expected = Sets.newHashSet(new SubmoduleSubscription(targetBranch, new Branch.NameKey(p1, "master"), "a"), new SubmoduleSubscription(targetBranch, new Branch.NameKey(p4, "master"), "e"));
assertThat(res).containsExactlyElementsIn(expected);
}
use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class SubmoduleSubscriptionsIT method subscriptionInheritACL.
@Test
public void subscriptionInheritACL() throws Exception {
createProjectWithPush("config-repo");
createProjectWithPush("config-repo2", new Project.NameKey(name("config-repo")));
TestRepository<?> superRepo = createProjectWithPush("super-project");
TestRepository<?> subRepo = createProjectWithPush("subscribed-to-project", new Project.NameKey(name("config-repo2")));
allowMatchingSubmoduleSubscription("config-repo", "refs/heads/*", "super-project", "refs/heads/*");
pushChangeTo(subRepo, "master");
createSubmoduleSubscription(superRepo, "master", "subscribed-to-project", "master");
ObjectId subHEAD = pushChangeTo(subRepo, "master");
expectToHaveSubmoduleState(superRepo, "master", "subscribed-to-project", subHEAD);
}
use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class AbstractSubmit method submitWholeTopicMultipleBranchesOnSameProject.
@Test
public void submitWholeTopicMultipleBranchesOnSameProject() throws Exception {
assume().that(isSubmitWholeTopicEnabled()).isTrue();
String topic = "test-topic";
// Create test project
String projectName = "project-a";
TestRepository<?> repoA = createProjectWithPush(projectName, null, getSubmitType());
RevCommit initialHead = getRemoteHead(new Project.NameKey(name(projectName)), "master");
// Create the dev branch on the test project
BranchInput in = new BranchInput();
in.revision = initialHead.name();
gApi.projects().name(name(projectName)).branch("dev").create(in);
// Create changes on master
PushOneCommit.Result change1 = createChange(repoA, "master", "Change 1", "a.txt", "content", topic);
PushOneCommit.Result change2 = createChange(repoA, "master", "Change 2", "b.txt", "content", topic);
// Create changes on dev
repoA.reset(initialHead);
PushOneCommit.Result change3 = createChange(repoA, "dev", "Change 3", "a.txt", "content", topic);
PushOneCommit.Result change4 = createChange(repoA, "dev", "Change 4", "b.txt", "content", topic);
approve(change1.getChangeId());
approve(change2.getChangeId());
approve(change3.getChangeId());
approve(change4.getChangeId());
submit(change4.getChangeId());
String expectedTopic = name(topic);
change1.assertChange(Change.Status.MERGED, expectedTopic, admin);
change2.assertChange(Change.Status.MERGED, expectedTopic, admin);
change3.assertChange(Change.Status.MERGED, expectedTopic, admin);
change4.assertChange(Change.Status.MERGED, expectedTopic, admin);
}
use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class AbstractSubmit method submitNoPermission.
@Test
public void submitNoPermission() throws Exception {
// create project where submit is blocked
Project.NameKey p = createProject("p");
block(p, "refs/*", Permission.SUBMIT, REGISTERED_USERS);
TestRepository<InMemoryRepository> repo = cloneProject(p, admin);
PushOneCommit push = pushFactory.create(db, admin.getIdent(), repo);
PushOneCommit.Result result = push.to("refs/for/master");
result.assertOkStatus();
submit(result.getChangeId(), new SubmitInput(), AuthException.class, "submit not permitted");
}
Aggregations