public void ValidateOperational_2ToDisabled_0_Reader()
        {
            UaPubSubApplication uaPubSubApplication = UaPubSubApplication.Create(SubscriberConfigurationFileName);

            UaPubSubConfigurator configurator = uaPubSubApplication.UaPubSubConfigurator;

            // The hierarchy PubSub -> PubSubConnection -> PubSubReaderGroup -> DataSetReader brought to [Disabled, Disabled, Disabled, Disabled]
            PubSubConfigurationDataType pubSub = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration;
            PubSubConnectionDataType    subscriberConnection = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration.Connections[0];
            ReaderGroupDataType         readerGroup          = subscriberConnection.ReaderGroups[0];
            DataSetReaderDataType       datasetReader        = readerGroup.DataSetReaders[0];

            configurator.Disable(pubSub);
            configurator.Disable(subscriberConnection);
            configurator.Disable(readerGroup);
            configurator.Disable(datasetReader);

            PubSubState psState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub);
            PubSubState conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(subscriberConnection);
            PubSubState rgState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(readerGroup);
            PubSubState dsrState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetReader);

            Assert.That(psState == PubSubState.Disabled, Is.True);
            Assert.That(conState == PubSubState.Disabled, Is.True);
            Assert.That(rgState == PubSubState.Disabled, Is.True);
            Assert.That(dsrState == PubSubState.Disabled, Is.True);

            // The hierarchy PubSub -> PubSubConnection -> PubSubReaderGroup -> DataSetReader brought to [Operational, Operational, Operational, Operational]
            configurator.Enable(pubSub);
            configurator.Enable(subscriberConnection);
            configurator.Enable(readerGroup);
            configurator.Enable(datasetReader);

            psState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub);
            conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(subscriberConnection);
            rgState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(readerGroup);
            dsrState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetReader);
            Assert.That(psState == PubSubState.Operational, Is.True);
            Assert.That(conState == PubSubState.Operational, Is.True);
            Assert.That(rgState == PubSubState.Operational, Is.True);
            Assert.That(dsrState == PubSubState.Operational, Is.True);

            // The hierarchy PubSub -> PubSubConnection -> PubSubReaderGroup -> DataSetReader brought to [Disabled, Disabled, Disabled, Disabled]

            configurator.Disable(pubSub);
            configurator.Disable(subscriberConnection);
            configurator.Disable(readerGroup);
            configurator.Disable(datasetReader);

            psState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub);
            conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(subscriberConnection);
            rgState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(readerGroup);
            dsrState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetReader);
            Assert.That(psState == PubSubState.Disabled, Is.True);
            Assert.That(conState == PubSubState.Disabled, Is.True);
            Assert.That(rgState == PubSubState.Disabled, Is.True);
            Assert.That(dsrState == PubSubState.Disabled, Is.True);
        }
Ejemplo n.º 2
0
        public void ValidateEnableOnOperational()
        {
            UaPubSubApplication         uaPubSubApplication = UaPubSubApplication.Create(publisherConfigurationFile);
            UaPubSubConfigurator        configurator        = uaPubSubApplication.UaPubSubConfigurator;
            PubSubConfigurationDataType pubSub = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration;

            configurator.Enable(pubSub);
            Assert.AreEqual((StatusCode)StatusCodes.BadInvalidState, configurator.Enable(pubSub));
        }
Ejemplo n.º 3
0
        public void ValidateOperational_2ToDisabled_0_Publisher()
        {
            UaPubSubApplication uaPubSubApplication = UaPubSubApplication.Create(publisherConfigurationFile);

            UaPubSubConfigurator configurator = uaPubSubApplication.UaPubSubConfigurator;

            // The hierarchy PubSub -> PubSubConnection -> PubSubWriterGroup -> DataSetWriter brought to [Disabled, Disabled, Disabled, Disabled]
            PubSubConfigurationDataType pubSub = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration;
            PubSubConnectionDataType    publisherConnection = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration.Connections.First();
            WriterGroupDataType         writerGroup         = publisherConnection.WriterGroups[0];
            DataSetWriterDataType       datasetWriter       = writerGroup.DataSetWriters[0];

            configurator.Disable(pubSub);
            configurator.Disable(publisherConnection);
            configurator.Disable(writerGroup);
            configurator.Disable(datasetWriter);

            PubSubState psState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub);
            PubSubState conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection);
            PubSubState wgState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup);
            PubSubState dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter);

            Assert.That(psState == PubSubState.Disabled, Is.True);
            Assert.That(conState == PubSubState.Disabled, Is.True);
            Assert.That(wgState == PubSubState.Disabled, Is.True);
            Assert.That(dswState == PubSubState.Disabled, Is.True);

            // The hierarchy PubSub -> PubSubConnection -> PubSubWriterGroup -> DataSetWriter brought to [Operational, Operational, Operational, Operational]
            configurator.Enable(pubSub);
            configurator.Enable(publisherConnection);
            configurator.Enable(writerGroup);
            configurator.Enable(datasetWriter);

            psState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub);
            conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection);
            wgState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup);
            dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter);
            Assert.That(psState == PubSubState.Operational, Is.True);
            Assert.That(conState == PubSubState.Operational, Is.True);
            Assert.That(wgState == PubSubState.Operational, Is.True);
            Assert.That(dswState == PubSubState.Operational, Is.True);

            // The hierarchy PubSub -> PubSubConnection -> PubSubWriterGroup -> DataSetWriter brought to [Disabled, Disabled, Disabled, Disabled]
            configurator.Disable(pubSub);
            configurator.Disable(publisherConnection);
            configurator.Disable(writerGroup);
            configurator.Disable(datasetWriter);

            psState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub);
            conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection);
            wgState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup);
            dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter);
            Assert.That(psState == PubSubState.Disabled, Is.True);
            Assert.That(conState == PubSubState.Disabled, Is.True);
            Assert.That(wgState == PubSubState.Disabled, Is.True);
            Assert.That(dswState == PubSubState.Disabled, Is.True);
        }
