當前位置: 首頁>>代碼示例>>Java>>正文


Java ReporterConfiguration類代碼示例

本文整理匯總了Java中org.arquillian.reporter.config.ReporterConfiguration的典型用法代碼示例。如果您正苦於以下問題:Java ReporterConfiguration類的具體用法?Java ReporterConfiguration怎麽用?Java ReporterConfiguration使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ReporterConfiguration類屬於org.arquillian.reporter.config包,在下文中一共展示了ReporterConfiguration類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: printJson

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
private void printJson(ReporterConfiguration reporterConfiguration) {
    Gson gson = new GsonBuilder().setPrettyPrinting().create();
    String json = gson.toJson(executionStore.get().getExecutionReport());
    try {
        FileUtils.writeStringToFile(reporterConfiguration.getReportFile(), json, Charset.defaultCharset());
    } catch (IOException e) {
        e.printStackTrace();
    }

    //        System.out.println(json);
    //        try {
    //            Thread.sleep(500);
    //        } catch (InterruptedException e) {
    //            e.printStackTrace();
    //        }
}
 
開發者ID:arquillian,項目名稱:arquillian-reporter,代碼行數:17,代碼來源:ReporterLifecycleManager.java

示例2: testWhenManagerIsStartedExecutionReportShouldBeInstantiatedAndFirstObserverInvoked

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
@Test
public void testWhenManagerIsStartedExecutionReportShouldBeInstantiatedAndFirstObserverInvoked()
    throws IOException {

    assertThatExecutionReport(executionStore.get().getExecutionReport())
        .as("The execution report should be already instantiated")
        .isNotNull();

    assertThatSectionTree(executionStore.get().getSectionTree())
        .as("The execution report should contain instantiated section tree")
        .isNotNull()
        .hasNumberOfSubTrees(0);

    verifyInReporterLifecycleManager().wasCalled(1).observeFirstEvent(any(ManagerStarted.class));
    verifyInReporterLifecycleManager().wasCalled(0).observeEventsForAllSections(any());
    verifyInReporterLifecycleManager().wasCalled(0).observeLastEvent(any(ManagerStopping.class), any(ReporterConfiguration.class));
}
 
開發者ID:arquillian,項目名稱:arquillian-reporter,代碼行數:18,代碼來源:ReporterLifecycleManagerTest.java

示例3: testWhenTestSuiteReportIsFiredUsingBuilderAnObserverShouldBeInvoked

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
@Test
public void testWhenTestSuiteReportIsFiredUsingBuilderAnObserverShouldBeInvoked()
    throws IllegalAccessException, InstantiationException, IOException {

    SectionEvent sectionToFire = sectionClass.newInstance();
    AbstractReport payload = reportClass.newInstance();
    payload.setName(new UnknownStringKey("Basic report"));

    Reporter
        .createReport(payload)
        .addEntry("dummy entry")
        .inSection(sectionToFire)
        .fire(sectionEvent);

    assertEventFired(sectionClass, 1);
    verifyInReporterLifecycleManager().wasCalled(1).observeFirstEvent(any(ManagerStarted.class));
    verifyInReporterLifecycleManager().wasCalled(1).observeEventsForAllSections(any(sectionClass));
    verifyInReporterLifecycleManager().wasCalled(0).observeLastEvent(any(ManagerStopping.class), any(ReporterConfiguration.class));
}
 
開發者ID:arquillian,項目名稱:arquillian-reporter,代碼行數:20,代碼來源:FiringSectionEventsUsingReporterTest.java

示例4: testWhenManagerIsStoppedLastObserverShouldBeInvoked

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
@Test
public void testWhenManagerIsStoppedLastObserverShouldBeInvoked() throws IOException {
    fire(new ManagerStopping());

    verifyInReporterLifecycleManager().wasCalled(1).observeFirstEvent(any(ManagerStarted.class));
    verifyInReporterLifecycleManager().wasCalled(0).observeEventsForAllSections(any());
    verifyInReporterLifecycleManager().wasCalled(1).observeLastEvent(any(ManagerStopping.class), any(ReporterConfiguration.class));
}
 
開發者ID:arquillian,項目名稱:arquillian-reporter,代碼行數:9,代碼來源:ReporterLifecycleManagerTest.java

示例5: reportToxicConfiguration

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
public void reportToxicConfiguration(@Observes After event, ReporterConfiguration reporterConfiguration)
    throws IOException {

    final Method testMethod = event.getTestMethod();
    final String testMethodName = testMethod.getName();
    final String fileName = testMethodName + ".json";

    final FileEntry fileEntry = createFileEntryWithJSON(reporterConfiguration, fileName);
    Reporter.createReport(new TestMethodReport(testMethodName))
        .addKeyValueEntry(TOXICITY_DETAILS_PATH, fileEntry)
        .inSection(new TestMethodSection(testMethod))
        .fire(sectionEvent);

    toxics.clear();
}
 
