org.jboss.arquillian.test.spi.context.ClassContext Java Examples

The following examples show how to use org.jboss.arquillian.test.spi.context.ClassContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RedmineGovernorTestCase.java    From arquillian-governor with Apache License 2.0 6 votes vote down vote up
@Test
public void gitHubGovernorTest() {
    fire(new BeforeClass(FakeTestClass.class));

    assertEventFired(BeforeClass.class, 1);
    assertEventFired(DecideMethodExecutions.class, 1);

    final GovernorConfiguration configuration = manager.getContext(ApplicationContext.class).getObjectStore().get(GovernorConfiguration.class);
    assertThat(configuration, is(not(nullValue())));

    final RedmineGovernorConfiguration gitHubConfiguration = manager.getContext(ApplicationContext.class).getObjectStore().get(RedmineGovernorConfiguration.class);
    assertThat(gitHubConfiguration, is(not(nullValue())));

    // for every method and for every Governor annotation of that method
    assertEventFired(ExecutionDecisionEvent.class, 1);

    final ExecutionDecision decision = manager.getContext(ClassContext.class).getObjectStore().get(ExecutionDecision.class);

    assertThat(decision, is(not(nullValue())));
    assertEquals(decision.getDecision(), Decision.EXECUTE);
}
 
Example #2
Source File: GitHubGovernorTestCase.java    From arquillian-governor with Apache License 2.0 6 votes vote down vote up
@Test
public void gitHubGovernorTest() {
    fire(new BeforeClass(FakeTestClass.class));

    assertEventFired(BeforeClass.class, 1);
    assertEventFired(DecideMethodExecutions.class, 1);

    final GovernorConfiguration configuration = manager.getContext(ApplicationContext.class).getObjectStore().get(GovernorConfiguration.class);
    assertThat(configuration, is(not(nullValue())));

    final GitHubGovernorConfiguration gitHubConfiguration = manager.getContext(ApplicationContext.class).getObjectStore().get(GitHubGovernorConfiguration.class);
    assertThat(gitHubConfiguration, is(not(nullValue())));

    // for every method and for every Governor annotation of that method
    assertEventFired(ExecutionDecisionEvent.class, 1);

    final ExecutionDecision decision = manager.getContext(ClassContext.class).getObjectStore().get(ExecutionDecision.class);

    assertThat(decision, is(not(nullValue())));
    assertEquals(decision.getDecision(), Decision.EXECUTE);
}
 
Example #3
Source File: AbstractGovernorTestCase.java    From arquillian-governor with Apache License 2.0 5 votes vote down vote up
@Override
protected void startContexts(Manager manager) {
    super.startContexts(manager);
    manager.getContext(SuiteContext.class).activate();
    manager.getContext(ClassContext.class).activate(super.getClass());
    manager.getContext(TestContext.class).activate(this);
}
 
Example #4
Source File: AbstractGovernorTestCase.java    From arquillian-governor with Apache License 2.0 5 votes vote down vote up
@Override
protected void startContexts(Manager manager) {
    super.startContexts(manager);
    manager.getContext(SuiteContext.class).activate();
    manager.getContext(ClassContext.class).activate(super.getClass());
    manager.getContext(TestContext.class).activate(this);
}
 
Example #5
Source File: JiraGovernorTestCase.java    From arquillian-governor with Apache License 2.0 5 votes vote down vote up
@Test
public void jiraGovernorTest() {
    fire(new BeforeClass(FakeTestClass.class));

    assertEventFired(BeforeClass.class, 1);
    assertEventFired(DecideMethodExecutions.class, 1);

    final GovernorRegistry governorRegistry = manager.getContext(ClassContext.class).getObjectStore().get(GovernorRegistry.class);
    assertThat(governorRegistry, is(not(nullValue())));

    final GovernorConfiguration configuration = manager.getContext(ApplicationContext.class).getObjectStore().get(GovernorConfiguration.class);
    assertThat(configuration, is(not(nullValue())));

    final JiraGovernorConfiguration jiraConfiguration = manager.getContext(ApplicationContext.class).getObjectStore().get(JiraGovernorConfiguration.class);
    assertThat(jiraConfiguration, is(not(nullValue())));

    final List<Method> jiraMethods = governorRegistry.getMethodsForAnnotation(Jira.class);
    assertEquals(1, jiraMethods.size());

    // for every method and for every Governor annotation of that method
    assertEventFired(ExecutionDecisionEvent.class, 1);

    final ExecutionDecision decision = manager.getContext(ClassContext.class).getObjectStore().get(ExecutionDecision.class);

    assertThat(decision, is(not(nullValue())));
    assertEquals(decision.getDecision(), Decision.EXECUTE);
}
 
Example #6
Source File: AbstractGovernorTestCase.java    From arquillian-governor with Apache License 2.0 5 votes vote down vote up
@Override
protected void startContexts(Manager manager) {
    super.startContexts(manager);
    manager.getContext(SuiteContext.class).activate();
    manager.getContext(ClassContext.class).activate(super.getClass());
    manager.getContext(TestContext.class).activate(this);
}
 
Example #7
Source File: AbstractGovernorTestCase.java    From arquillian-governor with Apache License 2.0 5 votes vote down vote up
@Override
protected void startContexts(Manager manager) {
    super.startContexts(manager);
    manager.getContext(SuiteContext.class).activate();
    manager.getContext(ClassContext.class).activate(super.getClass());
    manager.getContext(TestContext.class).activate(this);
}