Examples of IUnifiedRepository


Examples of org.pentaho.platform.api.repository2.unified.IUnifiedRepository

  public void testDatasourceNotFound() throws Exception {
    final String datasourceName = "not_here";
    final String dotKdb = ".kdb";
    final String fileName = datasourceName + dotKdb;
    final String databasesFolderPath = "/etc/pdi/databases";
    IUnifiedRepository repo = mock( IUnifiedRepository.class );
    // stub out get parent folder
    doReturn( new RepositoryFile.Builder( "123", "databases" ).folder( true ).build() ).when( repo ).getFile(
        databasesFolderPath );
    doReturn( reservedChars ).when( repo ).getReservedChars();
    // stub out get file not found
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.IUnifiedRepository

  @Test
  public void testGetDatasources() throws Exception {
    final String fileId = "456";
    final String databasesFolderPath = "/etc/pdi/databases";
    final String dotKdb = ".kdb";
    IUnifiedRepository repo = mock( IUnifiedRepository.class );
    // stub out get parent folder
    doReturn( new RepositoryFile.Builder( "123", "databases" ).folder( true ).build() ).when( repo ).getFile(
        databasesFolderPath );
    doReturn( reservedChars ).when( repo ).getReservedChars();
    // stub out get file to update
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.IUnifiedRepository

  private IDatasourceMgmtWebService datasourceMgmtWS;
  private IDatasourceMgmtService datasourceMgmtService;

  @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 GrantedAuthority[0] ) );
    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 GrantedAuthority[0] ) );

    KettleClientEnvironment.init();
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.IUnifiedRepository

  private IDatasourceMgmtService datasourceMgmtService;
  private IDatasourceMgmtWebService datasourceMgmtWebService;
  private DatabaseConnectionAdapter dbConnectionAdapter;

  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 GrantedAuthority[0] ) );
    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 GrantedAuthority[0] ) );

    KettleClientEnvironment.init();
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.IUnifiedRepository

  }

  private void sendEmail( Map<String, Object> actionParams, Map<String, Serializable> params, String filePath ) {
    try {
      IUnifiedRepository repo = PentahoSystem.get( IUnifiedRepository.class );
      RepositoryFile sourceFile = repo.getFile( filePath );
      // add metadata
      Map<String, Serializable> metadata = repo.getFileMetadata( sourceFile.getId() );
      String lineageId = (String) params.get( QuartzScheduler.RESERVEDMAPKEY_LINEAGE_ID );
      metadata.put( QuartzScheduler.RESERVEDMAPKEY_LINEAGE_ID, lineageId );
      repo.setFileMetadata( sourceFile.getId(), metadata );
      // send email
      SimpleRepositoryFileData data =
          repo.getDataForRead( sourceFile.getId(), SimpleRepositoryFileData.class );     
     
      // if email is setup and we have tos, then do it
      Emailer emailer = new Emailer();
      if ( !emailer.setup() ) {
        // email not configured
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.IUnifiedRepository

  public void testValidImportIndexLocaleFile() {
    String localeContent =
        "<index><name>My name</name><description>My descript</description><icon>samples.png</icon><visible>true</visible><display-type>icons</display-type></index>";
    RepositoryFileImportBundle importBundle = createBundle( localeContent, "index.xml" );

    IUnifiedRepository unifiedRepository = initLocaleHandler( importBundle );

    try {
      importer.importFile( importBundle );

      verify( unifiedRepository, times( 1 ) ).getFile( anyString() );
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.IUnifiedRepository

  public void testInValidImportIndexLocaleFile() {
    String localeContent =
        "<index><name>%name</name><description>%description</description><icon>samples.png</icon><visible>true</visible><display-type>icons</display-type></index>";
    RepositoryFileImportBundle importBundle = createBundle( localeContent, "index.xml" );

    IUnifiedRepository unifiedRepository = initLocaleHandler( importBundle );

    try {
      importer.importFile( importBundle );

      verify( unifiedRepository, times( 1 ) ).getFile( anyString() );
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.IUnifiedRepository

  @Test
  public void testImportNotLocaleFile() {
    String localeContent = "<index></display-type></index>";
    RepositoryFileImportBundle importBundle = createBundle( localeContent, "test.xml" );

    IUnifiedRepository unifiedRepository = initLocaleHandler( importBundle );

    try {
      importer.importFile( importBundle );

      verify( unifiedRepository, times( 1 ) ).getFile( anyString() );
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.IUnifiedRepository

    }

  }

  private IUnifiedRepository initLocaleHandler( RepositoryFileImportBundle importBundle ) {
    IUnifiedRepository unifiedRepository = mock( IUnifiedRepository.class );
    when( unifiedRepository.getFile( importBundle.getPath() ) ).thenReturn( importBundle.getFile() );
    LocaleImportHandler localeHandler = (LocaleImportHandler) importer.getHandlers().get( importBundle.getMimeType() );
    ReflectionTestUtils.setField( localeHandler, "unifiedRepository", unifiedRepository );
    return unifiedRepository;
  }
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.IUnifiedRepository

  @Test
  public void testWriteToPath() throws IOException {
    final String fileName = "test-file1.txt";
    final String filePath = publicDirPath + "/" + fileName;
    IUnifiedRepository repo = mock( IUnifiedRepository.class );
    RepositoryFile existingFile = new RepositoryFile.Builder( "123", fileName ).build();
    // simulate file already exists
    doReturn( existingFile ).when( repo ).getFile( filePath );
    mp.defineInstance( IUnifiedRepository.class, repo );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.