• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Before类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jboss.arquillian.test.spi.event.suite.Before的典型用法代码示例。如果您正苦于以下问题:Java Before类的具体用法?Java Before怎么用?Java Before使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Before类属于org.jboss.arquillian.test.spi.event.suite包,在下文中一共展示了Before类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startTestMethod

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
public void startTestMethod(@Observes(precedence = Integer.MAX_VALUE) Before event) {

        Method testMethod = event.getTestMethod();
        boolean runAsClient = event.getTestMethod().isAnnotationPresent(RunAsClient.class);
        String deploymentName = "_DEFAULT_";
        if (event.getTestMethod().isAnnotationPresent(OperateOnDeployment.class)) {
            deploymentName = event.getTestMethod().getAnnotation(OperateOnDeployment.class).value();
        }

        Reporter
            .createReport(new TestMethodReport(testMethod.getName()))
            .addKeyValueEntry(TEST_METHOD_OPERATES_ON_DEPLOYMENT, deploymentName)
            .addKeyValueEntry(TEST_METHOD_RUNS_AS_CLIENT, runAsClient)
            .inSection(new TestMethodSection(testMethod))
            .fire(sectionEvent);
    }
 
开发者ID:arquillian,项目名称:arquillian-reporter,代码行数:17,代码来源:ArquillianCoreReporterLifecycleManager.java


示例2: beforeTest

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
public void beforeTest(@Observes(precedence = -50) Before event) {

        if (new TakingScreenshotDecider(recorderStrategyRegister.get()).decide(event, null)) {
            ScreenshotMetaData metaData = getMetaData(event);
            metaData.setResourceType(getScreenshotType());

            DefaultFileNameBuilder nameBuilder = new DefaultFileNameBuilder();
            String screenshotName = nameBuilder
                .withMetaData(metaData)
                .withStage(When.BEFORE)
                .build();

            beforeScreenshotTaken.fire(new BeforeScreenshotTaken(metaData));

            TakeScreenshot takeScreenshooter = new TakeScreenshot(screenshotName, metaData, When.BEFORE, event.getTestMethod().getAnnotation(Screenshot.class));
            takeScreenshot.fire(takeScreenshooter);

            metaData.setBlurLevel(resolveBlurLevel(event));
            org.arquillian.extension.recorder.screenshooter.Screenshot screenshot = takeScreenshooter.getScreenshot();
            if(screenshot != null) {
                metaData.setFilename(screenshot.getResource());
            }

            afterScreenshotTaken.fire(new AfterScreenshotTaken(metaData));
        }
    }
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:27,代码来源:ScreenshooterLifecycleObserver.java


示例3: startBeforeSuiteTrueTest

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
@Test
public void startBeforeSuiteTrueTest() throws Exception {

    Mockito.when(configuration.getStartBeforeSuite()).thenReturn(true);

    fire(new VideoExtensionConfigured());

    fire(new BeforeSuite());
    fire(new BeforeClass(DummyTestCase.class));
    fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test")));

    bind(TestScoped.class, TestResult.class, TestResult.passed());

    fire(new After(DummyTestCase.class, DummyTestCase.class.getMethod("test")));
    fire(new AfterClass(DummyTestCase.class));
    fire(new AfterSuite());

    assertEventFired(BeforeVideoStart.class, 1);
    assertEventFired(StartRecordSuiteVideo.class, 1);
    assertEventFired(AfterVideoStart.class, 1);

    assertEventFired(BeforeVideoStop.class, 1);
    assertEventFired(StopRecordSuiteVideo.class, 1);
    assertEventFired(AfterVideoStop.class, 1);
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:26,代码来源:RecorderLifecycleObserverTestCase.java


示例4: startBeforeClassTrueTest

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
@Test
public void startBeforeClassTrueTest() throws Exception {

    Mockito.when(configuration.getStartBeforeClass()).thenReturn(true);

    fire(new VideoExtensionConfigured());

    fire(new BeforeSuite());
    fire(new BeforeClass(DummyTestCase.class));
    fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test")));

    bind(TestScoped.class, TestResult.class, TestResult.passed());

    fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP));
    fire(new AfterClass(DummyTestCase.class));
    fire(new AfterSuite());

    assertEventFired(BeforeVideoStart.class, 1);
    assertEventFired(StartRecordClassVideo.class, 1);
    assertEventFired(AfterVideoStart.class, 1);

    assertEventFired(BeforeVideoStop.class, 1);
    assertEventFired(StopRecordClassVideo.class, 1);
    assertEventFired(AfterVideoStop.class, 1);
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:26,代码来源:RecorderLifecycleObserverTestCase.java


