[ 
https://issues.apache.org/jira/browse/ARTEMIS-3808?focusedWorklogId=768083&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-768083
 ]

ASF GitHub Bot logged work on ARTEMIS-3808:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/May/22 18:11
            Start Date: 09/May/22 18:11
    Worklog Time Spent: 10m 
      Work Description: jbertram commented on code in PR #4061:
URL: https://github.com/apache/activemq-artemis/pull/4061#discussion_r868286574


##########
artemis-web/src/test/java/org/apache/activemq/cli/test/WebServerComponentTest.java:
##########
@@ -175,31 +166,31 @@ public void testComponentStopBehavior() throws Exception {
       Assert.assertFalse(webServerComponent.isStarted());
       webServerComponent.configure(webServerDTO, "./src/test/resources/", 
"./src/test/resources/");
       webServerComponent.start();
-      final int port = webServerComponent.getPort();
       // Make the connection attempt.
-      CountDownLatch latch = new CountDownLatch(1);
-      final ClientHandler clientHandler = new ClientHandler(latch);
-      bootstrap.group(group).channel(NioSocketChannel.class).handler(new 
ChannelInitializer() {
-         @Override
-         protected void initChannel(Channel ch) throws Exception {
-            ch.pipeline().addLast(new HttpClientCodec());
-            ch.pipeline().addLast(clientHandler);
-         }
-      });
-      Channel ch = bootstrap.connect("localhost", port).sync().channel();
+      verifyConnection(webServerComponent.getPort());
+      Assert.assertTrue(webServerComponent.isStarted());
 
-      URI uri = new URI(URL);
-      // Prepare the HTTP request.
-      HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, 
HttpMethod.GET, uri.getRawPath());
-      request.headers().set(HttpHeaderNames.HOST, "localhost");
+      //usual stop won't actually stop it
+      webServerComponent.stop();
+      assertTrue(webServerComponent.isStarted());
 
-      // Send the HTTP request.
-      ch.writeAndFlush(request);
-      assertTrue(latch.await(5, TimeUnit.SECONDS));
-      assertEquals("12345", clientHandler.body.toString());
-      // Wait for the server to close the connection.
-      ch.close();
-      ch.eventLoop().shutdownNow();
+      webServerComponent.stop(true);
+      Assert.assertFalse(webServerComponent.isStarted());
+   }
+
+   @Test
+   public void testComponentStopStartBehavior() throws Exception {

Review Comment:
   The default config in `management.xml` should cover these methods.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 768083)
    Time Spent: 2.5h  (was: 2h 20m)

> Support starting/stopping the embedded web server via mangement
> ---------------------------------------------------------------
>
>                 Key: ARTEMIS-3808
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3808
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Major
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> It would be useful to be able to cycle the embedded web server if, for 
> example, one needed to renew the SSL certificates.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to