Esempio n. 1
0
        public void GivenICreateAServerSourceAs(Table table)
        {
            var address = table.Rows[0]["Address"];

            if (address == "http://tst-ci-remote.premier.local:3142")
            {
                declaredDependency = new Depends(Depends.ContainerType.CIRemote);
                address            = "http://" + declaredDependency.Container.IP + ":" + declaredDependency.Container.Port;
            }
            else if (address == "http://wolfs-den.premier.local:3142")
            {
                declaredDependency = new Depends(Depends.ContainerType.AnonymousWarewolf);
                address            = "http://" + declaredDependency.Container.IP + ":" + declaredDependency.Container.Port;
            }
            if (!address.Contains("localhost"))
            {
                var ipAddress = GetIPAddress(address);
                IsServerOnline(ipAddress);
            }
            var authenticationType = table.Rows[0]["AuthenticationType"];

            Enum.TryParse(authenticationType, true, out AuthenticationType result);

            IServerSource serverSource = new ServerSource()
            {
                Address            = address,
                AuthenticationType = result
            };

            ScenarioContext.Current.Add("serverSource", serverSource);
        }
Esempio n. 2
0
        public void RedisSources_Test_With_ValidHost_AuthenticationType_Password_Expected_ValidValidationResult()
        {
            var dependency = new Depends(Depends.ContainerType.Redis);
            var source     = new RedisSource
            {
                HostName           = dependency.Container.IP,
                Port               = dependency.Container.Port,
                AuthenticationType = Dev2.Runtime.ServiceModel.Data.AuthenticationType.Password,
                Password           = "******"
            }.ToString();

            try
            {
                var handler = new RedisSources();
                var result  = handler.Test(source);
                Assert.IsTrue(result.IsValid, result.ErrorMessage);
            }
            catch (Exception e)
            {
                if (e.Message.Contains("could not connect to redis Instance"))
                {
                    Assert.Inconclusive(e.Message);
                }
                else
                {
                    throw;
                }
            }
        }
        public void Change_sql_source_verify_Empty_Inputs()
        {
            _containerOps = new Depends(Depends.ContainerType.MSSQL);
            var newName       = Guid.NewGuid().ToString();
            var cleanProcName = newName.Replace("-", "").Replace(" ", "");

            try
            {
                var createProcedure = "CREATE procedure [dbo].[" + cleanProcName + "](@ProductId int) as Begin select * from Country select * from City end";
                var result          = SqlHelper.RunSqlCommand(_containerOps.Container.IP,
                                                              _containerOps.Container.Port, createProcedure);
                Assert.AreEqual(-1, result);

                Setup(cleanProcName);

                var mockSource = new Mock <IDbSource>();

                IDatabaseInputRegion databaseInputRegion = new DatabaseInputRegion(_modelItem, _dbActionRegion);
                Assert.AreEqual(1, databaseInputRegion.Inputs.Count);
                Assert.AreEqual("ProductId", databaseInputRegion.Inputs.Single().Name);
                Assert.AreEqual("[[ProductId]]", databaseInputRegion.Inputs.Single().Value);
                //add testing here

                _source.SelectedSource = mockSource.Object;
                Assert.AreEqual(0, databaseInputRegion.Inputs.Count);
            }
            finally
            {
                var dropResult = DropProcedure(cleanProcName);
                Assert.AreEqual(-1, dropResult);
            }
        }
Esempio n. 4
0
 static void TestAnonymousAuth(Depends dependency, out string key, out string hostName, out string password, out int port)
 {
     key      = "key" + Guid.NewGuid();
     hostName = dependency.Container.IP;
     password = "";
     port     = int.Parse(dependency.Container.Port);
 }
        public static void ClassInit(TestContext context)
        {
            var aggr = new Mock <IEventAggregator>();

            DataListSingleton.SetDataList(new DataListViewModel(aggr.Object));
            _containerOps = new Depends(Depends.ContainerType.MSSQL);
        }
Esempio n. 6
0
        private void Verify(Logger logger)
        {
            Depends.Remove("");

            // TODO: verify Depends
            foreach (var depend in Depends)
            {
                if (!GetRoot().MapIdToFile.ContainsKey(depend))
                {
                    logger.Error(LoggingCodes.MissingConfigDependency, $"Unable to resolve dependency [{depend}] for config file [{Id}]");
                }
            }

            foreach (var includeDir in IncludeDirs)
            {
                includeDir.Path = ExpandString(includeDir.Path, false, logger);

                if (!includeDir.Path.StartsWith("=") && !Directory.Exists(includeDir.Path))
                {
                    logger.Error(LoggingCodes.IncludeDirectoryNotFound, $"Include directory {includeDir.Path} from config file [{Id}] not found");
                }
            }

            // Verify all dependencies
            foreach (var mappingFile in References)
            {
                mappingFile.Verify(logger);
            }
        }
Esempio n. 7
0
        public void AuditingSettingsData_Set_Get_LoggingDataSource()
        {
            var dependency = new Depends(Depends.ContainerType.AnonymousElasticsearch);
            var hostName   = "http://" + dependency.Container.IP;

            var source = new ElasticsearchSource
            {
                AuthenticationType = AuthenticationType.Anonymous,
                Port        = dependency.Container.Port,
                HostName    = hostName,
                SearchIndex = "warewolflogstests"
            };
            var serializer = new Dev2JsonSerializer();
            var jsonSource = serializer.Serialize(source);
            var expectedAuditingSettingsData = new AuditingSettingsData
            {
                Endpoint          = "ws://127.0.0.1:5000/ws",
                EncryptDataSource = true,
                LoggingDataSource = new NamedGuidWithEncryptedPayload
                {
                    Name    = "Data Source",
                    Value   = Guid.Empty,
                    Payload = jsonSource
                },
            };
            IDeserializer deserializer = new JsonSerializer();
            var           bytes        = UTF8Encoding.UTF8.GetBytes(expectedAuditingSettingsData.LoggingDataSource.Payload);
            var           result       = deserializer.Deserialize <ElasticsearchSource>(bytes);

            Assert.AreEqual(expectedAuditingSettingsData.LoggingDataSource.Value, Guid.Empty);
            Assert.AreEqual(expectedAuditingSettingsData.LoggingDataSource.Name, "Data Source");
            Assert.AreEqual(source, result);
        }
Esempio n. 8
0
        /// <summary>获取扩展属性,获取数据时向指定的依赖实体类注册数据更改事件</summary>
        /// <typeparam name="TDependEntity">依赖实体类,该实体类数据更改时清空所有依赖于实体类的扩展属性</typeparam>
        /// <typeparam name="TResult">返回类型</typeparam>
        /// <param name="key">键值</param>
        /// <param name="func">回调</param>
        /// <param name="cacheDefault">是否缓存默认值,可选参数,默认缓存</param>
        /// <returns></returns>
        protected virtual TResult GetExtend <TDependEntity, TResult>(String key, Func <String, Object> func, Boolean cacheDefault)
            where TDependEntity : Entity <TDependEntity>, new()
        {
            Object value = null;

            if (Extends.TryGetValue(key, out value))
            {
                return((TResult)value);
            }

            if (StopExtend)
            {
                return(default(TResult));
            }

            // 针对每个类型,仅注册一个事件
            Type          type = typeof(TDependEntity);
            List <String> list = null;

            if (!Depends.TryGetValue(type, out list))
            {
                list = new List <String>();
                Depends.Add(type, list);
            }

            // 这里使用了成员方法GetExtend<TDependEntity>而不是匿名函数,为了避免生成包装类,且每次调用前实例化包装类带来较大开销
            return((TResult)Extends.GetItem <Func <String, Object>, List <String> >(key, func, list, new Func <String, Func <String, Object>, List <String>, Object>(GetExtend <TDependEntity>), cacheDefault));
        }
Esempio n. 9
0
        /// <summary>设置扩展属性</summary>
        /// <typeparam name="TDependEntity"></typeparam>
        /// <param name="key"></param>
        /// <param name="value"></param>
        protected virtual void SetExtend <TDependEntity>(String key, Object value) where TDependEntity : Entity <TDependEntity>, new()
        {
            // 针对每个类型,仅注册一个事件
            Type          type = typeof(TDependEntity);
            List <String> list = null;

            if (!Depends.TryGetValue(type, out list))
            {
                list = new List <String>();
                Depends.Add(type, list);
            }

            lock (Extends)
            {
                Extends[key] = value;
                if (!list.Contains(key))
                {
                    list.Add(key);
                }

                // 停止扩展属性的情况下不生效
                if (!StopExtend && list.Count == 1)
                {
                    Entity <TDependEntity> .Meta.OnDataChange += RemoveExtend;
                }
            }
        }
        public void ElasticsearchSources_Test_With_ValidHost_AuthenticationType_Anonymous_Expected_ValidValidationResult()
        {
            try
            {
                var dependency = new Depends(Depends.ContainerType.AnonymousElasticsearch);
                var hostName   = "http://" + dependency.Container.IP;
                var source     = new ElasticsearchSource
                {
                    HostName           = hostName,
                    Port               = dependency.Container.Port,
                    AuthenticationType = Dev2.Runtime.ServiceModel.Data.AuthenticationType.Anonymous
                }.ToString();

                var handler = new ElasticsearchSources();
                var result  = handler.Test(source);
                Assert.IsTrue(result.IsValid, result.ErrorMessage);
            }
            catch (Exception e)
            {
                if (e.Message.Contains("could not connect to elasticsearch Instance"))
                {
                    Assert.Inconclusive(e.Message);
                }
                else
                {
                    throw;
                }
            }
        }
Esempio n. 11
0
        public void Add_A_New_InputOnSqlProcedure_Expect_New_IS_InputAdded()
        {
            _containerOps = new Depends(Depends.ContainerType.MSSQL);
            const string procName = "TestingAddingANewInput";

            Setup(procName);

            IDatabaseInputRegion databaseInputRegion = new DatabaseInputRegion(_modelItem, _dbActionRegion);

            Assert.AreEqual(1, databaseInputRegion.Inputs.Count);
            Assert.AreEqual("ProductId", databaseInputRegion.Inputs.Single().Name);
            Assert.AreEqual("[[ProductId]]", databaseInputRegion.Inputs.Single().Value);
            //testing here
            const string alterProcedure    = "ALTER procedure [dbo].[" + procName + "](@ProductId int,@ProductId1 int,@ProductId2 int) as Begin select * from Country select * from City end";
            var          alterTableResults = SqlHelper.RunSqlCommand(Depends.EnableDocker?Depends.RigOpsIP:Depends.SVRDEVIP,
                                                                     Depends.EnableDocker?_containerOps.Container.Port:"1433", alterProcedure);

            Assert.AreEqual(-1, alterTableResults);

            _dbActionRegion.RefreshActionsCommand.Execute(null);
            Assert.IsNotNull(_dbActionRegion.Actions, "No Actions were generated for source: " + _selectedSource);

            var procActionsToInputs = _dbActionRegion.Actions.Single(p => p.Name.EndsWith(procName));

            Assert.AreEqual("ProductId", procActionsToInputs.Inputs.ToList()[0].Name);
            Assert.AreEqual("[[ProductId]]", procActionsToInputs.Inputs.ToList()[0].Value);

            Assert.AreEqual("ProductId1", procActionsToInputs.Inputs.ToList()[1].Name);
            Assert.AreEqual("[[ProductId1]]", procActionsToInputs.Inputs.ToList()[1].Value);

            Assert.AreEqual("ProductId2", procActionsToInputs.Inputs.ToList()[2].Name);
            Assert.AreEqual("[[ProductId2]]", procActionsToInputs.Inputs.ToList()[2].Value);
        }
Esempio n. 12
0
        public void TestRedisSource_Execute_GivenResourceDefinition_ShouldTestNewSourceReturnResourceDefinitionMsg()
        {
            //---------------Set up test pack-------------------
            var dependency = new Depends(Depends.ContainerType.AnonymousRedis);
            var serializer = new Dev2JsonSerializer();
            var source     = new RedisSourceDefinition()
            {
                Id                 = Guid.Empty,
                Name               = "Name",
                HostName           = dependency.Container.IP,
                Port               = dependency.Container.Port,
                AuthenticationType = Dev2.Runtime.ServiceModel.Data.AuthenticationType.Anonymous
            };
            var testRedisSource = new TestRedisSource();
            var values          = new Dictionary <string, StringBuilder>
            {
                { "RedisSource", source.SerializeToJsonStringBuilder() }
            };
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            var jsonResult = testRedisSource.Execute(values, null);
            var result     = serializer.Deserialize <ExecuteMessage>(jsonResult);

            //---------------Test Result -----------------------
            Assert.IsFalse(result.HasError, result.Message.ToString());
        }
Esempio n. 13
0
 [Ignore] //TODO: Re-introduce this test once the move to the new domain (premier.local) is done
 public void SaveNewServerSource_GivenSourceName()
 {
     using (var _containerOps = new Depends(Depends.ContainerType.CIRemote))
     {
         //Create Source
         ExplorerUIMap.Select_NewServerSource_From_ExplorerContextMenu();
         ServerSourceUIMap.Select_http_From_Server_Source_Wizard_Address_Protocol_Dropdown();
         ServerSourceUIMap.Enter_TextIntoAddress_On_ServerSourceTab("tst-ci-remote.premier.local");
         Keyboard.SendKeys("{ESC}");
         ServerSourceUIMap.Select_Server_Authentication_User();
         ServerSourceUIMap.Enter_RunAsUser_On_ServerSourceTab("WarewolfAdmin", "W@rEw0lf@dm1n");
         Assert.IsTrue(
             ServerSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan
             .ServerSourceTab.WorkSurfaceContext.NewServerSource.TestConnectionButton.Enabled,
             "Test Connection button not enabled");
         ServerSourceUIMap.Click_Server_Source_Wizard_Test_Connection_Button_For_Valid_Server_Source();
         //Save Source
         const string sourceName = "NewCodedUITestServerSource";
         UIMap.Save_With_Ribbon_Button_And_Dialog(sourceName);
         ExplorerUIMap.Filter_Explorer(sourceName);
         Assert.IsTrue(
             ExplorerUIMap.MainStudioWindow.DockManager.SplitPaneLeft.Explorer.ExplorerTree.localhost.FirstItem
             .Exists, "Source did not save in the explorer UI.");
     }
 }
Esempio n. 14
0
 // ReSharper disable once InconsistentNaming
 public void Create_Save_And_Open_RabbitMQSource_From_ExplorerContextMenu_UITests()
 {
     using (var RabbitMQContainer = new Depends(Depends.ContainerType.RabbitMQ))
     {
         //Create Source
         ExplorerUIMap.Select_NewRabbitMQSource_From_ExplorerContextMenu();
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.Exists, "RabbitMQ Source Tab does not exist");
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.HostTextBoxEdit.Enabled, "Host Textbox is not enabled");
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.PortTextBoxEdit.Enabled, "Port Textbox is not enabled");
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.UserNameTextBoxEdit.Enabled, "Username Textbox is not enabled");
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.PasswordTextBoxEdit.Enabled, "Password Textbox is not enabled");
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.VirtualHostTextBoxEdit.Enabled, "Virtual Host Textbox is not enabled");
         Assert.IsFalse(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.TestConnectionButton.Enabled, "Test Connection button is enabled");
         RabbitMQSourceUIMap.Enter_Text_On_RabbitMQSourceTab(RabbitMQContainer.Container.IP, RabbitMQContainer.Container.Port);
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.TestConnectionButton.Enabled, "Test Connection button is not enabled");
         RabbitMQSourceUIMap.Click_RabbitMQSource_TestConnectionButton();
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.ItemImage.Exists, "Test Connection successful image does not appear.");
         Assert.IsTrue(UIMap.MainStudioWindow.SideMenuBar.SaveButton.Enabled, "Save ribbon button is not enabled after successfully testing new source.");
         //Save Source
         UIMap.Save_With_Ribbon_Button_And_Dialog(SourceName);
         ExplorerUIMap.Filter_Explorer(SourceName);
         Assert.IsTrue(ExplorerUIMap.MainStudioWindow.DockManager.SplitPaneLeft.Explorer.ExplorerTree.localhost.FirstItem.Exists, "Source did not save in the explorer UI.");
         RabbitMQSourceUIMap.Click_Close_RabbitMQSource_Tab_Button();
         //Open Source
         ExplorerUIMap.Select_Source_From_ExplorerContextMenu(SourceName);
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.Exists, "RabbitMQ Source Tab does not exist");
     }
 }
Esempio n. 15
0
        private IAuditQueryable GetAuditQueryablePasswordAuthentication()
        {
            var dependency = new Depends(Depends.ContainerType.Elasticsearch);
            var hostName   = "http://" + dependency.Container.IP;

            return(new AuditQueryableElastic(hostName, dependency.Container.Port, "warewolftestlogs", Dev2.Runtime.ServiceModel.Data.AuthenticationType.Password, "WarewolfUser", "$3@R(h"));
        }
Esempio n. 16
0
        private void Verify()
        {
            Depends.Remove("");

            // TODO: verify Depends
            foreach (var depend in Depends)
            {
                if (!GetRoot().MapIdToFile.ContainsKey(depend))
                {
                    throw new InvalidOperationException("Unable to resolve dependency [" + depend + "] for config file [" + Id + "]");
                }
            }

            foreach (var includeDir in IncludeDirs)
            {
                includeDir.Path = ExpandString(includeDir.Path, false);

                if (!includeDir.Path.StartsWith("=") && !Directory.Exists(includeDir.Path))
                {
                    throw new DirectoryNotFoundException("Directory [" + includeDir.Path + "] not found in config file [" + Id + "]");
                }
            }

            // Verify all dependencies
            foreach (var mappingFile in References)
            {
                mappingFile.Verify();
            }
        }
Esempio n. 17
0
 public static void MyClassInitialize(TestContext testContext)
 {
     _containerOps = new Depends(Depends.ContainerType.MSSQL);
     if (_containerOps != null)
     {
         Thread.Sleep(10000);
     }
 }
        static void TestAnonymousAuth(out string hostName, out string password, out int port)
        {
            var dependency = new Depends(Depends.ContainerType.AnonymousRedis, true);

            hostName = dependency.Container.IP;
            password = "";
            port     = int.Parse(dependency.Container.Port);
        }
Esempio n. 19
0
        void TypeDependencyHostName(Depends dependency)
        {
            var redisSourceControl = _scenarioContext.Get <RedisSourceControl>(Utils.ViewNameKey);

            redisSourceControl.EnterHostName(dependency.Container.IP);
            var viewModel = _scenarioContext.Get <RedisSourceViewModel>("viewModel");

            Assert.AreEqual(dependency.Container.IP, viewModel.HostName);
        }
Esempio n. 20
0
        static LogSettingsViewModel CreateLogSettingViewModel()
        {
            XmlConfigurator.ConfigureAndWatch(new FileInfo("Settings.config"));
            var loggingSettingsTo = new LoggingSettingsTo {
                FileLoggerLogSize = 50, FileLoggerLogLevel = "TRACE"
            };

            var _resourceRepo = new Mock <IResourceRepository>();
            var env           = new Mock <IServer>();
            var expectedServerSettingsData = new ServerSettingsData
            {
                ExecutionLogLevel = LogLevel.DEBUG.ToString(),
                Sink = "AuditingSettingsData"
            };

            _resourceRepo.Setup(res => res.GetServerSettings(env.Object)).Returns(expectedServerSettingsData);
            var dependency          = new Depends(Depends.ContainerType.AnonymousElasticsearch);
            var hostName            = "http://" + dependency.Container.IP;
            var elasticsearchSource = new ElasticsearchSource
            {
                AuthenticationType = AuthenticationType.Anonymous,
                Port        = dependency.Container.Port,
                HostName    = hostName,
                SearchIndex = "warewolflogstests"
            };
            var jsonSource           = JsonConvert.SerializeObject(elasticsearchSource);
            var auditingSettingsData = new AuditingSettingsData
            {
                Endpoint          = "ws://127.0.0.1:5000/ws",
                EncryptDataSource = true,
                LoggingDataSource = new NamedGuidWithEncryptedPayload
                {
                    Name    = "Auditing Data Source",
                    Value   = Guid.Empty,
                    Payload = jsonSource
                },
            };

            _resourceRepo.Setup(res => res.GetAuditingSettings <AuditingSettingsData>(env.Object)).Returns(auditingSettingsData);
            var selectedAuditingSourceId = Guid.NewGuid();
            var mockAuditingSource       = new Mock <IResource>();

            mockAuditingSource.Setup(source => source.ResourceID).Returns(selectedAuditingSourceId);
            var auditingSources = new Mock <IResource>();
            var expectedList    = new List <IResource>
            {
                mockAuditingSource.Object, auditingSources.Object
            };

            _resourceRepo.Setup(resourceRepository => resourceRepository.FindResourcesByType <IAuditingSource>(env.Object)).Returns(expectedList);

            env.Setup(a => a.ResourceRepository).Returns(_resourceRepo.Object);
            var logSettingsViewModel = new LogSettingsViewModel(loggingSettingsTo, env.Object);

            return(logSettingsViewModel);
        }