示例5: startBeforeTestTrueTest

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
@Test
public void startBeforeTestTrueTest() throws Exception {

    Mockito.when(configuration.getStartBeforeTest()).thenReturn(true);

    fire(new VideoExtensionConfigured());

    fire(new BeforeSuite());
    fire(new BeforeClass(DummyTestCase.class));
    fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test")));

    bind(TestScoped.class, TestResult.class, TestResult.passed());

    fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP));
    fire(new AfterClass(DummyTestCase.class));
    fire(new AfterSuite());

    assertEventFired(BeforeVideoStart.class, 1);
    assertEventFired(StartRecordVideo.class, 1);
    assertEventFired(AfterVideoStart.class, 1);

    assertEventFired(BeforeVideoStop.class, 1);
    assertEventFired(StopRecordVideo.class, 1);
    assertEventFired(AfterVideoStop.class, 1);
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:26,代码来源:RecorderLifecycleObserverTestCase.java


示例6: start

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
public void start(@Observes(precedence = Integer.MIN_VALUE) Before event) {
    Session session = this.session.get();
    NamespaceService namespaceService = this.namespaceService.get();

    String pkg = getPackage(event);
    String className = getClassName(event);
    String methodName = getMethodName(event);

    session.setCurrentMethodName(methodName);

    Map<String, String> annotations = new HashMap<>();
    String testCase = trimName(pkg, className, methodName);
    annotations.put(String.format(TEST_CASE_STATUS_FORMAT, testCase), Constants.RUNNING_STATUS);
    try {
        namespaceService.annotate(session.getNamespace(), annotations);
    } catch (Throwable t) {
        session.getLogger().warn("Could not annotate namespace:[" + session.getNamespace() +
            "] with test: [" + className + "] method: [" + methodName + "] state:[" + Constants.RUNNING_STATUS + "]");
    }
}
 
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:21,代码来源:TestListener.java


示例7: call

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
public void call(@Observes Before event)
{
    Set<String> httpMethods = IsHttpMethod.getHttpMethods(event.getTestMethod());
    if (httpMethods != null && httpMethods.size() == 1)
    {
        Response response = doRestCall(event.getTestMethod(), httpMethods);
        responseProducer.set(response);
    }
}
 
开发者ID:windup,项目名称:windup-rulesets,代码行数:10,代码来源:RestInvoker.java


