Package org.springframework.context.support

Examples of org.springframework.context.support.GenericGroovyApplicationContext


* <p>Version: 1.0
*/
public class XmlGroovyBeanDefinitionTest1 {
    @Test
    public void test() {
        ApplicationContext ctx = new GenericGroovyApplicationContext("classpath:spring-config-xml.groovy");
        MessagePrinter messagePrinter = (MessagePrinter) ctx.getBean("messagePrinter");
        messagePrinter.printMessage();
        System.out.println(ctx.getBean("map"));
    }
View Full Code Here


* @author Juergen Hoeller
*/
public class GroovyApplicationContextTests extends TestCase {

  public void testLoadingConfigFile() {
    GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext(
        "org/springframework/context/groovy/applicationContext.groovy");

    Object framework = ctx.getBean("framework");
    assertNotNull("could not find framework bean", framework);
    assertEquals("Grails", framework);
  }
View Full Code Here

    assertNotNull("could not find framework bean", framework);
    assertEquals("Grails", framework);
  }

  public void testLoadingMultipleConfigFiles() {
    GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext(
        "org/springframework/context/groovy/applicationContext2.groovy",
        "org/springframework/context/groovy/applicationContext.groovy");

    Object framework = ctx.getBean("framework");
    assertNotNull("could not find framework bean", framework);
    assertEquals("Grails", framework);

    Object company = ctx.getBean("company");
    assertNotNull("could not find company bean", company);
    assertEquals("SpringSource", company);
  }
View Full Code Here

    assertNotNull("could not find company bean", company);
    assertEquals("SpringSource", company);
  }

  public void testLoadingMultipleConfigFilesWithRelativeClass() {
    GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext();
    ctx.load(GroovyApplicationContextTests.class, "applicationContext2.groovy", "applicationContext.groovy");
    ctx.refresh();

    Object framework = ctx.getBean("framework");
    assertNotNull("could not find framework bean", framework);
    assertEquals("Grails", framework);

    Object company = ctx.getBean("company");
    assertNotNull("could not find company bean", company);
    assertEquals("SpringSource", company);
  }
View Full Code Here

public class GroovyControlGroupTests {

  @Test
  @SuppressWarnings("resource")
  public void verifyScriptUsingGenericGroovyApplicationContext() {
    ApplicationContext ctx = new GenericGroovyApplicationContext(getClass(), "context.groovy");

    String foo = ctx.getBean("foo", String.class);
    assertEquals("Foo", foo);

    String bar = ctx.getBean("bar", String.class);
    assertEquals("Bar", bar);

    Pet pet = ctx.getBean(Pet.class);
    assertNotNull("pet", pet);
    assertEquals("Dogbert", pet.getName());

    Employee employee = ctx.getBean(Employee.class);
    assertNotNull("employee", employee);
    assertEquals("Dilbert", employee.getName());
    assertEquals("???", employee.getCompany());
  }
View Full Code Here

TOP

Related Classes of org.springframework.context.support.GenericGroovyApplicationContext

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.