Skip to content

Commit

Permalink
Make import path and behaviour configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
eschleb committed Dec 16, 2024
1 parent 1a75f56 commit 1181dd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import javax.jcr.ImportUUIDBehavior;

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@Inherited
Expand All @@ -18,6 +20,8 @@
String xml();
String repositoryId() default "magnolia";
boolean create() default false;
String path() default "/";
int importUUIDBehavior() default ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW;
}

@interface NodeTypesDefinition {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void load(final Class<?> testClass, final Repository repository) throws
repositoryManager.loadWorkspace(workspace.repositoryId(), workspace.name());
}
final Session session = repositoryManager.getSystemSession(workspace.name());
session.importXML("/", testClass.getResourceAsStream(workspace.xml()), ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
session.importXML(workspace.path(), testClass.getResourceAsStream(workspace.xml()), workspace.importUUIDBehavior());
session.save();
session.logout();
}
Expand Down

0 comments on commit 1181dd5

Please sign in to comment.