Search in sources :

Example 1 with JcrBackedDatasourceMgmtService

use of org.pentaho.platform.repository.JcrBackedDatasourceMgmtService in project pentaho-platform by pentaho.

the class DefaultDatasourceMgmtWebServiceTest method setUp.

public void setUp() throws Exception {
    IUnifiedRepository repository = new MockUnifiedRepository(new MockUnifiedRepository.SpringSecurityCurrentUserProvider());
    datasourceMgmtService = new JcrBackedDatasourceMgmtService(repository, new DatabaseDialectService());
    datasourceMgmtWebService = new DefaultDatasourceMgmtWebService(datasourceMgmtService);
    dbConnectionAdapter = new DatabaseConnectionAdapter();
    SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken(MockUnifiedRepository.root().getName(), null, new ArrayList<GrantedAuthority>()));
    repository.createFolder(repository.getFile("/etc").getId(), new RepositoryFile.Builder(FOLDER_PDI).folder(true).build(), new RepositoryFileAcl.Builder(MockUnifiedRepository.root()).ace(MockUnifiedRepository.everyone(), READ, WRITE).build(), null);
    repository.createFolder(repository.getFile("/etc/pdi").getId(), new RepositoryFile.Builder(FOLDER_DATABASES).folder(true).build(), null);
    SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken(EXP_LOGIN, null, new ArrayList<GrantedAuthority>()));
    KettleClientEnvironment.init();
}
Also used : ArrayList(java.util.ArrayList) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken) MockUnifiedRepository(org.pentaho.test.platform.repository2.unified.MockUnifiedRepository) DatabaseDialectService(org.pentaho.database.service.DatabaseDialectService) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) JcrBackedDatasourceMgmtService(org.pentaho.platform.repository.JcrBackedDatasourceMgmtService) RepositoryFileAcl(org.pentaho.platform.api.repository2.unified.RepositoryFileAcl) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository)

Example 2 with JcrBackedDatasourceMgmtService

use of org.pentaho.platform.repository.JcrBackedDatasourceMgmtService in project pentaho-platform by pentaho.

the class DatasourceMgmtToWebServiceAdapterTest method setUp.

@Override
protected void setUp() throws Exception {
    IUnifiedRepository repository = new MockUnifiedRepository(new MockUnifiedRepository.SpringSecurityCurrentUserProvider());
    datasourceMgmtService = new JcrBackedDatasourceMgmtService(repository, new DatabaseDialectService());
    datasourceMgmtWS = new DefaultDatasourceMgmtWebService(datasourceMgmtService);
    adapter = new DatasourceMgmtToWebServiceAdapter(datasourceMgmtWS);
    SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken(MockUnifiedRepository.root().getName(), null, new ArrayList<GrantedAuthority>()));
    repository.createFolder(repository.getFile("/etc").getId(), new RepositoryFile.Builder(FOLDER_PDI).folder(true).build(), new RepositoryFileAcl.Builder(MockUnifiedRepository.root()).ace(MockUnifiedRepository.everyone(), READ, WRITE).build(), null);
    repository.createFolder(repository.getFile("/etc/pdi").getId(), new RepositoryFile.Builder(FOLDER_DATABASES).folder(true).build(), null);
    SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken(EXP_LOGIN, null, new ArrayList<GrantedAuthority>()));
    KettleClientEnvironment.init();
}
Also used : ArrayList(java.util.ArrayList) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken) MockUnifiedRepository(org.pentaho.test.platform.repository2.unified.MockUnifiedRepository) DatabaseDialectService(org.pentaho.database.service.DatabaseDialectService) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) JcrBackedDatasourceMgmtService(org.pentaho.platform.repository.JcrBackedDatasourceMgmtService) RepositoryFileAcl(org.pentaho.platform.api.repository2.unified.RepositoryFileAcl) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository)

Aggregations

ArrayList (java.util.ArrayList)2 DatabaseDialectService (org.pentaho.database.service.DatabaseDialectService)2 IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)2 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)2 RepositoryFileAcl (org.pentaho.platform.api.repository2.unified.RepositoryFileAcl)2 JcrBackedDatasourceMgmtService (org.pentaho.platform.repository.JcrBackedDatasourceMgmtService)2 MockUnifiedRepository (org.pentaho.test.platform.repository2.unified.MockUnifiedRepository)2 UsernamePasswordAuthenticationToken (org.springframework.security.authentication.UsernamePasswordAuthenticationToken)2