Enable plugins to create config stores for repository config

Therefore we have to
- add an API to create stores for repository ids, not only for
  repositories,
- make v1 properties available in scm-core
- make sure that properties are extracted from repositories before the
  update step of a plugin runs (this is done by sorting the update steps
  in a way so that "core" update steps are executed before plugin update
  steps with the same version)
This commit is contained in:
René Pfeuffer
2019-06-20 16:12:16 +02:00
parent d3b65ac3bd
commit 9581bf946b
29 changed files with 220 additions and 66 deletions

View File

@@ -40,6 +40,7 @@ import org.junit.Ignore;
import org.junit.Test;
import sonia.scm.api.v2.resources.GitRepositoryConfigStoreProvider;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.Repository;
import sonia.scm.store.InMemoryConfigurationStoreFactory;
import java.io.IOException;
@@ -189,7 +190,7 @@ public class GitIncomingCommandTest
*/
private GitIncomingCommand createCommand()
{
return new GitIncomingCommand(handler, new GitContext(incomingDirectory, null, new GitRepositoryConfigStoreProvider(new InMemoryConfigurationStoreFactory())),
incomingRepository);
return new GitIncomingCommand(handler, new GitContext(incomingDirectory, incomingRepository, new GitRepositoryConfigStoreProvider(new InMemoryConfigurationStoreFactory())),
this.incomingRepository);
}
}

View File

@@ -40,6 +40,7 @@ import org.eclipse.jgit.revwalk.RevCommit;
import org.junit.Test;
import sonia.scm.api.v2.resources.GitRepositoryConfigStoreProvider;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.Repository;
import sonia.scm.store.InMemoryConfigurationStoreFactory;
import java.io.IOException;
@@ -160,7 +161,7 @@ public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
*/
private GitOutgoingCommand createCommand()
{
return new GitOutgoingCommand(handler, new GitContext(outgoingDirectory, null, new GitRepositoryConfigStoreProvider(new InMemoryConfigurationStoreFactory())),
return new GitOutgoingCommand(handler, new GitContext(outgoingDirectory, outgoingRepository, new GitRepositoryConfigStoreProvider(new InMemoryConfigurationStoreFactory())),
outgoingRepository);
}
}

View File

@@ -71,7 +71,7 @@ public class LfsBlobStoreFactoryTest {
// the return value (and should not be part of this test)
verify(blobStoreFactory).getStore(argThat(blobStoreParameters -> {
assertThat(blobStoreParameters.getName()).isEqualTo("the-id-git-lfs");
assertThat(blobStoreParameters.getRepository()).isEqualTo(repository);
assertThat(blobStoreParameters.getRepositoryId()).isEqualTo("the-id");
return true;
}));