Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.0.1 #340

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading