예제 #1
0
        public async Task BrowseFullAddressSpace(string securityPolicy)
        {
            if (OperationLimits == null)
            {
                GetOperationLimits();
            }

            var requestHeader = new RequestHeader();

            requestHeader.Timestamp   = DateTime.UtcNow;
            requestHeader.TimeoutHint = MaxTimeout;

            // Session
            Session session;

            if (securityPolicy != null)
            {
                session = await ClientFixture.ConnectAsync(ServerUrl, securityPolicy, Endpoints).ConfigureAwait(false);
            }
            else
            {
                session = Session;
            }

            var clientTestServices = new ClientTestServices(session);

            ReferenceDescriptions = CommonTestWorkers.BrowseFullAddressSpaceWorker(clientTestServices, requestHeader, OperationLimits);

            if (securityPolicy != null)
            {
                session.Close();
                session.Dispose();
            }
        }
예제 #2
0
        public void Subscription()
        {
            var requestHeader = new RequestHeader();

            requestHeader.Timestamp   = DateTime.UtcNow;
            requestHeader.TimeoutHint = MaxTimeout;

            var clientTestServices = new ClientTestServices(Session);

            CommonTestWorkers.SubscriptionTest(clientTestServices, requestHeader);
        }
        private void BrowseFullAddressSpace()
        {
            var requestHeader = new RequestHeader {
                Timestamp   = DateTime.UtcNow,
                TimeoutHint = MaxTimeout
            };

            // Session
            var clientTestServices = new ClientTestServices(Session);

            ReferenceDescriptions = CommonTestWorkers.BrowseFullAddressSpaceWorker(clientTestServices, requestHeader);
        }
예제 #4
0
        public async Task ReverseConnect(string securityPolicy)
        {
            // ensure endpoints are available
            await RequireEndpoints().ConfigureAwait(false);

            // get a connection
            var config = ClientFixture.Config;
            ITransportWaitingConnection connection;

            using (var cancellationTokenSource = new CancellationTokenSource(MaxTimeout))
            {
                connection = await ClientFixture.ReverseConnectManager.WaitForConnection(
                    m_endpointUrl, null, cancellationTokenSource.Token).ConfigureAwait(false);

                Assert.NotNull(connection, "Failed to get connection.");
            }

            // select the secure endpoint
            var endpointConfiguration = EndpointConfiguration.Create(config);
            var selectedEndpoint      = ClientFixture.SelectEndpoint(config, Endpoints, m_endpointUrl, securityPolicy);

            Assert.NotNull(selectedEndpoint);
            var endpoint = new ConfiguredEndpoint(null, selectedEndpoint, endpointConfiguration);

            Assert.NotNull(endpoint);

            // connect
            var session = await Session.Create(config, connection, endpoint, false, false, "Reverse Connect Client",
                                               MaxTimeout, new UserIdentity(new AnonymousIdentityToken()), null).ConfigureAwait(false);

            Assert.NotNull(session);

            // default request header
            var requestHeader = new RequestHeader();

            requestHeader.Timestamp   = DateTime.UtcNow;
            requestHeader.TimeoutHint = MaxTimeout;

            // Browse
            var clientTestServices    = new ClientTestServices(session);
            var referenceDescriptions = CommonTestWorkers.BrowseFullAddressSpaceWorker(clientTestServices, requestHeader);

            Assert.NotNull(referenceDescriptions);

            // close session
            var result = session.Close();

            Assert.NotNull(result);
            session.Dispose();
        }
예제 #5
0
        public async Task TransferSubscriptionNative(bool sendInitialData)
        {
            Session transferSession = null;

            try
            {
                var requestHeader = new RequestHeader {
                    Timestamp   = DateTime.UtcNow,
                    TimeoutHint = MaxTimeout
                };

                // to validate the behavior of the sendInitialValue flag,
                // use a static variable to avoid sampled notifications in publish requests
                var      namespaceUris      = Session.NamespaceUris;
                NodeId[] testSet            = CommonTestWorkers.NodeIdTestSetStatic.Select(n => ExpandedNodeId.ToNodeId(n, namespaceUris)).ToArray();
                var      clientTestServices = new ClientTestServices(Session);
                var      subscriptionIds    = CommonTestWorkers.CreateSubscriptionForTransfer(clientTestServices, requestHeader, testSet, 0, -1);

                TestContext.Out.WriteLine("Transfer SubscriptionIds: {0}", subscriptionIds[0]);

                transferSession = await ClientFixture.ConnectAsync(ServerUrl, SecurityPolicies.Basic256Sha256, Endpoints).ConfigureAwait(false);

                Assert.AreNotEqual(Session.SessionId, transferSession.SessionId);

                requestHeader = new RequestHeader {
                    Timestamp   = DateTime.UtcNow,
                    TimeoutHint = MaxTimeout
                };
                var transferTestServices = new ClientTestServices(transferSession);
                CommonTestWorkers.TransferSubscriptionTest(transferTestServices, requestHeader, subscriptionIds, sendInitialData, false);

                // verify the notification of message transfer
                requestHeader = new RequestHeader {
                    Timestamp   = DateTime.UtcNow,
                    TimeoutHint = MaxTimeout
                };
                CommonTestWorkers.VerifySubscriptionTransferred(clientTestServices, requestHeader, subscriptionIds, true);

                transferSession.Close();
            }
            finally
            {
                transferSession?.Dispose();
            }
        }
예제 #6
0
        public async Task ReverseConnect2(bool updateBeforeConnect, bool checkDomain)
        {
            string securityPolicy = SecurityPolicies.Basic256Sha256;

            // ensure endpoints are available
            await RequireEndpoints().ConfigureAwait(false);

            // get a connection
            var config = ClientFixture.Config;

            // select the secure endpoint
            var endpointConfiguration = EndpointConfiguration.Create(config);
            var selectedEndpoint      = ClientFixture.SelectEndpoint(config, Endpoints, m_endpointUrl, securityPolicy);

            Assert.NotNull(selectedEndpoint);
            var endpoint = new ConfiguredEndpoint(null, selectedEndpoint, endpointConfiguration);

            Assert.NotNull(endpoint);

            // connect
            var session = await Session.Create(config, ClientFixture.ReverseConnectManager, endpoint, updateBeforeConnect, checkDomain, "Reverse Connect Client",
                                               MaxTimeout, new UserIdentity(new AnonymousIdentityToken()), null).ConfigureAwait(false);

            Assert.NotNull(session);

            // header
            var requestHeader = new RequestHeader();

            requestHeader.Timestamp   = DateTime.UtcNow;
            requestHeader.TimeoutHint = MaxTimeout;

            // Browse
            var clientTestServices    = new ClientTestServices(session);
            var referenceDescriptions = CommonTestWorkers.BrowseFullAddressSpaceWorker(clientTestServices, requestHeader);

            Assert.NotNull(referenceDescriptions);

            // close session
            var result = session.Close();

            Assert.NotNull(result);
            session.Dispose();
        }