Esempio n. 21
0
        string ResolveTFSBLDDependancy(string addressContainer)
        {
            var TFSBLDAddress = "TFSBLD.premier.local";

            if (addressContainer.Contains(TFSBLDAddress) && string.IsNullOrEmpty(Depends.GetIPAddress(TFSBLDAddress)))
            {
                return(addressContainer.Replace("TFSBLD.premier.local", Depends.TFSBLDIP));
            }
            return(addressContainer);
        }
Esempio n. 22
0
 public TestPublishSuccess(Depends dependency)
 {
     _factory = new ConnectionFactory()
     {
         HostName = dependency.Container.IP,
         Port     = int.Parse(dependency.Container.Port),
         UserName = "******",
         Password = "******"
     };
 }
 public ValidRealRabbitMQSourceForTestingAgainst(Depends dependency)
 {
     _factory = new ConnectionFactory()
     {
         HostName = dependency.Container.IP,
         Port     = int.Parse(dependency.Container.Port),
         UserName = "******",
         Password = "******"
     };
 }
        public void ElasticsearchSources_TestWithValidArgs_Expected_Valid_ValidationResult()
        {
            var handler             = new ElasticsearchSources();
            var elasticsearchSource = new ElasticsearchSource();
            var dependency          = new Depends(Depends.ContainerType.AnonymousElasticsearch);
            var hostName            = "http://" + dependency.Container.IP;

            elasticsearchSource.HostName = hostName;
            var result = handler.Test(elasticsearchSource);

            Assert.IsTrue(result.IsValid);
        }
Esempio n. 25
0
        void ConnectToRemoteServerContainer(Depends dependency)
        {
            string destinationServer = dependency.Container.IP + ":" + dependency.Container.Port;

            var     formattableString = $"http://{destinationServer}";
            IServer remoteServer      = new Server(new Guid(), new ServerProxy(formattableString, "WarewolfAdmin", "W@rEw0lf@dm1n"))
            {
                Name = destinationServer
            };

            _scenarioContext.Add("destinationServer", remoteServer);
            remoteServer.ConnectAsync().Wait(60000);
        }
Esempio n. 26
0
        public void ThenITypeHostAs(string hostname)
        {
            if (hostname == "test-rabbitmq")
            {
                _containerOps = new Depends(Depends.ContainerType.RabbitMQ);
            }
            var manageRabbitMqSourceControl = ScenarioContext.Current.Get <ManageRabbitMQSourceControl>(Utils.ViewNameKey);

            manageRabbitMqSourceControl.EnterHostName(hostname);
            var viewModel = ScenarioContext.Current.Get <ManageRabbitMQSourceViewModel>("viewModel");

            Assert.AreEqual(hostname, viewModel.HostName);
        }
Esempio n. 27
0
 private IAuditQueryable GetAuditQueryable(string sink)
 {
     if (sink == "AuditingSettingsData")
     {
         var dependency = new Depends(Depends.ContainerType.AnonymousElasticsearch);
         var hostName   = "http://" + dependency.Container.IP;
         return(new AuditQueryableElastic(hostName, dependency.Container.Port, "warewolftestlogs", Dev2.Runtime.ServiceModel.Data.AuthenticationType.Anonymous, "", ""));
     }
     else
     {
         return(new AuditQueryableSqlite());
     }
 }
