|
@@ -34,8 +34,10 @@ import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
|
|
|
import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -50,6 +52,8 @@ public class ServiceClientTest extends ServiceClient {
|
|
|
private Service goodServiceStatus = buildLiveGoodService();
|
|
|
private boolean initialized;
|
|
|
private Set<String> expectedInstances = new HashSet<>();
|
|
|
+ private Map<String, ApplicationId> serviceAppId = new HashMap<>();
|
|
|
+
|
|
|
|
|
|
public ServiceClientTest() {
|
|
|
super();
|
|
@@ -83,7 +87,10 @@ public class ServiceClientTest extends ServiceClient {
|
|
|
public ApplicationId actionCreate(Service service) throws IOException {
|
|
|
ServiceApiUtil.validateAndResolveService(service,
|
|
|
new SliderFileSystem(conf), getConfig());
|
|
|
- return ApplicationId.newInstance(System.currentTimeMillis(), 1);
|
|
|
+ ApplicationId appId =
|
|
|
+ ApplicationId.newInstance(System.currentTimeMillis(), 1);
|
|
|
+ serviceAppId.put(service.getName(), appId);
|
|
|
+ return appId;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -99,6 +106,9 @@ public class ServiceClientTest extends ServiceClient {
|
|
|
public int actionStart(String serviceName)
|
|
|
throws YarnException, IOException {
|
|
|
if (serviceName != null && serviceName.equals("jenkins")) {
|
|
|
+ ApplicationId appId =
|
|
|
+ ApplicationId.newInstance(System.currentTimeMillis(), 1);
|
|
|
+ serviceAppId.put(serviceName, appId);
|
|
|
return EXIT_SUCCESS;
|
|
|
} else {
|
|
|
throw new ApplicationNotFoundException("");
|
|
@@ -207,4 +217,10 @@ public class ServiceClientTest extends ServiceClient {
|
|
|
comp.setContainers(containers);
|
|
|
return service;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public synchronized ApplicationId getAppId(String serviceName)
|
|
|
+ throws IOException, YarnException {
|
|
|
+ return serviceAppId.get(serviceName);
|
|
|
+ }
|
|
|
}
|