コード例 #1
0
        public override void Connect(IReadOnlyCollection <Component> instanceComponents)
        {
            Logger.Instance.Log(LogLevel.Info, "\nConfiguring component ({0}) to work with component({1}):\n", VaultComponentId, DatabaseComponentId);

            VaultComponent    vaultComponent    = instanceComponents.Single(c => c.Id == VaultComponentId) as VaultComponent;
            DatabaseComponent databaseComponent = instanceComponents.Single(c => c.Id == DatabaseComponentId) as DatabaseComponent;

            HttpServerConnection connection = ServerConnectionFactory.GetServerConnection(databaseComponent);
            Innovator            innovator  = new Innovator(connection);

            Item vaultItem = innovator.newItem("Vault", "merge");

            vaultItem.setAttribute("where", string.Format(CultureInfo.InvariantCulture, "[name]='{0}'", vaultComponent.Name));
            vaultItem.setProperty("name", vaultComponent.Name);
            vaultItem.setProperty("vault_url_pattern", vaultComponent.VaultServerAspxUrl);
            vaultItem = vaultItem.apply();

            if (vaultItem.isError())
            {
                throw new ConnectException(
                          string.Format(CultureInfo.InvariantCulture, "Couldn't connect vault component '{0}' with database '{1}'. {2}",
                                        VaultComponentId,
                                        DatabaseComponentId,
                                        vaultItem.ToString()));
            }

            vaultComponent.TargetFileSystem.XmlHelper.XmlPoke(vaultComponent.PathToConfig, "/configuration/appSettings/add[@key = 'InnovatorServerUrl']/@value", databaseComponent.InnovatorServerAspxUrl);
        }
コード例 #2
0
        public override void Connect(IReadOnlyCollection <Component> instanceComponents)
        {
            Logger.Instance.Log(LogLevel.Info, "\nConfiguring component ({0}) to work with component({1}):\n", ConversionComponentId, DatabaseComponentId);

            ConversionComponent conversionComponent = instanceComponents.Single(c => c.Id == ConversionComponentId) as ConversionComponent;
            DatabaseComponent   databaseComponent   = instanceComponents.Single(c => c.Id == DatabaseComponentId) as DatabaseComponent;

            HttpServerConnection connection = ServerConnectionFactory.GetServerConnection(databaseComponent);
            Innovator            innovator  = new Innovator(connection);

            Item conversionItem = innovator.newItem("ConversionServer", "merge");

            conversionItem.setAttribute("where", string.Format(CultureInfo.InvariantCulture, "[name]='{0}'", conversionComponent.Name));
            conversionItem.setProperty("name", conversionComponent.Name);
            conversionItem.setProperty("url", conversionComponent.ConversionServiceAsmxUrl);
            conversionItem.setProperty("impersonation_user_id", "EB2D5AA617FB41A28F081345B8B5FECB");
            conversionItem = conversionItem.apply();

            if (conversionItem.isError())
            {
                throw new ConnectException(
                          string.Format(CultureInfo.InvariantCulture, "Couldn't connect conversion component '{0}' with database '{1}'. {2}",
                                        ConversionComponentId,
                                        DatabaseComponentId,
                                        conversionItem.ToString()));
            }

            conversionComponent.TargetFileSystem.XmlHelper.XmlPoke(conversionComponent.PathToConfig, "/configuration/ConversionServer/InnovatorServer/@url", databaseComponent.InnovatorServerAspxUrl);
        }
コード例 #3
0
ファイル: TestScript.cs プロジェクト: Projekt-SVEN/Simulation
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log($"Username: {Username}");
        Debug.Log($"Password: {Password}");
        Debug.Log($"ServerAddress: {ServerAddress}");
        Debug.Log($"RequiresAuthentication: {RequiresAuthentication}");

        Debug.Log("Tests erfolgen");

        IServerConnection connection = ServerConnectionFactory.CreateServerConnection(Username, Password, ServerAddress,
                                                                                      RequiresAuthentication);

        LsfInfoSchnittstelle lsfSchnittstelle = new LsfInfoSchnittstelle(connection, Device);

        bool     lecture;
        bool     isbreak;
        DateTime?nextbreak;

        lsfSchnittstelle.GetStates(out lecture, out isbreak, out nextbreak);

        Debug.Log(lecture);
        Debug.Log(isbreak);
        if (nextbreak != null)
        {
            Debug.Log(nextbreak.ToString());
        }
        else
        {
            Debug.Log("Time: null");
        }
    }
