Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Commit

Permalink
v0.1.1 downgraded htmlunit for ActiveMQ 5.15.11 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Wierenga committed Feb 26, 2020
1 parent 4f822c2 commit b42d8e0
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ organization := "com.antonwierenga"

name := "amazonmq-cli"

version := "0.1.0"
version := "0.1.1"

scalaVersion := "2.11.6"

licenses += ("Apache-2.0", url("http://opensource.org/licenses/apache2.0.php"))

libraryDependencies += "org.springframework.shell" % "spring-shell" % "1.1.0.RELEASE"
libraryDependencies += "org.springframework.shell" % "spring-shell" % "1.2.0.RELEASE"
libraryDependencies += "org.apache.activemq" % "activemq-all" % "5.15.9"
libraryDependencies += "com.typesafe" % "config" % "1.2.1"
libraryDependencies += "org.scala-lang" % "jline" % "2.11.0-M3"
libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.3"
libraryDependencies += "junit" % "junit" % "4.8" % "test"
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test->default"
libraryDependencies += "net.sourceforge.htmlunit" % "htmlunit" % "2.37.0"
libraryDependencies += "net.sourceforge.htmlunit" % "htmlunit" % "2.36.0"

import scalariform.formatter.preferences._

Expand Down
3 changes: 3 additions & 0 deletions src/main/scala/amazonmq/cli/AmazonMQCLI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class AmazonMQCLI extends CommandMarker {
object AmazonMQCLI extends App {

lazy val ReleaseNotes = Map(
"v0.1.1" List(
"Updated dependencies for ActiveMQ 5.15.11 compatibility"
),
"v0.1.0" List(
"Updated shell command 'browse-messages': new option --regex",
"Updated shell command 'copy-messages': new option --regex",
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/amazonmq/cli/command/BrokerCommands.scala
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class BrokerCommands extends Commands {
withWebClient((webClient: WebClient) {
val page: HtmlPage = webClient.getPage(AmazonMQCLI.broker.get.webConsole)
val tableRows = page.getByXPath("//td//table//tr").toArray.toList.asInstanceOf[List[HtmlTableRow]]
val headers = tableRows.map(tableRow tableRow.getCell(0).getVisibleText)
val row = tableRows.map(tableRow tableRow.getCell(1).getVisibleText)
val headers = tableRows.map(tableRow tableRow.getCell(0).getTextContent)
val row = tableRows.map(tableRow tableRow.getCell(1).getTextContent)
renderTable(List(row), headers)
})
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/amazonmq/cli/command/Commands.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import amazonmq.cli.AmazonMQCLI
import amazonmq.cli.util.Console.{info, prompt, warn}
import amazonmq.cli.util.Implicits._
import amazonmq.cli.util.PrintStackTraceExecutionProcessor
import com.gargoylesoftware.htmlunit.WebClient
import com.gargoylesoftware.htmlunit.{BrowserVersion, WebClient}
import com.gargoylesoftware.htmlunit.xml.XmlPage
import javax.jms.{Connection, Message, Session}
import javax.xml.bind.DatatypeConverter._
Expand Down Expand Up @@ -129,7 +129,7 @@ abstract class Commands extends PrintStackTraceExecutionProcessor {
}

def withWebClient(callback: (WebClient) String): String = {
val webClient = new WebClient();
val webClient = new WebClient(BrowserVersion.BEST_SUPPORTED);
webClient.addRequestHeader("Authorization", "Basic " + printBase64Binary(s"${AmazonMQCLI.broker.get.username}:${AmazonMQCLI.broker.get.password}".getBytes))
webClient.getOptions.setJavaScriptEnabled(false)
try {
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/amazonmq/cli/command/QueueCommands.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class QueueCommands extends Commands {
val page: HtmlPage = webClient.getPage(s"${AmazonMQCLI.broker.get.webConsole}/queues.jsp")
val anchor = page.getAnchors().find(a a.getHrefAttribute.startsWith("purgeDestination.action") &&
a.getHrefAttribute.contains(s"JMSDestination=$name&JMSDestinationType=queue"))

try {
anchor.get.click()
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class MessageCommandsTests {

@Test
def testSendAndExportInlineMessageAllHeadersProvided = {
assertTrue(shell.executeCommand("send-message --queue testQueue --reply-to replyQueue --correlation-id testCorrelationId --delivery-mode NON_PERSISTENT --time-to-live 2000 --priority 1 --body testMessage").getResult.toString.contains("Messages sent to queue 'testQueue': 1"))
assertTrue(shell.executeCommand("send-message --queue testQueue --reply-to replyQueue --correlation-id testCorrelationId --delivery-mode NON_PERSISTENT --time-to-live 20000 --priority 1 --body testMessage").getResult.toString.contains("Messages sent to queue 'testQueue': 1"))
assertEquals(info("\nMessages listed: 1"), shell.executeCommand("list-messages --queue testQueue").getResult)

val messageFilePath = createTempFilePath("MessageCommandsTests_testSendAndExportMessage")
Expand Down Expand Up @@ -101,7 +101,7 @@ class MessageCommandsTests {
def testSendInlineMessageToTopic = {
assertEquals(info("Topic 'VirtualTopic.testTopic' added"), shell.executeCommand("add-topic --name VirtualTopic.testTopic").getResult)
assertEquals(info("Queue 'Consumer.testQueue.VirtualTopic.testTopic' added"), shell.executeCommand("add-queue --name Consumer.testQueue.VirtualTopic.testTopic").getResult)
assertEquals(info("Messages sent to topic 'VirtualTopic.testTopic': 1"), shell.executeCommand("send-message --topic VirtualTopic.testTopic --body testMessage").getResult)
assertTrue(shell.executeCommand("send-message --topic VirtualTopic.testTopic --body testMessage").getResult.toString.contains("Messages sent to topic 'VirtualTopic.testTopic': 1"))
assertEquals(info("\nMessages listed: 1"), shell.executeCommand("list-messages --queue Consumer.testQueue.VirtualTopic.testTopic").getResult)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class QueueCommandsTests {

@Test
def testListQueuesFilters = {
assertEquals(info("Messages sent to queue 'testQueue': 1"), shell.executeCommand("send-message --queue testQueue --body testMessage1").getResult)
assertTrue(shell.executeCommand("send-message --queue testQueue --body testMessage1").getResult.toString.contains("Messages sent to queue 'testQueue': 1"))

List(
"list-queues --pending =1",
Expand Down

0 comments on commit b42d8e0

Please sign in to comment.