Related to issue 38888: Failing SS Build
authorMartin Taal <martin.taal@openbravo.com>
Thu, 06 Dec 2018 22:30:47 +0100
changeset 7960 753c3e04ce89
parent 7959 fbea92f79593
child 7961 a976ad871e11
Related to issue 38888: Failing SS Build
Added missing json files, do the correct check before central or store are bacck onlin
src-test/org/openbravo/test/mobile/retail/multiserver/MultiserverUtils.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMS008_RejectQuotations.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral003_CreateMultiorder.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral004_Cashup.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral005_Cashmanagement.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral006_LAWa010_CreateLayaway.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral008_RejectQuotations.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral009_MS020_ReturnServiceTests.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral010_I27476_SameDocumentNoAfterPayAndReload.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/store1/message-order-minimal-1.json
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/store1/message-order-multiline-1.json
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/MultiserverUtils.java	Wed Dec 05 13:44:48 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/MultiserverUtils.java	Thu Dec 06 22:30:47 2018 +0100
@@ -51,6 +51,7 @@
       (long) ((pushPeriodMillis + routePeriodMillis) * 1.2));
 
   public static void waitForCentralOutgoingSynced(ServerType storeServerType) {
+    checkForBatchesInError(ServerType.CENTRAL, storeServerType);
     waitForOutgoingSynced(waitMillis / 10, 10, ServerType.CENTRAL, storeServerType);
   }
 
@@ -64,6 +65,14 @@
     // wait for central to sync
     waitForOutgoingSynced(waitMillis, 10, ServerType.CENTRAL, storeServerType);
   }
+
+  public static void waitForStoreOutgoingSynchronization(final ServerType storeServerType) {
+    // first check so that we fail early
+    checkForBatchesInError(storeServerType, ServerType.CENTRAL);
+
+    // wait for the store to sync
+    waitForOutgoingSynced(waitMillis, 10, storeServerType, ServerType.CENTRAL);
+  }
   
   public static void waitForOutgoingSynced(final long interval, final int tries,
       final ServerType fromServerType, final ServerType toServerType) {
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMS008_RejectQuotations.java	Wed Dec 05 13:44:48 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMS008_RejectQuotations.java	Thu Dec 06 22:30:47 2018 +0100
@@ -65,8 +65,8 @@
     verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
 
     // go offline
+    MultiserverUtils.waitForSynchronization(getServerType());
     OBOfflineUtils.stopApache();
-    MultiserverUtils.waitForSynchronization(getServerType());
 
     // reject quotation 1
     loadQuotation(documentNo1);
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral003_CreateMultiorder.java	Wed Dec 05 13:44:48 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral003_CreateMultiorder.java	Thu Dec 06 22:30:47 2018 +0100
@@ -86,8 +86,9 @@
     WebPOSDatabaseHelper.verifyProcessedImportEntries(importCount + 2);
     verifyInDatabase(receiptNo1, receiptNo2, ServerType.STORE1);
 
+    MultiserverUtils.waitForCentralOutgoingSynced(getServerType());
+    MultiserverOfflineUtils.goCentralOnline();
     MultiserverUtils.waitForSynchronization(getServerType());
-    MultiserverOfflineUtils.goCentralOnline();
 
     verifyInDatabase(receiptNo1, receiptNo2, ServerType.CENTRAL);
 
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral004_Cashup.java	Wed Dec 05 13:44:48 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral004_Cashup.java	Thu Dec 06 22:30:47 2018 +0100
@@ -69,8 +69,9 @@
         ServerType.STORE1);
     WebPOSDatabaseHelper.verifyCashupTaxes(cashupId, new OBNumber("19.07"), 0, ServerType.STORE1);
 
+    MultiserverUtils.waitForCentralOutgoingSynced(getServerType());
+    MultiserverOfflineUtils.goCentralOnline();
     MultiserverUtils.waitForSynchronization(getServerType());
-    MultiserverOfflineUtils.goCentralOnline();
 
     // CENTRAL
     WebPOSDatabaseHelper.verifyInvoice(documentNo1, new OBNumber(GROSS), ServerType.CENTRAL);
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral005_Cashmanagement.java	Wed Dec 05 13:44:48 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral005_Cashmanagement.java	Thu Dec 06 22:30:47 2018 +0100
@@ -58,8 +58,9 @@
     verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
     verifytransactions(randomNumber, ServerType.STORE1);
 
+    MultiserverUtils.waitForCentralOutgoingSynced(getServerType());
+    MultiserverOfflineUtils.goCentralOnline();
     MultiserverUtils.waitForSynchronization(getServerType());
-    MultiserverOfflineUtils.goCentralOnline();
 
     verifytransactions(randomNumber, ServerType.CENTRAL);
 
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral006_LAWa010_CreateLayaway.java	Wed Dec 05 13:44:48 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral006_LAWa010_CreateLayaway.java	Thu Dec 06 22:30:47 2018 +0100
@@ -42,8 +42,9 @@
 
     getCOrderIdByDocumentNo(receiptNo, ServerType.STORE1);
 
+    MultiserverUtils.waitForCentralOutgoingSynced(getServerType());
+    MultiserverOfflineUtils.goCentralOnline();
     MultiserverUtils.waitForSynchronization(getServerType());
-    MultiserverOfflineUtils.goCentralOnline();
 
     getCOrderIdByDocumentNo(receiptNo, ServerType.CENTRAL);
   }
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral008_RejectQuotations.java	Wed Dec 05 13:44:48 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral008_RejectQuotations.java	Thu Dec 06 22:30:47 2018 +0100
@@ -50,7 +50,7 @@
     MultiserverUtils.waitForSynchronization(getServerType());
     // go offline
     goCentralOffline();
