private Boolean isLazyInit() { return properties.resolveBooleanProperty(MULE_LAZY_INIT_DEPLOYMENT_PROPERTY).orElse(false); }
@Override public boolean mustStartMessageSource(Component component) { if (configurationProperties.resolveProperty(DISABLE_SCHEDULER_SOURCES_PROPERTY).isPresent()) { if (component.getLocation().getComponentIdentifier().getIdentifier().equals(SCHEDULER_MESSAGE_SOURCE_IDENTIFIER)) { return !configurationProperties.resolveBooleanProperty(DISABLE_SCHEDULER_SOURCES_PROPERTY).orElse(false); } } return true; }
@Test public void appHomePropertyIsPresent() throws Exception { final ApplicationFileBuilder globalPropertyAppFileBuilder = new ApplicationFileBuilder("property-app").definedBy("app-properties-config.xml"); addExplodedAppFromBuilder(globalPropertyAppFileBuilder); startDeployment(); assertApplicationDeploymentSuccess(applicationDeploymentListener, globalPropertyAppFileBuilder.getId()); final Application app = findApp(globalPropertyAppFileBuilder.getId(), 1); Optional<ConfigurationProperties> configurationProperties = app.getRegistry().lookupByType(ConfigurationProperties.class); assertThat(configurationProperties.isPresent(), is(true)); File appHome = new File(configurationProperties.get().resolveStringProperty("appHome") .orElseThrow(() -> new RuntimeException("Could not find property appHome"))); assertThat(appHome.exists(), is(true)); assertThat(appHome.getName(), is(globalPropertyAppFileBuilder.getId())); }
@Override public Optional<ConfigurationProperty> getConfigurationProperty(String configurationAttributeKey) { return parentConfigurationProperties.get().resolveProperty(configurationAttributeKey) .map(value -> new DefaultConfigurationProperty(parentConfigurationProperties, configurationAttributeKey, value)); }
@Override protected String resolvePlaceholder(String placeholder, Properties props, int systemPropertiesMode) { return configurationProperties.resolveStringProperty(placeholder).orElse(null); }
@Override public Optional<ConfigurationProperty> getConfigurationProperty(String configurationAttributeKey) { return parentConfigurationProperties.get().resolveProperty(configurationAttributeKey) .map(value -> new DefaultConfigurationProperty(parentConfigurationProperties, configurationAttributeKey, value)); }
protected boolean isLazyModeEnabled() { return properties.resolveBooleanProperty(MULE_LAZY_INIT_DEPLOYMENT_PROPERTY).orElse(false); }
@Override public boolean mustStartMessageSource(Component component) { if (configurationProperties.resolveProperty(DISABLE_SCHEDULER_SOURCES_PROPERTY).isPresent()) { if (component.getLocation().getComponentIdentifier().getIdentifier().equals(SCHEDULER_MESSAGE_SOURCE_IDENTIFIER)) { return !configurationProperties.resolveBooleanProperty(DISABLE_SCHEDULER_SOURCES_PROPERTY).orElse(false); } } return true; }
@Override protected String resolvePlaceholder(String placeholder, Properties props) { return configurationProperties.resolveStringProperty(placeholder).orElse(null); }
private Boolean lazyInit() { return properties.resolveBooleanProperty(MULE_LAZY_INIT_DEPLOYMENT_PROPERTY).orElse(false); }
@Override public Object call(Object[] parameters, BindingContext context) { String name = (String) parameters[0]; String value = configurationProperties.resolveStringProperty(name).orElse(System.getProperty(name)); if (value == null) { value = System.getenv(name); } return value; }
private boolean getDoTestConnectivityProperty() { return System.getProperty(DO_TEST_CONNECTIVITY_PROPERTY_NAME) != null ? valueOf(System.getProperty(DO_TEST_CONNECTIVITY_PROPERTY_NAME)) : !configurationProperties.resolveBooleanProperty(MULE_LAZY_INIT_DEPLOYMENT_PROPERTY).orElse(false); } }
@Test public void appHomePropertyIsPresent() throws Exception { final ApplicationFileBuilder globalPropertyAppFileBuilder = new ApplicationFileBuilder("property-app").definedBy("app-properties-config.xml"); addExplodedAppFromBuilder(globalPropertyAppFileBuilder); startDeployment(); assertApplicationDeploymentSuccess(applicationDeploymentListener, globalPropertyAppFileBuilder.getId()); final Application app = findApp(globalPropertyAppFileBuilder.getId(), 1); Optional<ConfigurationProperties> configurationProperties = app.getRegistry().lookupByType(ConfigurationProperties.class); assertThat(configurationProperties.isPresent(), is(true)); String appHome = configurationProperties.get().resolveStringProperty("appHome") .orElseThrow(() -> new RuntimeException("Could not find property appHome")); assertThat(new File(appHome).exists(), is(true)); }
@Override protected Map<String, Object> getStartUpRegistryObjects() { Mockito.doReturn(Optional.empty()).when(configProperties).resolveBooleanProperty(Matchers.anyString()); return singletonMap(OBJECT_CONFIGURATION_PROPERTIES, configProperties); }
@Before public void setUpConfigProperties() { when(configProperties.resolveBooleanProperty(anyString())).thenReturn(empty()); }
@Override protected Map<String, Object> getStartUpRegistryObjects() { when(componentLocator.find(Location.builder().globalName(APPLE_FLOW).build())).thenReturn(of(mock(Flow.class))); when(configurationProperties.resolveBooleanProperty(MULE_LAZY_INIT_DEPLOYMENT_PROPERTY)).thenReturn(Optional.of(false)); Map<String, Object> registryObjects = new HashMap<>(); registryObjects.put(REGISTRY_KEY, componentLocator); registryObjects.put("_configurationProperties", configurationProperties); return registryObjects; }
when(configProps.resolveBooleanProperty(any())).thenReturn(empty());
@Override protected void doSetUp() throws Exception { ((MuleContextWithRegistry) muleContext).getRegistry().registerObject(OBJECT_CONNECTION_MANAGER, connectionManager); ((MuleContextWithRegistry) muleContext).getRegistry().registerObject(OBJECT_TIME_SUPPLIER, timeSupplier); ((MuleContextWithRegistry) muleContext).getRegistry().registerObject(OBJECT_CONFIGURATION_PROPERTIES, configurationProperties); doReturn(empty()).when(configurationProperties).resolveBooleanProperty(MULE_LAZY_INIT_DEPLOYMENT_PROPERTY); retryPolicyTemplate = createRetryTemplate(); retryPolicyTemplate.setNotifier(mock(RetryNotifier.class)); super.doSetUp(); }
protected boolean isLazyModeEnabled() { return properties.resolveBooleanProperty(MULE_LAZY_INIT_DEPLOYMENT_PROPERTY).orElse(false); }
private Boolean isLazyInit() { return properties.resolveBooleanProperty(MULE_LAZY_INIT_DEPLOYMENT_PROPERTY).orElse(false); }