PrincipalPolicyImporter implements ProtectedNodeImporter, ProtectedPropertyImporter, Constants { @Override public boolean init(@NotNull Session session, @NotNull Root root, @NotNull NamePathMapper namePathMapper, boolean isWorkspaceImport, int uuidBehavior, @NotNull ReferenceChangeTracker referenceTracker, @NotNull SecurityProvider securityProvider) { if (initialized) { throw new IllegalStateException("Already initialized"); } this.session = session; mgrProvider.reset(root, namePathMapper); filter = filterProvider.getFilter(mgrProvider.getSecurityProvider(), root, namePathMapper); authorizationConfiguration = securityProvider.getConfiguration(AuthorizationConfiguration.class); importBehavior = ImportBehavior.valueFromString(authorizationConfiguration.getParameters().getConfigValue(ProtectedItemImporter.PARAM_IMPORT_BEHAVIOR, ImportBehavior.NAME_ABORT)); initialized = true; return initialized; } PrincipalPolicyImporter(@NotNull FilterProvider filterProvider, @NotNull MgrProvider mgrProvider); @Override boolean init(@NotNull Session session, @NotNull Root root, @NotNull NamePathMapper namePathMapper, boolean isWorkspaceImport, int uuidBehavior, @NotNull ReferenceChangeTracker referenceTracker, @NotNull SecurityProvider securityProvider); @Override void processReferences(); @Override boolean handlePropInfo(@NotNull Tree parent, @NotNull PropInfo protectedPropInfo, @NotNull PropertyDefinition def); @Override void propertiesCompleted(@NotNull Tree protectedParent); @Override boolean start(@NotNull Tree protectedParent); @Override void end(@NotNull Tree protectedParent); @Override void startChildInfo(@NotNull NodeInfo childInfo, @NotNull List<PropInfo> propInfos); @Override void endChildInfo();  }
@Test public void testInitWorkspaceImport() { assertTrue(init(true, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW)); }
@Test public void testInitSessionImport() { assertTrue(init(false, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)); }
@Test(expected = IllegalStateException.class) public void testInitTwice() { assertTrue(init(true, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW)); init(false, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING); }