ApiDiscovery: Fix response and service impl to make them test-able

This commit is contained in:
Rohit Yadav 2013-01-22 14:26:02 -08:00
parent 45d21c3202
commit 179db40e3a
2 changed files with 21 additions and 7 deletions

View File

@ -57,18 +57,34 @@ public class ApiDiscoveryResponse extends BaseResponse {
this.name = name;
}
public String getName() {
return name;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
public void setSince(String since) {
this.since = since;
}
public String getSince() {
return since;
}
public void setAsync(Boolean isAsync) {
this.isAsync = isAsync;
}
public boolean getAsync() {
return isAsync;
}
public String getRelated() {
return related;
}

View File

@ -58,18 +58,16 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
if (s_apiNameDiscoveryResponseMap == null) {
long startTime = System.nanoTime();
s_apiNameDiscoveryResponseMap = new HashMap<String, ApiDiscoveryResponse>();
cacheResponseMap();
//TODO: Fix and use PluggableService to get the classes
Set<Class<?>> cmdClasses = ReflectUtil.getClassesWithAnnotation(APICommand.class,
new String[]{"org.apache.cloudstack.api", "com.cloud.api"});
cacheResponseMap(cmdClasses);
long endTime = System.nanoTime();
s_logger.info("Api Discovery Service: Annotation, docstrings, api relation graph processed in " + (endTime - startTime) / 1000000.0 + " ms");
}
}
private void cacheResponseMap() {
Set<Class<?>> cmdClasses = ReflectUtil.getClassesWithAnnotation(APICommand.class,
new String[]{"org.apache.cloudstack.api", "com.cloud.api"});
//TODO: Fix and use PluggableService to get the classes
protected void cacheResponseMap(Set<Class<?>> cmdClasses) {
Map<String, List<String>> responseApiNameListMap = new HashMap<String, List<String>>();
for (Class<?> cmdClass : cmdClasses) {