Package org.pentaho.platform.api.repository2.unified

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


    final String mimeType = "text/plain";
    final SimpleRepositoryFileData content = new SimpleRepositoryFileData( dataStream, encoding, mimeType );
    RepositoryFile newFile1 =
        repo.createFile( publicFolder.getId(), new RepositoryFile.Builder( "helloworld.xaction" ).versioned( true )
            .hidden( true ).build(), content, null );
    root = repo.getTree( new RepositoryRequest( publicFolder.getPath(), true, -1, null ) );
    assertFalse( root.getChildren().isEmpty() );
    root = repo.getTree( new RepositoryRequest( publicFolder.getPath(), false, -1, null ) );
    assertTrue( root.getChildren().isEmpty() );
  }
View Full Code Here


    userRoleDao.createUser( tenantAcme, USERNAME_SUZY, PASSWORD, "", null );

    login( USERNAME_SUZY, tenantAcme, new String[] { tenantAuthenticatedRoleName } );

    final String rootFolderID = String.valueOf( repo.getFile( ClientRepositoryPaths.getRootFolderPath() ).getId() );
    List<RepositoryFile> children = repo.getChildren( new RepositoryRequest( rootFolderID, true, -1, null ) );
    assertEquals( 3, children.size() );

    ArrayList<String> checkFolders = new ArrayList<String>( Arrays.asList( new String[] { "public", "etc", "home" } ) );
    for ( RepositoryFile f0 : children ) {
      if ( checkFolders.contains( f0.getName() ) ) {
        checkFolders.remove( f0.getName() );
      } else {
        fail( "Unknown file present" );
      }
    }
    if ( checkFolders.size() != 0 ) {
      fail( "All root folders not present" );
    }
    children = repo.getChildren( new RepositoryRequest( rootFolderID, true, -1, null ) );
    assertEquals( 3, children.size() );
    children = repo.getChildren( new RepositoryRequest( rootFolderID, true, -1, "*" ) );
    assertEquals( 3, children.size() );
    children = repo.getChildren( new RepositoryRequest( rootFolderID, true, -1, "*me" ) );
    assertEquals( 1, children.size() );
    children = repo.getChildren( new RepositoryRequest( rootFolderID, true, -1, "*Z*" ) );
    assertEquals( 0, children.size() );
  }
View Full Code Here

    userRoleDao.createUser( tenantAcme, USERNAME_TIFFANY, PASSWORD, "", null );

    login( USERNAME_TIFFANY, tenantAcme, new String[] { tenantAuthenticatedRoleName } );

    List<RepositoryFile> children =
        repo.getChildren( new RepositoryRequest( String.valueOf( repo.getFile(
            ClientRepositoryPaths.getHomeFolderPath() ).getId() ), true, -1, null ) );
    assertEquals( 1, children.size() );
  }
