3 Replies Latest reply on Jul 17, 2018 3:02 PM by notify

    HTTP GET/POST unit tests on WildFly 13.0.0.Final with JUnit 4 & 5 (Jupiter) now all return 404

    notify

      I have recently upgraded to WildFly 13.0.0.Final running on EE8 on macOS High Sierra 10.13.8 from 12.0.0.,Final,  where I had a series of Unit Tests accessing my web services using the Apache HTTP Core & Client JARs.

       

      I can still access the web services through the browser or cURL and return the JSON. However, all the JUnit tests now return a 404 when I try and execute the same URL, which works in the  Browser or Curl.

       

      The call is to localhost port 8080.

       

      I have upgraded JUnit from 4 to 5 (Jupiter) at the same time and also get the 404 error.

       

      All the unit tests ran fine and returned 200 and  the JSON with on WildFly 12.0.0.Final.

       

      Any known issues anyone aware of?

       

      *** UPDATE ***

       

      Using WireShark I can see the request is made successfully:

       

      No.     Time           Source                Destination           Protocol Length Info

            6 8.820219       192.168.1.66          109.144.5.192         HTTP     373    GET /success.txt HTTP/1.1

       

      No.     Time           Source                Destination           Protocol Length Info

            8 8.829004       109.144.5.192         192.168.1.66          HTTP     450    HTTP/1.1 200 OK  (text/plain)

        • 1. Re: HTTP GET/POST unit tests on WildFly 13.0.0.Final with JUnit 4 & 5 (Jupiter) now all return 404
          notify

          If I change my unit tests to use my local IP address in the URL it works. Why is localhost or 127.0.0.1 not working as before?

           

          ifconfig |grep inet

            inet 127.0.0.1 netmask 0xff000000

            inet6 ::1 prefixlen 128

            inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1

            inet6 fe80::b0:e9a0:2b34:d0b9%en0 prefixlen 64 secured scopeid 0x7

            inet 192.999.1.99 netmask 0xffffff00 broadcast 192.999.1.25

           

          String url = "http://192.999.1.99:8080/NOTiFYwell/notifywell/product-by-ean/05052319711639";

           

          >>>>> test03GetLastUpdated httpClient = org.apache.http.impl.client.InternalHttpClient@31dc339b

          >>>>> test03GetLastUpdated response = 200

          >>>>> test03GetLastUpdated response getStatus = 200

          >>>>> test03GetLastUpdated response json = {

            "productCharacteristics": {

              "isFood": "yes",

              "isDrink": "no",

              "healthScore": "10",

              "isHazardous": "no",

              "storageType": "dry"

            },

            "calcNutrition": {

              "per100Header": null,

              "perServingHeader": null,

              "calcNutrients": [

                {

                  "name": "Energy (kJ)",

                  "valuePer100": "364.8",

                  "valuePerServing": "766.08"

                },

                {

                  "name": "Energy (kcal)",

                  "valuePer100": "364.80kj86.5",

                  "valuePerServing": "766.08kj181.65"

                },

                {

                  "name": "Fat (g)",

                  "valuePer100": ".5",

                  "valuePerServing": "1.05"

                },

                {

                  "name": "Saturates (g)",

                  "valuePer100": ".14",

                  "valuePerServing": ".29"

                },

                {

                  "name": "Carbohydrate (g)",

                  "valuePer100": "14.6",

                  "valuePerServing": "30.66"

                },

                {

                  "name": "Sugars (g)",

                  "valuePer100": "4.5",

                  "valuePerServing": "9.45"

                },

                {

                  "name": "Fibre (g)",

                  "valuePer100": "4.4",

                  "valuePerServing": "9.24"

                },

                {

                  "name": "Protein (g)",

                  "valuePer100": "3.7",

                  "valuePerServing": "7.77"

                },

                {

                  "name": "Salt (g)",

                  "valuePer100": ".55",

                  "valuePerServing": "1.15"

                }

              ]

            },

            "nutrients": null,

            "enumbers": null,

            "chemicalsMineralsVitamins": null,

            "lifestyle": {

              "name": "Lifestyle",

              "vaue": null

            },

            "id": "5b43bbd837c8a94bd4400852",

            "ean": "05052319711639",

            "gtin": "05052319711639",

            "tpnb": "051627961",

            "tpnc": "258290127",

            "description": "Tesco Everyday Valuebaked Beans In Tomato Sauce 420G",

            "brand": "TESCO VALUE",

            "supermarket": "Tesco",

            "product_name": "product_name",

            "quantity_grammes": "420.0",

            "portion_serving_sachet_item_amount": "",

            "timestamp_lastupdated": "2018-07-09 20:47:36",

            "qtyContents": [

              {

                "quantity": "420.0",

                "totalQuantity": "420.0",

                "quantityUom": "g",

                "netContents": "420g e",

                "avgMeasure": ""

              }

            ],

            "ingredients": [

              {

                "ingredientName": "Haricot Beans (44%) (Water, Haricot Beans)",

                "percentage": "1"

              },

              {

                "ingredientName": "Tomato Puree (27%) (Water, Tomato Purée)",

                "percentage": "2"

              },

              {

                "ingredientName": "Water",

                "percentage": "3"

              },

              {

                "ingredientName": "Sugar",

                "percentage": "4"

              },

              {

                "ingredientName": "Glucose-Fructose Syrup",

                "percentage": "5"

              },

              {

                "ingredientName": "Modified Maize Starch",

                "percentage": "6"

              },

              {

                "ingredientName": "Salt",

                "percentage": "7"

              },

              {

                "ingredientName": "Onion Powder",

                "percentage": "8"

              },

              {

                "ingredientName": "Paprika",

                "percentage": "9"

              },

              {

                "ingredientName": "Maltodextrin",

                "percentage": "10"

              },

              {

                "ingredientName": "Spice Extracts (Paprika Extract, Clove Extract, Capsicum Extract)",

                "percentage": "11"

              },

              {

                "ingredientName": "Flavouring",

                "percentage": "12"

              }

            ]

          • 2. Re: HTTP GET/POST unit tests on WildFly 13.0.0.Final with JUnit 4 & 5 (Jupiter) now all return 404
            jewellgm

            This is just a stab in the dark, but could it have something to do with your proxy settings?  Are your browser and cURL using the system proxy settings, while your java process is not?  Typically local addresses bypass the proxy server, but maybe your configuration doesn't do that.

            • 3. Re: HTTP GET/POST unit tests on WildFly 13.0.0.Final with JUnit 4 & 5 (Jupiter) now all return 404
              notify

              The only thing that has changed since my unit tests were working using 'localhost' are:

               

              • Upgraded from WildFly 12 -> 13
              • macOS High Sierra 10.13.6 Update - Can't see anything in that.

               

              I'll have a look at the Apple Network Settings. Any other suggestions where to look?

               

              Thanks,