Related to issue 38888: Failing SS Build
authorMartin Taal <martin.taal@openbravo.com>
Sun, 02 Dec 2018 09:51:44 +0100
changeset 7933 6dc8cae483c3
parent 7932 0c08fffc7828
child 7934 be4fe54c2e0f
Related to issue 38888: Failing SS Build
Log outgoing batches which are not synced
src-test/org/openbravo/test/mobile/retail/multiserver/MultiserverUtils.java
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/MultiserverUtils.java	Sat Dec 01 22:11:24 2018 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/MultiserverUtils.java	Sun Dec 02 09:51:44 2018 +0100
@@ -29,6 +29,7 @@
 import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperInsertUpdateOrDelete;
 import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperQuery;
 import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperSelect;
+import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperSelect.RecordsCount;
 import org.openbravo.test.mobile.retail.mobilecore.javascript.MobileCoreAPI;
 import org.openbravo.test.mobile.retail.pack.database.ServerType;
 import org.openqa.selenium.TimeoutException;
@@ -38,7 +39,7 @@
       .getPushPeriodMillis();
   private static final long routePeriodMillis = ConfigurationProperties.INSTANCE
       .getRoutePeriodMillis();
-  private static final long waitMillis = Math.max(25000,
+  private static final long waitMillis = Math.max(10000,
       (long) ((pushPeriodMillis + routePeriodMillis) * 1.2));
 
   public static void waitForCentralOutgoingSynced(ServerType storeServerType) {
@@ -64,7 +65,7 @@
       return;
     }
 
-    String toServerKey = "Central";
+    final String toServerKey;
     if (toServerType.equals(ServerType.STORE1)) {
       toServerKey = "Store1";
     } else if (toServerType.equals(ServerType.STORE2)) {
@@ -102,6 +103,28 @@
             isServerSynchronized.set(0, isSynchronized);
           }
         }.execute(sqlOutgoing, 1, fromServerType);
+
+        // log the records which are waiting
+        if (!isServerSynchronized.get(0)) {
+
+          final String sqlLogging = "select * from sym_outgoing_batch where node_id = '"
+              + toServerKey + "' and status not in ('OK', 'IG')";
+
+          new DatabaseHelperSelect() {
+            @Override
+            protected void yieldResultSet(final ResultSet rs) throws SQLException {
+              final String channelId = rs.getString("channel_id");
+              final String status = rs.getString("status");
+              final String summary = rs.getString("summary");
+              final String nodeId = rs.getString("node_id");
+              TestLogger.getLogger().info(
+                  "Outgoing batch data " + channelId + " - " + nodeId + " " + status + " "
+                      + summary);
+            }
+          }.execute(sqlLogging, 10000, false, fromServerType,
+              RecordsCount.LESS_OR_EQUAL_THAN_EXPECTED);
+
+        }
         return isServerSynchronized.get(0);
       }