protected static List<RepositoryElementMetaInterface> loadRepositoryObjects( RepositoryDirectoryInterface dir,
      boolean getTransformations, boolean getJobs, Repository rep ) throws KettleDatabaseException {
    // Then show the transformations & jobs in that directory...
    List<RepositoryElementMetaInterface> repositoryObjects = new ArrayList<RepositoryElementMetaInterface>();
    if ( dir.getRepositoryObjects() == null ) {
      try {
        dir.setRepositoryObjects( rep.getJobAndTransformationObjects( dir.getObjectId(), false ) );
      } catch ( KettleException e ) {
        throw new KettleDatabaseException( e );
      }
    }

    List<RepositoryObjectType> allowedTypes = new ArrayList<>( 2 );
    if ( getTransformations ) {
      allowedTypes.add( RepositoryObjectType.TRANSFORMATION );
    }
    if ( getJobs ) {
      allowedTypes.add( RepositoryObjectType.JOB );
    }
    for ( RepositoryElementMetaInterface repoObject : dir.getRepositoryObjects() ) {
      if ( allowedTypes.contains( repoObject.getObjectType() ) ) {
        repositoryObjects.add( repoObject );
      }
    }
    return repositoryObjects;
  }
@Test
  public void testLoadRepositoryObjectsFilled() throws Exception {
    RepositoryDirectory root = new RepositoryDirectory();
    root.setObjectId( new LongObjectId( 0L ) );
    RepositoryDirectory dir = new RepositoryDirectory();
    dir.setObjectId( new LongObjectId( 1L ) );
    root.addSubdirectory( dir );
    RepositoryElementMetaInterface meta = mock( RepositoryElementMetaInterface.class );
    when( meta.getObjectType() ).thenReturn( RepositoryObjectType.TRANSFORMATION );

    root.setRepositoryObjects( Collections.emptyList() );
    dir.setRepositoryObjects( Collections.singletonList( meta ) );
    Repository repo = mock( Repository.class );

    assertTrue( RepositoryDirectoryUI.loadRepositoryObjects( root, true, true, repo ).isEmpty() );
    assertEquals( 1, RepositoryDirectoryUI.loadRepositoryObjects( dir, true, true, repo ).size() );

    verifyNoMoreInteractions( repo );
  }