Internal class, public only for unit tests
Inheritance: ConfigurationProperties
コード例 #1
0
        public override bool Equals(object o)
        {
            ConfigurationPropertiesImpl other = o as ConfigurationPropertiesImpl;

            if (other != null)
            {
                return(CollectionUtil.SetsEqual(_properties,
                                                other._properties));
            }
            return(false);
        }
コード例 #2
0
        public APIConfigurationImpl(APIConfigurationImpl other)
        {
            if (null != other._connectorPoolConfiguration)
            {
                ConnectorPoolConfiguration = new ObjectPoolConfiguration(other._connectorPoolConfiguration);
            }
            if (null != other._resultsHandlerConfiguration)
            {
                ResultsHandlerConfiguration = new ResultsHandlerConfiguration(other._resultsHandlerConfiguration);
            }
            IsConnectorPoolingSupported = other.IsConnectorPoolingSupported;
            ConfigurationPropertiesImpl prop = new ConfigurationPropertiesImpl();
            prop.Properties = ((ConfigurationPropertiesImpl)other.ConfigurationProperties).Properties;
            ConfigurationProperties = prop;

            ProducerBufferSize = other.ProducerBufferSize;
            TimeoutMap = new Dictionary<SafeType<APIOperation>, int>(other.TimeoutMap);
            SupportedOperations = new HashSet<SafeType<APIOperation>>(other.SupportedOperations);

            ConnectorInfo = other.ConnectorInfo;
            ChangeListener = other.ChangeListener;
        }
コード例 #3
0
        public void TestRemoteConnectorInfo()
        {
            RemoteConnectorInfoImpl v1 = new RemoteConnectorInfoImpl();
            v1.Messages = (new ConnectorMessagesImpl());
            v1.ConnectorKey = (new ConnectorKey("my bundle",
                "my version",
            "my connector"));
            ConfigurationPropertiesImpl configProperties = new ConfigurationPropertiesImpl();
            configProperties.Properties = (new List<ConfigurationPropertyImpl>());
            APIConfigurationImpl apiImpl = new APIConfigurationImpl();
            apiImpl.ConfigurationProperties = (configProperties);
            v1.DefaultAPIConfiguration = (apiImpl);
            v1.ConnectorDisplayNameKey = ("mykey");
            v1.ConnectorCategoryKey = ("LDAP");

            RemoteConnectorInfoImpl v2 = (RemoteConnectorInfoImpl)
                CloneObject(v1);

            Assert.IsNotNull(v2.Messages);
            Assert.AreEqual("my bundle", v2.ConnectorKey.BundleName);
            Assert.AreEqual("my version", v2.ConnectorKey.BundleVersion);
            Assert.AreEqual("my connector", v2.ConnectorKey.ConnectorName);
            Assert.AreEqual("mykey", v2.ConnectorDisplayNameKey);
            Assert.AreEqual("LDAP", v2.ConnectorCategoryKey);
            Assert.IsNotNull(v2.DefaultAPIConfiguration);
        }
コード例 #4
0
        public void TestOperationRequest()
        {
            ConfigurationPropertiesImpl configProperties = new ConfigurationPropertiesImpl();
            configProperties.Properties = (new List<ConfigurationPropertyImpl>());
            APIConfigurationImpl apiImpl = new APIConfigurationImpl();
            apiImpl.ConfigurationProperties = (configProperties);

            IList<object> args = new List<object>();
            args.Add("my arg");
            OperationRequest v1 = new
                OperationRequest(new ConnectorKey("my bundle",
                    "my version",
                "my connector"),
                    SerializerUtil.SerializeBase64Object(apiImpl),
                    SafeType<APIOperation>.Get<CreateApiOp>(),
                    "mymethodName",
                    args);
            OperationRequest v2 = (OperationRequest)CloneObject(v1);
            Assert.AreEqual("my bundle", v2.ConnectorKey.BundleName);
            Assert.AreEqual("my version", v2.ConnectorKey.BundleVersion);
            Assert.AreEqual("my connector", v2.ConnectorKey.ConnectorName);
            Assert.IsNotNull(v2.ConnectorFacadeKey);
            Assert.AreEqual(SafeType<APIOperation>.Get<CreateApiOp>(), v2.Operation);
            Assert.AreEqual("mymethodName", v2.OperationMethodName);
            Assert.IsTrue(
                CollectionUtil.Equals(
                    args, v2.Arguments));
        }
