Example #1
0
        /// <summary>
        /// Method for convenient testing of local connectors.
        /// </summary>
        public APIConfiguration CreateTestConfiguration(SafeType <Connector> clazz,
                                                        Configuration config)
        {
            LocalConnectorInfoImpl info = new LocalConnectorInfoImpl();

            info.ConnectorConfigurationClass = SafeType <Configuration> .Get(config);

            info.ConnectorClass          = (clazz);
            info.ConnectorDisplayNameKey = ("DUMMY_DISPLAY_NAME");
            info.ConnectorKey            = (
                new ConnectorKey(clazz.RawType.Name + ".bundle",
                                 "1.0",
                                 clazz.RawType.Name));
            info.Messages = (this.CreateDummyMessages());
            APIConfigurationImpl rv = new APIConfigurationImpl();

            rv.IsConnectorPoolingSupported = (
                IsConnectorPoolingSupported(clazz));
            ConfigurationPropertiesImpl properties =
                CSharpClassProperties.CreateConfigurationProperties(config);

            rv.ConfigurationProperties = (properties);
            rv.ConnectorInfo           = (info);
            rv.SupportedOperations     = (
                FrameworkUtil.GetDefaultSupportedOperations(clazz));
            info.DefaultAPIConfiguration = (
                rv);
            return(rv);
        }
Example #2
0
        public void FillConfiguration(Configuration config, IDictionary <string, object> configData)
        {
            IDictionary <string, object> configDataCopy = new Dictionary <string, object>(configData);
            ConfigurationPropertiesImpl  configProps    =
                CSharpClassProperties.CreateConfigurationProperties(config);

            foreach (string propName in configProps.PropertyNames)
            {
                object value;
                if (configDataCopy.TryGetValue(propName, out value))
                {
                    // Remove the entry from the config map, so that at the end
                    // the map only contains entries that were not assigned to a config property.
                    configDataCopy.Remove(propName);
                    configProps.SetPropertyValue(propName, value);
                }
            }
            // The config map now contains entries that were not assigned to a config property.
            foreach (string propName in configDataCopy.Keys)
            {
                Trace.TraceWarning("Configuration property {0} does not exist!", propName);
            }
            CSharpClassProperties.MergeIntoBean(configProps, config);
        }