Esempio n. 28
0
        public void SeriLogPublisher_NewPublisher_Elasticsearch_WriteToSink_UsingAny_ILogEventSink_IPML_Success()
        {
            //-------------------------Arrange------------------------------
            var testEventSink = new TestLogEventSink();
            var seriConfig    = new TestSeriLogSinkConfig(testEventSink);
            var dependency    = new Depends(Depends.ContainerType.AnonymousElasticsearch);
            var hostName      = "http://" + dependency.Container.IP;
            var loggerSource  = new SerilogElasticsearchSource
            {
                Port     = DefaultPort,
                HostName = hostName,
            };

            var loggerConnection = loggerSource.NewConnection(seriConfig);
            var loggerPublisher  = loggerConnection.NewPublisher();

            var error = new { ServerName = "testServer", Error = "testError" };
            var fatal = new { ServerName = "testServer", Error = "testFatalError" };
            var info  = new { Message = "test message" };

            //-------------------------Act----------------------------------

            loggerPublisher.Info(GlobalConstants.WarewolfLogsTemplate, info);
            loggerPublisher.Error(GlobalConstants.WarewolfLogsTemplate, error);
            loggerPublisher.Fatal(GlobalConstants.WarewolfLogsTemplate, fatal);

            var actualLogEventList = testEventSink.LogData;

            //-------------------------Assert-------------------------------
            Assert.AreEqual(3, actualLogEventList.Count);

            Assert.AreEqual(expected: LogEventLevel.Information, actual: actualLogEventList[0].Level);
            Assert.AreEqual(expected: GlobalConstants.WarewolfLogsTemplate, actual: actualLogEventList[0].MessageTemplate.Text);
            var o1 = JObject.Parse(actualLogEventList[0].Properties["Data"].ToString());

            Assert.AreEqual(expected: "test message", actual: o1["Message"].ToString());

            Assert.AreEqual(expected: LogEventLevel.Error, actual: actualLogEventList[1].Level);
            Assert.AreEqual(expected: GlobalConstants.WarewolfLogsTemplate, actual: actualLogEventList[1].MessageTemplate.Text);
            var o2 = JObject.Parse(actualLogEventList[1].Properties["Data"].ToString());

            Assert.AreEqual(expected: "testServer", o2["ServerName"].ToString());
            Assert.AreEqual(expected: "testError", o2["Error"].ToString());

            Assert.AreEqual(expected: LogEventLevel.Fatal, actual: actualLogEventList[2].Level);
            Assert.AreEqual(expected: GlobalConstants.WarewolfLogsTemplate, actual: actualLogEventList[2].MessageTemplate.Text);
            var o3 = JObject.Parse(actualLogEventList[2].Properties["Data"].ToString());

            Assert.AreEqual(expected: "testServer", o3["ServerName"].ToString());
            Assert.AreEqual(expected: "testFatalError", o3["Error"].ToString());
        }
