Create the Java Runtime API client

Example 1

In this example,

Example 2

In this example, we stop Virtual Users in the population MyPopulationSmallCities and then we stop the test itself.

import com.neotys.rest.runtime.client.RuntimeAPIClient;
import com.neotys.rest.runtime.client.RuntimeAPIClientFactory;
import com.neotys.rest.runtime.model.Status;
import com.neotys.rest.runtime.model.StopTestParams;
import com.neotys.rest.runtime.model.StopVirtualUsersParams.StopVirtualUsersBuilder;

public class StopTestExample {
    public static void main(String[] args) throws Exception {
   	 final RuntimeAPIClient client = RuntimeAPIClientFactory.newClient("http://localhost:7400/Runtime/v1/Service.svc/");

   	 // make sure a test is running
   	 if (Status.TEST_RUNNING.equals(client.getStatus())) {
   		 int stopped = client.stopVirtualUsers(new StopVirtualUsersBuilder("MyPopulationSmallCities", 5).build());
   		 System.out.println(stopped + " users stopped");

   		 Thread.sleep(10000);
   		 client.stopTest(new StopTestParams.StopTestBuilder().forceStop(false).build());
   	 }
    }
}