ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpav...@apache.org
Subject [ignite-teamcity-bot] branch ignite-9869 updated: IGNITE-9869: Bug fix for Running builds not uploaded into prefetched builds collection: fixed JAXB 2 roots problem
Date Fri, 12 Oct 2018 16:53:09 GMT
This is an automated email from the ASF dual-hosted git repository.

dpavlov pushed a commit to branch ignite-9869
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git


The following commit(s) were added to refs/heads/ignite-9869 by this push:
     new 0dc2427  IGNITE-9869: Bug fix for Running builds not uploaded into prefetched builds
collection: fixed JAXB 2 roots problem
0dc2427 is described below

commit 0dc242753fdbf0107bc5d07fc2ffe9f2daba22e6
Author: Dmitriy Pavlov <dpavlov@apache.org>
AuthorDate: Fri Oct 12 19:53:08 2018 +0300

    IGNITE-9869: Bug fix for Running builds not uploaded into prefetched builds collection:
fixed JAXB 2 roots problem
---
 .../apache/ignite/ci/tcmodel/hist/BuildRef.java    |  5 +---
 .../org/apache/ignite/ci/tcmodel/hist/Builds.java  | 15 ++++++++++
 .../ci/teamcity/pure/BuildHistoryEmulator.java     | 33 +++++++++++-----------
 3 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/hist/BuildRef.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/hist/BuildRef.java
index 58f196d..4ce62f7 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/hist/BuildRef.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/hist/BuildRef.java
@@ -18,12 +18,10 @@
 package org.apache.ignite.ci.tcmodel.hist;
 
 import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
-
-import com.google.common.base.Objects;
-import javax.xml.bind.annotation.XmlRootElement;
 import org.apache.ignite.ci.tcmodel.result.AbstractRef;
 
 /**
@@ -31,7 +29,6 @@ import org.apache.ignite.ci.tcmodel.result.AbstractRef;
  * short version involved in snapshot dependencies and into build history list
  */
 @XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "build")
 public class BuildRef extends AbstractRef {
     public static final String STATUS_UNKNOWN = "UNKNOWN";
     public static final String STATUS_SUCCESS = "SUCCESS";
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/hist/Builds.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/hist/Builds.java
index 82a76a5..0de40d5 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/hist/Builds.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/hist/Builds.java
@@ -32,6 +32,9 @@ public class Builds {
     @XmlAttribute
     private String nextHref;
 
+    @XmlAttribute
+    private Integer count;
+
     @XmlElement(name = "build")
     private List<BuildRef> builds;
 
@@ -42,4 +45,16 @@ public class Builds {
     public String nextHref() {
         return nextHref;
     }
+
+    public void count(int count) {
+        this.count = count;
+    }
+
+    public void nextHref(String nextHref) {
+        this.nextHref = nextHref;
+    }
+
+    public void builds(List<BuildRef> list) {
+        this.builds = list;
+    }
 }
diff --git a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/teamcity/pure/BuildHistoryEmulator.java
b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/teamcity/pure/BuildHistoryEmulator.java
index 20a3db7..d9d40be 100644
--- a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/teamcity/pure/BuildHistoryEmulator.java
+++ b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/teamcity/pure/BuildHistoryEmulator.java
@@ -19,10 +19,12 @@ package org.apache.ignite.ci.teamcity.pure;
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import javax.xml.bind.JAXBException;
 import org.apache.ignite.ci.tcmodel.hist.BuildRef;
+import org.apache.ignite.ci.tcmodel.hist.Builds;
 import org.apache.ignite.ci.util.XmlUtil;
 import org.jetbrains.annotations.Nullable;
 
@@ -50,39 +52,38 @@ public class BuildHistoryEmulator {
         if (totalRemained < 0)
             totalRemained = 0;
 
-        StringBuffer buf = new StringBuffer();
-
         int returnNow = Math.min(totalRemained, cnt);
 
         int nextStart = 0;
         if (totalBuilds > start + returnNow)
             nextStart = start + returnNow;
 
-        addXmlStart(cnt, buf, returnNow, nextStart);
+        Builds builds = createBuilds(cnt, returnNow, nextStart);
+        List<BuildRef> buildsList  = new ArrayList<>();
 
         for (int i = start; i < start + returnNow; i++)
-            buf.append(XmlUtil.save(sharedState.get(i)));
-
-        buf.append("</builds>");
+            buildsList.add(sharedState.get(i));
 
-        byte[] bytes = buf.toString().getBytes(UTF_8);
+        builds.builds(buildsList);
 
-        return new ByteArrayInputStream(bytes);
+        return new ByteArrayInputStream(XmlUtil.save(builds).getBytes(UTF_8));
     }
 
-    public void addXmlStart(int cnt, StringBuffer buf, int returnNow, int nextStart) {
-        buf.append("<builds count=" + "\"");
-        buf.append(returnNow);
-        buf.append("\"");
+    public Builds createBuilds(int cnt, int returnNow, int nextStart) {
+        Builds builds = new Builds();
+        builds.count(returnNow);
         if (nextStart > 0) {
-            buf.append(" nextHref=\"/app/rest/latest/builds?locator=defaultFilter:false,count:");
+            StringBuffer buf = new StringBuffer();
+            buf.append("/app/rest/latest/builds?locator=defaultFilter:false,count:");
             buf.append(cnt);
             buf.append(",start:");
             buf.append(nextStart);
-            buf.append("\"");
+
+            builds.nextHref(buf.toString());
         }
-        buf.append(">\n");
-        buf.append(" ");
+
+        return builds;
+
     }
 
     /**


Mime
View raw message