コード例 #5
0
        public void TestAPIConfiguration()
        {
            ConfigurationPropertyImpl prop1 = new ConfigurationPropertyImpl();
            prop1.Order = (1);
            prop1.IsConfidential = (true);
            prop1.Name = ("foo");
            prop1.HelpMessageKey = ("help key");
            prop1.DisplayMessageKey = ("display key");
            prop1.GroupMessageKey = ("group key");
            prop1.Value = ("bar");
            prop1.ValueType = (typeof(string));
            prop1.Operations = null;

            ConfigurationPropertiesImpl props1 = new ConfigurationPropertiesImpl();
            props1.Properties = (CollectionUtil.NewReadOnlyList<ConfigurationPropertyImpl>(prop1));

            APIConfigurationImpl v1 = new APIConfigurationImpl();
            v1.ConnectorPoolConfiguration = (new ObjectPoolConfiguration());
            v1.ConfigurationProperties = (props1);
            v1.IsConnectorPoolingSupported = (true);
            v1.ProducerBufferSize = (200);
            v1.SupportedOperations = (FrameworkUtil.AllAPIOperations());
            IDictionary<SafeType<APIOperation>, int> map =
                CollectionUtil.NewDictionary<SafeType<APIOperation>, int>(SafeType<APIOperation>.Get<CreateApiOp>(), 6);
            v1.TimeoutMap = (map);

            APIConfigurationImpl v2 = (APIConfigurationImpl)
                CloneObject(v1);
            Assert.IsTrue(!Object.ReferenceEquals(v1, v2));
            Assert.IsNotNull(v2.ConnectorPoolConfiguration);
            Assert.IsNotNull(v2.ConfigurationProperties);
            Assert.AreEqual(v1.ConnectorPoolConfiguration, v2.ConnectorPoolConfiguration);
            Assert.AreEqual(v1.ConfigurationProperties, v2.ConfigurationProperties);
            Assert.IsTrue(v2.IsConnectorPoolingSupported);
            Assert.AreEqual(200, v2.ProducerBufferSize);
            Assert.IsTrue(CollectionUtil.SetsEqual(
                FrameworkUtil.AllAPIOperations(),
                v2.SupportedOperations));
            Assert.AreEqual(map, v2.TimeoutMap);
        }
コード例 #6
0
        public void TestHelloResponse()
        {
            Exception ex = new Exception("foo");
            IDictionary<string,object> serverInfo = new Dictionary<string, object>(1);
            serverInfo.Add(HelloResponse.SERVER_START_TIME, DateTimeUtil.GetCurrentUtcTimeMillis());
             	 	 	ConnectorKey key = new ConnectorKey("my bundle", "my version", "my connector");
            RemoteConnectorInfoImpl info = new RemoteConnectorInfoImpl();
            info.Messages = (new ConnectorMessagesImpl());
            info.ConnectorKey = (key);
            ConfigurationPropertiesImpl configProperties = new ConfigurationPropertiesImpl();
            configProperties.Properties = (new List<ConfigurationPropertyImpl>());
            APIConfigurationImpl apiImpl = new APIConfigurationImpl();
            apiImpl.ConfigurationProperties = (configProperties);
            info.DefaultAPIConfiguration = (apiImpl);
            info.ConnectorDisplayNameKey = ("mykey");
            info.ConnectorCategoryKey = ("");

            HelloResponse v1 = new HelloResponse(ex, serverInfo, CollectionUtil.NewReadOnlyList<ConnectorKey>(key), CollectionUtil.NewReadOnlyList<RemoteConnectorInfoImpl>(info));
            HelloResponse v2 = (HelloResponse)CloneObject(v1);
            Assert.IsNotNull(v2.Exception);
            Assert.IsNotNull(v2.ServerInfo[HelloResponse.SERVER_START_TIME]);
            Assert.IsNotNull(v2.ConnectorKeys.First());
            Assert.IsNotNull(v2.ConnectorInfos.First());
        }
コード例 #7
0
        public void TestConfigurationProperties()
        {
            ConfigurationPropertyImpl prop1 = new ConfigurationPropertyImpl();
            prop1.Order = (1);
            prop1.IsConfidential = (true);
            prop1.Name = ("foo");
            prop1.HelpMessageKey = ("help key");
            prop1.DisplayMessageKey = ("display key");
            prop1.GroupMessageKey = ("group key");
            prop1.Value = ("bar");
            prop1.ValueType = (typeof(string));
            prop1.Operations = null;

            ConfigurationPropertiesImpl v1 = new ConfigurationPropertiesImpl();
            v1.Properties = (CollectionUtil.NewReadOnlyList<ConfigurationPropertyImpl>(prop1));
            v1.SetPropertyValue("foo", "bar");

            ConfigurationPropertiesImpl v2 = (ConfigurationPropertiesImpl)
                CloneObject(v1);
            Assert.AreEqual("bar", v2.GetProperty("foo").Value);
        }
コード例 #8
0
        public void TestHelloResponse()
        {
            RemoteConnectorInfoImpl info = new RemoteConnectorInfoImpl();
            info.Messages = (new ConnectorMessagesImpl());
            info.ConnectorKey = (new ConnectorKey("my bundle",
                "my version",
            "my connector"));
            ConfigurationPropertiesImpl configProperties = new ConfigurationPropertiesImpl();
            configProperties.Properties = (new List<ConfigurationPropertyImpl>());
            APIConfigurationImpl apiImpl = new APIConfigurationImpl();
            apiImpl.ConfigurationProperties = (configProperties);
            info.DefaultAPIConfiguration = (apiImpl);
            info.ConnectorDisplayNameKey = ("mykey");

            Exception ex = new Exception("foo");
            HelloResponse v1 = new HelloResponse(ex, CollectionUtil.NewReadOnlyList<RemoteConnectorInfoImpl>(info));
            HelloResponse v2 = (HelloResponse)CloneObject(v1);
            Assert.IsNotNull(v2.Exception);
            Assert.IsNotNull(v2.ConnectorInfos.First());
        }