本文整理了Java中org.guvnor.structure.repositories.Branch.getName()
方法的一些代码示例,展示了Branch.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Branch.getName()
方法的具体详情如下:
包路径:org.guvnor.structure.repositories.Branch
类名称:Branch
方法名:getName
暂无
代码示例来源:origin: kiegroup/appformer
public void addBranch(final Branch branch) {
branches.put(branch.getName(),
branch);
}
}
代码示例来源:origin: org.kie.workbench/kie-wb-common-ala-ui-backend
private Collection<String> toBranchNames(final Collection<Branch> branches) {
final ArrayList<String> result = new ArrayList<>();
for (final Branch branch : branches) {
result.add(branch.getName());
}
return result;
}
}
代码示例来源:origin: kiegroup/appformer
private boolean hasBranchBeenRemoved(final Repository repository,
final String branchName) {
return !repository
.getBranches()
.stream()
.anyMatch(branch -> branch.getName().equals(branchName));
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-datasource-mgmt-client
@Override
protected DefExplorerQuery createRefreshQuery() {
return new DefExplorerQuery(activeOrganizationalUnit,
activeRepository,
activeModule,
activeRepository.getDefaultBranch().get().getName());
}
代码示例来源:origin: kiegroup/appformer
@Override
public void onNewRepositoryAdded(final Repository repository) {
addRepositoryItem(repository,
repository.getDefaultBranch().get().getName());
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-api
private Branch makeBranch(String branchName) {
final Branch branch = mock(Branch.class);
doReturn(branchName).when(branch).getName();
return branch;
}
}
代码示例来源:origin: kiegroup/appformer
public void onNewRepository(final @Observes NewRepositoryEvent event) {
final Repository newRepository = event.getNewRepository();
if (newRepository.getDefaultBranch().isPresent()) {
aliasBranch.put(newRepository.getAlias(),
newRepository.getDefaultBranch().get().getName());
}
for (final GuvnorStructureContextChangeHandler handler : handlers.values()) {
handler.onNewRepositoryAdded(newRepository);
}
}
代码示例来源:origin: org.uberfire/uberfire-project-backend
private Branch mockBranch(final String branchName) {
final Branch masterBranch = mock(Branch.class);
doReturn(branchName).when(masterBranch).getName();
return masterBranch;
}
代码示例来源:origin: kiegroup/appformer
private Branch mockBranch(final String branchName) {
final Branch masterBranch = mock(Branch.class);
doReturn(branchName).when(masterBranch).getName();
return masterBranch;
}
代码示例来源:origin: kiegroup/appformer
private void updateBranch(final Repository repository) {
if (!repository.getDefaultBranch().isPresent()) {
return;
}
final String branchName = aliasBranch.get(repository.getAlias());
if (branchName == null || hasBranchBeenRemoved(repository,
branchName)) {
aliasBranch.put(repository.getAlias(),
repository.getDefaultBranch().get().getName());
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@PostConstruct
public void setup() {
view.init(AddBranchPopUpPresenter.this);
project = libraryPlaces.getActiveWorkspace();
view.setBranches(project.getRepository().getBranches().stream().map(Branch::getName).sorted(SortHelper.ALPHABETICAL_ORDER_COMPARATOR).collect(Collectors.toList()));
view.setBranchFrom(project.getBranch().getName());
}
代码示例来源:origin: kiegroup/appformer
private void populateBranches(final String currentBranch) {
final ArrayList<Branch> branches = new ArrayList<>(repository.getBranches());
Collections.reverse(branches);
view.clearBranches();
for (Branch branch : branches) {
view.addBranch(branch.getName());
}
view.setSelectedBranch(currentBranch);
}
代码示例来源:origin: kiegroup/appformer
private void updateRepository(final Repository repository) {
if (!repository.getDefaultBranch().isPresent()) {
return;
}
if (isNewRepository(repository)) {
aliasBranch.put(repository.getAlias(),
repository.getDefaultBranch().get().getName());
} else {
updateBranch(repository);
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-backend
private void fireNewBranchEvent(final Path targetRoot,
final org.uberfire.java.nio.file.Path nioTargetRepositoryRoot) {
final Repository repository = repoService.getRepository(targetRoot);
final Optional<Branch> branch = repository.getBranch(Paths.convert(nioTargetRepositoryRoot.getRoot()));
if (branch.isPresent()) {
newBranchEvent.fire(new NewBranchEvent(repository,
branch.get().getName(),
sessionInfo.getIdentity()));
} else {
throw new IllegalStateException("Could not find a branch that was just created. The Path used was " + nioTargetRepositoryRoot.getRoot());
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@Test
public void testShowDeleteIfIsAbleTo() {
this.presenter.show(branch);
verify(this.view).show(eq(branch.getName()));
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@Test
public void newBranchCreatedByOtherUserShouldNotBeOpened() {
final User otherUser = mock(User.class);
when(otherUser.getIdentifier()).thenReturn("otherUser");
doReturn(false).when(libraryPlaces).isThisUserAccessingThisRepository(otherUser, repository);
presenter.newBranchEvent(new NewBranchEvent(repository, newBranch.getName(), otherUser));
verify(libraryPlaces, never()).goToProject(project, newBranch);
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@Before
public void setUp() {
when(libraryPlaces.getActiveWorkspace()).thenReturn(project);
when(project.getRepository().getDefaultBranch()).thenReturn(Optional.of(branch));
when(branch.getName()).thenReturn("myBranch");
presenter = spy(new DeleteBranchPopUpScreen(view,
new CallerMock<>(libraryService),
libraryPlaces));
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
public boolean userCanDeleteBranch(final WorkspaceProject project) {
return (userIsAtLeast(ContributorType.ADMIN, project.getRepository().getContributors())
|| userIsAtLeast(ContributorType.ADMIN, project.getOrganizationalUnit().getContributors())
|| userCanDeleteProject(project))
&& !project.getBranch().getName().equals("master");
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-api
@Test
public void lastBranchOpenedExists() {
final WorkspaceProject project = makeProject("space", "repo", "master");
final Branch masterBranch = makeBranch("master");
libraryInternalPreferences.setLastBranchOpened(project,
masterBranch);
assertEquals(masterBranch.getName(), libraryInternalPreferences.getLastBranchOpened(project).get().getName());
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@Test
public void newBranchCreatedByUserShouldBeOpened() {
doReturn(true).when(libraryPlaces).isThisUserAccessingThisRepository(user, repository);
presenter.newBranchEvent(new NewBranchEvent(repository, newBranch.getName(), user));
verify(libraryPlaces).goToProject(project, newBranch);
}
内容来源于网络,如有侵权,请联系作者删除!