public virtual void TestConnectorKeysInRange() { ConnectorKeyRange r1 = ConnectorKeyRange.NewBuilder() .SetBundleName("B") .SetConnectorName("C") .SetBundleVersion("1.1.0.0") .Build(); ConnectorKeyRange r2 = ConnectorKeyRange.NewBuilder() .SetBundleName("B") .SetConnectorName("C") .SetBundleVersion("[1.1.0.0,1.2.0.0]") .Build(); ConnectorKey k1 = new ConnectorKey("B", "1.1.0.0", "C"); ConnectorKey k2 = new ConnectorKey("B", "1.2.0.0", "C"); Assert.IsTrue(r1.BundleVersionRange.Exact); Assert.IsFalse(r2.BundleVersionRange.Exact); Assert.IsTrue(r1.IsInRange(k1)); Assert.IsFalse(r1.IsInRange(k2)); Assert.IsTrue(r2.IsInRange(k1)); Assert.IsTrue(r2.IsInRange(k2)); ConnectorKeyRange r45 = ConnectorKeyRange.NewBuilder().SetBundleName("B").SetConnectorName("C") .SetBundleVersion("[1.4.0.0,1.5.0.0)").Build(); Assert.IsTrue(r45.IsInRange(new ConnectorKey("B", "1.4.0.0", "C"))); Assert.IsFalse(r45.IsInRange(new ConnectorKey("B", "1.5.0.0", "C"))); }
public override bool Equals(object o) { if (o is ConnectorKey) { ConnectorKey other = (ConnectorKey)o; if (!_bundleName.Equals(other._bundleName)) { return(false); } if (!_bundleVersion.Equals(other._bundleVersion)) { return(false); } if (!_connectorName.Equals(other._connectorName)) { return(false); } return(true); } return(false); }
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()); }
public ConnectorInfo FindConnectorInfo(ConnectorKey key) { foreach (ConnectorInfo info in _connectorInfo) { if (info.ConnectorKey.Equals(key)) { return info; } } return null; }
public OperationRequest(ConnectorKey key, APIConfigurationImpl apiConfiguration, SafeType<APIOperation> operation, string operationMethodName, IList<Object> arguments) { _connectorKey = key; _configuration = apiConfiguration; _operation = operation; _operationMethodName = operationMethodName; _arguments = CollectionUtil.NewReadOnlyList<object>(arguments); }