PentahoXml { public List<AclEntry> getDefaultAcls() { List<AclEntry> aclEntries = new ArrayList<>(); List<Node> nodes = document.selectNodes( ACL_ENTRY_XPATH ); for ( Node node : nodes ) { if ( node.getNodeType() == Node.ELEMENT_NODE ) { Element element = (Element) node; AclEntry aclEntry = new AclEntry(); aclEntry.setPrincipalName( element.attributeValue( "role" ) ); aclEntry.setPermission( element.attributeValue( "acl" ) ); aclEntries.add( aclEntry ); } } return aclEntries; } PentahoXml( File pentahoXmlFile );  PentahoXml( String xml );  PentahoXml( Document doc );  PentahoXml(); String getAuditDateFormat(); void setAuditDateFormat( String auditDateFormat ); String getAuditLogFile(); void setAuditLogFile( String auditLogFile ); String getAuditLogSeparator(); void setAuditLogSeparator( String auditLogSeparator ); String getDefaultParameterForm(); void setDefaultParameterForm( String defaultParameterForm ); String getLogFile(); void setLogFile( String logFile ); String getLogLevel(); void setLogLevel( String logLevel ); List<AclEntry> getDefaultAcls(); void setDefaultAcls( List<AclEntry> defaultAcls ); Integer getSolutionRepositoryCacheSize(); void setSolutionRepositoryCacheSize( Integer solutionReporitoryCacheSize ); String getAclFiles(); void setAclFiles( String fileExtensions ); String getAdminRole(); void setAdminRole( String role ); String getAnonymousUser(); void setAnonymousUser( String user ); String getAnonymousRole(); void setAnonymousRole( String role ); Document getDocument();  }
@Test public void testGetDefaultAcls() throws Exception { List<Node> nodes = new ArrayList<>(); DefaultElement e1 = mock( DefaultElement.class ); DefaultElement e2 = mock( DefaultElement.class ); when( e1.attributeValue( "role" ) ).thenReturn( "scrum master" ); when( e2.attributeValue( "role" ) ).thenReturn( "developer" ); when( e1.attributeValue( "acl" ) ).thenReturn( "read" ); when( e2.attributeValue( "acl" ) ).thenReturn( "execute" ); when( e1.getNodeType() ).thenReturn( Node.ELEMENT_NODE ); when( e2.getNodeType() ).thenReturn( Node.ELEMENT_NODE ); nodes.add( e1 ); nodes.add( e2 ); when( document.selectNodes( "pentaho-system/acl-publisher/default-acls/acl-entry" ) ).thenReturn( nodes ); List<AclEntry> defaultAcls = pentahoXml.getDefaultAcls(); assertNotNull( defaultAcls ); assertEquals( nodes.size(), defaultAcls.size() ); assertEquals( e1.attributeValue( "role" ), defaultAcls.get( 0 ).getPrincipalName() ); assertEquals( e2.attributeValue( "role" ), defaultAcls.get( 1 ).getPrincipalName() ); assertEquals( e1.attributeValue( "acl" ), defaultAcls.get( 0 ).getPermission() ); assertEquals( e2.attributeValue( "acl" ), defaultAcls.get( 1 ).getPermission() ); }