本文整理汇总了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();
// }
}
示例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));
}
示例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));
}
示例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));
}
示例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();
}
示例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());
}
示例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)))));
}
示例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)))));
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
示例13: observeLastEvent
import org.arquillian.reporter.config.ReporterConfiguration; //导入依赖的package包/类
public void observeLastEvent(@Observes ManagerStopping event, ReporterConfiguration reporterConfiguration) throws IOException {
printJson(reporterConfiguration);
}
示例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<>()));
}
示例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);
}