Esempio n. 29
0
 public void RabbitMQConsumeTool_Small_And_LargeView_Then_NewSource_UITest()
 {
     using (Depends RabbitMQContainer = new Depends(Depends.ContainerType.RabbitMQ))
     {
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.Exists, "RabbitMQ Consume Tool does not exist on the design surface.");
         //Small View
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.SmallViewContentCustom.SourceComboBox.Exists, "Source ComboBox does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.SmallViewContentCustom.EditSourceButton.Exists, "EditSource Button does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.SmallViewContentCustom.NewSourceButton.Exists, "NewSource Button does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.SmallViewContentCustom.QueueNameComboBox.Exists, "QueueName ComboBox does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.SmallViewContentCustom.ResponseComboBox.Exists, "Response ComboBox does not exist on the design surface.");
         //Large View
         UtilityToolsUIMap.Open_RabbitMqConsume_LargeView();
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.SourceComboBox.Exists, "Source ComboBox does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.EditSourceButton.Exists, "EditSource Button does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.NewSourceButton.Exists, "NewSource Button does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.QueueNameComboBox.Exists, "QueueName ComboBox does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.ResponseComboBox.Exists, "Response ComboBox does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.PrefetchComboBox.Exists, "Prefetch ComboBox does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.TimeOutComboBox.Exists, "Timeout ComboBox does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.AcknowledgeCheckBox.Exists, "Acknowledge Checkbox does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.ReQueueCheckBox.Exists, "ReQueue Checkbox does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.ResultsComboBox.Exists, "Results ComboBox does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.OnErrorCustom.Exists, "OnError Pane does not exist on the design surface.");
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.DoneButton.Exists, "Done Button does not exist on the design surface.");
         //New Source
         UtilityToolsUIMap.Click_NewSourceButton_From_RabbitMQConsumeTool();
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.Exists, "RabbitMQ Source Tab does not exist");
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.HostTextBoxEdit.Enabled, "Host Textbox is not enabled");
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.PortTextBoxEdit.Enabled, "Port Textbox is not enabled");
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.UserNameTextBoxEdit.Enabled, "Username Textbox is not enabled");
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.PasswordTextBoxEdit.Enabled, "Password Textbox is not enabled");
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.VirtualHostTextBoxEdit.Enabled, "Virtual Host Textbox is not enabled");
         Assert.IsFalse(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.TestConnectionButton.Enabled, "Test Connection button is enabled");
         RabbitMQSourceUIMap.Enter_Text_On_RabbitMQSourceTab(RabbitMQContainer.Container.IP, RabbitMQContainer.Container.Port);
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.TestConnectionButton.Enabled, "Test Connection button is not enabled");
         RabbitMQSourceUIMap.Click_RabbitMQSource_TestConnectionButton();
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.RabbitMQSourceCustom.ItemImage.Exists, "Test Connection successful image does not appear.");
         UIMap.WaitForControlEnabled(UIMap.MainStudioWindow.SideMenuBar.SaveButton);
         Assert.IsTrue(UIMap.MainStudioWindow.SideMenuBar.SaveButton.Enabled, "Save ribbon button is not enabled after successfully testing new source.");
         UIMap.Save_With_Ribbon_Button_And_Dialog(SourceName);
         RabbitMQSourceUIMap.Click_Close_RabbitMQSource_Tab_Button();
         //Edit Source
         UtilityToolsUIMap.Open_RabbitMqConsume_LargeView();
         UtilityToolsUIMap.Select_Source_From_RabbitMQConsumeTool();
         Assert.IsTrue(UtilityToolsUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.WorkflowTab.WorkSurfaceContext.WorkflowDesignerView.DesignerView.ScrollViewerPane.ActivityTypeDesigner.WorkflowItemPresenter.Flowchart.RabbitMQConsume.LargeViewContentCustom.EditSourceButton.Enabled, "Edit Source Button is not enabled after selecting source.");
         UtilityToolsUIMap.Click_EditSourceButton_On_RabbitMQConsumeTool();
         Assert.IsTrue(RabbitMQSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.RabbitMqSourceTab.Exists, "RabbitMQ Source Tab does not exist");
     }
 }
Esempio n. 30
0
 [Ignore] //TODO: Re-introduce this test once the move to the new domain (premier.local) is done
 public void Clicking_Edit_Server_Button_Opens_Server_Source_Tab()
 {
     using (var _containerOps = new Depends(Depends.ContainerType.CIRemote))
     {
         Mouse.Click(UIMap.MainStudioWindow.SideMenuBar.SearchButton, new Point(16, 11));
         Mouse.Click(SearchUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.SearchTab
                     .SearchConnectControlCustom.ServerComboBox.ServersToggleButton);
         Mouse.Click(SearchUIMap.MainStudioWindow.ComboboxItemAsRemoteConnectionIntegration);
         Mouse.Click(SearchUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan.SearchTab
                     .SearchConnectControlCustom.EditServerSource);
         Assert.IsTrue(
             ServerSourceUIMap.MainStudioWindow.DockManager.SplitPaneMiddle.TabManSplitPane.TabMan
             .ServerSourceTab.Exists,
             "Server Source tab did not open after clicking Edit Server Source Button.");
     }
 }