Package org.springframework.core.env

Examples of org.springframework.core.env.Environment


  @Test
  public void entityManagerFactoryDB() throws Exception {
    DataSource dataSource = createMock(DataSource.class);

    final Environment env = createMock(Environment.class);
    String mode = "create";

    expect(env.getRequiredProperty(DataSources.DATABASE)).andReturn("jdbc:mysql://local");
    expect(env.getRequiredProperty("application.ns", String[].class)).andReturn(
        new String[]{JpaModuleTest.class.getPackage().getName() });
    expect(env.getProperty(JpaModule.DB_SCHEMA, "update")).andReturn(mode);

    ReflectionUtils.doWithFields(AvailableSettings.class, new FieldCallback() {
      @Override
      public void doWith(final Field field) throws IllegalArgumentException,
          IllegalAccessException {
        String propertyName = (String) field.get(null);
        expect(env.getProperty(propertyName)).andReturn(null);
      }
    });

    ApplicationContext context = createMock(ApplicationContext.class);
    expect(context.getEnvironment()).andReturn(env);
View Full Code Here

TOP

Related Classes of org.springframework.core.env.Environment

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.