Beispiel #1
0
        public override async Task WriteFile(StepContext context, string path, Stream source)
        {
            //Client.Containers.ExtractArchiveToContainerAsync(ContainerID, new ContainerPathStatParameters { Path = path }, ...);

            using var tempFile = await DirectoryHelper.WriteStreamToTempFile(source);

            if (path.StartsWith("~"))
            {
                path = (await GetHomeDir()) + path.Substring(1);
            }

            InternalOutput.LogInformation("Writing file " + path);

            await ExecuteLocalCommand(new NodeCommand
            {
                FileName  = "docker",
                Arguments = new string[] { "cp", tempFile.FilePath, ContainerName + ":" + path },
                Output    = InternalOutput,
            }).CompletedTask;
        }
Beispiel #2
0
        public void run(params string[] args)
        {
            var options = new CommandLineOptionsWithLog(logText, logTableRequestResponse, args);

            // redirect java out to TextArea
            if (options.verboseLoggingEnabled())
            {
                var debug = new InternalOutput(logText);
                var print = new java.io.PrintStream(debug);
                java.lang.System.setOut(print);
            }

            var FILES_ROOT    = @"__files";
            var MAPPINGS_ROOT = @"mappings";
            var useFolder     = args.Contains("--root-dir");

            FileSource fileSource = options.filesRoot();

            if (useFolder)
            {
                fileSource.createIfNecessary();
            }

            FileSource filesFileSource = fileSource.child(FILES_ROOT);

            if (useFolder)
            {
                filesFileSource.createIfNecessary();
            }

            FileSource mappingsFileSource = fileSource.child(MAPPINGS_ROOT);

            if (useFolder)
            {
                mappingsFileSource.createIfNecessary();
            }

            try
            {
                wireMockServer = new com.github.tomakehurst.wiremock.WireMockServer(options);
                wireMockServer.addMockServiceRequestListener(new RequestAndResponseListener(logTableRequestResponse));

                if (options.recordMappingsEnabled())
                {
                    wireMockServer.enableRecordMappings(mappingsFileSource, filesFileSource);
                }

                if (options.specifiesProxyUrl())
                {
                    addProxyMapping(options.proxyUrl());
                }

                wireMockServer.start();
            }
            finally
            {
                var httpSettings = options.httpsSettings()?.ToString();
                logText.Info(Helper.ResolveBreakLineInCompatibility(options.ToString()), true, true);
                if (httpSettings != null && options.verboseLoggingEnabled())
                {
                    logText.Info(httpSettings, true, true);
                }
            }
        }