Skip to content

Commit

Permalink
Migrate archived flag from v1 repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
pfeuffer committed Dec 14, 2020
1 parent 0308660 commit 9bd881a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Expand Up @@ -175,6 +175,7 @@ private void update(V1Repository v1Repository) {
v1Repository.getContact(),
v1Repository.getDescription(),
createPermissions(v1Repository));
repository.setArchived(v1Repository.isArchived());
LOG.info("creating new repository {} from old repository {} in directory {}", repository, v1Repository.getName(), newPath);
repositoryDao.add(repository, newPath);
propertyStore.put(v1Repository.getId(), v1Repository.getProperties());
Expand Down
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package sonia.scm.update.repository;

import sonia.scm.repository.spi.ZippedRepositoryTestBase;
Expand Down Expand Up @@ -52,7 +52,7 @@ class V1RepositoryFileSystem {
* <id>c1597b4f-a9f0-49f7-ad1f-37d3aae1c55f</id>
* <name>some/more/directories/than/one</name>
* <public>false</public>
* <archived>false</archived>
* <archived>true</archived>
* <type>git</type>
* </repository>
* <repository>
Expand Down
Expand Up @@ -136,7 +136,19 @@ void shouldMapAttributes() throws JAXBException {
.get()
.hasFieldOrPropertyWithValue("type", "git")
.hasFieldOrPropertyWithValue("contact", "arthur@dent.uk")
.hasFieldOrPropertyWithValue("description", "A repository with two folders.");
.hasFieldOrPropertyWithValue("description", "A repository with two folders.")
.hasFieldOrPropertyWithValue("archived", false);
}

@Test
void shouldMapArchivedAttribute() throws JAXBException {
updateStep.doUpdate();

Optional<Repository> repository = findByNamespace("namespace-c1597b4f-a9f0-49f7-ad1f-37d3aae1c55f");

assertThat(repository)
.get()
.hasFieldOrPropertyWithValue("archived", true);
}

@Test
Expand Down
Binary file not shown.

0 comments on commit 9bd881a

Please sign in to comment.