/// <summary>
        /// Выполняет задачу по взаимодействию с ГИС ЖКХ.
        /// </summary>
        /// <param name="taskDataPack"></param>
        /// <returns></returns>
        public async Task ExecuteOriginTaskAsync(TaskUnit.DataPack taskDataPack)
        {
            // Отлавливаем исключения, которые относятся к задаче в целом.
            try
            {
                // Получаем объект-обработчик метода сервиса ГИС ЖКХ.
                var nextOriginTask = TaskUnit.Manager.MethodProcessor(taskDataPack);

                // Выполняет подготовительные работы перед отправкой запроса в ГИС ЖКХ.
                nextOriginTask.Prepare();

                // Выполняет запрос в ГИС ЖКХ и разбор ответа.
                await nextOriginTask.Perform();

                // Проверяет результаты работы задачи.
                nextOriginTask.Check();

                // Устанавливает статус задачи.
                nextOriginTask.Complete();
            }
            catch (System.Exception ex)
            {
                Notificator.Write("AsyncRircGisService.ExecuteOriginTaskAsync() Задача Task_id = " + taskDataPack.TaskId + " не выполнена. Сообщение об ошибке: " + ex.Message + "Stack Trace: " + ex.StackTrace, EventLogEntryType.Error);
            }
        }
        public void PerformGisRequestForResults_CorrectGisResultDataPack_FillTuple()
        {
            // Arrange.
            AsyncRircGisService.TaskUnit.DataPack dataPack = new AsyncRircGisService.TaskUnit.DataPack
            {
                TaskId        = "2",
                ServiceId     = "2",
                MethodId      = "2",
                LastStartDate = "20.09.16 01:00:00,000000 +03:00"
            };

            ServiceConfig.Conformation = new Сonformation
            {
                login    = "******",
                password = "******",
                certificateThumbprint = "0FC21AD8F0CE100EF455185A12C5DF811057D652",
                certificatePassword   = "",
                schemaVersion         = "10.0.1.2",
                soapConfiguration     = new AsyncRircGisService.Gis.Configurations.Sections.SoapConfiguration
                {
                    SoapTemplatePath            = @"Templates\soap-template.xml",
                    RequestHeaderTemplatePath   = @"Templates\request-header-template.xml",
                    ISRequestHeaderTemplatePath = @"Templates\is-request-header-template.xml"
                },
                baseUrl = "http://127.0.0.1:8080/"
            };

            AsyncRircGisService.Gis.DataPack gisDataPack = new AsyncRircGisService.Gis.DataPack
            {
                TemplatePath          = "Templates\\nsi-common\\getState-template.xml",
                SchemaVersion         = ServiceConfig.Conformation.schemaVersion,
                AddOrgPPAGUID         = false,
                OrgPPAGUID            = "",
                Xpath2Values          = new[] { new Tuple <string, string>("./base:getStateRequest/base:MessageGUID", "8e867011-7e88-4abf-a0b1-4b9c7bfd3742") },
                SoapConfig            = ServiceConfig.Conformation.soapConfiguration,
                CertificateThumbprint = ServiceConfig.Conformation.certificateThumbprint,
                SignPasswd            = ServiceConfig.Conformation.certificatePassword,
                AddSignature          = false,
                RequesterMessageGuid  = "3c654236-79f6-ff2a-e050-a8c005015c76",

                Url          = @"http://127.0.0.1:8080/ext-bus-nsi-common-service/services/NsiCommonAsync",
                Action       = "getState",
                LoginService = ServiceConfig.Conformation.login,
                PassService  = ServiceConfig.Conformation.password
            };

            // Act.
            ExportNsiItemSubtask exportNsiItemSubtask = new ExportNsiItemSubtask(dataPack);

            exportNsiItemSubtask.GisResultDataPack = gisDataPack;


            // Act.
            exportNsiItemSubtask.PerformGisRequestForResults();

            // Assert.
            Assert.IsNotNull(exportNsiItemSubtask.GisResultDataPack.GisResponseData);
        }
        public void PerformGisRequestForResults_CorrectGisResultDataPack_FillTuple()
        {
            // Arrange.
            AsyncRircGisService.TaskUnit.DataPack dataPack = new AsyncRircGisService.TaskUnit.DataPack
            {
                TaskId        = "5",
                ServiceId     = "3",
                MethodId      = "1",
                LastStartDate = "20.09.16 01:00:00,000000 +03:00"
            };

            ServiceConfig.Conformation = new Сonformation
            {
                login    = "******",
                password = "******",
                certificateThumbprint = "0FC21AD8F0CE100EF455185A12C5DF811057D652",
                certificatePassword   = "",
                soapConfiguration     = new AsyncRircGisService.Gis.Configurations.Sections.SoapConfiguration
                {
                    SoapTemplatePath            = @"Templates\soap-template.xml",
                    RequestHeaderTemplatePath   = @"Templates\request-header-template.xml",
                    ISRequestHeaderTemplatePath = @"Templates\is-request-header-template.xml"
                },
                baseUrl = "http://127.0.0.1:8080/"
            };

            AsyncRircGisService.Gis.DataPack gisDataPack = new AsyncRircGisService.Gis.DataPack
            {
                TemplatePath          = "Templates\\nsi\\getState-template.xml",
                AddOrgPPAGUID         = true,
                OrgPPAGUID            = "0b1c0cee-398e-48b8-90f2-7db954ea91a9",
                Xpath2Values          = new[] { new Tuple <string, string>("./base:getStateRequest/base:MessageGUID", "c829bdb0-bfa0-497e-a27c-3bf98e0e99bd") },
                SoapConfig            = ServiceConfig.Conformation.soapConfiguration,
                CertificateThumbprint = ServiceConfig.Conformation.certificateThumbprint,
                SignPasswd            = ServiceConfig.Conformation.certificatePassword,
                AddSignature          = false,
                RequesterMessageGuid  = "3c654236-79f6-ff2a-e050-b8c005015c76",

                Url          = @"http://127.0.0.1:8080/ext-bus-nsi-service/services/NsiAsync",
                Action       = "getState",
                LoginService = ServiceConfig.Conformation.login,
                PassService  = ServiceConfig.Conformation.password
            };

            // Act.
            ExportDataProviderNsiItemSubtask exportDataProviderNsiItemSubtask = new ExportDataProviderNsiItemSubtask(dataPack);

            exportDataProviderNsiItemSubtask.GisResultDataPack = gisDataPack;


            // Act.
            exportDataProviderNsiItemSubtask.PerformGisRequestForResults();

            // Assert.
            Assert.IsNotNull(exportDataProviderNsiItemSubtask.GisResultDataPack.GisResponseData);
        }
 public void TestInitialize()
 {
     dataPack = new AsyncRircGisService.TaskUnit.DataPack
     {
         TaskId        = "5",
         ServiceId     = "3",
         MethodId      = "1",
         LastStartDate = "04.07.16 15:56:13,000000 +03:00",
         Attempt       = 0
     };
 }
Exemplo n.º 5
0
        public void Ctor_incorrectDataPack_ContractException()
        {
            // Arrange.
            AsyncRircGisService.TaskUnit.DataPack dataPack = new AsyncRircGisService.TaskUnit.DataPack
            {
                TaskId        = testContextInstance.DataRow["TaskId"].ToString(),
                MethodId      = testContextInstance.DataRow["MethodId"].ToString(),
                ServiceId     = testContextInstance.DataRow["ServiceId"].ToString(),
                LastStartDate = testContextInstance.DataRow["LastStartDate"].ToString()
            };

            // Act.
            GetTaskObject(testContextInstance.DataRow["Service"].ToString(), dataPack);

            // Assert - Exception expected.
        }
Exemplo n.º 6
0
        public void Ctor__Incorrect_DataPack__ContractException()
        {
            // Arrange.
            dataPack = new AsyncRircGisService.TaskUnit.DataPack
            {
                TaskId        = testContextInstance.DataRow["TaskId"].ToString(),
                MethodId      = testContextInstance.DataRow["MethodId"].ToString(),
                ServiceId     = testContextInstance.DataRow["ServiceId"].ToString(),
                LastStartDate = testContextInstance.DataRow["LastStartDate"].ToString()
            };
            // Act.
            Debug.WriteLine("TaskId = " + testContextInstance.DataRow["TaskId"].ToString());
            Debug.WriteLine("MethodId = " + testContextInstance.DataRow["MethodId"].ToString());
            Debug.WriteLine("ServiceId = " + testContextInstance.DataRow["ServiceId"].ToString());
            Debug.WriteLine("MugkxId = " + testContextInstance.DataRow["MugkxId"].ToString());
            Debug.WriteLine("DuId = " + testContextInstance.DataRow["DuId"].ToString());
            Debug.WriteLine("LastStartDate = " + testContextInstance.DataRow["LastStartDate"].ToString());

            exportOrgRegistryTask = new ExportOrgRegistryTask(dataPack);

            //Assert - Expect exception.
        }
        public void PerformGisRequest_CorrectGisDataPack_ReturnMessageGuid()
        {
            // Arrange.
            ServiceConfig.Conformation = new Сonformation
            {
                login    = "******",
                password = "******",
                certificateThumbprint = "0FC21AD8F0CE100EF455185A12C5DF811057D652",
                certificatePassword   = "",
                schemaVersion         = "10.0.1.2",
                soapConfiguration     = new AsyncRircGisService.Gis.Configurations.Sections.SoapConfiguration
                {
                    SoapTemplatePath            = @"Templates\soap-template.xml",
                    RequestHeaderTemplatePath   = @"Templates\request-header-template.xml",
                    ISRequestHeaderTemplatePath = @"Templates\is-request-header-template.xml"
                },
                baseUrl = "http://127.0.0.1:8080/"
            };

            AsyncRircGisService.TaskUnit.DataPack dataPack = new AsyncRircGisService.TaskUnit.DataPack
            {
                TaskId        = "2",
                ServiceId     = "2",
                MethodId      = "2",
                LastStartDate = "20.09.16 01:00:00,000000 +03:00"
            };

            AsyncRircGisService.Gis.DataPack gisDataPack = new AsyncRircGisService.Gis.DataPack
            {
                TemplatePath          = "Templates\\nsi-common\\exportNsiItem-template.xml",
                SchemaVersion         = ServiceConfig.Conformation.schemaVersion,
                AddOrgPPAGUID         = false,
                OrgPPAGUID            = "",
                Xpath2Values          = new[] { new Tuple <string, string>("./base:getStateRequest/base:MessageGUID", "db11fa0b-a379-4d5e-8cb5-2f1905f3468a") },
                SoapConfig            = ServiceConfig.Conformation.soapConfiguration,
                CertificateThumbprint = ServiceConfig.Conformation.certificateThumbprint,
                SignPasswd            = ServiceConfig.Conformation.certificatePassword,
                AddSignature          = true,
                RequesterMessageGuid  = "5d7917f9-df95-3a0d-e050-a8c00501768a",

                Url          = @"http://127.0.0.1:8080/ext-bus-nsi-common-service/services/NsiCommonAsync",
                Action       = "exportNsiItem",
                LoginService = ServiceConfig.Conformation.login,
                PassService  = ServiceConfig.Conformation.password
            };

            string oracleDataXMLNode = @"<nsi:RegistryNumber>10</nsi:RegistryNumber><nsi1:ListGroup>NSI</nsi1:ListGroup>";

            gisDataPack.Xpath2Values = new[] { new Tuple <string, string>("nsi:exportNsiItemRequest/@base:version", ServiceConfig.Conformation.schemaVersion),
                                               new Tuple <string, string>("nsi:exportNsiItemRequest", oracleDataXMLNode) };

            ExportNsiItemSubtask exportNsiItemSubtask = new ExportNsiItemSubtask(dataPack);

            exportNsiItemSubtask.GisDataPack = gisDataPack;


            // Act.
            exportNsiItemSubtask.PerformGisRequest();

            // Assert.
            Debug.WriteLine("MessageGuid = {0}", exportNsiItemSubtask.MessageGuid);

            Assert.IsNotNull(exportNsiItemSubtask.MessageGuid);
        }