コード例 #4
0
 public void GenerateConnectionGeneratesConnection()
 {
     var factory = new ServerConnectionFactory();
     var address = "http://somewhere";
     var connection = factory.GenerateConnection(address);
     Assert.IsNotNull(connection);
     Assert.AreEqual(connection.Address, address);
 }
コード例 #5
0
        public void GenerateConnectionGeneratesConnection()
        {
            var factory    = new ServerConnectionFactory();
            var address    = "http://somewhere";
            var connection = factory.GenerateConnection(address);

            Assert.IsNotNull(connection);
            Assert.AreEqual(connection.Address, address);
        }
コード例 #6
0
        public void ApplyAml(string aml)
        {
            HttpServerConnection connection = ServerConnectionFactory.GetServerConnection(this);
            Innovator            innovator  = new Innovator(connection);
            Item result = innovator.applyAML(aml);

            if (result.isError())
            {
                Logger.Instance.Log(LogLevel.Error, result.ToString());

                throw new Exception(string.Format(CultureInfo.InvariantCulture, "Failed to apply AML {0}.", aml));
            }
        }
コード例 #7
0
        private void EndAccept(IAsyncResult ar)
        {
            var listener = ListenSocket.EndAccept(ar);
            var connId   = Guid.NewGuid().ToString();
            var args     = ClientPool.Take();

            args.AcceptSocket = listener;
            args.UserToken    = ServerConnectionFactory.Create(this, connId);
            args.LastResponse = DateTime.UtcNow.AddMinutes(1);
            listener.BeginReceive(_receiveBuffer, 0, _receiveBuffer.Length, SocketFlags.None, EndReceive, args);
            ListenSocket.BeginAccept(EndAccept, ListenArgs);
            ClientsToSocket.TryAdd(connId, args);
            OnClientConnectedInvoke((ServerConnectionBase)args.UserToken);
        }
コード例 #8
0
        internal static void CheckAmlApplicability(DatabaseComponent databaseComponent)
        {
            Logger.Instance.Log(LogLevel.Info, "Checking that we can apply AML to '{0}' component", databaseComponent.Id);

            HttpServerConnection connection = ServerConnectionFactory.GetServerConnection(databaseComponent);
            Innovator            innovator  = new Innovator(connection);
            string aml    = "<AML />";
            Item   result = innovator.applyAML(aml);

            if (result.isError())
            {
                Logger.Instance.Log(LogLevel.Error, result.ToString());

                throw new ValidationException(string.Format(CultureInfo.InvariantCulture, "Failed to apply AML: {0}.", aml));
            }

            Logger.Instance.Log(LogLevel.Info, "OK");
        }
コード例 #9
0
        public void CreatePlugin()
        {
            var plugin  = new TestApplication();
            var Clients = new List <PeerBase>();
            var tcp     = plugin.GetTransportByName("TCPIPV4");

            plugin.RegisterReceiveCommand(tcp, new LogInRequest());

            var connection = ServerConnectionFactory.Create(plugin.GetTransportByName("TCPIPV4"), Guid.NewGuid().ToString());
            var byteconn   = connection as ServerConnection <byte[]>;

            byteconn.DeSerializer = new ProtoBufGenericSerializer <LogInRequest>();

            plugin.OnClientConnected += (sender, conn) =>
            {
                var peer = new TestPeer(conn);
                Clients.Add(peer);
            };

            plugin.RaiseClientConnected(connection);
            plugin.RaisePacketReceived(connection);
        }