use of net.n2oapp.properties.OverrideProperties in project n2o-framework by i-novus-llc.
the class DataControllerTestBase method setUp.
@Before
public void setUp() {
N2oEnvironment environment = new N2oEnvironment();
environment.setNamespacePersisterFactory(new PersisterFactoryByMap());
environment.setNamespaceReaderFactory(new ReaderFactoryByMap());
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasenames("n2o_messages", "messages");
messageSource.setDefaultEncoding("UTF-8");
environment.setMessageSource(new MessageSourceAccessor(messageSource));
OverrideProperties properties = PropertiesReader.getPropertiesFromClasspath("META-INF/n2o.properties");
properties.put("n2o.engine.mapper", "spel");
SimplePropertyResolver propertyResolver = new SimplePropertyResolver(properties);
setUpStaticProperties(propertyResolver);
environment.setSystemProperties(propertyResolver);
builder = new N2oApplicationBuilder(environment);
configure(builder);
CompileInfo.setSourceTypes(builder.getEnvironment().getSourceTypeRegister());
}
use of net.n2oapp.properties.OverrideProperties in project n2o-framework by i-novus-llc.
the class N2oTestBase method setUp.
public void setUp() throws Exception {
N2oEnvironment environment = new N2oEnvironment();
environment.setNamespacePersisterFactory(new PersisterFactoryByMap());
environment.setNamespaceReaderFactory(new ReaderFactoryByMap());
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.addBasenames("n2o_api_messages", "n2o_api_messages", "n2o_config_messages", "test_messages", "messages");
messageSource.setDefaultEncoding("UTF-8");
Locale locale = new Locale("ru");
LocaleContextHolder.setLocale(locale);
environment.setMessageSource(new MessageSourceAccessor(messageSource));
OverrideProperties n2oProperties = PropertiesReader.getPropertiesFromClasspath("META-INF/n2o.properties");
OverrideProperties appProperties = PropertiesReader.getPropertiesFromClasspath("application.properties");
appProperties.setBaseProperties(n2oProperties);
environment.setSystemProperties(new SimplePropertyResolver(appProperties));
builder = new N2oApplicationBuilder(environment);
configure(builder);
CompileInfo.setSourceTypes(builder.getEnvironment().getSourceTypeRegister());
}
use of net.n2oapp.properties.OverrideProperties in project n2o-framework by i-novus-llc.
the class CopyValuesControllerTest method setUp.
@Before
public void setUp() {
N2oEnvironment environment = new N2oEnvironment();
environment.setNamespacePersisterFactory(new PersisterFactoryByMap());
environment.setNamespaceReaderFactory(new ReaderFactoryByMap());
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasenames("n2o_messages", "messages");
messageSource.setDefaultEncoding("UTF-8");
environment.setMessageSource(new MessageSourceAccessor(messageSource));
OverrideProperties properties = PropertiesReader.getPropertiesFromClasspath("META-INF/n2o.properties");
properties.put("n2o.engine.mapper", "spel");
environment.setSystemProperties(new SimplePropertyResolver(properties));
builder = new N2oApplicationBuilder(environment);
configure(builder);
CompileInfo.setSourceTypes(builder.getEnvironment().getSourceTypeRegister());
}
use of net.n2oapp.properties.OverrideProperties in project n2o-framework by i-novus-llc.
the class DefaultValuesControllerTest method setUp.
@Before
public void setUp() {
N2oEnvironment environment = new N2oEnvironment();
environment.setNamespacePersisterFactory(new PersisterFactoryByMap());
environment.setNamespaceReaderFactory(new ReaderFactoryByMap());
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasenames("n2o_messages", "messages");
messageSource.setDefaultEncoding("UTF-8");
environment.setMessageSource(new MessageSourceAccessor(messageSource));
OverrideProperties properties = PropertiesReader.getPropertiesFromClasspath("META-INF/n2o.properties");
properties.put("n2o.engine.mapper", "spel");
environment.setSystemProperties(new SimplePropertyResolver(properties));
builder = new N2oApplicationBuilder(environment);
configure(builder);
CompileInfo.setSourceTypes(builder.getEnvironment().getSourceTypeRegister());
}
use of net.n2oapp.properties.OverrideProperties in project n2o-framework by i-novus-llc.
the class PropertiesReader method getPropertiesFromURI.
public static OverrideProperties getPropertiesFromURI(String locationPattern) {
OverrideProperties properties = new OverrideProperties();
PathMatchingResourcePatternResolver r = new PathMatchingResourcePatternResolver();
try {
for (Resource resource : r.getResources(locationPattern)) {
try (InputStream is = resource.getInputStream()) {
if (is != null) {
try {
properties.load(is);
} catch (IOException e) {
throw new IllegalStateException(e);
}
} else {
log.debug("{} not found.", locationPattern);
}
}
}
return properties;
} catch (IOException e) {
log.error(e.getMessage(), e);
}
return null;
}
Aggregations