Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-3335

Cannot access hawtio resource without prior login

    XMLWordPrintable

Details

    • % %

    Description

      This code fails with 2.3-redhat on EAP-6.4 but passes with 2.3 on wildfly-8.2

          @Test
          public void testAccessHawtIO() throws Exception {
      
              URL url = new URL("http://localhost:8080/hawtio/jolokia/read/java.lang:type=Memory/HeapMemoryUsage/used");
              URLConnection conn = url.openConnection();
              try {
                  // Accessing hawtio requires an admin id/password.
                  String userpass = USERNAME + ":" + PASSWORD;
                  String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userpass.getBytes());
                  conn.setRequestProperty("Authorization", basicAuth);
      
                  int code = ((HttpURLConnection) conn).getResponseCode();
                  assertEquals(200, code);
                  String content = new String(readFully((InputStream) conn.getContent()), "UTF-8");
      
                  // Let check to see if it has some of the expected output.
                  assertTrue("Unexpected content: "+content, content.contains("\"mbean\":\"java.lang:type=Memory\""));
      
              } finally {
                  try {
                      conn.getInputStream().close();
                  } catch (Throwable ignore) {
                  }
              }
      
          }
      

      Attachments

        Issue Links

          Activity

            People

              ggrzybek Grzegorz Grzybek
              tdiesler@redhat.com Thomas Diesler
              Tomas Rohovsky Tomas Rohovsky (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: