public void TcpGetAggregatorConfigWithInvalidExtendingPortTest(Ksi ksi)
 {
     Assert.DoesNotThrow(delegate
     {
         ksi.GetAggregatorConfig();
     }, "Invalid exteding port should not prevent signing.");
 }
        public void GetAggregatorConfigTest(Ksi ksi)
        {
            if (TestSetup.PduVersion == PduVersion.v1)
            {
                Exception ex = Assert.Throws <KsiServiceException>(delegate
                {
                    ksi.GetAggregatorConfig();
                });

                Assert.That(ex.Message.StartsWith("Aggregator config request is not supported using PDU version v1"), "Unexpected exception message: " + ex.Message);
            }
            else
            {
                ksi.GetAggregatorConfig();
            }
        }
Esempio n. 3
0
        public void HAAggregatorGetConfTest()
        {
            Ksi ksi = new Ksi(new HAKsiService(SigningServices, null, null));
            AggregatorConfig conf = ksi.GetAggregatorConfig();

            Assert.NotNull(conf);
        }
 public void GetAggregatorConfigSuccessWithInvalidExtendingPassTest(Ksi ksi)
 {
     if (TestSetup.PduVersion != PduVersion.v1)
     {
         Assert.DoesNotThrow(delegate
         {
             ksi.GetAggregatorConfig();
         }, "Invalid extending password should not prevent getting aggregator config.");
     }
 }
        public void AggregatorConfigRequestStaticTest()
        {
            Ksi ksi = GetStaticKsi(Resources.KsiService_AggregatorConfigResponsePdu);

            AggregatorConfig config = ksi.GetAggregatorConfig();

            Assert.AreEqual(17, config.MaxLevel, "Unexpected max level value");
            Assert.AreEqual(1, config.AggregationAlgorithm, "Unexpected algorithm value");
            Assert.AreEqual(400, config.AggregationPeriod, "Unexpected aggregation period value");
            Assert.AreEqual(1024, config.MaxRequests, "Unexpected max requests value");
        }
        public void TcpGetAggregatorConfigWithInvalidPortTest(Ksi ksi)
        {
            Exception ex = Assert.Throws <KsiServiceProtocolException>(delegate
            {
                ksi.GetAggregatorConfig();
            });

            Assert.That(ex.Message.StartsWith("Completing connection failed"), "Unexpected exception message: " + ex.Message);
            Assert.IsNotNull(ex.InnerException, "Inner exception should not be null");
            Assert.That(ex.InnerException.Message.StartsWith("No connection could be made because the target machine actively refused it"),
                        "Unexpected inner exception message: " + ex.InnerException.Message);
        }
        public void AggregatorConfigRequestWithMultiPayloadsResponseStaticTest()
        {
            // Response has multiple payloads (2 signature payloads and a configuration payload)
            Ksi ksi = GetStaticKsi(Resources.KsiService_AggregationResponsePdu_Multi_Payloads);

            AggregatorConfig config = ksi.GetAggregatorConfig();

            Assert.AreEqual(17, config.MaxLevel, "Unexpected max level value");
            Assert.AreEqual(1, config.AggregationAlgorithm, "Unexpected algorithm value");
            Assert.AreEqual(400, config.AggregationPeriod, "Unexpected aggregation period value");
            Assert.AreEqual(1024, config.MaxRequests, "Unexpected max requests value");
        }
        public void AggregatorConfigRequestWithAcknowledgmentStaticTest()
        {
            // Response has multiple payloads (a configuration payload and an acknowledgment payload)
            Ksi ksi = GetStaticKsi(Resources.KsiService_AggregatorConfigResponsePdu_With_Acknowledgment);

            AggregatorConfig config = ksi.GetAggregatorConfig();

            Assert.AreEqual(17, config.MaxLevel, "Unexpected max level value");
            Assert.AreEqual(1, config.AggregationAlgorithm, "Unexpected algorithm value");
            Assert.AreEqual(400, config.AggregationPeriod, "Unexpected aggregation period value");
            Assert.AreEqual(1024, config.MaxRequests, "Unexpected max requests value");
        }
        public void HttpGetAggregatorConfigWithInvalidUrlTest(Ksi ksi)
        {
            if (TestSetup.PduVersion == PduVersion.v1)
            {
                Exception ex = Assert.Throws <KsiServiceException>(delegate
                {
                    ksi.GetAggregatorConfig();
                });

                Assert.That(ex.Message.StartsWith("Aggregator config request is not supported using PDU version v1"), "Unexpected exception message: " + ex.Message);
            }
            else
            {
                Exception ex = Assert.Throws <KsiServiceProtocolException>(delegate
                {
                    ksi.GetAggregatorConfig();
                });

                Assert.That(ex.Message.StartsWith("Request failed"), "Unexpected exception message: " + ex.Message);
                Assert.That(ex.InnerException.Message.StartsWith("The remote name could not be resolved"), "Unexpected inner exception message: " + ex.InnerException.Message);
            }
        }
        public void AggregatorConfigRequestInvalidStaticTest()
        {
            // pdu does not contain aggregator config payload
            Ksi ksi = GetStaticKsi(Resources.KsiService_AggregationResponsePdu_RequestId_1584727637);

            KsiServiceException ex = Assert.Throws <KsiServiceException>(delegate
            {
                ksi.GetAggregatorConfig();
            });

            Assert.That(ex.Message.StartsWith("Invalid response PDU. Could not find a valid payload."),
                        "Unexpected exception message: " + ex.Message);
        }