///<inheritdoc cref="IProjectInfoTransmitter"/> public async Task <RepositoryImportResult> Work(TransmitterArguments args, IInputUriProvider uriProvider = null, IProjectInfoBuilder projectInfoBuilder = null) { if (args == null) { throw new ArgumentNullException(nameof(args)); } try { this.DisplayParameters(args); IEnumerable <string> uris = this.GetPaths(args, uriProvider ?? UriProviderFactory.Get(args, this.logger)); if (projectInfoBuilder == null) { projectInfoBuilder = ProjectInfoBuilderFactory.Get(args, this.logger); } this.AddEnrichersToBuilder(projectInfoBuilder); IEnumerable <ProjectInfo> infos = projectInfoBuilder.GetInfos(uris); this.projectInfoSender.SetBaseAddress(args.ApiBaseUri); var result = await this.projectInfoSender.Send(infos).ConfigureAwait(false); this.logger.Info("All done"); return(result); } catch (Exception ex) { this.logger.Fatal(ex); throw; } }
public void RelativePathPropertyKey_ResolvedOk() { //arrange ManifestBasedUriProvider uriProvider = new ManifestBasedUriProvider(new TraceLogger(LogLevel.Debug)); List <string> uris = uriProvider.GetUris(RepoRoot.FullName).ToList(); IProjectInfoBuilder builder = ProjectInfoBuilderFactory.Get(new TransmitterArguments() { TransmissionMode = TransmissionMode.LocalManifestBased }, new TraceLogger(LogLevel.Debug)); //act List <ProjectInfo> infos = builder.GetInfos(uris).ToList(); //assert var scriptTwo = infos.Single(x => x.ProjectName == "ScriptTwo"); var samplePath = scriptTwo.Components.Single().Properties["SamplePath"]; FileAssert.Exists(samplePath.ToString()); }
public void ProjectInfo_RepoStampsShouldBeEqual() { //arrange ManifestBasedUriProvider uriProvider = new ManifestBasedUriProvider(new TraceLogger(LogLevel.Debug)); List <string> uris = uriProvider.GetUris(RepoRoot.FullName).ToList(); IProjectInfoBuilder builder = ProjectInfoBuilderFactory.Get(new TransmitterArguments() { TransmissionMode = TransmissionMode.LocalManifestBased }, new TraceLogger(LogLevel.Debug)); //act List <ProjectInfo> infos = builder.GetInfos(uris).ToList(); //assert //the stamp of both scripts should be the same (as they are loaded at the same time) //otherwise, they would be visible in different snapshots of the repo Assert.AreEqual(infos[0].RepositoryStamp, infos[1].RepositoryStamp); }
private ProjectInfo LoadFromManifestWithRepoIncluded(bool allowOverride, RepositoryInfo repositoryInfoFromTransmitter) { //arrange ManifestBasedUriProvider uriProvider = new ManifestBasedUriProvider(new TraceLogger(LogLevel.Debug)); List <string> uris = uriProvider.GetUris(RepoRoot.FullName).ToList(); IProjectInfoBuilder builder = ProjectInfoBuilderFactory.Get(new TransmitterArguments() { RepositoryName = repositoryInfoFromTransmitter?.RepositoryName, OrganizationName = repositoryInfoFromTransmitter?.OrganizationName, RepositoryMode = repositoryInfoFromTransmitter?.RepositoryMode ?? RepositoryMode.Default, TransmissionMode = TransmissionMode.LocalManifestBased, ManifestCanOverrideRepositoryInfo = allowOverride }, new TraceLogger(LogLevel.Debug)); //act List <ProjectInfo> infos = builder.GetInfos(uris).ToList(); //assert var scriptOne = infos.Single(x => x.ProjectName == "ScriptOne"); return(scriptOne); }
private ProjectInfo LoadFromManifestWithoutRepositoryInfo(bool allowOverride, RepositoryInfo repositoryInfoFromTransmitter) { //arrange var file = Samples.GetFiles("ProjectManifestWithoutRepository.RepoCat.xml").Single(); IProjectInfoBuilder builder = ProjectInfoBuilderFactory.Get(new TransmitterArguments() { RepositoryName = repositoryInfoFromTransmitter?.RepositoryName, OrganizationName = repositoryInfoFromTransmitter?.OrganizationName, RepositoryMode = repositoryInfoFromTransmitter?.RepositoryMode ?? RepositoryMode.Default, TransmissionMode = TransmissionMode.LocalManifestBased, ManifestCanOverrideRepositoryInfo = allowOverride }, new TraceLogger(LogLevel.Debug)); //act List <ProjectInfo> infos = builder.GetInfos(new [] { file.FullName }).ToList(); //assert var scriptOne = infos.Single(); return(scriptOne); }
public void ProjectInfo_ProvidedOk() { //arrange ManifestBasedUriProvider uriProvider = new ManifestBasedUriProvider(new TraceLogger(LogLevel.Debug)); List <string> uris = uriProvider.GetUris(RepoRoot.FullName).ToList(); IProjectInfoBuilder builder = ProjectInfoBuilderFactory.Get(new TransmitterArguments() { TransmissionMode = TransmissionMode.LocalManifestBased }, new TraceLogger(LogLevel.Debug)); //act List <ProjectInfo> infos = builder.GetInfos(uris).ToList(); //assert Assert.AreEqual(2, infos.Count); var scriptOne = infos.Single(x => x.ProjectName == "ScriptOne"); var scriptTwo = infos.Single(x => x.ProjectName == "ScriptTwo"); //most properties are the same. Also, we care simply about whether the files exist ValidateProjectInfo(scriptOne, ".Script", ".Script", "I_AM_FAKE.Script"); ValidateProjectInfo(scriptTwo, ".scr", "CustomScript", "I_AM_FAKE_TOO.Script"); Assert.IsTrue(File.Exists(scriptTwo.DocumentationUri)); }