You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2013/01/22 23:34:03 UTC

[1/3] git commit: ApiDiscovery: Fix response and service impl to make them test-able

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


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/179db40e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/179db40e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/179db40e

Branch: refs/heads/master
Commit: 179db40e3adfefbc4f5b77e260c6a8c7fe46b472
Parents: 45d21c3
Author: Rohit Yadav <bh...@apache.org>
Authored: Tue Jan 22 14:26:02 2013 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Tue Jan 22 14:28:30 2013 -0800

----------------------------------------------------------------------
 .../api/response/ApiDiscoveryResponse.java         |   16 +++++++++++++++
 .../discovery/ApiDiscoveryServiceImpl.java         |   12 ++++------
 2 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/179db40e/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java
----------------------------------------------------------------------
diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java
index de6a9f9..77484f0 100644
--- a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java
+++ b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java
@@ -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;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/179db40e/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
index f06e200..5ac2281 100644
--- a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
+++ b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
@@ -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) {