Package org.springframework.test.context

Examples of org.springframework.test.context.TestContext


*/
public final class SpringTestPlugin extends AbstractTestPlugin {
    public void prepareTestInstance(Context context) {
        try {
            final TestContextManager manager = new TestContextManager(context.getTest().getTargetClass());
            final TestContext ctx = manager.testContext();
            context.setAttribute("org.springframework.test.context.TestContextManager", manager);
            context.setAttribute("org.springframework.test.context.TestContext", ctx);
            setupContextLoader(ctx, new MycilaContextLoader(context));
            manager.prepareTestInstance(context.getTest().getTarget());
            context.setAttribute("org.springframework.context.ApplicationContext", manager.testContext().getApplicationContext());
View Full Code Here


  private JobScopeTestExecutionListener listener = new JobScopeTestExecutionListener();

  @Test
  public void testDefaultJobContext() throws Exception {
    TestContext testContext = getTestContext(new Object());
    listener.prepareTestInstance(testContext);
    listener.beforeTestMethod(testContext);
    JobContext context = JobSynchronizationManager.getContext();
    assertNotNull(context);
    listener.afterTestMethod(testContext);
View Full Code Here

  public void testWithParameters() throws Exception {
    testJobParameters(new WithJobExecutionFactory());
  }

  private void testExecutionContext(Object target) throws Exception {
    TestContext testContext = getTestContext(target);
    listener.prepareTestInstance(testContext);
    try {
      listener.beforeTestMethod(testContext);
      JobContext context = JobSynchronizationManager.getContext();
      assertNotNull(context);
View Full Code Here

    }
    assertNull(JobSynchronizationManager.getContext());
  }

  private void testJobParameters(Object target) throws Exception {
    TestContext testContext = getTestContext(target);
    listener.prepareTestInstance(testContext);
    try {
      listener.beforeTestMethod(testContext);
      JobContext context = JobSynchronizationManager.getContext();
      assertNotNull(context);
View Full Code Here

  private StepScopeTestExecutionListener listener = new StepScopeTestExecutionListener();

  @Test
  public void testDefaultStepContext() throws Exception {
    TestContext testContext = getTestContext(new Object());
    listener.prepareTestInstance(testContext);
    listener.beforeTestMethod(testContext);
    StepContext context = StepSynchronizationManager.getContext();
    assertNotNull(context);
    listener.afterTestMethod(testContext);
View Full Code Here

  public void testWithParameters() throws Exception {
    testJobParameters(new WithStepExecutionFactory());
  }

  private void testExecutionContext(Object target) throws Exception {
    TestContext testContext = getTestContext(target);
    listener.prepareTestInstance(testContext);
    try {
      listener.beforeTestMethod(testContext);
      StepContext context = StepSynchronizationManager.getContext();
      assertNotNull(context);
View Full Code Here

    }
    assertNull(StepSynchronizationManager.getContext());
  }

  private void testJobParameters(Object target) throws Exception {
    TestContext testContext = getTestContext(target);
    listener.prepareTestInstance(testContext);
    try {
      listener.beforeTestMethod(testContext);
      StepContext context = StepSynchronizationManager.getContext();
      assertNotNull(context);
View Full Code Here

    assertKey(config, "anotherKey", "another=Value");
  }

  private Map<String, Object> getEnvironmentProperties(Class<?> testClass)
      throws Exception {
    TestContext context = new ExposedTestContextManager(testClass)
        .getExposedTestContext();
    new IntegrationTestPropertiesListener().prepareTestInstance(context);
    MergedContextConfiguration config = (MergedContextConfiguration) ReflectionTestUtils
        .getField(context, "mergedContextConfiguration");
    return this.loader.extractEnvironmentProperties(config
View Full Code Here

TOP

Related Classes of org.springframework.test.context.TestContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.