... | ... | @@ -70,7 +70,7 @@ public class JavaApp { |
|
|
}
|
|
|
```
|
|
|
|
|
|
It simply prints a new line every 100ms infinitely. Notice that the name "App2" is the name of the application registered in the Cameo server so that there is no link with the class name.
|
|
|
It simply prints a new line every 100 ms infinitely. Notice that the name "App2" is the name of the application registered in the Cameo server so that there is no link with the class name.
|
|
|
Moreover consider that the app is registered so that its standard output and error are streamed.
|
|
|
|
|
|
The application *App1* written in C++ has the following lines:
|
... | ... | @@ -244,6 +244,25 @@ server.start("App2", ["-debug", "true", "-timeout", "10"]); |
|
|
```
|
|
|
These arguments are set after the arguments defined into the configuration file.
|
|
|
|
|
|
# Application state
|
|
|
|
|
|
There are different ways to get the state of an app. We already saw that *waitFor()* returns a state which is the last state of the app execution. You can also get the states directly:
|
|
|
|
|
|
For example in C++:
|
|
|
```cpp
|
|
|
// Get the last execution state.
|
|
|
cameo::State state = app->getLastState();
|
|
|
|
|
|
// Get the actual state that can be NIL if the app is not executing anymore.
|
|
|
cameo::State state = app->getActualState();
|
|
|
|
|
|
// Get the past execution states, e.g. from RUNNING to SUCCESS.
|
|
|
std::set<cameo::State> states = app->getPastStates();
|
|
|
```
|
|
|
|
|
|
The call to *getLastState()* does not invoke a call on the Cameo server but only pulls all the states already received. If the app has terminated then it should be *SUCCESS*, *STOPPED*, *KILLED* or *FAILURE*.
|
|
|
However a call to *getActualState()* makes a request to the Cameo server i.e. it can fail if the server is not accessible anymore.
|
|
|
|
|
|
# Exit code
|
|
|
|
|
|
Sometimes we need to get the exit code of an app. It is possible to do it with the API as well as with the console. The APIs provide the *getExitCode()* function or method of the *Instance* class.
|
... | ... | |