Package org.pentaho.platform.repository2.unified.webservices.jaxws

Examples of org.pentaho.platform.repository2.unified.webservices.jaxws.DefaultUnifiedRepositoryJaxwsWebServiceTest


    }
    return stack;
  }

  private RepositoryFileDto getFile( FileName fullName ) throws FileSystemException {
    final RepositoryFileTreeDto tree = getTreeNode( fullName );
    if ( tree == null ) {
      throw new FileSystemException( FILE_NOT_FOUND, fullName );
    }
    return tree.getFile();
  }
View Full Code Here


    }
    return tree.getFile();
  }

  private List<RepositoryFileTreeDto> getChildNodes( final FileName fullName ) throws FileSystemException {
    final RepositoryFileTreeDto tree = getTreeNode( fullName );
    if ( tree == null ) {
      throw new FileSystemException( FILE_NOT_FOUND, fullName );
    }
    final List<RepositoryFileTreeDto> children = tree.getChildren();
    return children == null ? Collections.<RepositoryFileTreeDto>emptyList() : children;
  }
View Full Code Here

    final List<RepositoryFileTreeDto> children = getChildNodes( fullName );
    logger.debug( "size = " + children.size() );

    final String[] childrenArray = new String[ children.size() ];
    for ( int i = 0; i < children.size(); i++ ) {
      final RepositoryFileTreeDto treeNode = children.get( i );
      if ( treeNode != null ) {
        final RepositoryFileDto file = treeNode.getFile();
        if ( file != null ) {
          logger.debug( "file " + file.getName() );
          childrenArray[ i ] = file.getName();
        } else {
          throw new FileSystemException( NULL_OBJECT );
View Full Code Here

    config.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, true);
    Client client = Client.create(config);
    client.addFilter(new HTTPBasicAuthFilter("joe", "password"));

    final WebResource resource = client.resource(url + "/api/repo/files/children?depth=-1&filter=*");
    final RepositoryFileTreeDto tree = resource.path("").accept(MediaType.APPLICATION_XML_TYPE).get(RepositoryFileTreeDto.class);

    printDebugInfo(tree);

    final List<RepositoryFileTreeDto> children = tree.getChildren();
    for (int i = 0; i < children.size(); i++)
    {
      final RepositoryFileTreeDto child = children.get(i);
      printDebugInfo(child);
    }

/*
    final FileSystemOptions fileSystemOptions = new FileSystemOptions();
View Full Code Here

    repositoryFile.setVersionId( file.getVersionId() );
    return repositoryFile;
  }

  public static RepositoryFileTreeDto convertFromRepositoryFileTree( RepositoryFileTree tree ) {
    RepositoryFileTreeDto fileTreeDto = new RepositoryFileTreeDto();
    List<RepositoryFileTreeDto> fileList = new ArrayList<RepositoryFileTreeDto>();
    RepositoryFileDto file = convertFromRepositoryFile( tree.getFile() );
    fileTreeDto.setFile( file );
    for ( RepositoryFileTree treeItem : tree.getChildren() ) {
      fileList.add( convertFromRepositoryFileTree( treeItem ) );
    }
    fileTreeDto.setChildren( fileList );
    return fileTreeDto;
  }
View Full Code Here

    Integer depth = 0;
    String filter = "filter";
    Boolean showHidden = Boolean.TRUE;
    Boolean includeAcls = Boolean.TRUE;

    RepositoryFileTreeDto mockRepositoryFileTreeDto = mock( RepositoryFileTreeDto.class );
    doReturn( mockRepositoryFileTreeDto ).when( fileResource.fileService )
      .doGetTree( FileUtils.PATH_SEPARATOR, depth, filter, showHidden, includeAcls );

    RepositoryFileTreeDto testDto = fileResource.doGetRootTree( depth, filter, showHidden, includeAcls );
    assertEquals( mockRepositoryFileTreeDto, testDto );

    verify( fileResource.fileService, times( 1 ) )
      .doGetTree( FileUtils.PATH_SEPARATOR, depth, filter, showHidden, includeAcls );
  }
View Full Code Here

    Integer depth = 0;
    String filter = "filter";
    Boolean showHidden = Boolean.TRUE;
    Boolean includeAcls = Boolean.TRUE;

    RepositoryFileTreeDto mockRepositoryFileTreeDto = mock( RepositoryFileTreeDto.class );
    doReturn( mockRepositoryFileTreeDto ).when( fileResource.fileService ).doGetTree( pathId, depth, filter, showHidden,
      includeAcls );

    RepositoryFileTreeDto testDto = fileResource.doGetTree( pathId, depth, filter, showHidden, includeAcls );
    assertEquals( mockRepositoryFileTreeDto, testDto );

    verify( fileResource.fileService ).doGetTree( pathId, depth, filter, showHidden, includeAcls );
  }
View Full Code Here

    }

    RepositoryRequest repositoryRequest = getRepositoryRequest( path, showHidden, depth, filter );
    repositoryRequest.setIncludeAcls( includeAcls );

    RepositoryFileTreeDto tree = getRepoWs().getTreeFromRequest( repositoryRequest );
    List<RepositoryFileTreeDto> filteredChildren = new ArrayList<RepositoryFileTreeDto>();

    // BISERVER-9599 - Use special sort order
    if ( isShowingTitle( repositoryRequest ) ) {
      Collator collator = getCollatorInstance();
      collator.setStrength( Collator.PRIMARY ); // ignore case
      sortByLocaleTitle( collator, tree );
    }

    for ( RepositoryFileTreeDto child : tree.getChildren() ) {
      RepositoryFileDto file = child.getFile();
      Map<String, Serializable> fileMeta = getRepository().getFileMetadata( file.getId() );
      boolean isSystemFolder =
        fileMeta.containsKey( IUnifiedRepository.SYSTEM_FOLDER ) ? (Boolean) fileMeta
          .get( IUnifiedRepository.SYSTEM_FOLDER ) : false;
      if ( !isSystemFolder ) {
        filteredChildren.add( child );
      }
    }
    tree.setChildren( filteredChildren );

    return tree;
  }
View Full Code Here

          hasSchedulable = true;
          break;
        }
      }
      if ( !hasSchedulable ) {
        StringKeyStringValueDto schedPerm = new StringKeyStringValueDto( "_PERM_SCHEDULABLE", "true" );
        list.add( schedPerm );
      }

      // check file object for hidden value and add it to the list
      list.add( new StringKeyStringValueDto( "_PERM_HIDDEN", String.valueOf( file.isHidden() ) ) );
    }

    return list;
  }
View Full Code Here

      }
    };
  }

  public StringKeyStringValueDto getStringKeyStringValueDto( String key, String value ) {
    return new StringKeyStringValueDto( key, value );
  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.repository2.unified.webservices.jaxws.DefaultUnifiedRepositoryJaxwsWebServiceTest

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.