Skip to content

Commit

Permalink
refactor + remove un-used code
Browse files Browse the repository at this point in the history
  • Loading branch information
phuthanhta committed Feb 2, 2018
1 parent 134c1d5 commit f8cab46
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Expand Up @@ -134,7 +134,7 @@ private static Long prepareTestSuite(Configuration configuration, String accessT
if (null == json) {
return -1L;
}
JSONArray containerPath = json.getJSONArray("containerPath");
JSONArray containerPath = json.optJSONArray("containerPath");
if (null == containerPath) {
return -1L;
}
Expand Down
Expand Up @@ -133,14 +133,17 @@ private void showInfo(PrintStream logger) {
if (!configuration.isSubmitToContainer()) {
LoggerUtils.formatInfo(logger, "With release: %s (id=%s).", configuration.getReleaseName(), configuration.getReleaseId());
} else {
JSONObject json = configuration.getContainerJSONObject();
JSONArray containerPath = json.getJSONArray("containerPath");
Long nodeId = 0L;
String nodeType = "N/A";
if (0 < containerPath.size()) {
nodeId = containerPath.getJSONObject(containerPath.size() - 1).getLong("nodeId");
nodeType = containerPath.getJSONObject(containerPath.size() - 1).getString("nodeType");
JSONObject json = configuration.getContainerJSONObject();
if (null != json) {
JSONArray containerPath = json.optJSONArray("containerPath");
if (null != containerPath && 0 < containerPath.size()) {
nodeId = containerPath.getJSONObject(containerPath.size() - 1).optLong("nodeId", 0L);
nodeType = containerPath.getJSONObject(containerPath.size() - 1).optString("nodeType", "");
}
}

LoggerUtils.formatInfo(logger, "With container: %s (id=%s, type=%s).",
json.getJSONObject("selectedContainer").getString("name"),
nodeId, nodeType);
Expand Down
Expand Up @@ -2,11 +2,9 @@

import com.qasymphony.ci.plugin.model.qtest.Container;
import com.qasymphony.ci.plugin.model.qtest.Setting;
import com.qasymphony.ci.plugin.utils.JsonUtils;
import hudson.Extension;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.DataBoundConstructor;
Expand Down

0 comments on commit f8cab46

Please sign in to comment.