當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。