-    MultiserverUtils.waitForSynchronization(getServerType());
+    MultiserverUtils.waitForCentralOutgoingSynced(getServerType());
 
     // fake single offline to prevent checks on message table
     SequentialTestInfo.setIsOffline();
@@ -87,6 +87,7 @@
       // go online
       MultiserverUtils.waitForSynchronization(getServerType());
       MultiserverOfflineUtils.goCentralOnline();
+      MultiserverUtils.waitForSynchronization(getServerType());
 
       verifyRejected(documentNo2, "REJECT_2", ServerType.CENTRAL);
       verifyRejected(documentNo1, "REJECT_1", ServerType.CENTRAL);
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral009_MS020_ReturnServiceTests.java	Wed Dec 05 13:44:48 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral009_MS020_ReturnServiceTests.java	Thu Dec 06 22:30:47 2018 +0100
@@ -102,8 +102,9 @@
     WebPOSDatabaseHelper.getCOrderIdByDocumentNo(documentNo1, ServerType.STORE1);
     WebPOSDatabaseHelper.getCOrderIdByDocumentNo(documentNo2, ServerType.STORE1);
 
+    MultiserverUtils.waitForCentralOutgoingSynced(getServerType());
+    MultiserverOfflineUtils.goCentralOnline();
     MultiserverUtils.waitForSynchronization(getServerType());
-    MultiserverOfflineUtils.goCentralOnline();
 
     WebPOSDatabaseHelper.getCOrderIdByDocumentNo(documentNo1, ServerType.CENTRAL);
     WebPOSDatabaseHelper.getCOrderIdByDocumentNo(documentNo2, ServerType.CENTRAL);
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral010_I27476_SameDocumentNoAfterPayAndReload.java	Wed Dec 05 13:44:48 2018 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/offline/OfflineMSCentral010_I27476_SameDocumentNoAfterPayAndReload.java	Thu Dec 06 22:30:47 2018 +0100
@@ -36,8 +36,9 @@
     final String newDocumentno = String.format("%s/%07d", documentnoHeader[0], documentNumber);
     assertThat(BackboneHelper.getDocumentNo(), equalTo(newDocumentno));
 
+    MultiserverUtils.waitForCentralOutgoingSynced(getServerType());
+    MultiserverOfflineUtils.goCentralOnline();
     MultiserverUtils.waitForSynchronization(getServerType());
-    MultiserverOfflineUtils.goCentralOnline();
 
     assertThat(BackboneHelper.getDocumentNo(), equalTo(newDocumentno));
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/store1/message-order-minimal-1.json	Thu Dec 06 22:30:47 2018 +0100
@@ -0,0 +1,42 @@
+{
+    "messageId": "$messageId",
+    "posTerminal": "VBS-1",
+    "channel": "External",
+    "data": [{
+        "id": "$orderId",
+        "currency": "EUR",
+        "step": "all",
+        "grossAmount": 24.9,
+        "netAmount": 20.58,
+        "businessPartner": "VBS/C0001",
+        "lines": [{
+            "id": "$line0Id",
+            "product": "WVG/S0011",
+            "qty": 1,
+            "grossAmount": 24.9,
+            "netAmount": 20.58,
+            "taxAmount": 4.32,
+            "taxLines": {
+                "Entregas IVA 21%": {
+                    "rate": 21,
+                    "netAmount": 20.58,
+                    "taxAmount": 4.32
+                }
+             }
+        }],
+        "payments": [{
+            "paidAmount": 24.9,
+            "date": "2015-11-16T08:48:51.524Z",
+            "kind": "OBPOS_payment.cash",
+            "rate": "1",
+            "isocode": "EUR"
+        }],
+        "taxes": {
+            "Entregas IVA 21%": {
+                "rate": 21,
+                "netAmount": 20.58,
+                "taxAmount": 4.32
+            }
+        }
+    }]
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/tests/store1/message-order-multiline-1.json	Thu Dec 06 22:30:47 2018 +0100
@@ -0,0 +1,56 @@
+{
+    "messageId": "$messageId",
+    "posTerminal": "VBS-1",
+    "channel": "External",
+    "data": [{
+        "id": "$orderId",
+        "currency": "EUR",
+        "step": "all",
+        "grossAmount": 12.1,
+        "netAmount": 10.00,
+        "businessPartner": "VBS/C0001",
+        "lines": [{
+            "id": "$line0Id",
+            "product": "WVG/S0011",
+            "qty": 2,
+            "grossAmount": 6.05,
+            "netAmount": 5,
+            "taxAmount": 1.05,
+            "taxLines": {
+                "Entregas IVA 21%": {
+                    "rate": 21,
+                    "netAmount": 5,
+                    "taxAmount": 1.05
+                }
+             }
+        },{
+            "id": "$line1Id",
+            "product": "WVG/B0017",
+            "qty": 2,
+            "grossAmount": 6.05,
+            "netAmount": 5.0,
+            "taxAmount": 1.05,
+            "taxLines": {
+                "Entregas IVA 21%": {
+                    "rate": 21,
+                    "netAmount": 5,
+                    "taxAmount": 1.05
+                }
+             }
+        }],
+        "payments": [{
+            "paidAmount": 12.1,
+            "date": "2015-11-16T08:48:51.524Z",
+            "kind": "OBPOS_payment.cash",
+            "rate": "1",
+            "isocode": "EUR"
+        }],
+        "taxes": {
+            "Entregas IVA 21%": {
+                "rate": 21,
+                "netAmount": 10.00,
+                "taxAmount": 2.1
+            }
+        }
+    }]
+}
\ No newline at end of file