Package org.pentaho.platform.repository2.unified.jcr

Examples of org.pentaho.platform.repository2.unified.jcr.InheritDefaultAclHandlerTest


   * @param locale The locale to be deleted
   * @throws Exception containing the string, "SystemResource.GENERAL_ERROR"
   */
  public void doDeleteLocale( String pathId, String locale ) throws Exception {
    try {
      RepositoryFileDto file = getRepoWs().getFile( idToPath( pathId ) );
      if ( file != null ) {
        getRepoWs().deleteLocalePropertiesForFile( file.getId(), locale );
      }
    } catch ( Exception e ) {
      logger.error( Messages.getInstance().getString( "SystemResource.GENERAL_ERROR" ), e );
      throw e;
    }
View Full Code Here


  }

  @Test
  public void testSetContentCreator() throws Exception {
    String pathId = "pathId";
    RepositoryFileDto mockRepositoryFileDto = mock( RepositoryFileDto.class );

    doNothing().when( fileResource.fileService ).doSetContentCreator( pathId, mockRepositoryFileDto );

    Response mockOkResponse = mock( Response.class );
    doReturn( mockOkResponse ).when( fileResource ).buildOkResponse();
View Full Code Here

  }

  @Test
  public void testSetContentCreatorError() throws Exception {
    String pathId = "pathId";
    RepositoryFileDto mockRepositoryFileDto = mock( RepositoryFileDto.class );

    Response mockNotFoundResponse = mock( Response.class );
    doReturn( mockNotFoundResponse ).when( fileResource ).buildStatusResponse( NOT_FOUND );

    Response mockInternalServerErrorResponse = mock( Response.class );
View Full Code Here

   * not available
   * @throws FileNotFoundException
   */
  public void doMoveFiles( String destPathId, String params ) throws FileNotFoundException {
    String idToPath = idToPath( destPathId );
    RepositoryFileDto repositoryFileDto = getRepoWs().getFile( idToPath );
    if ( repositoryFileDto == null ) {
      throw new FileNotFoundException( idToPath );
    }
    String[] sourceFileIds = params.split( "[,]" );
    int i = 0;
    try {
      for ( ; i < sourceFileIds.length; i++ ) {
        getRepoWs().moveFile( sourceFileIds[ i ], repositoryFileDto.getPath(), null );
      }
    } catch ( IllegalArgumentException e ) {
      throw e;
    } catch ( Exception e ) {
      throw new InternalError();
View Full Code Here

    verify( fileResource, times( 1 ) ).buildServerErrorResponse( mockThrowable );
  }

  @Test
  public void testDoGetRootProperties() {
    RepositoryFileDto mockRepositoryFileDto = mock( RepositoryFileDto.class );
    doReturn( mockRepositoryFileDto ).when( fileResource.fileService ).doGetRootProperties();

    RepositoryFileDto testRepositoryFileDto = fileResource.doGetRootProperties();
    assertEquals( mockRepositoryFileDto, testRepositoryFileDto );

    verify( fileResource.fileService, times( 1 ) ).doGetRootProperties();
  }
View Full Code Here

  @Test
  public void testDoGetProperties() throws Exception {
    String pathId = "pathId";

    RepositoryFileDto mockRepositoryFileDto = mock( RepositoryFileDto.class );
    doReturn( mockRepositoryFileDto ).when( fileResource.fileService ).doGetProperties( pathId );

    RepositoryFileDto testDto = fileResource.doGetProperties( pathId );
    assertEquals( mockRepositoryFileDto, testDto );

    verify( fileResource.fileService, times( 1 ) ).doGetProperties( pathId );
  }
View Full Code Here

   * @param pathId (colon separated path for the repository file)
   * @param locale
   * @return
   */
  public List<StringKeyStringValueDto> doGetLocaleProperties( String pathId, String locale ) {
    RepositoryFileDto file = getRepoWs().getFile( idToPath( pathId ) );
    List<StringKeyStringValueDto> keyValueList = new ArrayList<StringKeyStringValueDto>();
    if ( file != null ) {
      PropertiesWrapper propertiesWrapper = getRepoWs().getLocalePropertiesForFileById( file.getId(), locale );
      if ( propertiesWrapper != null ) {
        Properties properties = propertiesWrapper.getProperties();
        if ( properties != null && !properties.isEmpty() ) {
          for ( String key : properties.stringPropertyNames() ) {
            keyValueList.add( getStringKeyStringValueDto( key, properties.getProperty( key ) ) );
View Full Code Here

    doThrow( mockFileNotFoundException ).when( fileResource.fileService ).doGetProperties( pathId );

    Messages mockMessages = mock( Messages.class );
    doReturn( mockMessages ).when( fileResource ).getMessagesInstance();

    RepositoryFileDto testDto = fileResource.doGetProperties( pathId );
    assertNull( testDto );

    verify( fileResource.fileService, times( 1 ) ).doGetProperties( pathId );
    verify( fileResource, times( 1 ) ).getMessagesInstance();
    verify( mockMessages, times( 1 ) ).getString( "SystemResource.GENERAL_ERROR" );
View Full Code Here

  @Test
  public void testDoGetContentCreator() throws Exception {
    String pathId = "pathId";

    RepositoryFileDto mockRepositoryFileDto = mock( RepositoryFileDto.class );
    doReturn( mockRepositoryFileDto ).when( fileResource.fileService ).doGetContentCreator( pathId );

    RepositoryFileDto testDto = fileResource.doGetContentCreator( pathId );
    assertEquals( mockRepositoryFileDto, testDto );

    verify( fileResource.fileService, times( 1 ) ).doGetContentCreator( pathId );
  }
View Full Code Here

    String pathId = "pathId";

    Throwable mockThrowable = mock( RuntimeException.class );
    doThrow( mockThrowable ).when( fileResource.fileService ).doGetContentCreator( pathId );

    RepositoryFileDto testDto = fileResource.doGetContentCreator( pathId );
    assertNull( testDto );

    verify( fileResource.fileService, times( 1 ) ).doGetContentCreator( pathId );
  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.repository2.unified.jcr.InheritDefaultAclHandlerTest

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.