PrincipalPolicyImporter implements ProtectedNodeImporter, ProtectedPropertyImporter, Constants { @Override public void startChildInfo(@NotNull NodeInfo childInfo, @NotNull List<PropInfo> propInfos) throws RepositoryException { checkState(policy != null); String ntName = getOakName(childInfo.getPrimaryTypeName()); if (NT_REP_PRINCIPAL_ENTRY.equals(ntName)) { if (entry != null) { throw new ConstraintViolationException("Invalid child node sequence: Entries must not be nested."); } entry = new Entry(propInfos); } else if (NT_REP_RESTRICTIONS.equals(ntName)) { if (entry == null) { throw new ConstraintViolationException("Invalid child node sequence: Restriction must be associated with an Entry"); } entry.addRestrictions(propInfos); } else { throw new ConstraintViolationException("Invalid child node '"+childInfo.getName()+"' with type " + ntName); } } 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(expected = IllegalStateException.class) public void testStartChildInfoWithoutPolicy() throws Exception { importer.startChildInfo(mock(NodeInfo.class), mock(List.class)); }