Related to issue 38888: Failing SS Build
authorMartin Taal <martin.taal@openbravo.com>
Wed, 14 Nov 2018 21:34:15 +0100
changeset 7866 9e7bf0ccbcf7
parent 7865 bb0c03067197
child 7867 ae07248429ac
Related to issue 38888: Failing SS Build
Clear errors also from the central server database
src-test/org/openbravo/test/mobile/retail/multiserver/MultiserverUtils.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSCentralOfflineTerminalHelper.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSLAYVBSStore1TerminalHelper.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSStore1OfflineTerminalHelper.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSStore1TerminalHelper.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSStore2TerminalHelper.java
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/MultiserverUtils.java	Wed Nov 14 09:10:54 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/MultiserverUtils.java	Wed Nov 14 21:34:15 2018 +0100
@@ -167,6 +167,18 @@
     };
   }
 
+  public static void clearCentralServerErrors() {
+    new DatabaseHelperInsertUpdateOrDelete("delete the OBPOS_Errors records").execute(
+        "DELETE FROM obpos_errors CASCADE",
+        DatabaseHelperInsertUpdateOrDelete.UNKNOWN_AFFECTED_ROWS, ServerType.CENTRAL);
+    new DatabaseHelperInsertUpdateOrDelete("delete the OBMOBC_LOGCLIENT records").execute(
+        "TRUNCATE TABLE obmobc_logclient",
+        DatabaseHelperInsertUpdateOrDelete.UNKNOWN_AFFECTED_ROWS, ServerType.CENTRAL);
+    new DatabaseHelperInsertUpdateOrDelete("delete remaining Import Entry records").execute(
+        "DELETE FROM C_Import_Entry WHERE importstatus='Error' OR importstatus='Initial'",
+        DatabaseHelperInsertUpdateOrDelete.UNKNOWN_AFFECTED_ROWS, ServerType.CENTRAL);
+  }
+
   private static boolean isServerSynchronized(final ServerType serverType) {
     final String sqlIncomming = "SELECT COUNT(1) FROM (SELECT 1 FROM sym_data d LEFT JOIN sym_data_event de ON d.data_id = de.data_id WHERE de.data_id IS NULL) AS foo";
     // final String sqlIncomming =
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSCentralOfflineTerminalHelper.java	Wed Nov 14 09:10:54 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSCentralOfflineTerminalHelper.java	Wed Nov 14 21:34:15 2018 +0100
@@ -19,6 +19,7 @@
 
 package org.openbravo.test.mobile.retail.multiserver.selenium.terminals;
 
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.rules.TestRule;
 import org.junit.rules.Timeout;
@@ -29,6 +30,7 @@
 import org.openbravo.test.mobile.core.utils.TestLogger;
 import org.openbravo.test.mobile.retail.mobilecore.selenium.TestIdConstructor;
 import org.openbravo.test.mobile.retail.multiserver.MultiserverOfflineUtils;
+import org.openbravo.test.mobile.retail.multiserver.MultiserverUtils;
 import org.openbravo.test.mobile.retail.multiserver.selenium.TestIdMultiserver;
 
 public class WebPOSCentralOfflineTerminalHelper extends WebPOSStore1TerminalHelper {
@@ -44,6 +46,15 @@
   }
 
   /**
+   * Also remove all errors from the central server database
+   */
+  @Before
+  public void before() {
+    MultiserverUtils.clearCentralServerErrors();
+    super.before();
+  }
+
+  /**
    * Stop Apache to enable Offline Mode in central server
    */
   public void goCentralOffline() {
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSLAYVBSStore1TerminalHelper.java	Wed Nov 14 09:10:54 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSLAYVBSStore1TerminalHelper.java	Wed Nov 14 21:34:15 2018 +0100
@@ -1,6 +1,8 @@
 package org.openbravo.test.mobile.retail.multiserver.selenium.terminals;
 
+import org.junit.Before;
 import org.openbravo.test.mobile.retail.mobilecore.javascript.MobileCoreAPI;
+import org.openbravo.test.mobile.retail.multiserver.MultiserverUtils;
 import org.openbravo.test.mobile.retail.pack.database.ServerType;
 import org.openbravo.test.mobile.retail.pack.database.WebPOSDatabaseHelper;
 import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
@@ -26,6 +28,15 @@
 
   }
 
+  /**
+   * Also remove all errors from the central server database
+   */
+  @Before
+  public void before() {
+    MultiserverUtils.clearCentralServerErrors();
+    super.before();
+  }
+
   public ServerType getServerType() {
     return ServerType.STORE1;
   }
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSStore1OfflineTerminalHelper.java	Wed Nov 14 09:10:54 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSStore1OfflineTerminalHelper.java	Wed Nov 14 21:34:15 2018 +0100
@@ -19,7 +19,9 @@
 
 package org.openbravo.test.mobile.retail.multiserver.selenium.terminals;
 
+import org.junit.Before;
 import org.openbravo.test.mobile.retail.multiserver.MultiserverOfflineUtils;
+import org.openbravo.test.mobile.retail.multiserver.MultiserverUtils;
 
 public class WebPOSStore1OfflineTerminalHelper extends WebPOSStore1TerminalHelper {
 
@@ -32,4 +34,14 @@
   public void afterClass() {
     MultiserverOfflineUtils.startApache();
   }
+
+  /**
+   * Also remove all errors from the central server database
+   */
+  @Before
+  public void before() {
+    MultiserverUtils.clearCentralServerErrors();
+    super.before();
+  }
+
 }
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSStore1TerminalHelper.java	Wed Nov 14 09:10:54 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSStore1TerminalHelper.java	Wed Nov 14 21:34:15 2018 +0100
@@ -19,6 +19,7 @@
 
 package org.openbravo.test.mobile.retail.multiserver.selenium.terminals;
 
+import org.junit.Before;
 import org.openbravo.test.mobile.retail.mobilecore.javascript.MobileCoreAPI;
 import org.openbravo.test.mobile.retail.multiserver.MultiserverUtils;
 import org.openbravo.test.mobile.retail.pack.database.ServerType;
@@ -37,6 +38,15 @@
     super(DEFAULT_TERMINAL, DEFAULT_USER, DEFAULT_PASSWORD, ServerType.STORE1);
   }
 
+  /**
+   * Also remove all errors from the central server database
+   */
+  @Before
+  public void before() {
+    MultiserverUtils.clearCentralServerErrors();
+    super.before();
+  }
+
   @Override
   protected void activateTerminals() {
     MobileCoreAPI.activateTerminals(ServerType.CENTRAL);
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSStore2TerminalHelper.java	Wed Nov 14 09:10:54 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSStore2TerminalHelper.java	Wed Nov 14 21:34:15 2018 +0100
@@ -19,6 +19,7 @@
 
 package org.openbravo.test.mobile.retail.multiserver.selenium.terminals;
 
+import org.junit.Before;
 import org.openbravo.test.mobile.retail.mobilecore.javascript.MobileCoreAPI;
 import org.openbravo.test.mobile.retail.multiserver.MultiserverUtils;
 import org.openbravo.test.mobile.retail.pack.database.ServerType;
@@ -37,6 +38,15 @@
     super(DEFAULT_TERMINAL, DEFAULT_USER, DEFAULT_PASSWORD, ServerType.STORE2);
   }
 
+  /**
+   * Also remove all errors from the central server database
+   */
+  @Before
+  public void before() {
+    MultiserverUtils.clearCentralServerErrors();
+    super.before();
+  }
+
   @Override
   protected void activateTerminals() {
     MobileCoreAPI.activateTerminals(ServerType.CENTRAL);