当前位置: 首页>>代码示例>>Java>>正文


Java Usage类代码示例

本文整理汇总了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());
}
 
开发者ID:nidi3,项目名称:raml-tester,代码行数:18,代码来源:UsageTest.java

示例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()));
    }
}
 
开发者ID:nidi3,项目名称:raml-tester,代码行数:8,代码来源:ExpectedUsage.java

示例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());
}
 
开发者ID:nidi3,项目名称:raml-tester,代码行数:12,代码来源:SimpleReportAggregatorTest.java

示例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());
}
 
开发者ID:nidi3,项目名称:raml-tester,代码行数:12,代码来源:MultiReportAggregatorTest.java

示例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());
}
 
开发者ID:nidi3,项目名称:raml-tester,代码行数:11,代码来源:MultiReportAggregatorTest.java

示例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());
    }
}
 
开发者ID:nidi3,项目名称:raml-tester-proxy,代码行数:8,代码来源:Reporter.java

示例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);
    }
}
 
开发者ID:nidi3,项目名称:raml-tester-proxy,代码行数:13,代码来源:Reporter.java

示例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());
    }
}
 
开发者ID:nidi3,项目名称:raml-tester-uc-servlet,代码行数:6,代码来源:HttpComponentsTest.java

示例9: logUsage

import guru.nidi.ramltester.core.Usage; //导入依赖的package包/类
private void logUsage(String key, Usage usage) {
    log.error(key + "\n" + usage.toString());
}
 
开发者ID:nidi3,项目名称:raml-tester-proxy,代码行数:4,代码来源:Reporter.java

示例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());
}
 
开发者ID:nidi3,项目名称:raml-tester-proxy,代码行数:7,代码来源:ReportFormat.java

示例11: getUsage

import guru.nidi.ramltester.core.Usage; //导入依赖的package包/类
@Override
public Usage getUsage() {
    return UsageBuilder.usage(getRaml(), unclearableReports);
}
 
开发者ID:nidi3,项目名称:raml-tester-proxy,代码行数:5,代码来源:CommandTest.java


注:本文中的guru.nidi.ramltester.core.Usage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。