-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add capability to determine topic names
- Loading branch information
Brett Delle Grazie
committed
Aug 15, 2018
1 parent
473ed73
commit 8dda4db
Showing
9 changed files
with
160 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/java/uk/gov/justice/framework/tools/command/ListTopics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package uk.gov.justice.framework.tools.command; | ||
|
||
import uk.gov.justice.framework.tools.common.command.ShellCommand; | ||
|
||
public class ListTopics extends AbstractArtemisCommand implements ShellCommand { | ||
|
||
@Override | ||
public void run(String[] args) { | ||
|
||
try { | ||
final String[] queues = artemisConnector.topicNames(host, port, brokerName); | ||
outputPrinter.writeStringArray(queues); | ||
} catch (final Exception exception) { | ||
outputPrinter.writeStackTrace(exception); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
src/test/java/uk/gov/justice/framework/tools/command/BrowseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/test/java/uk/gov/justice/framework/tools/command/ListTopicsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package uk.gov.justice.framework.tools.command; | ||
|
||
import static org.mockito.Matchers.anyString; | ||
import static org.mockito.Mockito.when; | ||
import static org.mockito.Mockito.verify; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.runners.MockitoJUnitRunner; | ||
|
||
import uk.gov.justice.artemis.manager.connector.ArtemisConnector; | ||
|
||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class ListTopicsTest { | ||
|
||
@Mock | ||
ArtemisConnector artemisConnector; | ||
|
||
@InjectMocks | ||
ListTopics listTopicsCommand; | ||
|
||
@Test | ||
public void shouldInvokeConnector() throws Exception { | ||
listTopicsCommand.brokerName = "brokerabc"; | ||
listTopicsCommand.host = "some.host"; | ||
listTopicsCommand.port = "1212"; | ||
when(artemisConnector.topicNames(anyString(), anyString(), anyString())).thenReturn(new String[] {"testTopic" }); | ||
|
||
listTopicsCommand.run(null); | ||
verify(artemisConnector).topicNames("some.host", "1212", "brokerabc"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters