org.guvnor.structure.repositories.Repository.getBranchRoot()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中org.guvnor.structure.repositories.Repository.getBranchRoot方法的一些代码示例,展示了Repository.getBranchRoot的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.getBranchRoot方法的具体详情如下:
包路径:org.guvnor.structure.repositories.Repository
类名称:Repository
方法名:getBranchRoot

Repository.getBranchRoot介绍

暂无

代码示例

代码示例来源:origin: org.guvnor/guvnor-structure-backend

public void add(final Repository repository) {
  repositoriesByAlias.put(repository.getAlias(),
              repository);
  if (repository instanceof GitRepository &&
      repository.getBranches() != null) {
    for (String branch : repository.getBranches()) {
      repositoriesByBranchRoot.put(repository.getBranchRoot(branch),
                     repository);
    }
  } else {
    repositoriesByBranchRoot.put(repository.getRoot(),
                   repository);
  }
}

代码示例来源:origin: org.guvnor/guvnor-asset-mgmt-backend

public RepositoryStructureModel load(final Repository repository,
                   final String branch,
                   final boolean includeModules) {
  if (repository == null) {
    return null;
  }
  final Project project = projectService.resolveToParentProject(repository.getBranchRoot(branch));
  if (project != null) {
    return getModel(repository,
            includeModules,
            project);
  } else {
    return getModel(repository,
            branch);
  }
}

代码示例来源:origin: org.uberfire/uberfire-asset-mgmt-backend

public RepositoryStructureModel load(final Repository repository,
                   final String branch,
                   final boolean includeModules) {
  if (repository == null) {
    return null;
  }
  final Project project = projectService.resolveToParentProject(repository.getBranchRoot(branch));
  if (project != null) {
    return getModel(repository,
            includeModules,
            project);
  } else {
    return getModel(repository,
            branch);
  }
}

代码示例来源:origin: org.guvnor/guvnor-rest-backend

private void whenProjectExists() {
  when(repository.getDefaultBranch()).thenReturn("master");
  Path path = mock(Path.class);
  when(path.getFileName()).thenReturn("");
  when(path.toURI()).thenReturn("file://project/");
  when(repository.getBranchRoot("master")).thenReturn(path);
  when(projectService.resolveProject(any(Path.class))).thenReturn(mock(MyProject.class));
}

代码示例来源:origin: org.guvnor/guvnor-structure-client

@Override
public void addNewRepository(final Repository repository,
               final String branch) {
  final FSTreeItem repositoryRootItem = rootTreeItem.addItem(FSTreeItem.FSType.FOLDER,
                                repository.getAlias());
  repositoryRootItem.setUserObject(repository);
  repositoryRootItem.setState(FSTreeItem.State.OPEN,
                false,
                false);
  repositoryToTreeItemMap.put(repository,
                repositoryRootItem);
  presenter.loadDirectoryContent(new FileExplorerItem(repositoryRootItem),
                  repository.getBranchRoot(branch));
}

代码示例来源:origin: org.guvnor/guvnor-rest-backend

@Before
public void setUp() throws Exception {
  fileSystemProvider = new SimpleFileSystemProvider();
  final Repository repository = mock(Repository.class);
  when(repositoryService.getRepository("myRepository")).thenReturn(repository);
  when(repository.getDefaultBranch()).thenReturn("master");
  final Path root = fileSystemProvider.getPath(URI.create("default://master@myRepository/"));
  when(repository.getBranchRoot("master")).thenReturn(Paths.convert(root));
}

代码示例来源:origin: org.guvnor/guvnor-structure-backend

@Test
public void testLoadMultiBranch() throws Exception {
  final Repository single = configuredRepositories.getRepositoryByRepositoryAlias("multibranch");
  assertEquals(3,
         single.getBranches().size());
  assertNotNull(single.getBranchRoot("master"));
  assertNotNull(single.getBranchRoot("dev"));
  assertNotNull(single.getBranchRoot("release"));
}

代码示例来源:origin: org.guvnor/guvnor-rest-backend

@Test
public void projectDoesNotExist() throws Exception {
  when(repository.getDefaultBranch()).thenReturn("master");
  Path path = mock(Path.class);
  when(path.getFileName()).thenReturn("");
  when(path.toURI()).thenReturn("file://project/");
  when(repository.getBranchRoot("master")).thenReturn(path);
  final JobResult jobResult = helper.testProject(null,
                          "repositoryAlias",
                          "project");
  assertEquals(JobStatus.RESOURCE_NOT_EXIST,
         jobResult.getStatus());
}

