Skip to content

Commit

Permalink
Merge pull request #340 from xdev-software/develop
Browse files Browse the repository at this point in the history
v3.0.1
  • Loading branch information
JohannesRabauer authored Jan 7, 2025
2 parents fb515d0 + d07b527 commit a4a72e3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.0.1

* Fix for ExplicitMigrater without any scripts

## 3.0.0

* Added support for EclipseStore v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void migrate(final Object objectToMigrate)
objectToMigrate
);
// Update stored version, if needed
if(!versionAfterUpdate.equals(versionBeforeUpdate))
if(versionAfterUpdate != null && !versionAfterUpdate.equals(versionBeforeUpdate))
{
this.currentVersionSetter.accept(versionAfterUpdate);
this.currentVersionStorer.accept(versionAfterUpdate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,32 @@ void updateFromEmptyVersion(@TempDir final Path storageFolder)
}
}

@Test
void updateWithNoScripts(@TempDir final Path storageFolder)
{
// First run without any migration script
try(final EmbeddedStorageManager storageManager = this.startEmbeddedStorageManagerWithPath(storageFolder))
{
final EmptyVersionedRoot firstRoot = new EmptyVersionedRoot();
storageManager.setRoot(firstRoot);
storageManager.storeRoot();
assertNull(firstRoot.getVersion());
}

try(final EmbeddedStorageManager storageManager = this.startEmbeddedStorageManagerWithPath(storageFolder))
{
new MigrationManager(
(Versioned)storageManager.root(),
new ExplicitMigrater(),
storageManager
)
.migrate(storageManager.root());
@SuppressWarnings("unchecked")
final EmptyVersionedRoot currentRoot = (EmptyVersionedRoot)storageManager.root();
assertNull(currentRoot.getVersion());
}
}

private EmbeddedStorageManager startEmbeddedStorageManagerWithPath(final Path storageFolder)
{
return EmbeddedStorage.start(storageFolder);
Expand Down

0 comments on commit a4a72e3

Please sign in to comment.