Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
@Category(IntegrationTest.class)
public class ExampleTest {
  @Rule
  public LocatorStarterRule locator = new LocatorStarterRule().withAutoStart();

  @Rule
  public GfshShellConnectionRule gfshRule = new GfshShellConnectionRule();

  @Before
  public void before() throws Exception {
    gfshRule.connectAndVerify(locator);
  }

  @Test
  public void simpleUsage() throws Exception {
    // gfshRule already connect, ready to execute some command
 and verify output.
 CommandResult result = gfshRule.executeAndVerifyCommandexecuteAndAssertThat("list members");
	// examine the result and do some assertions
	// get the string representation of the gfsh result
	String resultString = gfshRule.getGfshOutput(
		.statusIsOK()
		.containsOutput("blah,blah");
  }
}

 

This example starts a server with JMXManager and then use the gfshRule to connect to the jmxManager of the server

...

Code Block
languagejava
@Category(IntegrationTest.class)
public class ExampleTest {
  public LocatorStarterRule locator = new LocatorStarterRule().withAutoStart();
  public GfshShellConnectionRule gfshRule = new GfshShellConnectionRule(locator::getJmxPort, GfshShellConnectionRule.PortType.jmxManger);

  @Rule
  public RuleChain ruleChain = RuleChain.outerRule(locator).around(gfshRule);

  @Test
  public void simpleUsage() throws Exception {
    // gfshRule already connect, ready to execute some command
    gfshRule.executeAndVerifyCommandexecuteAndAssertThat("list members").statusIsOK();
  }
}
Info

...