use of org.hamcrest.core.StringContains in project nakadi by zalando.
the class HilaAT method testGetSubscriptionStat.
@Test(timeout = 10000)
public void testGetSubscriptionStat() throws Exception {
publishEvents(eventType.getName(), 15, i -> "{\"foo\":\"bar\"}");
final TestStreamingClient client = TestStreamingClient.create(URL, subscription.getId(), "max_uncommitted_events=20").start();
waitFor(() -> assertThat(client.getBatches(), Matchers.hasSize(15)));
List<SubscriptionEventTypeStats> subscriptionStats = Collections.singletonList(new SubscriptionEventTypeStats(eventType.getName(), Collections.singletonList(new SubscriptionEventTypeStats.Partition("0", "assigned", 15L, null, client.getSessionId(), AUTO))));
NakadiTestUtils.getSubscriptionStat(subscription).then().content(new StringContains(JSON_TEST_HELPER.asJsonString(new ItemsWrapper<>(subscriptionStats))));
final String partition = client.getBatches().get(0).getCursor().getPartition();
final SubscriptionCursor cursor = new SubscriptionCursor(partition, "9", eventType.getName(), "token");
commitCursors(subscription.getId(), ImmutableList.of(cursor), client.getSessionId());
subscriptionStats = Collections.singletonList(new SubscriptionEventTypeStats(eventType.getName(), Collections.singletonList(new SubscriptionEventTypeStats.Partition("0", "assigned", 5L, null, client.getSessionId(), AUTO))));
NakadiTestUtils.getSubscriptionStat(subscription).then().content(new StringContains(JSON_TEST_HELPER.asJsonString(new ItemsWrapper<>(subscriptionStats))));
}
use of org.hamcrest.core.StringContains in project jbosstools-integration-tests by jbosstools.
the class ValidationHelper method findProblems.
public List<Problem> findProblems(ValidationProblem validationProblem) {
StringContains regexpMatcher = new StringContains(validationProblem.getMessage());
MarkerDescriptionMatcher descriptionMatcher = new MarkerDescriptionMatcher(regexpMatcher);
List<Problem> filteredProblems = new ArrayList<Problem>();
try {
/**
* Sometimes happens that marker is displayed and suddenly is hidden and displayed again,
* so it is better to wait and doublecheck.
*/
new WaitUntil(new ProblemExists(validationProblem.getProblemType(), descriptionMatcher), TimePeriod.LONG);
new WaitWhile(new ProblemExists(validationProblem.getProblemType(), descriptionMatcher), TimePeriod.getCustom(5), false);
new WaitUntil(new ProblemExists(validationProblem.getProblemType(), descriptionMatcher), TimePeriod.DEFAULT);
ProblemsView pw = new ProblemsView();
pw.open();
new WaitUntil(new ProblemExists(ProblemType.ALL), TimePeriod.MEDIUM, false);
filteredProblems = pw.getProblems(validationProblem.getProblemType(), descriptionMatcher);
} catch (WaitTimeoutExpiredException ex) {
log.warn(validationProblem.toString() + " not found.");
}
logProblemViewStatus(filteredProblems);
return filteredProblems;
}
use of org.hamcrest.core.StringContains in project reddeer by eclipse.
the class NewRuntimeWizardPage method selectType.
/**
* Select type.
*
* @param type the type
*/
public NewRuntimeWizardPage selectType(String... type) {
new WaitUntil(new NamedThreadHasStatus(new StringContains("Initializing Servers view"), Thread.State.TERMINATED, true));
new DefaultTreeItem(new DefaultTree(this), type).select();
return this;
}
use of org.hamcrest.core.StringContains in project reddeer by eclipse.
the class NewServerWizardPage method selectType.
/**
* Select type.
*
* @param type
* the type
*/
public NewServerWizardPage selectType(String... type) {
new GroupWait(waitUntil(new NamedThreadHasStatus(new StringContains("Initializing Servers view"), Thread.State.TERMINATED, true)), waitUntil(new TreeContainsItem(new DefaultTree(this), type)));
new DefaultTreeItem(new DefaultTree(this), type).select();
new WaitUntil(new ControlIsEnabled(new NextButton(this)));
return this;
}
use of org.hamcrest.core.StringContains in project hive by apache.
the class TestMetastoreConf method dumpConfig.
@Test
public void dumpConfig() throws IOException {
createConfFile("metastore-site.xml", true, "METASTORE_HOME", instaMap("test.long", "23"));
conf = MetastoreConf.newMetastoreConf();
String dump = MetastoreConf.dumpConfig(conf);
Assert.assertThat(dump, new StringContains("Used metastore-site file: file:/"));
Assert.assertThat(dump, new StringContains("Key: <test.long> old hive key: <hive.test.long> value: <23>"));
Assert.assertThat(dump, new StringContains("Key: <test.str> old hive key: <hive.test.str> value: <defaultval>"));
Assert.assertThat(dump, new StringEndsWith("Finished MetastoreConf object.\n"));
// Make sure the hidden keys didn't get published
Assert.assertThat(dump, CoreMatchers.not(new StringContains(ConfVars.PWD.getVarname())));
}
Aggregations