Class ExternalSutController
- All Implemented Interfaces:
CustomizationHandler,SutHandler
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidbootingSut(boolean bootingSut) specify whether the SUT is booting (ie starting up), or not.final List<org.evomaster.client.java.instrumentation.AdditionalInfo>abstract Stringorg.evomaster.client.java.controller.api.dto.BootTimeInfoDtofinal Stringabstract String[]final voidgetJvmDtoSchema(List<String> dtoNames) abstract String[]abstract Stringabstract longabstract Stringfinal List<org.evomaster.client.java.instrumentation.TargetInfo>getTargetInfos(Collection<Integer> ids, boolean fullyCovered, boolean descriptiveIds) final org.evomaster.client.java.controller.api.dto.UnitsInfoDtointfinal booleanfinal booleanCheck if bytecode instrumentation is on.a customized interface to implement for checking if the system under test is started.final booleanCheck if the system under test (SUT) is running and fully initializedfinal voidnewActionSpecificHandler(org.evomaster.client.java.controller.api.dto.ActionDto dto) final voidnewScheduleActionSpecificHandler(org.evomaster.client.java.controller.api.dto.problem.rpc.ScheduleTaskInvocationDto dto) final voidRe-initialize all internal data to enable a completely new search phase which should be independent from previous onesfinal voidabstract voidThis method is going to be called after the SUT is started.abstract voidpostStop()If the SUT needs some third-party processes (eg a non-embedded database), here we can shut them down once the SUT has been stopped.abstract voidpreStart()If the SUT needs some third-party processes (eg a non-embedded database), here they can be configured and started.abstract voidpreStop()This method is going to be called before the SUT is stopped.final voidsetExecutingAction(boolean executingAction) final voidsetExecutingInitMongo(boolean executingInitMongo) final voidsetExecutingInitRedis(boolean executingInitRedis) final voidsetExecutingInitSql(boolean executingInitSql) final voidsetInstrumentation(boolean instrumentation) final ExternalSutControllerfinal ExternalSutControllersetJavaCommand(String command) final voidsetKillSwitch(boolean b) final voidsetNeedsJdk17Options(boolean needsJdk17Options) Unfortunately, the use of --add-opens in JDK 17+ has broken many things... :( If you are using JDK 17 or above, you must set this to truefinal voidThere might be different settings based on when the SUT is run during the search of EvoMaster, and when it is later started in the generated tests.protected voidstartExternalProcessPrinter(boolean checkSutInitializedWithLog) final StringstartSut()Start a new instance of the SUT.final voidstopSut()Stop the SUT.Methods inherited from class org.evomaster.client.java.controller.internal.SutController
addSuccessfulInitSqlInsertion, addTableToInserted, categorizeBasedOnResponse, cleanAccessedTables, computeExtraHeuristics, computeMongoHeuristics, computeOpenSearchHeuristics, computeRedisHeuristics, customizeMockingDatabase, customizeMockingRPCExternalService, customizeRPCTestOutput, customizeScheduleTaskInvocation, deriveObjectParameterData, doEmploySmartDbClean, enableComputeSqlHeuristicsOrExtractExecution, execInsertionsIntoDatabase, execInsertionsIntoMongoDatabase, execInsertionsIntoRedisDatabase, executeAction, executeHandleLocalAuthenticationSetup, executeRPCEndpoint, extractRPCProblemDto, extractRPCSchema, extractSqlDbSchemaAndConstraints, getActionIndex, getBootTimeInfoDto, getConnection, getConnectionIfExist, getControllerHost, getControllerPort, getControllerServerPort, getCustomizedValueInRequests, getDatabaseDriverName, getExceptionImportanceLevels, getExtraHeuristics, getInfoForAuthentication, getLocalAuthSetupSchemaMap, getPackagePrefixesToCover, getPreferredOutputFormat, getProblemInfo, getRPCClient, getRPCSchema, getSqlDatabaseSchema, getUnitsInfoDto, handleSeededTests, initMongoHandler, initOpenSearchHandler, initRedisHandler, initSqlHandler, invokeScheduleTasks, invokeScheduleTaskWithCustomizedHandling, isScheduleTaskCompleted, mockDatabasesWithCustomizedHandling, mockRPCExternalServicesWithCustomizedHandling, newAction, newScheduleAction, newTest, packagesToSkipInstrumentation, postSearchAction, readFileAsStringFromTestResource, registerOrExecuteInitSqlCommandsIfNeeded, registerOrExecuteInitSqlCommandsIfNeeded, resetCustomizedMethodForMockObject, resetDatabase, resetExtraHeuristics, seedRPCTests, setControllerHost, setControllerPort, specifyCustomizedNotNullAnnotation, startTheControllerServer, stopTheControllerServer, verifySqlConnectionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.evomaster.client.java.controller.SutHandler
getDbSpecifications, getMongoConnection, getOpenSearchConnection, getRedisConnection, handleLocalAuthenticationSetup, resetStateOfSUT
-
Field Details
-
PROP_MUTE_SUT
System property to avoid printing the console output of the SUT.- See Also:
-
process
-
-
Constructor Details
-
ExternalSutController
public ExternalSutController()
-
-
Method Details
-
setJaCoCo
public final ExternalSutController setJaCoCo(String jaCoCoAgentLocation, String jaCoCoCliLocation, String jaCoCoOutputFile, int port) -
getWaitingSecondsForIncomingConnection
public int getWaitingSecondsForIncomingConnection() -
setupForGeneratedTest
public final void setupForGeneratedTest()Description copied from interface:SutHandlerThere might be different settings based on when the SUT is run during the search of EvoMaster, and when it is later started in the generated tests. -
setNeedsJdk17Options
public final void setNeedsJdk17Options(boolean needsJdk17Options) Unfortunately, the use of --add-opens in JDK 17+ has broken many things... :( If you are using JDK 17 or above, you must set this to true- Parameters:
needsJdk17Options-
-
setInstrumentation
public final void setInstrumentation(boolean instrumentation) -
getInputParameters
- Returns:
- the input parameters with which the system under test should be started
-
getJVMParameters
- Returns:
- the JVM parameters (eg -X and -D) with which the system under test should be started
-
getBaseURL
- Returns:
- the base URL of the running SUT, eg "http://localhost:8080". Note: this value will likely depend on how getInputParameters() has been implemented
-
getPathToExecutableJar
- Returns:
- a String representing either a relative or absolute path to the where the JAR of the system under test is located
-
getLogMessageOfInitializedServer
- Returns:
- a string subtext that should be present in the logs (std output) of the system under test to check if the server is up and ready. If there is the need to do something more sophisticated to check if the SUT has started, then this method should be left returning null, and rather override the method isSUTInitialized()
-
isSUTInitialized
a customized interface to implement for checking if the system under test is started. by default (returning null), such check is performed based on messages in log.- Returns:
- Boolean representing if the system under test is up and ready.
-
getMaxAwaitForInitializationInSeconds
public abstract long getMaxAwaitForInitializationInSeconds()- Returns:
- how long (in seconds) we should wait at most to check if SUT is ready and initialized (this related to the getLogMessageOfInitializedServer() method)
-
preStart
public abstract void preStart()If the SUT needs some third-party processes (eg a non-embedded database), here they can be configured and started. This method is going to be called before we start the SUT. -
postStart
public abstract void postStart()This method is going to be called after the SUT is started. -
preStop
public abstract void preStop()This method is going to be called before the SUT is stopped. -
postStop
public abstract void postStop()If the SUT needs some third-party processes (eg a non-embedded database), here we can shut them down once the SUT has been stopped. -
setJavaCommand
-
startSut
Description copied from interface:SutHandlerStart a new instance of the SUT.
This method must be blocking until the SUT is initialized.
How this method is implemented depends on the library/framework in which the application is written. For example, in Spring applications you can use something like:
SpringApplication.run()- Returns:
- the base URL of the running SUT, eg "http://localhost:8080"
-
isSutRunning
public final boolean isSutRunning()Description copied from class:SutControllerCheck if the system under test (SUT) is running and fully initialized
How to implement this method depends on the library/framework used to build the application. In Spring applications, this can be done with something like:
ctx != null && ctx.isRunning(), wherectxis a field whereConfigurableApplicationContextshould be stored when starting the application.- Specified by:
isSutRunningin classSutController- Returns:
- true if the SUT is running
-
stopSut
public final void stopSut()Description copied from interface:SutHandlerStop the SUT.
How to implement this method depends on the library/framework in which the application is written. For example, in Spring applications you can save in a variable the
ConfigurableApplicationContextreturned when starting the application, and then callstop()on it here. -
isInstrumentationActivated
public final boolean isInstrumentationActivated()Description copied from class:SutControllerCheck if bytecode instrumentation is on.- Specified by:
isInstrumentationActivatedin classSutController- Returns:
- true if the instrumentation is on
-
isConnectedToServerController
public final boolean isConnectedToServerController() -
newSearch
public final void newSearch()Description copied from class:SutControllerRe-initialize all internal data to enable a completely new search phase which should be independent from previous ones- Specified by:
newSearchin classSutController
-
newTestSpecificHandler
public final void newTestSpecificHandler()- Specified by:
newTestSpecificHandlerin classSutController
-
getTargetInfos
public final List<org.evomaster.client.java.instrumentation.TargetInfo> getTargetInfos(Collection<Integer> ids, boolean fullyCovered, boolean descriptiveIds) - Specified by:
getTargetInfosin classSutController
-
getAdditionalInfoList
- Specified by:
getAdditionalInfoListin classSutController- Returns:
- additional info for each action in the test. The list is ordered based on the action index.
-
getBootTimeInfoDto
public org.evomaster.client.java.controller.api.dto.BootTimeInfoDto getBootTimeInfoDto()- Specified by:
getBootTimeInfoDtoin classSutController
-
newActionSpecificHandler
public final void newActionSpecificHandler(org.evomaster.client.java.controller.api.dto.ActionDto dto) - Specified by:
newActionSpecificHandlerin classSutController
-
newScheduleActionSpecificHandler
public final void newScheduleActionSpecificHandler(org.evomaster.client.java.controller.api.dto.problem.rpc.ScheduleTaskInvocationDto dto) - Specified by:
newScheduleActionSpecificHandlerin classSutController
-
getUnitsInfoDto
public final org.evomaster.client.java.controller.api.dto.UnitsInfoDto getUnitsInfoDto()- Specified by:
getUnitsInfoDtoin classSutController
-
setKillSwitch
public final void setKillSwitch(boolean b) - Specified by:
setKillSwitchin classSutController
-
setExecutingInitSql
public final void setExecutingInitSql(boolean executingInitSql) - Specified by:
setExecutingInitSqlin classSutController
-
setExecutingInitMongo
public final void setExecutingInitMongo(boolean executingInitMongo) - Specified by:
setExecutingInitMongoin classSutController
-
setExecutingInitRedis
public final void setExecutingInitRedis(boolean executingInitRedis) - Specified by:
setExecutingInitRedisin classSutController
-
setExecutingAction
public final void setExecutingAction(boolean executingAction) - Specified by:
setExecutingActionin classSutController
-
bootingSut
public final void bootingSut(boolean bootingSut) Description copied from class:SutControllerspecify whether the SUT is booting (ie starting up), or not. this is needed because we don't want to handle targets covered at startup during the fitness evaluations- Specified by:
bootingSutin classSutController
-
getExecutableFullPath
- Specified by:
getExecutableFullPathin classSutController
-
getJvmDtoSchema
- Specified by:
getJvmDtoSchemain classSutController
-
startExternalProcessPrinter
protected void startExternalProcessPrinter(boolean checkSutInitializedWithLog)
-