@Override
  public String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions,
    ResourceNamingInterface namingInterface, Repository repository, IMetaStore metaStore ) throws KettleException {
    // Try to load the transformation from repository or file.
    // Modify this recursively too...
    //
    // AGAIN: there is no need to clone this job entry because the caller is
    // responsible for this.
    //
    // First load the job meta data...
    //
    copyVariablesFrom( space ); // To make sure variables are available.
    JobMeta jobMeta = getJobMeta( repository, metaStore, space );

    // Also go down into the job and export the files there. (going down
    // recursively)
    //
    String proposedNewFilename =
      jobMeta.exportResources( jobMeta, definitions, namingInterface, repository, metaStore );

    // To get a relative path to it, we inject
    // ${Internal.Entry.Current.Directory}
    //
    String newFilename = "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}/" + proposedNewFilename;

    // Set the filename in the job
    //
    jobMeta.setFilename( newFilename );

    // exports always reside in the root directory, in case we want to turn this
    // into a file repository...
    //
    jobMeta.setRepositoryDirectory( new RepositoryDirectory() );

    // export to filename ALWAYS (this allows the exported XML to be executed remotely)
    //
    setSpecificationMethod( ObjectLocationSpecificationMethod.FILENAME );

    // change it in the job entry
    //
    filename = newFilename;

    return proposedNewFilename;
  }
@Test
  public void testExportResources() throws Exception {
    try ( MockedConstruction<JobMeta> jobMetaMockedConstruction = mockConstruction( JobMeta.class );
          MockedConstruction<CurrentDirectoryResolver> currentDirectoryResolverMockedConstruction = mockConstruction(
            CurrentDirectoryResolver.class, ( mock, context ) ->
            {
              doCallRealMethod().when( mock ).normalizeSlashes( anyString() );
              doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ),
                any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), anyString() );
            } ) ) {
      JobMeta meta = mock( JobMeta.class );
      JobEntryJob jej = getJej();
      jej.setDescription( JOB_ENTRY_DESCRIPTION );

      doReturn( meta ).when( jej ).getJobMeta(
        nullable( Repository.class ), nullable( IMetaStore.class ), nullable( VariableSpace.class ) );
      doReturn( JOB_ENTRY_JOB_NAME ).when( meta ).exportResources(
        nullable( JobMeta.class ), nullable( Map.class ), nullable( ResourceNamingInterface.class ),
        nullable( Repository.class ), nullable( IMetaStore.class ) );

      jej.exportResources( null, null, null, null, null );

      verify( meta ).setFilename( "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}/" + JOB_ENTRY_JOB_NAME );
      verify( jej ).setSpecificationMethod( ObjectLocationSpecificationMethod.FILENAME );
    }
  }