開發者ID:arquillian,項目名稱:arquillian-cube-q,代碼行數:16,代碼來源:TakeNetworkChaosInformation.java

示例6: createFileEntryWithJSON

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
private FileEntry createFileEntryWithJSON(ReporterConfiguration reporterConfiguration, String fileName)
    throws IOException {
    final File rootDirectory = new File(reporterConfiguration.getRootDirectory());
    File jsonFile = new File(createDirectory(rootDirectory, "chaos"), fileName);

    if (!toxics.isEmpty()) {
        createJSONAndWriteToFile(jsonFile);
    }

    final Path rootDir = Paths.get(rootDirectory.getName());
    final Path relativize = rootDir.relativize(jsonFile.toPath());

    return new FileEntry(relativize.toString());
}
 
開發者ID:arquillian,項目名稱:arquillian-cube-q,代碼行數:15,代碼來源:TakeNetworkChaosInformation.java

示例7: should_create_json_for_toxic_creation_and_write_it_to_file

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
@Test
public void should_create_json_for_toxic_creation_and_write_it_to_file()
    throws IOException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
    //given
    ToxiProxyClient.Timeout timeout =
        new ToxiProxyClient.Timeout("timeout_downstream", "DOWNSTREAM", 1.0f, timeoutInMillis(1000));
    ToxicCreated toxicCreated = new ToxicCreated(timeout);
    ReporterConfiguration reporterConfiguration = ReporterConfiguration.fromMap(new LinkedHashMap<>());
    Method method = getMethod("should_create_json_for_toxic_updation_and_write_to_file");
    String path = getFilePath(reporterConfiguration, method.getName());

    TakeNetworkChaosInformation takeNetworkChaosInformation = new TakeNetworkChaosInformation();
    takeNetworkChaosInformation.sectionEvent = sectionEvent;

    //when
    takeNetworkChaosInformation.captureToxicDetailsAfterCreate(toxicCreated, toxicAction);
    takeNetworkChaosInformation.reportToxicConfiguration(new After(TakeNetworkChaosInformationTest.class, method),
        reporterConfiguration);

    //then
    File json = new File(path);
    Assert.assertThat(json, isJson());
    Assert.assertThat(json, isJson(CoreMatchers.allOf(
        withJsonPath("$.services", hasSize(1)),
        withJsonPath("$.services[0].actionon", equalTo("helloworld")),
        withJsonPath("$.services[0].type", equalTo("Timeout")),
        withJsonPath("$.services[0].phase", equalTo("create")),
        withJsonPath("$.services[0].toxic.name", equalTo("timeout_downstream")),
        withJsonPath("$.services[0].toxic.stream", equalTo("DOWNSTREAM")),
        withJsonPath("$.services[0].toxic.toxcicity", equalTo(1.0)),
        withJsonPath("$.services[0].toxic.timeout", equalTo(1000)))));
}
 
開發者ID:arquillian,項目名稱:arquillian-cube-q,代碼行數:33,代碼來源:TakeNetworkChaosInformationTest.java

示例8: should_create_json_for_toxic_updation_and_write_to_file

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
@Test
public void should_create_json_for_toxic_updation_and_write_to_file()
    throws IOException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
    //given
    ToxiProxyClient.Timeout timeout =
        new ToxiProxyClient.Timeout("timeout_downstream", "DOWNSTREAM", 1.0f, timeoutInMillis(1000));
    ToxicUpdated toxicUpdated = new ToxicUpdated(timeout);
    ReporterConfiguration reporterConfiguration = ReporterConfiguration.fromMap(new LinkedHashMap<>());

    Method method = getMethod("should_create_json_for_toxic_updation_and_write_to_file");
    String path = getFilePath(reporterConfiguration, method.getName());

    TakeNetworkChaosInformation takeNetworkChaosInformation = new TakeNetworkChaosInformation();
    takeNetworkChaosInformation.sectionEvent = sectionEvent;

    //when
    takeNetworkChaosInformation.captureToxicDetailsAfterUpdate(toxicUpdated, toxicAction);
    takeNetworkChaosInformation.reportToxicConfiguration(new After(TakeNetworkChaosInformationTest.class,
            method),
        reporterConfiguration);

    //then
    File json = new File(path);
    Assert.assertThat(json, isJson());
    Assert.assertThat(json, isJson(CoreMatchers.allOf(
        withJsonPath("$.services", hasSize(1)),
        withJsonPath("$.services[0].actionon", equalTo("helloworld")),
        withJsonPath("$.services[0].type", equalTo("Timeout")),
        withJsonPath("$.services[0].phase", equalTo("update")),
        withJsonPath("$.services[0].toxic.name", equalTo("timeout_downstream")),
        withJsonPath("$.services[0].toxic.stream", equalTo("DOWNSTREAM")),
        withJsonPath("$.services[0].toxic.toxcicity", equalTo(1.0)),
        withJsonPath("$.services[0].toxic.timeout", equalTo(1000)))));
}
 
