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-10030 updated: IGNITE-10030: Change date, commit hash, and equals supported
Date Mon, 29 Oct 2018 11:10:32 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/ignite-10030 by this push:
     new 91ebebc  IGNITE-10030: Change date, commit hash, and equals supported
91ebebc is described below

commit 91ebebc2fb70c9f107aaa62fbbcb376b936eca4c
Author: Dmitriy Pavlov <dpavlov@apache.org>
AuthorDate: Mon Oct 29 14:10:30 2018 +0300

    IGNITE-10030: Change date, commit hash, and equals supported
---
 .../ignite/ci/di/scheduler/TcBotScheduler.java     |  2 +-
 .../ignite/ci/tcmodel/changes/ChangeRef.java       | 27 ++++++++++
 .../teamcity/ignited/change/ChangeCompacted.java   | 57 ++++++++++++++++++++--
 .../ignited/fatbuild/ProactiveFatBuildSync.java    |  2 +-
 .../src/test/resources/change2.xml                 |  2 +-
 5 files changed, 84 insertions(+), 6 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/scheduler/TcBotScheduler.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/scheduler/TcBotScheduler.java
index 045ea2a..c931b08 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/scheduler/TcBotScheduler.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/scheduler/TcBotScheduler.java
@@ -28,7 +28,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
 class TcBotScheduler implements IScheduler {
-    public static final int POOL_SIZE = 8;
+    public static final int POOL_SIZE = 10;
     /** Logger. */
     private static final Logger logger = LoggerFactory.getLogger(TcBotScheduler.class);
 
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/changes/ChangeRef.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/changes/ChangeRef.java
index 4d16034..21af700 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/changes/ChangeRef.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/changes/ChangeRef.java
@@ -17,14 +17,24 @@
 
 package org.apache.ignite.ci.tcmodel.changes;
 
+import com.google.common.base.Strings;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
 import org.apache.ignite.ci.db.Persisted;
 import org.apache.ignite.ci.tcmodel.result.AbstractRef;
 
+import static org.apache.ignite.ci.util.ExceptionUtil.propagateException;
+
 /**
  * Change short version.
  */
 @Persisted
+@XmlAccessorType(XmlAccessType.FIELD)
 public class ChangeRef extends AbstractRef {
     @XmlAttribute public String id;
     @XmlAttribute public String version;
@@ -36,6 +46,7 @@ public class ChangeRef extends AbstractRef {
     @XmlAttribute public String date;
     @XmlAttribute public String webUrl;
 
+
     @Override public String toString() {
         return "ChangeRef{" +
             "href='" + href + '\'' +
@@ -46,4 +57,20 @@ public class ChangeRef extends AbstractRef {
             ", webUrl='" + webUrl + '\'' +
             '}';
     }
+
+    /** Format local. */
+    @XmlTransient private static ThreadLocal<SimpleDateFormat> fmtLoc
+        = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyyMMdd'T'HHmmssZ"));
+
+    /**
+     *
+     */
+    public Long getDateTs() {
+        try {
+            return Strings.isNullOrEmpty(date) ? null : fmtLoc.get().parse(date).getTime();
+        }
+        catch (ParseException e) {
+            throw propagateException(e);
+        }
+    }
 }
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/change/ChangeCompacted.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/change/ChangeCompacted.java
index c9ebd38..616bc07 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/change/ChangeCompacted.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/change/ChangeCompacted.java
@@ -16,6 +16,10 @@
  */
 package org.apache.ignite.ci.teamcity.ignited.change;
 
+import com.google.common.base.Objects;
+import com.google.common.base.Strings;
+import javax.annotation.Nullable;
+import javax.xml.bind.DatatypeConverter;
 import org.apache.ignite.ci.analysis.IVersionedEntity;
 import org.apache.ignite.ci.db.Persisted;
 import org.apache.ignite.ci.tcmodel.changes.Change;
@@ -30,7 +34,7 @@ public class ChangeCompacted implements IVersionedEntity {
     private static final Logger logger = LoggerFactory.getLogger(FatBuildDao.class);
 
     /** Latest version. */
-    private static final int LATEST_VERSION = 1;
+    private static final int LATEST_VERSION = 3;
 
     /** Entity fields version. */
     @SuppressWarnings("FieldCanBeLocal")
@@ -45,6 +49,12 @@ public class ChangeCompacted implements IVersionedEntity {
     private int tcUserUsername = -1;
     private int tcUserFullname = -1;
 
+    /** Version: For Git revision, 20 bytes. */
+    @Nullable private byte[] version;
+
+    /** Date timestamp. */
+    private long date;
+
     public ChangeCompacted(IStringCompactor compactor, Change change) {
         id = compactor.getStringId(change.id);
         vcsUsername = compactor.getStringId(change.username);
@@ -52,13 +62,32 @@ public class ChangeCompacted implements IVersionedEntity {
         if (change.user != null) {
             try {
                 tcUserId = Integer.parseInt(change.user.id);
-            } catch (NumberFormatException e) {
-                logger.error("TC User id parse failed " + change.user.id, e);
+            }
+            catch (NumberFormatException e) {
+                logger.error("TC User id parse failed " + change.user.id + ":" + e.getMessage(),
e);
             }
             tcUserUsername = compactor.getStringId(change.user.username);
             tcUserFullname = compactor.getStringId(change.user.name);
         }
 
+        if (!Strings.isNullOrEmpty(change.version)) {
+            try {
+                version = DatatypeConverter.parseHexBinary(change.version);
+            }
+            catch (Exception e) {
+                logger.error("TC Change version parse failed " + change.version + ":" + e.getMessage(),
e);
+            }
+        }
+
+        try {
+            Long date = change.getDateTs();
+
+            this.date = date == null ? -1L : date;
+        }
+        catch (Exception e) {
+            logger.error("TC Change date parse failed " + change.date + ":" + e.getMessage(),
e);
+        }
+
     }
 
     public int id() {
@@ -86,4 +115,26 @@ public class ChangeCompacted implements IVersionedEntity {
     public String tcUserFullName(IStringCompactor compactor) {
         return compactor.getStringFromId(tcUserFullname);
     }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        if (o == null || getClass() != o.getClass())
+            return false;
+        ChangeCompacted compacted = (ChangeCompacted)o;
+        return _ver == compacted._ver &&
+            id == compacted.id &&
+            vcsUsername == compacted.vcsUsername &&
+            tcUserId == compacted.tcUserId &&
+            tcUserUsername == compacted.tcUserUsername &&
+            tcUserFullname == compacted.tcUserFullname &&
+            date == compacted.date &&
+            Objects.equal(version, compacted.version);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return Objects.hashCode(_ver, id, vcsUsername, tcUserId, tcUserUsername, tcUserFullname,
version, date);
+    }
 }
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/ProactiveFatBuildSync.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/ProactiveFatBuildSync.java
index b5c2c56..2f0a986 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/ProactiveFatBuildSync.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/ProactiveFatBuildSync.java
@@ -46,7 +46,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 public class ProactiveFatBuildSync {
-    public static final int FAT_BUILD_PROACTIVE_TASKS = 4;
+    public static final int FAT_BUILD_PROACTIVE_TASKS = 5;
 
     /** Logger. */
     private static final Logger logger = LoggerFactory.getLogger(ProactiveFatBuildSync.class);
diff --git a/ignite-tc-helper-web/src/test/resources/change2.xml b/ignite-tc-helper-web/src/test/resources/change2.xml
index 4b1b746..d81cfd7 100644
--- a/ignite-tc-helper-web/src/test/resources/change2.xml
+++ b/ignite-tc-helper-web/src/test/resources/change2.xml
@@ -1,7 +1,7 @@
 <!--https://ci.ignite.apache.org/app/rest/latest/changes/id:834837-->
 <change id="834837" version="584652293c8646d8a893eed1a2b2ae1a179a5d20" username="aplatonovv"
date="20181011T184228+0300" href="/app/rest/latest/changes/id:834837" webUrl="http://ci.ignite.apache.org/viewModification.html?modId=834837&amp;personal=false">
     <comment>
-        IGNITE-9726 Prevent the whole suite lockup after GridCacheAbstractFailoverSelfTest
failure - Fixes #4859. Signed-off-by: Alexey Goncharuk <alexey.goncharuk@gmail.com>
+        IGNITE-9726 Prevent the whole suite lockup after GridCacheAbstractFailoverSelfTest
failure - Fixes #4859. Signed-off-by: Alexey Goncharuk &lt;alexey.goncharuk@gmail.com>
     </comment>
     <files count="2">
         <file before-revision="88df5ee607b23a30e051e9724dcd97b7e43aa6d6" after-revision="584652293c8646d8a893eed1a2b2ae1a179a5d20"
changeType="edited" file="modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java"
relative-file="modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java"/>


Mime
View raw message