コード例 #1
0
 public function itDeleteCorrespondingKeyWhenNoServer()
 {
     $gerrit_server_id = 7;
     $this->event->setParameters("{$gerrit_server_id}");
     stub($this->gerrit_server_factory)->getServerById()->throws(new Git_RemoteServer_NotFoundException($gerrit_server_id));
     $key = new Git_RemoteServer_Gerrit_ReplicationSSHKey();
     $key->setGerritHostId($gerrit_server_id)->setValue('');
     expect($this->ssh_key_dumper)->dumpSSHKeys($key)->once();
     $this->event->process();
 }
 public function process()
 {
     $server = $this->getServer();
     $replication_key = new Git_RemoteServer_Gerrit_ReplicationSSHKey();
     $replication_key->setGerritHostId($server->getId())->setValue($server->getReplicationKey());
     if ($this->ssh_key_dumper->dumpSSHKeys($replication_key)) {
         $this->done();
     } else {
         $this->error('Impossible to dump replication ssh key for Gerrit server ' . $server->getId());
     }
 }
コード例 #3
0
 public function getForRepository(GitRepository $repository)
 {
     $project = $repository->getProject();
     $repo_config = '';
     $repo_config .= $this->fetchConfigPermissions($project, $repository, Git::PERM_READ);
     $repo_config .= $this->formatPermission(Git::PERM_READ, $this->getMirrorUserNames($repository));
     if ($repository->isMigratedToGerrit()) {
         $key = new Git_RemoteServer_Gerrit_ReplicationSSHKey();
         $key->setGerritHostId($repository->getRemoteServerId());
         $repo_config .= $this->formatPermission(Git::PERM_WPLUS, array($key->getUserName()));
     } else {
         $repo_config .= $this->fetchConfigPermissions($project, $repository, Git::PERM_WRITE);
         $repo_config .= $this->fetchConfigPermissions($project, $repository, Git::PERM_WPLUS);
     }
     return $repo_config;
 }