protected JobMeta processLinkedJobs( JobMeta jobMeta ) {
    for ( int i = 0; i < jobMeta.nrJobEntries(); i++ ) {
      JobEntryCopy jec = jobMeta.getJobEntry( i );
      if ( jec.getEntry() instanceof JobEntryJob ) {
        JobEntryJob jej = (JobEntryJob) jec.getEntry();
        ObjectLocationSpecificationMethod specMethod = jej.getSpecificationMethod();
        // If the reference is by filename, change it to Repository By Name. Otherwise it's fine so leave it alone
        if ( specMethod == ObjectLocationSpecificationMethod.FILENAME ) {
          jej.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME );
          String filename = jej.getFilename();
          // if the filename is a missing variable name, it will not contain a slash - we don't want to fail
          // ungracefully in this case, simply set the job name to the whole filename value and let the run-time
          // handle any exceptions that arise from this
          if ( filename != null ) {
            if ( filename.indexOf( "/" ) > -1 ) {
              String jobname = filename.substring( filename.lastIndexOf( "/" ) + 1, filename.lastIndexOf( '.' ) );
              String directory = filename.substring( 0, filename.lastIndexOf( "/" ) );
              jej.setJobName( jobname );
              jej.setDirectory( directory );
            } else {
              jej.setJobName( filename );
            }
          }
          jobMeta.setJobEntry( i, jec );
        }
      }
    }
    return jobMeta;
  }
@Test
  public void testProcessLinkedJobsWithFilename() {
    JobEntryJob jobJobExecutor = spy( new JobEntryJob() );
    jobJobExecutor.setFileName( "/path/to/Job1.kjb" );
    jobJobExecutor.setSpecificationMethod( ObjectLocationSpecificationMethod.FILENAME );
    JobEntryCopy jobEntry = mock( JobEntryCopy.class );
    when( jobEntry.getEntry() ).thenReturn( jobJobExecutor );

    JobMeta parent = mock( JobMeta.class );
    when( parent.nrJobEntries() ).thenReturn( 1 );
    when( parent.getJobEntry( 0 ) ).thenReturn( jobEntry );

    JobMeta result = jobFileListener.processLinkedJobs( parent );

    JobEntryCopy meta = result.getJobEntry( 0 );
    assertNotNull( meta );
    JobEntryJob resultExecMeta = (JobEntryJob) meta.getEntry();
    assertEquals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME, resultExecMeta.getSpecificationMethod() );
    assertEquals( resultExecMeta.getDirectory(), "/path/to" );
    assertEquals( resultExecMeta.getJobName(), "Job1" );
  }