public void CreateNewSource(enSourceType type) { switch (type) { case enSourceType.SqlDatabase: _shell.NewSqlServerSource(string.Empty); break; case enSourceType.MySqlDatabase: _shell.NewMySqlSource(string.Empty); break; case enSourceType.PostgreSQL: _shell.NewPostgreSqlSource(string.Empty); break; case enSourceType.Oracle: _shell.NewOracleSource(string.Empty); break; case enSourceType.ODBC: _shell.NewOdbcSource(string.Empty); break; default: throw new ArgumentException("Unrecognized Source Type: " + type.ToString()); } }
public void EditSource(IDbSource selectedSource, enSourceType type) { switch (type) { case enSourceType.SqlDatabase: _shell.EditSqlServerResource(selectedSource); break; case enSourceType.MySqlDatabase: _shell.EditMySqlResource(selectedSource); break; case enSourceType.PostgreSQL: _shell.EditPostgreSqlResource(selectedSource); break; case enSourceType.Oracle: _shell.EditOracleResource(selectedSource); break; case enSourceType.ODBC: _shell.EditOdbcResource(selectedSource); break; } }
public void DbSourceDefinition_Equals_Object_GetType_Expected_False() { const AuthenticationType expectedAuthenticationType = AuthenticationType.Public; const string expectedDatabaseName = "warewolfDb"; var expectedResourceID = Guid.NewGuid(); const string expectedPassword = "******"; const string expectedServer = "localhost"; const int expectedConnectionTimeout = 30; const enSourceType expectedServerType = enSourceType.SqlDatabase; const string expectedUserId = "userId"; var mockDb = new Mock <IDb>(); mockDb.Setup(db => db.Server).Returns(expectedServer); mockDb.Setup(db => db.ServerType).Returns(expectedServerType); mockDb.Setup(db => db.UserID).Returns(expectedUserId); mockDb.Setup(db => db.Password).Returns(expectedPassword); mockDb.Setup(db => db.AuthenticationType).Returns(expectedAuthenticationType); mockDb.Setup(db => db.ResourceID).Returns(expectedResourceID); mockDb.Setup(db => db.DatabaseName).Returns(expectedDatabaseName); mockDb.Setup(db => db.ConnectionTimeout).Returns(expectedConnectionTimeout); var dbSourceDefinition = new DbSourceDefinition(mockDb.Object); var dbSource = new object(); var isEqual = dbSourceDefinition.Equals(dbSource); Assert.IsFalse(isEqual); }
public void CreateNewSource(enSourceType type) { switch (type) { case enSourceType.SqlDatabase: _shell.NewSqlServerSource(string.Empty); break; case enSourceType.MySqlDatabase: _shell.NewMySqlSource(string.Empty); break; case enSourceType.PostgreSQL: _shell.NewPostgreSqlSource(string.Empty); break; case enSourceType.Oracle: _shell.NewOracleSource(string.Empty); break; case enSourceType.ODBC: _shell.NewOdbcSource(string.Empty); break; } }
public void DbSourceDefinition_GetHashCode_Not_Equal_To_Zero() { const AuthenticationType expectedAuthenticationType = AuthenticationType.Public; const string expectedDatabaseName = "warewolfDb"; const string expectedPassword = "******"; const string expectedServer = "localhost"; const int expectedConnectionTimeout = 30; const enSourceType expectedServerType = enSourceType.SqlDatabase; const string expectedUserId = "userId"; var mockDb = new Mock <IDb>(); mockDb.Setup(db => db.Server).Returns(expectedServer); mockDb.Setup(db => db.ServerType).Returns(expectedServerType); mockDb.Setup(db => db.UserID).Returns(expectedUserId); mockDb.Setup(db => db.Password).Returns(expectedPassword); mockDb.Setup(db => db.AuthenticationType).Returns(expectedAuthenticationType); mockDb.Setup(db => db.ConnectionTimeout).Returns(expectedConnectionTimeout); mockDb.Setup(db => db.DatabaseName).Returns(expectedDatabaseName); var dbSourceDefinition = new DbSourceDefinition(mockDb.Object); var hashCode = dbSourceDefinition.GetHashCode(); Assert.AreNotEqual(0, hashCode); }
public void WcfServiceSourceDefinition_GetHashCode_Not_Equal_To_Zero() { const string expectedResourceName = "testResourceName"; var expectedResourceID = Guid.NewGuid(); const string expectedEndpointUrl = "testEndpointUrl"; const string expectedName = "testName"; const string expectedPath = "testPath"; var expectedId = Guid.NewGuid(); const enSourceType expectedType = enSourceType.WcfSource; const string expectedResourceType = "WcfSource"; var wcfServiceSourceDefinition = new WcfServiceSourceDefinition { ResourceName = expectedResourceName, ResourceID = expectedResourceID, EndpointUrl = expectedEndpointUrl, Name = expectedName, Path = expectedPath, Id = expectedId, Type = expectedType, ResourceType = expectedResourceType }; var hashCode = wcfServiceSourceDefinition.GetHashCode(); Assert.AreNotEqual(0, hashCode); }
public static ResourceType ToResourceType(enSourceType sourceType) { var resourceType = ResourceType.Unknown; switch (sourceType) { case enSourceType.SqlDatabase: case enSourceType.MySqlDatabase: resourceType = ResourceType.DbSource; break; case enSourceType.Plugin: resourceType = ResourceType.PluginSource; break; case enSourceType.Dev2Server: resourceType = ResourceType.Server; break; case enSourceType.EmailSource: resourceType = ResourceType.EmailSource; break; case enSourceType.WebSource: resourceType = ResourceType.WebSource; break; case enSourceType.WebService: resourceType = ResourceType.WebService; break; } return(resourceType); }
public void WcfServiceSourceDefinition_Validate() { const string expectedResourceName = "testResourceName"; var expectedResourceID = Guid.NewGuid(); const string expectedEndpointUrl = "testEndpointUrl"; const string expectedName = "testName"; const string expectedPath = "testPath"; var expectedId = Guid.NewGuid(); const enSourceType expectedType = enSourceType.WcfSource; const string expectedResourceType = "WcfSource"; var wcfServiceSourceDefinition = new WcfServiceSourceDefinition { ResourceName = expectedResourceName, ResourceID = expectedResourceID, EndpointUrl = expectedEndpointUrl, Name = expectedName, Path = expectedPath, Id = expectedId, Type = expectedType, ResourceType = expectedResourceType }; Assert.AreEqual(expectedResourceName, wcfServiceSourceDefinition.ResourceName); Assert.AreEqual(expectedResourceID, wcfServiceSourceDefinition.ResourceID); Assert.AreEqual(expectedEndpointUrl, wcfServiceSourceDefinition.EndpointUrl); Assert.AreEqual(expectedName, wcfServiceSourceDefinition.Name); Assert.AreEqual(expectedPath, wcfServiceSourceDefinition.Path); Assert.AreEqual(expectedId, wcfServiceSourceDefinition.Id); Assert.AreEqual(expectedType, wcfServiceSourceDefinition.Type); Assert.AreEqual(expectedResourceType, wcfServiceSourceDefinition.ResourceType); }
public void WcfServiceSourceDefinition_RefEquals_Object_As_WcfServiceSourceDefinition_Expected_True() { const string expectedResourceName = "testResourceName"; var expectedResourceID = Guid.NewGuid(); const string expectedEndpointUrl = "testEndpointUrl"; const string expectedName = "testName"; const string expectedPath = "testPath"; var expectedId = Guid.NewGuid(); const enSourceType expectedType = enSourceType.WcfSource; const string expectedResourceType = "WcfSource"; var wcfServiceSourceDefinition = new WcfServiceSourceDefinition { ResourceName = expectedResourceName, ResourceID = expectedResourceID, EndpointUrl = expectedEndpointUrl, Name = expectedName, Path = expectedPath, Id = expectedId, Type = expectedType, ResourceType = expectedResourceType }; object wcfServiceSource = wcfServiceSourceDefinition; var isEqual = wcfServiceSourceDefinition.Equals(wcfServiceSource); Assert.IsTrue(isEqual); }
public void ExchangeSourceDefinition_Equals_Object_GetType_Expected_False() { var expectedResourceID = Guid.NewGuid(); const string expectedAutoDiscoverUrl = "testAutoDiscoverUrl"; const string expectedUserName = "******"; const string expectedPassword = "******"; const enSourceType expectedType = enSourceType.ExchangeSource; const string expectedResourceType = "ExchangeSource"; const int expectedTimeout = 30; const string expectedEmailTo = "testEmailTo"; const string expectedPath = "testPath"; var expectedID = Guid.NewGuid(); const string expectedResourceName = "testResourceName"; var exchangeSourceDefinition = new ExchangeSourceDefinition { ResourceID = expectedResourceID, AutoDiscoverUrl = expectedAutoDiscoverUrl, UserName = expectedUserName, Password = expectedPassword, Type = expectedType, ResourceType = expectedResourceType, Timeout = expectedTimeout, EmailTo = expectedEmailTo, Path = expectedPath, Id = expectedID, ResourceName = expectedResourceName }; var exchangeSource = new object(); var isEqual = exchangeSourceDefinition.Equals(exchangeSource); Assert.IsFalse(isEqual); }
public DatabaseSourceRegion(IDbServiceModel model, ModelItem modelItem, enSourceType type) { LabelWidth = 46; ToolRegionName = "DatabaseSourceRegion"; Dependants = new List <IToolRegion>(); NewSourceCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(() => model.CreateNewSource(type)); EditSourceCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(() => model.EditSource(SelectedSource, type), CanEditSource); var sources = model.RetrieveSources().OrderBy(source => source.Name); Sources = sources.Where(source => source != null && source.Type == type).ToObservableCollection(); IsEnabled = true; _modelItem = modelItem; SourceId = modelItem.GetProperty <Guid>("SourceId"); SourcesHelpText = Warewolf.Studio.Resources.Languages.HelpText.DatabaseServiceSourceTypesHelp; EditSourceHelpText = Warewolf.Studio.Resources.Languages.HelpText.DatabaseServiceEditSourceHelp; NewSourceHelpText = Warewolf.Studio.Resources.Languages.HelpText.DatabaseServiceNewSourceHelp; SourcesTooltip = Warewolf.Studio.Resources.Languages.Tooltips.ManageDbServiceSourcesTooltip; EditSourceTooltip = Warewolf.Studio.Resources.Languages.Tooltips.ManageDbServiceEditSourceTooltip; NewSourceTooltip = Warewolf.Studio.Resources.Languages.Tooltips.ManageDbServiceNewSourceTooltip; if (SourceId != Guid.Empty) { SelectedSource = Sources.FirstOrDefault(source => source.Id == SourceId); } }
public void EditSource(IDbSource selectedSource, enSourceType type) { switch (type) { case enSourceType.SqlDatabase: _shell.EditSqlServerResource(selectedSource); break; case enSourceType.MySqlDatabase: _shell.EditMySqlResource(selectedSource); break; case enSourceType.PostgreSQL: _shell.EditPostgreSqlResource(selectedSource); break; case enSourceType.Oracle: _shell.EditOracleResource(selectedSource); break; case enSourceType.ODBC: _shell.EditOdbcResource(selectedSource); break; default: throw new ArgumentException("Unrecognized Source Type: " + type.ToString()); } }
public void DbSourceDefinition_Validate() { const AuthenticationType expectedAuthenticationType = AuthenticationType.Public; const string expectedDatabaseName = "warewolfDb"; var expectedResourceID = Guid.NewGuid(); const string expectedSavePath = "Path\\ResourcePath"; const string expectedResourceName = "testResource"; const string expectedPassword = "******"; const string expectedServer = "localhost"; const int expectedConnectionTimeout = 30; const enSourceType expectedServerType = enSourceType.SqlDatabase; const string expectedUserId = "userId"; var mockDb = new Mock <IDb>(); mockDb.Setup(db => db.AuthenticationType).Returns(expectedAuthenticationType); mockDb.Setup(db => db.DatabaseName).Returns(expectedDatabaseName); mockDb.Setup(db => db.ResourceID).Returns(expectedResourceID); mockDb.Setup(db => db.GetSavePath()).Returns(expectedSavePath); mockDb.Setup(db => db.ResourceName).Returns(expectedResourceName); mockDb.Setup(db => db.Password).Returns(expectedPassword); mockDb.Setup(db => db.Server).Returns(expectedServer); mockDb.Setup(db => db.ConnectionTimeout).Returns(expectedConnectionTimeout); mockDb.Setup(db => db.ServerType).Returns(expectedServerType); mockDb.Setup(db => db.UserID).Returns(expectedUserId); var dbSourceDefinition = new DbSourceDefinition(mockDb.Object) { ReloadActions = true }; Assert.IsTrue(dbSourceDefinition.ReloadActions); Assert.AreEqual(expectedAuthenticationType, dbSourceDefinition.AuthenticationType); Assert.AreEqual(expectedDatabaseName, dbSourceDefinition.DbName); Assert.AreEqual(expectedResourceID, dbSourceDefinition.Id); Assert.AreEqual(expectedSavePath, dbSourceDefinition.Path); Assert.AreEqual(expectedResourceName, dbSourceDefinition.Name); Assert.AreEqual(expectedPassword, dbSourceDefinition.Password); Assert.AreEqual(expectedServer, dbSourceDefinition.ServerName); Assert.AreEqual(expectedConnectionTimeout, dbSourceDefinition.ConnectionTimeout); Assert.AreEqual(expectedServerType, dbSourceDefinition.Type); Assert.AreEqual(expectedUserId, dbSourceDefinition.UserName); Assert.AreEqual(expectedResourceName, dbSourceDefinition.ToString()); }
public List <T> FindSourcesByType <T>(IServer targetEnvironment, enSourceType sourceType) { var result = new List <T>(); if (targetEnvironment == null) { return(result); } var comsController = new CommunicationController { ServiceName = "FindSourcesByType" }; comsController.AddPayloadArgument("Type", Enum.GetName(typeof(enSourceType), sourceType)); result = comsController.ExecuteCommand <List <T> >(targetEnvironment.Connection, GlobalConstants.ServerWorkspaceID); return(result); }
public void ExchangeSourceDefinition_Validate() { var expectedResourceID = Guid.NewGuid(); const string expectedAutoDiscoverUrl = "testAutoDiscoverUrl"; const string expectedUserName = "******"; const string expectedPassword = "******"; const enSourceType expectedType = enSourceType.ExchangeSource; const string expectedResourceType = "ExchangeSource"; const int expectedTimeout = 30; const string expectedEmailTo = "testEmailTo"; const string expectedPath = "testPath"; var expectedID = Guid.NewGuid(); const string expectedResourceName = "testResourceName"; var exchangeSourceDefinition = new ExchangeSourceDefinition { ResourceID = expectedResourceID, AutoDiscoverUrl = expectedAutoDiscoverUrl, UserName = expectedUserName, Password = expectedPassword, Type = expectedType, ResourceType = expectedResourceType, Timeout = expectedTimeout, EmailTo = expectedEmailTo, Path = expectedPath, Id = expectedID, ResourceName = expectedResourceName }; Assert.AreEqual(expectedResourceID, exchangeSourceDefinition.ResourceID); Assert.AreEqual(expectedAutoDiscoverUrl, exchangeSourceDefinition.AutoDiscoverUrl); Assert.AreEqual(expectedUserName, exchangeSourceDefinition.UserName); Assert.AreEqual(expectedPassword, exchangeSourceDefinition.Password); Assert.AreEqual(expectedType, exchangeSourceDefinition.Type); Assert.AreEqual(expectedResourceType, exchangeSourceDefinition.ResourceType); Assert.AreEqual(expectedTimeout, exchangeSourceDefinition.Timeout); Assert.AreEqual(expectedEmailTo, exchangeSourceDefinition.EmailTo); Assert.AreEqual(expectedPath, exchangeSourceDefinition.Path); Assert.AreEqual(expectedID, exchangeSourceDefinition.Id); Assert.AreEqual(expectedResourceName, exchangeSourceDefinition.ResourceName); }
public IEnumerable GetModels(Guid workspaceID, enSourceType sourceType) { var workspaceResources = GetResources(workspaceID); var resources = workspaceResources.FindAll(r => r.ResourceType == sourceType.ToString()); if (sourceType == enSourceType.MySqlDatabase || sourceType == enSourceType.Oracle || sourceType == enSourceType.PostgreSQL || sourceType == enSourceType.SqlDatabase || sourceType == enSourceType.ODBC) { var oldResources = workspaceResources.FindAll(r => r.ResourceType.ToUpper() == "DbSource".ToUpper()); foreach (var oldResource in oldResources) { if (!resources.Exists(resource => resource.ResourceID == oldResource.ResourceID)) { resources.Add(oldResource); } } } var commands = new Dictionary <enSourceType, Func <IEnumerable> > { { enSourceType.Dev2Server, () => BuildSourceList <Connection>(resources) }, { enSourceType.EmailSource, () => BuildSourceList <EmailSource>(resources) }, { enSourceType.SqlDatabase, () => BuildSourceList <DbSource>(resources) }, { enSourceType.MySqlDatabase, () => BuildSourceList <DbSource>(resources) }, { enSourceType.PostgreSQL, () => BuildSourceList <DbSource>(resources) }, { enSourceType.Oracle, () => BuildSourceList <DbSource>(resources) }, { enSourceType.ODBC, () => BuildSourceList <DbSource>(resources) }, { enSourceType.PluginSource, () => BuildSourceList <PluginSource>(resources) }, { enSourceType.WebSource, () => BuildSourceList <WebSource>(resources) }, { enSourceType.OauthSource, () => BuildSourceList <DropBoxSource>(resources) }, { enSourceType.SharepointServerSource, () => BuildSourceList <SharepointSource>(resources) }, { enSourceType.ExchangeSource, () => BuildSourceList <ExchangeSource>(resources) }, { enSourceType.RedisSource, () => BuildSourceList <RedisSource>(resources) }, { enSourceType.ElasticsearchSource, () => BuildSourceList <ElasticsearchSource>(resources) } }; var result = commands.ContainsKey(sourceType) ? commands[sourceType].Invoke() : null; return(result); }
public static ResourceType ToResourceType(enSourceType sourceType) { var resourceType = ResourceType.Unknown; switch(sourceType) { case enSourceType.SqlDatabase: case enSourceType.MySqlDatabase: resourceType = ResourceType.DbSource; break; case enSourceType.Plugin: resourceType = ResourceType.PluginSource; break; case enSourceType.Dev2Server: resourceType = ResourceType.Server; break; case enSourceType.EmailSource: resourceType = ResourceType.EmailSource; break; case enSourceType.WebSource: resourceType = ResourceType.WebSource; break; case enSourceType.WebService: resourceType = ResourceType.WebService; break; case enSourceType.OauthSource: resourceType = ResourceType.OauthSource; break; case enSourceType.SharepointServerSource: resourceType = ResourceType.SharepointServerSource; break; } return resourceType; }
public IEnumerable GetModels(Guid workspaceID, enSourceType sourceType) => _catalogPluginContainer.LoadProvider.GetModels(workspaceID, sourceType);
protected virtual MySqlDatabaseBroker CreateMySqlDatabaseBroker(enSourceType type) { return(new MySqlDatabaseBroker()); }
public DbSource(enSourceType sourceType) { ResourceType = "DbSource"; ServerType = sourceType; }
public void EditSource(IDbSource selectedSource, enSourceType type) { }
public void CreateNewSource(enSourceType type) { }
protected virtual MySqlDatabaseBroker CreateMySqlDatabaseBroker(enSourceType type) { return new MySqlDatabaseBroker(); }