fixing issues with tests
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
package zw.qantra.tm;
|
||||
|
||||
import io.nflow.rest.config.RestConfiguration;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
@SpringBootApplication
|
||||
@Import(RestConfiguration.class)
|
||||
@EnableCaching
|
||||
@EnableAsync
|
||||
public class TmApplication {
|
||||
@@ -24,4 +23,14 @@ public class TmApplication {
|
||||
public Gson gson() {
|
||||
return new Gson();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Conditionally imports nFlow REST configuration only when NOT running the "test" profile.
|
||||
* This prevents nFlow's PostgreSQL-dependent beans from loading in tests that use H2.
|
||||
*/
|
||||
@Configuration
|
||||
@Profile("!test")
|
||||
@org.springframework.context.annotation.Import(io.nflow.rest.config.RestConfiguration.class)
|
||||
static class NflowRestConfig {
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,13 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
@Profile("!test")
|
||||
public class NflowDatabaseConfig extends PgDatabaseConfiguration {
|
||||
|
||||
@Bean
|
||||
@@ -31,4 +33,4 @@ public class NflowDatabaseConfig extends PgDatabaseConfiguration {
|
||||
.initializeDataSourceBuilder()
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user