JobEntrySparkSubmit extends JobEntryBase implements Cloneable, JobEntryInterface, JobEntryListener { @VisibleForTesting protected boolean validate() { boolean valid = true; if ( Const.isEmpty( scriptPath ) || !new File( environmentSubstitute( scriptPath ) ).exists() ) { logError( BaseMessages.getString( PKG, "JobEntrySparkSubmit.Error.SparkSubmitPathInvalid" ) ); valid = false; } if ( Const.isEmpty( master ) ) { logError( BaseMessages.getString( PKG, "JobEntrySparkSubmit.Error.MasterURLEmpty" ) ); valid = false; } if ( JOB_TYPE_JAVA_SCALA.equals( getJobType() ) ) { if ( Const.isEmpty( jar ) ) { logError( BaseMessages.getString( PKG, "JobEntrySparkSubmit.Error.JarPathEmpty" ) ); valid = false; } } else { if ( Const.isEmpty( pyFile ) ) { logError( BaseMessages.getString( PKG, "JobEntrySparkSubmit.Error.PyFilePathEmpty" ) ); valid = false; } } return valid; } JobEntrySparkSubmit( String n );  JobEntrySparkSubmit(); Object clone(); String getXML(); void loadXML( Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers, Repository rep,
                       IMetaStore metaStore ); void loadRep( Repository rep, IMetaStore metaStore, ObjectId id_jobentry, List<DatabaseMeta> databases,
                       List<SlaveServer> slaveServers ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ); String getScriptPath(); void setScriptPath( String scriptPath ); String getMaster(); void setMaster( String master ); List<String> getConfigParams(); void setConfigParams( List<String> configParams ); Map<String, String> getLibs(); void setLibs( Map<String, String> docs ); String getJar(); void setJar( String jar ); String getClassName(); void setClassName( String className ); String getArgs(); void setArgs( String args ); String getExecutorMemory(); void setExecutorMemory( String executorMemory ); String getDriverMemory(); void setDriverMemory( String driverMemory ); boolean isBlockExecution(); void setBlockExecution( boolean blockExecution ); String getJobType(); void setJobType( String jobType ); String getPyFile(); void setPyFile( String pyFile ); List<String> getCmds(); Result execute( Result result, int nr ); boolean evaluates(); @Override void check( List<CheckResultInterface> remarks, JobMeta jobMeta, VariableSpace space, Repository repository,
                     IMetaStore metaStore ); List<String> parseCommandLine( String commandLineString ); @Override void afterExecution( Job arg0, JobEntryCopy arg1, JobEntryInterface arg2, Result arg3 ); @Override void beforeExecution( Job arg0, JobEntryCopy arg1, JobEntryInterface arg2 ); static final String JOB_TYPE_JAVA_SCALA; static final String JOB_TYPE_PYTHON; static final String HADOOP_CLUSTER_PREFIX; }
@Test public void testValidate () { JobEntrySparkSubmit ss = spy( new JobEntrySparkSubmit() ); doNothing().when( ss ).logError( anyString() ); Assert.assertFalse( ss.validate() ); ss.setScriptPath( "." ); ss.setMaster( "" ); Assert.assertFalse( ss.validate() ); ss.setMaster( "master-url" ); Assert.assertFalse( "Jar path", ss.validate() ); ss.setJobType( JOB_TYPE_JAVA_SCALA ); Assert.assertFalse( "Jar path should not be empty", ss.validate() ); ss.setJar( "jar-path" ); Assert.assertTrue( "Validation should pass", ss.validate() ); ss.setJobType( JobEntrySparkSubmit.JOB_TYPE_PYTHON ); Assert.assertFalse( "Pyfile path should not be empty", ss.validate() ); ss.setPyFile( "pyfile-path" ); Assert.assertTrue( "Validation should pass", ss.validate() ); }