/** * Synchronizes environment properties between the {@link GeoServerEnvironment} and the {@link * GeoWebCacheEnvironment}. (GeoServer properties will override GeoWebCache properties) * * @throws IllegalArgumentException */ public void syncEnv() throws IllegalArgumentException { if (gsEnvironment != null && gsEnvironment.isStale() && gwcEnvironment != null) { if (GeoServerEnvironment.ALLOW_ENV_PARAMETRIZATION && gsEnvironment.getProps() != null) { Properties gwcProps = gwcEnvironment.getProps(); if (gwcProps == null) { gwcProps = new Properties(); } gwcProps.putAll(gsEnvironment.getProps()); gwcEnvironment.setProps(gwcProps); } } }
public void testSystemProperty() { // check for a property we did set up in the setUp GeoWebCacheEnvironment genv = new GeoWebCacheEnvironment(); assertEquals("ABC", genv.resolveValue("${TEST_SYS_PROPERTY}")); Properties props = new Properties(); props.setProperty("TEST_SYS_PROPERTY", "DEF"); props.setProperty("TEST_PROPERTY", "WWW"); genv.setProps(props); assertEquals("ABC", genv.resolveValue("${TEST_SYS_PROPERTY}")); assertEquals("WWW", genv.resolveValue("${TEST_PROPERTY}")); } }