代码示例来源:origin: org.jbpm/jbpm-console-ng-business-domain-backend

@Override
public void bootstrapProject( String repoAlias,
               String group,
               String artifact,
               String version ) {
  GAV gav = new GAV( group, artifact, version );
  try {
    Repository repository = repositoryService.getRepository( repoAlias );
    if ( repository != null ) {
      String projectLocation = repository.getUri() + ioService.getFileSystem( URI.create( repository.getUri() ) ).getSeparator() + artifact;
      if ( !ioService.exists( ioService.get( URI.create( projectLocation ) ) ) ) {
        projectService.newProject( repository.getBranchRoot( repository.getDefaultBranch() ),
                      new POM( gav ),
                      "/" );
      }
    } else {
      logger.error( "Repository " + repoAlias + " was not found, cannot add project" );
    }
  } catch ( Exception e ) {
    logger.error( "Unable to bootstrap project {} in repository {}", gav, repoAlias, e );
  }
}

代码示例来源:origin: org.guvnor/guvnor-structure-backend

@Test
public void testLoadSingle() throws Exception {
  final Repository single = configuredRepositories.getRepositoryByRepositoryAlias("single");
  assertEquals(1,
         single.getBranches().size());
  assertNotNull(single.getBranchRoot("master"));
}

代码示例来源:origin: org.guvnor/guvnor-project-backend

public Set<Project> getProjects(final Repository repository,
                String branch,
                boolean secure) {
  final Set<Project> authorizedProjects = new HashSet<Project>();
  if (repository == null) {
    return authorizedProjects;
  }
  final Path repositoryRoot = repository.getBranchRoot(branch);
  final DirectoryStream<org.uberfire.java.nio.file.Path> nioRepositoryPaths = ioService.newDirectoryStream(Paths.convert(repositoryRoot));
  try {
    for (org.uberfire.java.nio.file.Path nioRepositoryPath : nioRepositoryPaths) {
      if (Files.isDirectory(nioRepositoryPath)) {
        final org.uberfire.backend.vfs.Path projectPath = Paths.convert(nioRepositoryPath);
        final Project project = resourceResolver.resolveProject(projectPath);
        if (project != null) {
          if (!secure || authorizationManager.authorize(project,
                                 sessionInfo.getIdentity())) {
            POM projectPom = pomService.load(project.getPomXMLPath());
            project.setPom(projectPom);
            authorizedProjects.add(project);
          }
        }
      }
    }
  } finally {
    nioRepositoryPaths.close();
  }
  return authorizedProjects;
}

代码示例来源:origin: org.guvnor/guvnor-structure-backend

@Test
  public void testNewBranch() throws Exception {
    final Path branchPath = mock(Path.class);
    final NewBranchEvent changedEvent = new NewBranchEvent("single",
                                "mybranch",
                                branchPath,
                                System.currentTimeMillis());
    configuredRepositories.onNewBranch(changedEvent);

    // Root for both is the default root
    assertEquals(configuredRepositories.getRepositoryByRepositoryAlias("single").getRoot(),
           configuredRepositories.getRepositoryByRootPath(branchPath).getRoot());

    final Repository single = configuredRepositories.getRepositoryByRepositoryAlias("single");

    assertEquals(2,
           single.getBranches().size());

    assertEquals(branchPath,
           single.getBranchRoot("mybranch"));
  }
}

代码示例来源:origin: org.guvnor/guvnor-asset-mgmt-backend

final Project project = projectService.newProject(repository.getBranchRoot(repository.getDefaultBranch()),
                         pom,
                         baseUrl,

代码示例来源:origin: org.uberfire/uberfire-asset-mgmt-backend

final Project project = projectService.newProject(repository.getBranchRoot(repository.getDefaultBranch()),
                         pom,
                         baseUrl,

代码示例来源:origin: org.guvnor/guvnor-structure-backend

@Test
public void testRemoveMultiBranch() throws Exception {
  final Path devRoot = configuredRepositories.getRepositoryByRepositoryAlias("multibranch").getBranchRoot("dev");
  assertNotNull(configuredRepositories.getRepositoryByRootPath(devRoot));
  assertNotNull(configuredRepositories.remove("multibranch"));
  assertFalse(configuredRepositories.containsAlias("multibranch"));
  assertNull(configuredRepositories.getRepositoryByRootPath(devRoot));
}

相关文章