本文整理汇总了Java中guru.nidi.ramltester.core.Usage类的典型用法代码示例。如果您正苦于以下问题:Java Usage类的具体用法?Java Usage怎么用?Java Usage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Usage类属于guru.nidi.ramltester.core包,在下文中一共展示了Usage类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findUnused
import guru.nidi.ramltester.core.Usage; //导入依赖的package包/类
@Test
public void findUnused() throws Exception {
final SimpleReportAggregator aggregator = new SimpleReportAggregator();
assertNoViolations(test(aggregator,
api,
get("/data"),
jsonResponse(200, "\"hula\"")));
final Usage usage = aggregator.getUsage();
assertEquals(set("/uuWithAction"), usage.getUnusedResources());
assertEquals(set("POST /data", "GET /uuWithAction"), usage.getUnusedActions());
assertEquals(set("uuQuery in GET /data"), usage.getUnusedQueryParameters());
assertEquals(set("uuReqHeader in GET /data"), usage.getUnusedRequestHeaders());
assertEquals(set("uuFormParam in POST /data (application/x-www-form-urlencoded)"), usage.getUnusedFormParameters());
assertEquals(set("uuResHeader in GET /data -> 200"), usage.getUnusedResponseHeaders());
assertEquals(set("201 in GET /data"), usage.getUnusedResponseCodes());
}
示例2: verify
import guru.nidi.ramltester.core.Usage; //导入依赖的package包/类
@Override
protected void verify() throws Throwable {
final Usage usage = usageProvider.getUsage();
for (final UsageItem item : items) {
assertThat(item.get(usage), new EmptyMatcher(new Message("usage." + item.name()).toString()));
}
}
示例3: simple
import guru.nidi.ramltester.core.Usage; //导入依赖的package包/类
@Test
public void simple() {
final SimpleReportAggregator aggregator = new SimpleReportAggregator();
aggregator.addReport(SimpleReport.report("simple.raml", "/data", "/d", "/"));
final Iterator<Map.Entry<String, Usage>> usages = aggregator.usages().iterator();
final Map.Entry<String, Usage> usageEntry = usages.next();
assertEquals("simple", usageEntry.getKey());
assertEquals(new HashSet<>(Arrays.asList("/mediaType", "/schema")),
usageEntry.getValue().getUnusedResources());
assertFalse(usages.hasNext());
}
示例4: simple
import guru.nidi.ramltester.core.Usage; //导入依赖的package包/类
@Test
public void simple() {
final MultiReportAggregator aggregator = new MultiReportAggregator();
aggregator.addReport(SimpleReport.report("simple.raml", "/data", "/d", "/"));
final Iterator<Map.Entry<String, Usage>> usages = aggregator.usages().iterator();
final Map.Entry<String, Usage> usageEntry = usages.next();
assertEquals("simple", usageEntry.getKey());
assertEquals(new HashSet<>(Arrays.asList("/mediaType", "/schema")),
usageEntry.getValue().getUnusedResources());
assertFalse(usages.hasNext());
}
示例5: multi
import guru.nidi.ramltester.core.Usage; //导入依赖的package包/类
@Test
public void multi() {
final MultiReportAggregator aggregator = new MultiReportAggregator();
aggregator.addReport(SimpleReport.report("simple.raml"));
aggregator.addReport(SimpleReport.report("header.raml"));
final Iterator<Map.Entry<String, Usage>> usages = aggregator.usages().iterator();
assertThat(usages.next().getKey(), either(equalTo("simple")).or(equalTo("header")));
assertThat(usages.next().getKey(), either(equalTo("simple")).or(equalTo("header")));
assertFalse(usages.hasNext());
}
示例6: flushingUsage
import guru.nidi.ramltester.core.Usage; //导入依赖的package包/类
@Override
public void flushingUsage(ReportAggregator aggregator) {
for (final Map.Entry<String, Usage> entry : aggregator.usages()) {
logUsage(entry.getKey(), entry.getValue());
fileUsage(entry.getKey(), entry.getValue());
}
}
示例7: fileUsage
import guru.nidi.ramltester.core.Usage; //导入依赖的package包/类
private void fileUsage(String key, Usage usage) {
if (saveDir == null) {
return;
}
try {
try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(usageFile(key)), "utf-8")) {
out.write(reportFormat.formatUsage(usage));
}
} catch (IOException e) {
log.error("Problem writing error file", e);
}
}
示例8: assertUsage
import guru.nidi.ramltester.core.Usage; //导入依赖的package包/类
private void assertUsage(Usage usage, EnumSet<UsageItem> usageItems) {
for (UsageItem usageItem : usageItems) {
assertEquals(usageItem.name(), 0, usageItem.get(usage).size());
}
}
示例9: logUsage
import guru.nidi.ramltester.core.Usage; //导入依赖的package包/类
private void logUsage(String key, Usage usage) {
log.error(key + "\n" + usage.toString());
}
示例10: createUsageData
import guru.nidi.ramltester.core.Usage; //导入依赖的package包/类
public static UsageData createUsageData(Usage usage) {
return new UsageData(usage.getUnusedActions(), usage.getUnusedResources(),
usage.getUnusedRequestHeaders(), usage.getUnusedQueryParameters(),
usage.getUnusedFormParameters(), usage.getUnusedResponseHeaders(),
usage.getUnusedResponseCodes());
}
示例11: getUsage
import guru.nidi.ramltester.core.Usage; //导入依赖的package包/类
@Override
public Usage getUsage() {
return UsageBuilder.usage(getRaml(), unclearableReports);
}