View Full Code Here

  @Test
  public void testBlockoutWillFireError() throws Exception {
    JobScheduleRequest mockJobScheduleRequest = mock( JobScheduleRequest.class );

    UnifiedRepositoryException mockUnifiedRepositoryException = mock( UnifiedRepositoryException.class );

    SchedulerException mockSchedulerException = mock( SchedulerException.class );

    Response mockUnifiedRepositoryExceptionResponse = mock( Response.class );
    doReturn( mockUnifiedRepositoryExceptionResponse ).when( schedulerResource )
View Full Code Here

    // copy doesn't increase version number
    assertTrue( versionSummaries.size() >= 1 );
    assertEquals( USERNAME_SUZY, versionSummaries.get( 0 ).getAuthor() );

    logger.info( "getVersionSummary" );
    VersionSummary versionSummary = repo.getVersionSummary( file1.getId(), null );
    assertNotNull( versionSummary );
    assertNotNull( versionSummary.getId() );

    logger.info( "getFileAtVersion" );
    RepositoryFile file1AtVersion = repo.getFileAtVersion( file1.getId(), versionSummary.getId() );
    assertNotNull( file1AtVersion );
    assertEquals( versionSummary.getId(), file1AtVersion.getVersionId() );

    logger.info( "getTree" );
    RepositoryFileTree tree = repo.getTree( new RepositoryRequest( ClientRepositoryPaths.getRootFolderPath(), true, -1, null ) );
    assertNotNull( tree.getFile().getId() );
View Full Code Here

        RepositoryFile metadata =
          unifiedRepository.getFile( etcMondrian + RepositoryFile.SEPARATOR + catalogName + RepositoryFile.SEPARATOR
            + "metadata" ); //$NON-NLS-1$

        if ( metadata != null ) {
          DataNode metadataNode =
            unifiedRepository.getDataForRead( metadata.getId(), NodeRepositoryFileData.class ).getNode();
          String datasourceInfo = metadataNode.getProperty( "datasourceInfo" ).getString(); //$NON-NLS-1$
          String definition = metadataNode.getProperty( "definition" ).getString(); //$NON-NLS-1$

          datasourcesXML.append( "<Catalog name=\"" + encoder.encodeForXML( catalogName ) + "\">\n" ); //$NON-NLS-1$ //$NON-NLS-2$
          datasourcesXML
            .append( "<DataSourceInfo>" + encoder.encodeForXML( datasourceInfo ) + "</DataSourceInfo>\n" ); //$NON-NLS-1$ //$NON-NLS-2$
          datasourcesXML.append( "<Definition>" + encoder.encodeForXML( definition ) + "</Definition>\n" ); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

    final TimeZone defaultTimeZone = TimeZone.getDefault();
    final String DATE_PROPERTY = "date"; //$NON-NLS-1$

    NodeRepositoryFileDataAdapter adapter = new NodeRepositoryFileDataAdapter();
    Date date = new Date();
    DataNode node = new DataNode( "" ); //$NON-NLS-1$
    node.setProperty( DATE_PROPERTY, date );
    NodeRepositoryFileData data = new NodeRepositoryFileData( node );
    NodeRepositoryFileData result;

    // Convert using the provided locale
    try {
View Full Code Here

    logger.info( "getReservedChars" );
    assertFalse( repo.getReservedChars().isEmpty() );
  }

  private NodeRepositoryFileData makeNodeRepositoryFileData1() {
    DataNode node = new DataNode( "testNode" );
    node.setProperty( "prop1", "hello world" );
    node.setProperty( "prop2", false );
    node.setProperty( "prop3", 12L );
    return new NodeRepositoryFileData( node );
  }
View Full Code Here

    } finally {
      Locale.setDefault( defaultLocale );
      TimeZone.setDefault( defaultTimeZone );
    }

    DataProperty property = result.getNode().getProperty( DATE_PROPERTY );
    assertNotNull( property );
    assertEquals( date, property.getDate() );
  }
View Full Code Here

    NodeRepositoryFileDataAdapter adapter = new NodeRepositoryFileDataAdapter();
    Date date = new Date();
    DataNode node = new DataNode( "" ); //$NON-NLS-1$
    node.setProperty( DATE_PROPERTY, date );
    NodeRepositoryFileData data = new NodeRepositoryFileData( node );
    NodeRepositoryFileData result;

    // Convert using the provided locale
    try {
      Locale.setDefault( locale );
      TimeZone.setDefault( timeZone );
      NodeRepositoryFileDataDto dto = adapter.marshal( data );
      result = adapter.unmarshal( dto );
    } finally {
      Locale.setDefault( defaultLocale );
      TimeZone.setDefault( defaultTimeZone );
    }

    DataProperty property = result.getNode().getProperty( DATE_PROPERTY );
    assertNotNull( property );
    assertEquals( date, property.getDate() );
  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.repository2.unified.RepositoryRequest

Copyright © 2018 www.massapicom. 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.