開發者ID:arquillian,項目名稱:arquillian-cube-q,代碼行數:35,代碼來源:TakeNetworkChaosInformationTest.java

示例9: reportDockerEnvironment

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
public void reportDockerEnvironment(@Observes AfterAutoStart event, CubeDockerConfiguration cubeDockerConfiguration, DockerClientExecutor executor, ReporterConfiguration reporterConfiguration) {

        final ReportBuilder reportBuilder = Reporter.createReport(DOCKER_ENVIRONMENT)
                .addReport(createDockerInfoGroup(executor));

        reportBuilder.addKeyValueEntry(DOCKER_COMPOSITION_SCHEMA, createDockerCompositionSchema(cubeDockerConfiguration, reporterConfiguration));
        reportBuilder.addKeyValueEntry(NETWORK_TOPOLOGY_SCHEMA, createNetworkTopologyGraph(cubeDockerConfiguration, executor, reporterConfiguration));

        reportBuilder
                .inSection(DockerContainerSection.standalone())
                .fire(reportEvent);
    }
 
開發者ID:arquillian,項目名稱:arquillian-cube,代碼行數:13,代碼來源:TakeDockerEnvironment.java

示例10: reportContainerLogs

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
public void reportContainerLogs(@Observes org.arquillian.cube.spi.event.lifecycle.BeforeStop beforeStop, DockerClientExecutor executor, ReporterConfiguration reporterConfiguration) throws IOException {
    final String cubeId = beforeStop.getCubeId();
    if (cubeId != null) {
        final File logFile = new File(createContainerLogDirectory(new File(reporterConfiguration.getRootDirectory())), cubeId + ".log");
        final Path rootDir = Paths.get(reporterConfiguration.getRootDirectory());
        final Path relativePath = rootDir.relativize(logFile.toPath());

        executor.copyLog(beforeStop.getCubeId(), false, true, true, true, -1, new FileOutputStream(logFile));

        Reporter.createReport()
                .addKeyValueEntry(LOG_PATH, new FileEntry(relativePath))
                .inSection(new DockerContainerSection(cubeId))
                .fire(reportEvent);
    }
}
 
開發者ID:arquillian,項目名稱:arquillian-cube,代碼行數:16,代碼來源:TakeDockerEnvironment.java

示例11: generateCompositionSchemaImage

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
private FileEntry generateCompositionSchemaImage(mxGraph graph, ReporterConfiguration reporterConfiguration) {

        final File imageFile = new File(createSchemasDirectory(new File(reporterConfiguration.getRootDirectory())), "docker_composition.png");
        try {
            return createScreenshotEntry(imageFile, graph, reporterConfiguration);
        } catch (IOException e) {
            log.log(Level.WARNING, String.format("Docker compositions schema could not be generated because of %s.", e));
        }

        return EMPTY_SCREENSHOT;
    }
 
開發者ID:arquillian,項目名稱:arquillian-cube,代碼行數:12,代碼來源:TakeDockerEnvironment.java

示例12: generateNetworkTopologyImage

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
private FileEntry generateNetworkTopologyImage(mxGraph graph, ReporterConfiguration reporterConfiguration) {
    try {
        final File imageFile = new File(createNetworkTopologyDirectory(new File(reporterConfiguration.getRootDirectory())), "docker_network_topology.png");
        return createScreenshotEntry(imageFile, graph, reporterConfiguration);

    } catch (IOException e) {
        log.log(Level.WARNING, String.format("Docker container network toplogy could not be generated because of %s.", e));
    }

    return EMPTY_SCREENSHOT;

}
 
開發者ID:arquillian,項目名稱:arquillian-cube,代碼行數:13,代碼來源:TakeDockerEnvironment.java

示例13: observeLastEvent

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
public void observeLastEvent(@Observes ManagerStopping event, ReporterConfiguration reporterConfiguration) throws IOException {
    printJson(reporterConfiguration);
}
 
開發者ID:arquillian,項目名稱:arquillian-reporter,代碼行數:4,代碼來源:ReporterLifecycleManager.java

示例14: observeAndInvokeLastEvent

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
public void observeAndInvokeLastEvent(@Observes ManagerStopping event) throws IOException {
    reporterLifecycleManager.get().observeLastEvent(event, ReporterConfiguration.fromMap(new HashMap<>()));
}
 
開發者ID:arquillian,項目名稱:arquillian-reporter,代碼行數:4,代碼來源:ReporterLifecycleManagerInvoker.java

示例15: getFilePath

import org.arquillian.reporter.config.ReporterConfiguration; //導入依賴的package包/類
private String getFilePath(ReporterConfiguration reporterConfiguration, String methodName) {
    String path = reporterConfiguration.getRootDirectory() + "/reports/chaos/" + methodName + ".json";

    return path.replace("/", File.separator);
}
 
開發者ID:arquillian,項目名稱:arquillian-cube-q,代碼行數:6,代碼來源:TakeNetworkChaosInformationTest.java


注:本文中的org.arquillian.reporter.config.ReporterConfiguration類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。