コード例 #1
0
ファイル: Server.cs プロジェクト: igarciaa/identityconnectors
        private HelloResponse ProcessHelloRequest(HelloRequest request)
        {
            IList <RemoteConnectorInfoImpl> connectorInfo;
            Exception exception = null;

            try
            {
                ConnectorInfoManager manager =
                    GetConnectorInfoManager();
                IList <ConnectorInfo> localInfos =
                    manager.ConnectorInfos;
                connectorInfo = new List <RemoteConnectorInfoImpl>();
                foreach (ConnectorInfo localInfo in localInfos)
                {
                    LocalConnectorInfoImpl localInfoImpl =
                        (LocalConnectorInfoImpl)localInfo;
                    RemoteConnectorInfoImpl remoteInfo =
                        localInfoImpl.ToRemote();
                    connectorInfo.Add(remoteInfo);
                }
            }
            catch (Exception e)
            {
                TraceUtil.TraceException(null, e);
                exception     = e;
                connectorInfo = null;
            }
            return(new HelloResponse(exception, connectorInfo));
        }
コード例 #2
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);
        }
コード例 #3
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());
        }
コード例 #4
0
        public RemoteConnectorInfoImpl ToRemote()
        {
            RemoteConnectorInfoImpl rv = new RemoteConnectorInfoImpl();

            rv.ConnectorDisplayNameKey = ConnectorDisplayNameKey;
            rv.ConnectorKey            = ConnectorKey;
            rv.DefaultAPIConfiguration = DefaultAPIConfiguration;
            rv.Messages = Messages;
            return(rv);
        }
コード例 #5
0
        private HelloResponse ProcessHelloRequest(HelloRequest request)
        {
            IList <RemoteConnectorInfoImpl> connectorInfo = null;
            IList <ConnectorKey>            connectorKeys = null;
            IDictionary <string, object>    serverInfo    = null;
            Exception exception = null;

            try
            {
                serverInfo = new Dictionary <string, object>(1);
                if (request.isServerInfo())
                {
                    serverInfo.Add(HelloResponse.SERVER_START_TIME, _server.StartTime());
                }
                if (request.isConnectorKeys())
                {
                    ConnectorInfoManager  manager    = GetConnectorInfoManager();
                    IList <ConnectorInfo> localInfos = manager.ConnectorInfos;
                    connectorKeys = new List <ConnectorKey>();
                    foreach (ConnectorInfo localInfo in localInfos)
                    {
                        connectorKeys.Add(localInfo.ConnectorKey);
                    }
                    if (request.isConnectorInfo())
                    {
                        connectorInfo = new List <RemoteConnectorInfoImpl>();
                        foreach (ConnectorInfo localInfo in localInfos)
                        {
                            LocalConnectorInfoImpl localInfoImpl =
                                (LocalConnectorInfoImpl)localInfo;
                            RemoteConnectorInfoImpl remoteInfo =
                                localInfoImpl.ToRemote();
                            connectorInfo.Add(remoteInfo);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                LOG.Error(e);
                exception     = e;
                connectorInfo = null;
            }
            return(new HelloResponse(exception, serverInfo, connectorKeys, connectorInfo));
        }
コード例 #6
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());
        }