protected override IObservable <ITask> PostModelToApi(ITogglApi api, ITask model) { var user = api.User.Get().Wait(); WorkspaceHelper.SetSubscription(user, user.DefaultWorkspaceId, PricingPlans.StarterMonthly).Wait(); return(api.Tasks.Create(model)); }
private void FillWorkspaces() { string activeWorkspace = TFSVersionControlService.Instance.GetActiveWorkspace(projectCollection); _workspaceComboBox.Changed -= OnChangeActiveWorkspaces; _workspaceStore.Clear(); _workspaces.Clear(); _workspaces.AddRange(WorkspaceHelper.GetLocalWorkspaces(projectCollection)); TreeIter activeWorkspaceRow = TreeIter.Zero; foreach (var workspace in _workspaces) { var iter = _workspaceStore.AppendValues(workspace, workspace.Name); if (string.Equals(workspace.Name, activeWorkspace, StringComparison.Ordinal)) { activeWorkspaceRow = iter; } } _workspaceComboBox.Changed += OnChangeActiveWorkspaces; if (_workspaces.Count > 0) { if (!activeWorkspaceRow.Equals(TreeIter.Zero)) { _workspaceComboBox.SetActiveIter(activeWorkspaceRow); } else { _workspaceComboBox.Active = 0; } } }
private bool NavigateToViewModel(ViewModelDirectiveValue currentDirective) { //get all declarations of the viewmodel's name var declarations = WorkspaceHelper .GetSyntaxTreeInfos() .SelectMany( s => s.Tree.GetRoot() .DescendantNodes() .OfType <TypeDeclarationSyntax>() .Select(d => new { DeclarationSyntax = d, Info = s })) .Where(s => s.DeclarationSyntax.Identifier.ToString() == currentDirective.TypeName); //get exact match foreach (var declaration in declarations) { //declaration.Info.Compilation.GetTypeByMetadataName() var semanticModel = declaration.Info.Compilation.GetSemanticModel(declaration.DeclarationSyntax.SyntaxTree); var declaredSymbol = semanticModel .GetDeclaredSymbol(declaration.DeclarationSyntax); // check assambly name and namespace if (declaredSymbol.ContainingAssembly.Identity.Name == currentDirective.AssamblyName && declaredSymbol.ContainingNamespace.ToString() == currentDirective.Namespace) { //navigate to definition - open window var item = DTEHelper.GetProjectItemByFullPath(declaration.DeclarationSyntax.Identifier.SyntaxTree.FilePath); DTEHelper.ChangeActiveWindowTo(item); return(true); } } return(false); }
internal static void PrepareBinaryRepositoryEnvironment(string username, string password, string tfsPath, string workspaceName, string tfsProject, string localWorkspaceFolder) { try { NetworkCredential cred = new NetworkCredential(username, password); using (TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri(tfsPath), cred)) { tfs.EnsureAuthenticated(); VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer)); var workspace = WorkspaceHelper.WorkspaceCreate(vcs, tfsProject, workspaceName, localWorkspaceFolder); workspace.Get(); var targetContent = "<?xml version='1.0'?><Component xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns='http://schemas.aitgmbh.de/DependencyManager/2011/11'><Dependencies><Dependency Type='BinaryDependency'><Provider Type='BinaryRepository'><Settings Type='BinaryRepositorySettings'><Setting Name='BinaryTeamProjectCollectionUrl' Value='{0}' /><Setting Name='BinaryRepositoryTeamProject' Value='{1}' /><Setting Name='ComponentName' Value='BinaryRepoSource' /><Setting Name='VersionNumber' Value='1.0' /></Settings></Provider></Dependency></Dependencies></Component>"; targetContent = string.Format(targetContent, Values.TeamProjectCollection, Values.TeamProjectName); FileHelper.CheckInFolderWithFile(workspace, "BinaryRepo", "component.targets", targetContent); var emptyTarget = "<?xml version='1.0'?><Component xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns='http://schemas.aitgmbh.de/DependencyManager/2011/11'><Dependencies /></Component>"; CheckInFolderSubFoldersWithFiles(workspace, "BinaryRepoSource", "1.0", "component.targets", emptyTarget); } } catch (Exception) { throw; } }
public static void ClassInitialize(TestContext TC) { string path = TestResources.GetTestResourcesFolder(@"Solutions" + Path.DirectorySeparatorChar + "AnalyzerTestSolution"); SR = WorkspaceHelper.CreateWorkspaceAndOpenSolution(path); SR.StopAllRepositoryFolderWatchers(); }
protected override IObservable <List <ITask> > CallEndpointWith(ITogglApi togglApi, DateTimeOffset threshold) { var user = togglApi.User.Get().Wait(); WorkspaceHelper.SetSubscription(user, user.DefaultWorkspaceId, PricingPlans.StarterMonthly).Wait(); return(togglApi.Tasks.GetAllSince(threshold)); }
protected override void OnCheckout(FilePath targetLocalPath, Revision rev, bool recurse, IProgressMonitor monitor) { var ws = WorkspaceHelper.GetLocalWorkspaces(this.VersionControlService.Collection); if (ws.Count == 0) { Workspace newWorkspace = new Workspace(this.VersionControlService, Environment.MachineName + ".WS", this.VersionControlService.Collection.Server.UserName, "Auto created", new List <WorkingFolder> { new WorkingFolder(VersionControlPath.RootFolder, targetLocalPath) }, Environment.MachineName); var workspace = this.VersionControlService.CreateWorkspace(newWorkspace); workspace.Get(new GetRequest(VersionControlPath.RootFolder, RecursionType.Full, VersionSpec.Latest), GetOptions.None, monitor); } else { this.workspaces.AddRange(ws); var workspace = GetWorkspaceByLocalPath(targetLocalPath); if (workspace == null) { return; } workspace.Get(new GetRequest(workspace.GetServerPathForLocalPath(targetLocalPath), RecursionType.Full, VersionSpec.Latest), GetOptions.None, monitor); } }
/// <summary> /// Creates a new DBEngineHelper object using the provided factory. /// </summary> /// <param name="factory">The factory to be use this object.</param> protected DBEngineHelper(DbProviderFactory factory) { this.factory = factory; connectionContainers = new List<WorkspaceHelper>(); WorkspaceHelper container = new WorkspaceHelper(); container.Factory = factory; connectionContainers.Add(container); }
protected override IObservable <ITask> CallEndpointWith(ITogglApi togglApi) { var user = togglApi.User.Get().Wait(); WorkspaceHelper.SetSubscription(user, user.DefaultWorkspaceId, PricingPlans.StarterMonthly).Wait(); var project = createProject(togglApi, user.DefaultWorkspaceId).Wait(); return(createTask(togglApi, project, user.Id)); }
public static void ClassInitialize(TestContext TC) { WorkspaceHelper.CreateWorkspace2(); mTestHelper.ClassInitialize(TC); string path = Path.Combine(TestResources.GetTestResourcesFolder(@"Solutions" + Path.DirectorySeparatorChar + "RepositoryItemTest")); WorkSpace.Instance.OpenSolution(path, EncryptionHandler.GetDefaultKey()); }
public void Clean() { WorkspaceHelper.WorkspaceCleanup(Values.WorkspaceOwner, Values.Password, Values.TeamProjectCollection, _workspaceName, Values.WorkspaceOwner); if (Directory.Exists(_localWorkspaceFolder)) { Directory.Delete(_localWorkspaceFolder, true); } }
public async Task ReturnsEmptyListWhenTheDefaultWorkspaceIsDeleted() { var(togglClient, user) = await SetupTestUser(); await WorkspaceHelper.Delete(user, user.DefaultWorkspaceId.Value).ConfigureAwait(false); var workspaces = await CallEndpointWith(togglClient); workspaces.Should().BeEmpty(); }
public static void ClassInitialize(TestContext TC) { mTestHelper.ClassInitialize(TC); string path = Path.Combine(TestResources.GetTestResourcesFolder(@"Solutions" + Path.DirectorySeparatorChar + "GlobalCrossSolution")); SR = WorkspaceHelper.CreateWorkspaceAndOpenSolution(path); GlobalSolutionUtils.Instance.SolutionFolder = Path.Combine(TestResources.GetTestResourcesFolder(@"Solutions" + Path.DirectorySeparatorChar + "GlobalCrossSolution")); GlobalSolutionUtils.Instance.EncryptionKey = EncryptionHandler.GetDefaultKey(); }
public async void ThePricingPlansEnumsContainsAllAndOnlyTheAvailablePricingPlans() { var(_, user) = await SetupTestUser(); var availablePlans = await WorkspaceHelper.GetAllAvailablePricingPlans(user); var convertedPlans = availablePlans.Select(plan => (PricingPlans)plan); Enum.GetNames(typeof(PricingPlans)).Length.Should().Be(availablePlans.Count); Enum.GetValues(typeof(PricingPlans)).Should().Contain(convertedPlans); }
public async Task ReturnsCreatedWorkspace() { var(togglClient, user) = await SetupTestUser(); var secondWorkspace = await WorkspaceHelper.CreateFor(user); var workspace = await CallEndpointWith(togglClient, secondWorkspace.Id); workspace.Id.Should().Be(secondWorkspace.Id); workspace.Name.Should().Be(secondWorkspace.Name); }
public async void CreatingTaskWorksForAllPricingPlansOtherThanTheFreePlan(PricingPlans plan) { var(togglApi, user) = await SetupTestUser(); WorkspaceHelper.SetSubscription(user, user.DefaultWorkspaceId, plan).Wait(); var project = createProject(togglApi, user.DefaultWorkspaceId).Wait(); Action creatingTask = () => createTask(togglApi, project, user.Id).Wait(); creatingTask.ShouldNotThrow(); }
public async Task ReturnsAllWorkspaceFeaturesForMultipleWorkspaces() { var(togglClient, user) = await SetupTestUser(); var anotherWorkspace = await WorkspaceHelper.CreateFor(user); var workspaceFeatureCollection = await CallEndpointWith(togglClient); workspaceFeatureCollection.Should().HaveCount(2); workspaceFeatureCollection.Should().Contain(collection => collection.WorkspaceId == user.DefaultWorkspaceId); workspaceFeatureCollection.Should().Contain(collection => collection.WorkspaceId == anotherWorkspace.Id); }
public async Task ReturnsAllWorkspaces() { var(togglClient, user) = await SetupTestUser(); var secondWorkspace = await WorkspaceHelper.CreateFor(user); var workspaces = await CallEndpointWith(togglClient); workspaces.Should().HaveCount(2); workspaces.Should().Contain(ws => ws.Id == user.DefaultWorkspaceId); workspaces.Should().Contain(ws => ws.Id == secondWorkspace.Id); }
public async System.Threading.Tasks.Task ReturnsEmptyListWhenThereAreNoActiveProjects() { var(togglClient, user) = await SetupTestUser(); var project = await createProject(togglClient, user.DefaultWorkspaceId); WorkspaceHelper.SetSubscription(user, user.DefaultWorkspaceId, PricingPlans.StarterMonthly).Wait(); await togglClient.Tasks.Create(randomTask(project, user.Id, isActive : false)); var tasks = await togglClient.Tasks.GetAll(); tasks.Should().HaveCount(0); }
private static async Task CleanupWorkspacesAsync() { Console2.WriteStartHeader("Clean Up Workspaces"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); WorkspaceHelper workspaceHelper = new WorkspaceHelper(_connectionManager.RsapiClient); await workspaceHelper.CleanupWorkspacesAsync(); stopwatch.Stop(); DisplayTimeElapsed(stopwatch.Elapsed); }
public void Configure( IApplicationBuilder app, IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISharedTextWriter writer, IAssemblyLoader loader, IOptionsMonitor <OmniSharpOptions> options) { if (_env.TransportType == TransportType.Stdio) { loggerFactory.AddStdio(writer, (category, level) => LogFilter(category, level, _env)); } else { loggerFactory.AddConsole((category, level) => LogFilter(category, level, _env)); } var logger = loggerFactory.CreateLogger <Startup>(); var assemblies = DiscoverOmniSharpAssemblies(loader, logger); PluginHost = CreateCompositionHost(serviceProvider, options.CurrentValue, assemblies); Workspace = PluginHost.GetExport <OmniSharpWorkspace>(); app.UseRequestLogging(); app.UseExceptionHandler("/error"); app.UseMiddleware <EndpointMiddleware>(); app.UseMiddleware <StatusMiddleware>(); app.UseMiddleware <StopServerMiddleware>(); if (_env.TransportType == TransportType.Stdio) { logger.LogInformation($"Omnisharp server running using {nameof(TransportType.Stdio)} at location '{_env.TargetDirectory}' on host {_env.HostProcessId}."); } else { logger.LogInformation($"Omnisharp server running on port '{_env.Port}' at location '{_env.TargetDirectory}' on host {_env.HostProcessId}."); } var workspaceHelper = new WorkspaceHelper(PluginHost, Configuration, options.CurrentValue, loggerFactory); workspaceHelper.Initialize(Workspace); // when configuration options change // run workspace options providers automatically options.OnChange(o => { workspaceHelper.ProvideOptions(Workspace, o); }); logger.LogInformation("Configuration finished."); }
public async ThreadingTask DoesNotFindProjectInADifferentWorkspace() { var(togglApi, user) = await SetupTestUser(); var secondWorkspace = await WorkspaceHelper.CreateFor(user); var projectA = await togglApi.Projects.Create(new Project { Name = Guid.NewGuid().ToString(), WorkspaceId = secondWorkspace.Id }); var projectB = await togglApi.Projects.Create(new Project { Name = Guid.NewGuid().ToString(), WorkspaceId = secondWorkspace.Id }); var projects = await togglApi.Projects.Search(user.DefaultWorkspaceId, new[] { projectA.Id, projectB.Id }); projects.Should().HaveCount(0); }
private void FillWorkspaces() { _listStore.Clear(); var workspaces = _showRemoteCheck.State == CheckBoxState.On ? WorkspaceHelper.GetRemoteWorkspaces(this.projectCollection) : WorkspaceHelper.GetLocalWorkspaces(this.projectCollection); foreach (var workspace in workspaces) { var row = _listStore.AddRow(); _listStore.SetValue(row, _name, workspace.Name); _listStore.SetValue(row, _computer, workspace.Computer); _listStore.SetValue(row, _owner, workspace.OwnerName); _listStore.SetValue(row, _comment, workspace.Comment.Replace(Environment.NewLine, " ")); } }
public async Task ReturnsTagsForAllWorkspaces() { var(togglApi, user) = await SetupTestUser(); var otherWorkspace = await WorkspaceHelper.CreateFor(user); await pushTags(togglApi, tags1, user.DefaultWorkspaceId); await pushTags(togglApi, tags2, otherWorkspace.Id); var returnedTags = await CallEndpointWith(togglApi); returnedTags.Should().HaveCount(tags1.Length + tags2.Length); assertTags(returnedTags, tags1, user.DefaultWorkspaceId); assertTags(returnedTags, tags2, otherWorkspace.Id); }
public async ThreadingTask ReturnsOnlyProjectInTheSearchedWorkspace() { var(togglApi, user) = await SetupTestUser(); var secondWorkspace = await WorkspaceHelper.CreateFor(user); var projectA = await togglApi.Projects.Create(new Project { Name = Guid.NewGuid().ToString(), WorkspaceId = user.DefaultWorkspaceId }); var projectB = await togglApi.Projects.Create(new Project { Name = Guid.NewGuid().ToString(), WorkspaceId = secondWorkspace.Id }); var projects = await togglApi.Projects.Search(user.DefaultWorkspaceId, new[] { projectA.Id, projectB.Id }); projects.Should().HaveCount(1); projects.Should().Contain(p => p.Id == projectA.Id); }
public async Task ChangesDefaultWorkspace() { var(togglClient, user) = await SetupTestUser(); var secondWorkspace = await WorkspaceHelper.CreateFor(user); var userWithUpdates = new Ultrawave.Models.User(user); userWithUpdates.DefaultWorkspaceId = secondWorkspace.Id; var updatedUser = await togglClient.User.Update(userWithUpdates); updatedUser.Id.Should().Be(user.Id); updatedUser.DefaultWorkspaceId.Should().NotBe(user.DefaultWorkspaceId); updatedUser.DefaultWorkspaceId.Should().Be(secondWorkspace.Id); }
private void ShowDialog(DialogAction action) { Microsoft.TeamFoundation.VersionControl.Client.Workspace workspace = null; if (action == DialogAction.Edit) { string workspaceName = _listStore.GetValue(_listView.SelectedRow, _name); workspace = WorkspaceHelper.GetWorkspace(this.projectCollection, workspaceName); } using (var dialog = new WorkspaceAddEditDialog(workspace, this.projectCollection)) { if (dialog.Run(this) == Command.Ok) { FillWorkspaces(); } } }
protected BaseCommandTarget(IVsTextView textViewAdapter, ITextView textView, BaseHandlerProvider provider) { TextViewAdapter = textViewAdapter; TextView = textView; Workspace = provider.VsWorkspace; WorkspaceHelper = new WorkspaceHelper() { Workspace = Workspace }; // Add the target later to make sure it makes it in before other command handlers (thanks to Mads Kristensen - https://github.com/madskristensen/WebEssentials2013/blob/fa001f0737b0ab0a76a3e9fac9d89e6b722d70f3/EditorExtensions/Shared/Commands/CommandTargetBase.cs) Dispatcher.CurrentDispatcher.InvokeAsync(() => { ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(this, out nextCommandHandler)); }, DispatcherPriority.ApplicationIdle); }
private TFSRepository GetRepoFromServer(BaseTeamFoundationServer server, FilePath path) { foreach (var collection in server.ProjectCollections) { var workspaces = WorkspaceHelper.GetLocalWorkspaces(collection); var workspace = workspaces.SingleOrDefault(w => w.IsLocalPathMapped(path)); if (workspace != null) { var result = new TFSRepository(workspace.VersionControlService, path); result.AttachWorkspace(workspace); return(result); } } return(null); }
static void Prep() { // Create new solution mBusinessFlow = new BusinessFlow(); mBusinessFlow.Activities = new ObservableList <Activity>(); mBusinessFlow.Name = "MyDriver BF"; mBusinessFlow.Active = true; Platform p = new Platform(); p.PlatformType = ePlatformType.NA; mBusinessFlow.TargetApplications.Add(new TargetApplication() { AppName = mAppName }); mGingerRunner = new GingerRunner(); mGingerRunner.CurrentSolution = new Ginger.SolutionGeneral.Solution(); Agent agent = new Agent(); agent.AgentType = Agent.eAgentType.Service; mGingerRunner.SolutionAgents = new ObservableList <Agent>(); mGingerRunner.SolutionAgents.Add(agent); mGingerRunner.ApplicationAgents.Add(new ApplicationAgent() { AppName = mAppName, Agent = agent }); mGingerRunner.SolutionApplications = new ObservableList <ApplicationPlatform>(); mGingerRunner.SolutionApplications.Add(new ApplicationPlatform() { AppName = mAppName, Platform = ePlatformType.NA }); mGingerRunner.BusinessFlows.Add(mBusinessFlow); WorkspaceHelper.CreateWorkspaceWithTempSolution("sol1"); // Add the plugin to solution string pluginFolder = TestResources.GetTestResourcesFolder(@"Plugins" + Path.DirectorySeparatorChar + "PluginDriverExample4"); WorkSpace.Instance.PlugInsManager.Init(WorkSpace.Instance.SolutionRepository); WorkSpace.Instance.PlugInsManager.AddPluginPackage(pluginFolder); Console.WriteLine("LocalGingerGrid Status: " + WorkSpace.Instance.LocalGingerGrid.Status); }
public static void ClassInit(TestContext context) { string solutionfolder = TestResources.GetTempFolder("GingerVariableTests"); WorkspaceHelper.CreateWorkspaceWithTempSolution(solutionfolder); mBF = new BusinessFlow(); mBF.Activities = new ObservableList <Activity>(); mBF.Name = "BF Test Fire Fox"; mBF.Active = true; Platform p = new Platform(); p.PlatformType = ePlatformType.Web; mBF.TargetApplications.Add(new TargetApplication() { AppName = "SCM" }); VariableString busFlowV1 = new VariableString() { Name = "BFV1", InitialStringValue = "1" }; mBF.AddVariable(busFlowV1); mGR = new GingerRunner(); mGR.CurrentSolution = new Ginger.SolutionGeneral.Solution(); Agent a = new Agent(); a.AgentType = Agent.eAgentType.Service; // Simple agent which anyhow we don't need to start for this test and will work on Linux mGR.SolutionAgents = new ObservableList <Agent>(); mGR.SolutionAgents.Add(a); mGR.ApplicationAgents.Add(new ApplicationAgent() { AppName = "SCM", Agent = a }); mGR.SolutionApplications = new ObservableList <ApplicationPlatform>(); mGR.SolutionApplications.Add(new ApplicationPlatform() { AppName = "SCM", Platform = ePlatformType.Web, Description = "New application" }); mGR.BusinessFlows.Add(mBF); }
/// <summary> /// Creates a new Workspace object. /// </summary> /// <param name="name">The name of the new WorkspaceHelper.</param> /// <param name="factoryName">The name of the factory to by use by this WorkspaceHelper object (the name most exist on the configuration xml file).</param> /// <returns>The new WorkspaceHelper object.</returns> public static WorkspaceHelper CreateWorkspace(string name, string factoryName) { WorkspaceHelper ws = new WorkspaceHelper(name, AdoFactoryManager.GetFactory(factoryName)); return ws; }