I split the database dataSourceConfig.yml
configuration file:
environments: development: dataSource: dbCreate: none url: jdbc:oracle:thin:xxxxxx driverClassName: oracle.jdbc.OracleDriver dialect: org.hibernate.dialect.Oracle10gDialect username: xxxx password: xxxx test: dataSource: dbCreate: none url: jdbc:oracle:thin:xxxxx driverClassName: oracle.jdbc.OracleDriver dialect: org.hibernate.dialect.Oracle10gDialect username: xxxxx password: xxxxx
What I connect to the project in Application.java
:
class Application extends GrailsAutoConfiguration implements EnvironmentAware { static void main(String[] args) { GrailsApp.run(Application, args) } @Override void setEnvironment(Environment environment) { String configPath = environment.getProperty("local.config.location") Resource resourceConfig = new FileSystemResource(configPath) YamlPropertiesFactoryBean ypfb = new YamlPropertiesFactoryBean() ypfb.setResources([resourceConfig] as Resource[]) ypfb.afterPropertiesSet() Properties properties = ypfb.getObject() environment.propertySources.addFirst(new PropertiesPropertySource("local.config.location", properties)) } }
When I run integration tests through Intellij IDEA 15, it runs tests in the development environment, but there is test in the YAML configuration file.
Does anyone know how to fix this? The command below does not help.
grails test test-app -integration
source share