Ejemplo n.º 4
0
        public void ValidateEnableOnNUll()
        {
            UaPubSubApplication  uaPubSubApplication = UaPubSubApplication.Create(publisherConfigurationFile);
            UaPubSubConfigurator configurator        = uaPubSubApplication.UaPubSubConfigurator;

            Assert.Throws <ArgumentException>(() => configurator.Enable(null), "The Enable method does not throw exception when called with null parameter.");
        }
Ejemplo n.º 5
0
        public void ValidateEnableOnNonExisting()
        {
            UaPubSubApplication         uaPubSubApplication = UaPubSubApplication.Create(publisherConfigurationFile);
            UaPubSubConfigurator        configurator        = uaPubSubApplication.UaPubSubConfigurator;
            PubSubConfigurationDataType nonExisting         = new PubSubConfigurationDataType();

            Assert.Throws <ArgumentException>(() => configurator.Enable(nonExisting), "The Enable method does not throw exception when called with non existing parameter.");
        }
Ejemplo n.º 6
0
        public void ValidateDisableOnEnabled()
        {
            UaPubSubApplication         uaPubSubApplication = UaPubSubApplication.Create(publisherConfigurationFile);
            UaPubSubConfigurator        configurator        = uaPubSubApplication.UaPubSubConfigurator;
            PubSubConfigurationDataType pubSub = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration;

            configurator.Enable(pubSub);
            Assert.AreEqual((StatusCode)StatusCodes.Good, configurator.Disable(pubSub));
        }
Ejemplo n.º 7
0
        public void ValidateDisabled_0ToPause_1_Publisher()
        {
            UaPubSubApplication uaPubSubApplication = UaPubSubApplication.Create(PublisherConfigurationFileName);

            UaPubSubConfigurator configurator = uaPubSubApplication.UaPubSubConfigurator;

            // The hierarchy PubSub -> PubSubConnection -> PubSubWriterGroup -> DataSetWriter brought to [Disabled, Disabled, Disabled, Disabled]

            PubSubConfigurationDataType pubSub = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration;
            PubSubConnectionDataType    publisherConnection = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration.Connections[0];
            WriterGroupDataType         writerGroup         = publisherConnection.WriterGroups[0];
            DataSetWriterDataType       datasetWriter       = writerGroup.DataSetWriters[0];

            configurator.Disable(pubSub);
            configurator.Disable(publisherConnection);
            configurator.Disable(writerGroup);
            configurator.Disable(datasetWriter);

            PubSubState psState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub);
            PubSubState conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection);
            PubSubState wgState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup);
            PubSubState dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter);

            Assert.That(psState == PubSubState.Disabled, Is.True);
            Assert.That(conState == PubSubState.Disabled, Is.True);
            Assert.That(wgState == PubSubState.Disabled, Is.True);
            Assert.That(dswState == PubSubState.Disabled, Is.True);

            // Bring connection to Enabled
            configurator.Enable(publisherConnection);

            psState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub);
            conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection);
            wgState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup);
            dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter);
            Assert.That(psState == PubSubState.Disabled, Is.True);
            Assert.That(conState == PubSubState.Paused, Is.True);
            Assert.That(wgState == PubSubState.Disabled, Is.True);
            Assert.That(dswState == PubSubState.Disabled, Is.True);

            // Bring writerGroup to Enabled
            configurator.Enable(writerGroup);

            psState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub);
            conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection);
            wgState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup);
            dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter);
            Assert.That(psState == PubSubState.Disabled, Is.True);
            Assert.That(conState == PubSubState.Paused, Is.True);
            Assert.That(wgState == PubSubState.Paused, Is.True);
            Assert.That(dswState == PubSubState.Disabled, Is.True);

            // Bring datasetWriter to Enabled
            configurator.Enable(datasetWriter);

            psState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub);
            conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection);
            wgState  = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup);
            dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter);
            Assert.That(psState == PubSubState.Disabled, Is.True);
            Assert.That(conState == PubSubState.Paused, Is.True);
            Assert.That(wgState == PubSubState.Paused, Is.True);
            Assert.That(dswState == PubSubState.Paused, Is.True);
        }