示例8: hasScreenshotAnnotation

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
private boolean hasScreenshotAnnotation(org.jboss.arquillian.core.spi.event.Event event) {
    if (event instanceof Before) {
        return ScreenshotAnnotationScanner.getScreenshotAnnotation(((Before) event).getTestMethod()) != null;
    } else if (event instanceof AfterTestLifecycleEvent) {
        return ScreenshotAnnotationScanner
            .getScreenshotAnnotation(((AfterTestLifecycleEvent) event).getTestMethod()) != null;
    }
    return false;
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:10,代码来源:ScreenshooterLifecycleObserver.java


示例9: isTakingAction

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
@Override
public boolean isTakingAction(Event event) {

    if (event instanceof Before) {
        Screenshot screenshotAnnotation = ScreenshotAnnotationScanner.getScreenshotAnnotation(((Before) event).getTestMethod());

        if (screenshotAnnotation != null) {
            return screenshotAnnotation.takeBeforeTest();
        }
    }

    return false;
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:14,代码来源:DefaultAnnotationScreenshootingStrategy.java


示例10: setMocks

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
@org.junit.Before
public void setMocks() throws Exception {
    bind(ApplicationScoped.class, ServiceLoader.class, serviceLoader);
    bind(ApplicationScoped.class, ScreenshooterConfiguration.class, configuration);
    bind(ApplicationScoped.class, Screenshooter.class, screenshooter);
    bind(ApplicationScoped.class, RecorderStrategyRegister.class, recorderStrategyRegister);

    Mockito.when(screenshooter.getScreenshotType()).thenReturn(ScreenshotType.PNG);

    Mockito.doNothing().when(cleaner).clean(configuration);

    Mockito.when(serviceLoader.onlyOne(ScreenshooterEnvironmentCleaner.class, DefaultScreenshooterEnvironmentCleaner.class))
        .thenReturn(cleaner);
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:15,代码来源:ScreenshooterLifecycleObserverTestCase.java


示例11: beforeTest

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
public void beforeTest(@Observes Before event) {
    if (strategy.get().isTakingAction(event)) {
        VideoMetaData testMetaData = getMetaData(event);
        VideoType videoType = getVideoType();

        beforeVideoStart.fire(new BeforeVideoStart(videoType, testMetaData));

        startRecordVideo.fire(new StartRecordVideo(videoType, testMetaData));

        afterVideoStart.fire(new AfterVideoStart(videoType, testMetaData));
    }
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:13,代码来源:VideoLifecycleObserver.java


示例12: isTakingAction

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
@Override
public boolean isTakingAction(Event event) {
    if (event instanceof BeforeSuite
            || event instanceof AfterSuite) {
        return configuration.getStartBeforeSuite();
    } else if (event instanceof BeforeClass
            || event instanceof AfterClass) {
        return configuration.getStartBeforeClass();
    } else if (event instanceof Before) {
        return configuration.getStartBeforeTest()
            || configuration.getTakeOnlyOnFail();
    }

    return false;
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:16,代码来源:DefaultVideoStrategy.java


示例13: setup

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
@org.junit.Before
    public void setup() throws Exception {
        bind(ApplicationScoped.class, ServiceLoader.class, serviceLoader);
        bind(ApplicationScoped.class, VideoConfiguration.class, configuration);
        bind(ApplicationScoped.class, Recorder.class, recorder);
        bind(ApplicationScoped.class, TakenResourceRegister.class, takenResourceRegister);

        strategy.setConfiguration(configuration);
        bind(ApplicationScoped.class, VideoStrategy.class, strategy);

        Mockito.when(recorder.getVideoType()).thenReturn(VideoType.MP4);

        Mockito.doNothing().when(cleaner).clean(configuration);

        Mockito.when(serviceLoader.onlyOne(VideoRecorderEnvironmentCleaner.class, DefaultVideoRecorderEnvironmentCleaner.class))
            .thenReturn(cleaner);

//        Mockito.when(serviceLoader.onlyOne(VideoStrategy.class, DefaultVideoStrategy.class))
//            .thenReturn(strategy);

        videoFile = File.createTempFile("fakeVideo", recorder.getVideoType().toString().toLowerCase());

        Mockito.when(configuration.getVideoName()).thenReturn("record");

        Mockito.when(video.getResource()).thenReturn(videoFile);
        Mockito.when(video.getResourceType()).thenReturn(VideoType.MP4);
        Mockito.when(video.getWidth()).thenReturn(100);
        Mockito.when(video.getHeight()).thenReturn(100);

        Mockito.when(recorder.stopRecording()).thenReturn(video);
    }
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:32,代码来源:RecorderLifecycleObserverTestCase.java


示例14: defaultConfigurationTest

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
@Test
public void defaultConfigurationTest() throws Exception {

    // by default, no videos are taken at all

    fire(new VideoExtensionConfigured());

    fire(new BeforeSuite());
    fire(new BeforeClass(DummyTestCase.class));
    fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test")));

    bind(TestScoped.class, TestResult.class, TestResult.passed());

    fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP));
    fire(new AfterClass(DummyTestCase.class));
    fire(new AfterSuite());

    assertEventFired(BeforeVideoStart.class, 0);
    assertEventFired(StartRecordVideo.class, 0);
    assertEventFired(StartRecordSuiteVideo.class, 0);
    assertEventFired(AfterVideoStart.class, 0);

    assertEventFired(BeforeVideoStop.class, 0);
    assertEventFired(StopRecordVideo.class, 0);
    assertEventFired(StopRecordSuiteVideo.class, 0);
    assertEventFired(AfterVideoStop.class, 0);
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:28,代码来源:RecorderLifecycleObserverTestCase.java


示例15: takeOnlyOnFailTestFailedTest

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
@Test
public void takeOnlyOnFailTestFailedTest() throws Exception {

    Mockito.when(configuration.getTakeOnlyOnFail()).thenReturn(true);

    fire(new VideoExtensionConfigured());

    fire(new BeforeSuite());
    fire(new BeforeClass(DummyTestCase.class));
    fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test")));

    bind(TestScoped.class, TestResult.class, TestResult.failed(new RuntimeException("some exception")));

    fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP));
    fire(new AfterClass(DummyTestCase.class));
    fire(new AfterSuite());

    assertEventFired(BeforeVideoStart.class, 1);
    assertEventFired(StartRecordVideo.class, 1);
    assertEventFired(AfterVideoStart.class, 1);

    assertEventFired(PropertyReportEvent.class, 1);

    assertEventFired(BeforeVideoStop.class, 1);
    assertEventFired(StopRecordVideo.class, 1);
    assertEventFired(AfterVideoStop.class, 1);
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:28,代码来源:RecorderLifecycleObserverTestCase.java


示例16: takeOnlyOnFailTestPassedTest

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
@Test
public void takeOnlyOnFailTestPassedTest() throws Exception {

    Mockito.when(configuration.getTakeOnlyOnFail()).thenReturn(true);

    fire(new VideoExtensionConfigured());

    fire(new BeforeSuite());
    fire(new BeforeClass(DummyTestCase.class));
    fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test")));

    bind(TestScoped.class, TestResult.class, TestResult.passed());

    fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP));
    fire(new AfterClass(DummyTestCase.class));
    fire(new AfterSuite());

    assertEventFired(BeforeVideoStart.class, 1);
    assertEventFired(StartRecordVideo.class, 1);
    assertEventFired(AfterVideoStart.class, 1);

    assertEventFired(PropertyReportEvent.class, 0);

    assertEventFired(BeforeVideoStop.class, 1);
    assertEventFired(StopRecordVideo.class, 1);
    assertEventFired(AfterVideoStop.class, 1);
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:28,代码来源:RecorderLifecycleObserverTestCase.java


示例17: startRecording

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
public void startRecording(@Observes Before beforeTestMethod, CubeDroneConfiguration cubeDroneConfiguration,
    CubeRegistry cubeRegistry) {

    if (cubeDroneConfiguration.isRecording()) {

        // lazy init
        initVncCube(cubeRegistry);

        vnc.create();
        vnc.start();
    }
}
 
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:13,代码来源:VncRecorderLifecycleManager.java


示例18: createOpenShiftResource

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
public void createOpenShiftResource(@Observes(precedence = 10) Before event, OpenShiftAdapter client,
    CubeOpenShiftConfiguration cubeOpenShiftConfiguration) {

    final TestClass testClass = event.getTestClass();
    final Method testMethod = event.getTestMethod();

    log.info(String.format("Creating environment for %s method %s", testClass.getName(), testMethod));

    OpenShiftResourceFactory.createResources(testClass.getJavaClass(), client, testMethod, cubeOpenShiftConfiguration.getProperties());
    methodTemplateProcessor = new MethodTemplateProcessor(client, cubeOpenShiftConfiguration, testClass, testMethod);
    methodTemplateProcessor.processTemplateResources();
}
 
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:13,代码来源:CEEnvironmentProcessor.java


示例19: injectRule

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
public void injectRule(@Observes Before enrichRule) {
    if (getEnrichers() == null || getEnrichers().isEmpty()) {
        Collection<TestEnricher> testEnrichers = serviceLoader.get().all(TestEnricher.class);
        enrichers.set(testEnrichers);
    }

    Class<?> clazz = enrichRule.getTestClass().getJavaClass();
    List<Field> rules = SecurityActions.getFieldsWithAnnotation(clazz, ArquillianRule.class);
    for (Field f : rules) {
        Object value = SecurityActions.getFieldValue(enrichRule.getTestInstance(), f);
        for (TestEnricher enricher : getEnrichers()) {
            enricher.enrich(value);
        }
    }
}
 
开发者ID:aerogear,项目名称:aerogear-testing-tools,代码行数:16,代码来源:ArquillianRuleInjector.java


示例20: isTakingAction

import org.jboss.arquillian.test.spi.event.suite.Before; //导入依赖的package包/类
@Override
public boolean isTakingAction(Event event) {
    return event instanceof Before && configuration.getTakeBeforeTest();
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:5,代码来源:DefaultScreenshootingStrategy.java



注:本文中的org.jboss.arquillian.test.spi.event.suite.Before类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OperationClient类代码示例发布时间:2022-05-23
下一篇:
Java Canvas类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap