@ VisibleForTesting protected Mesos startInternal ( ) { String version = System . getenv ( "MESOS_API_VERSION" ) ; if ( version == null ) { version = "V0" ; } LOGGER . info ( "Using Mesos API version: {}" , version ) ; if ( version . equals ( "V0" ) ) { if ( credential == null ) { return new V0Mesos ( this , frameworkInfo , master ) ; } else { return new V0Mesos ( this , frameworkInfo , master , credential ) ; } } else if ( version . equals ( "V1" ) ) { if ( credential == null ) { return new V1Mesos ( this , master ) ; } else { return new V1Mesos ( this , master , credential ) ; } } else { throw new IllegalArgumentException ( "Unsupported API version: " + version ) ; } }
Broken out into a separate function to allow testing with custom Mesos implementations .