use of org.pentaho.platform.repository2.unified.IRepositoryFileAclDao in project pentaho-platform by pentaho.
the class JcrRepositoryFileDaoTest method setUp.
@Before
public void setUp() throws RepositoryException {
Node node = mock(Node.class);
Node nodeParent = mock(Node.class);
when(node.getIdentifier()).thenReturn("");
when(nodeParent.getIdentifier()).thenReturn("");
when(node.getParent()).thenReturn(nodeParent);
when(node.isNodeType("null:pentahoFile")).thenReturn(true);
when(node.isNodeType("null:pentahoVersionable")).thenReturn(true);
VersionManagerImpl versionManager = mock(VersionManagerImpl.class);
Workspace workspace = mock(Workspace.class);
when(workspace.getVersionManager()).thenReturn(versionManager);
Session session = mock(Session.class);
when(session.getWorkspace()).thenReturn(workspace);
when(session.getNodeByIdentifier(anyString())).thenReturn(node);
when(session.getItem(anyString())).thenReturn(node);
pentahoSession = mock(IPentahoSession.class);
PentahoSessionHolder.setSession(pentahoSession);
IRepositoryVersionManager repositoryVersionManager = mock(IRepositoryVersionManager.class);
when(repositoryVersionManager.isVersioningEnabled(anyString())).thenReturn(true);
PentahoSystem.registerObject(repositoryVersionManager);
JcrTemplate jcrTemplate = new JcrTemplate() {
@Override
public Object execute(JcrCallback callback) throws DataAccessException {
try {
return callback.doInJcr(session);
} catch (Exception e) {
// wrapping exception to comply overriding rules
throw new RuntimeException(e);
}
}
};
List<ITransformer<IRepositoryFileData>> transformerList = Collections.emptyList();
IPathConversionHelper pathConversionHelper = new DefaultPathConversionHelper();
IRepositoryFileAclDao aclDao = mock(IRepositoryFileAclDao.class);
accessVoterManager = mock(IRepositoryAccessVoterManager.class);
JcrRepositoryFileDao jcrDao = new JcrRepositoryFileDao(jcrTemplate, transformerList, null, null, pathConversionHelper, aclDao, null, accessVoterManager);
dao = spy(jcrDao);
}
Aggregations