This is an automated email from the ASF dual-hosted git repository. dgrove pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-dotnet.git
The following commit(s) were added to refs/heads/master by this push: new 3aeba59 Drop support for dotnet3.1 (EOL) (#83) 3aeba59 is described below commit 3aeba59ed4d58f6b8a2505c4cdf65e3c1d030875 Author: David Grove <dgrove-...@users.noreply.github.com> AuthorDate: Fri Aug 30 14:45:50 2024 -0400 Drop support for dotnet3.1 (EOL) (#83) --- .github/workflows/ci.yaml | 6 +- README.md | 2 - core/dotnet3.1/CHANGELOG.md | 47 ---- core/dotnet3.1/Dockerfile | 42 ---- core/dotnet3.1/QUICKSTART.md | 238 ------------------ core/dotnet3.1/build.gradle | 20 -- .../Apache.OpenWhisk.Runtime.Common.csproj | 33 --- .../HttpResponseExtension.cs | 43 ---- .../proxy/Apache.OpenWhisk.Runtime.Common/Init.cs | 192 --------------- .../proxy/Apache.OpenWhisk.Runtime.Common/Run.cs | 130 ---------- .../Apache.OpenWhisk.Runtime.Common/Startup.cs | 70 ------ .../Apache.OpenWhisk.Runtime.Dotnet.Minimal.csproj | 28 --- .../Program.cs | 48 ---- core/dotnet3.1/proxy/build.gradle | 28 --- .../proxy/gradle/wrapper/gradle-wrapper.jar | Bin 54329 -> 0 bytes .../proxy/gradle/wrapper/gradle-wrapper.properties | 21 -- core/dotnet3.1/proxy/gradlew | 188 --------------- core/dotnet3.1/proxy/gradlew.bat | 100 -------- core/dotnet3.1/proxy/openwhisk-runtime-dotnet.sln | 39 --- core/net6.0/QUICKSTART.md | 2 +- settings.gradle | 4 - tests/build.gradle | 1 - .../Apache.OpenWhisk.Tests.Dotnet.csproj | 32 --- tests/dotnet3.1/build.gradle | 51 ---- tests/dotnet3.1/openwhisk-tests-dotnet.sln | 33 --- .../DotNet3_1ActionContainerTests.scala | 266 --------------------- .../DotNet3_1ActionContainerTests_2_2.scalaZ | 266 --------------------- tools/vagrant/README.md | 1 - 28 files changed, 2 insertions(+), 1929 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2ca90c6..7c62158 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -88,8 +88,6 @@ jobs: working-directory: runtime run: | SHORT_COMMIT=$(git rev-parse --short "$GITHUB_SHA") - ./gradlew :core:dotnet3.1:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=nightly - ./gradlew :core:dotnet3.1:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT ./gradlew :core:net6.0:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=nightly ./gradlew :core:net6.0:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT - name: Push Release Images @@ -98,9 +96,7 @@ jobs: run: | RUNTIME_VERSION=${GITHUB_REF_NAME%@*} IMAGE_TAG=${GITHUB_REF_NAME##*@} - if [ ${RUNTIME_VERSION} == "3.1" ]; then - RUNTIME="dotnet3.1" - elif [ ${RUNTIME_VERSION} == "6.0" ]; then + if [ ${RUNTIME_VERSION} == "6.0" ]; then RUNTIME="net6.0" fi ./gradlew :core:$RUNTIME:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$IMAGE_TAG diff --git a/README.md b/README.md index 2760967..a2661c2 100644 --- a/README.md +++ b/README.md @@ -124,12 +124,10 @@ namespace Apache.OpenWhisk.Tests.Dotnet ## Changelogs -- [.NET Core 3.1 CHANGELOG.md](core/dotnet3.1/CHANGELOG.md) - [.NET 6.0 CHANGELOG.md](core/net6.0/CHANGELOG.md) ## Quick Start Guides -- [.NET Core 3.1](core/dotnet3.1/QUICKSTART.md) - [.NET Core 6.0](core/net6.0/QUICKSTART.md) # License diff --git a/core/dotnet3.1/CHANGELOG.md b/core/dotnet3.1/CHANGELOG.md deleted file mode 100644 index f856950..0000000 --- a/core/dotnet3.1/CHANGELOG.md +++ /dev/null @@ -1,47 +0,0 @@ -<!-- -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ---> - -# .NET Core 3.1 OpenWhisk Runtime Container - -## 1.17 -- Support array result include sequence action (#65) - -## 1.16 -- Fix Akka version ($55) -- Init json quickstart updates (#50) -- Export init args to environment. (#44) -- Upgrade dotnet sdk packages (removed 2.2 references) (#42) - -## 1.15 -Changes: -- Increased MaxRequestBodySize, so larger zip files can be uploaded (#33) -- Get the latest security fixes (apk upgrade) with every build. - -## 1.14 -Changes: -- Initial release -- Support for async methods. Example: - -```csharp - public async Task<JObject> MainAsync(JObject args) - { - await Task.Delay(10); // Just do a delay to have an async/await process occur. - return (args); - } -``` diff --git a/core/dotnet3.1/Dockerfile b/core/dotnet3.1/Dockerfile deleted file mode 100644 index f636628..0000000 --- a/core/dotnet3.1/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build - -WORKDIR /app -COPY proxy/Apache.OpenWhisk.Runtime.Common/*.csproj ./Apache.OpenWhisk.Runtime.Common/ -COPY proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/*.csproj ./Apache.OpenWhisk.Runtime.Dotnet.Minimal/ -COPY proxy/openwhisk-runtime-dotnet.sln ./openwhisk-runtime-dotnet.sln -RUN dotnet restore - -COPY proxy/Apache.OpenWhisk.Runtime.Common/. ./Apache.OpenWhisk.Runtime.Common/ -COPY proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/. ./Apache.OpenWhisk.Runtime.Dotnet.Minimal/ -WORKDIR /app/Apache.OpenWhisk.Runtime.Dotnet.Minimal -RUN dotnet publish -c Release -r linux-musl-x64 -o out - -FROM mcr.microsoft.com/dotnet/core/runtime:3.1-alpine AS runtime - -# Get the latest security fixes in case the base image does not contain them already. -RUN apk update \ - && apk upgrade \ - && rm -f /var/cache/apk/* - -WORKDIR /app -COPY --from=build /app/Apache.OpenWhisk.Runtime.Dotnet.Minimal/out ./ -ENV ASPNETCORE_URLS http://+:8080 -EXPOSE 8080/tcp -ENTRYPOINT ["dotnet", "Apache.OpenWhisk.Runtime.Dotnet.Minimal.dll"] diff --git a/core/dotnet3.1/QUICKSTART.md b/core/dotnet3.1/QUICKSTART.md deleted file mode 100644 index 02cbfda..0000000 --- a/core/dotnet3.1/QUICKSTART.md +++ /dev/null @@ -1,238 +0,0 @@ -<!-- -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ---> - -# Quick .NET Core 3.1 Action - -A .NET Core action is a .NET Core class library with a method called `Main` or `MainAsync` that has the exact signature as follows: - -Synchronous: - -```csharp -public Newtonsoft.Json.Linq.JObject Main(Newtonsoft.Json.Linq.JObject); -``` - -Asynchronous: - -```csharp -public async System.Threading.Tasks.Task<Newtonsoft.Json.Linq.JObject> MainAsync(Newtonsoft.Json.Linq.JObject); -``` - -In order to compile, test and archive .NET Core projects, you must have the [.NET Core SDK](https://www.microsoft.com/net/download) installed locally and the environment variable `DOTNET_HOME` set to the location where the `dotnet` executable can be found. - -For example, create a C# project called `Apache.OpenWhisk.Example.Dotnet`: - -```bash -dotnet new classlib -n Apache.OpenWhisk.Example.Dotnet -lang C# -f netstandard2.1 -cd Apache.OpenWhisk.Example.Dotnet -``` - -Install the [Newtonsoft.Json](https://www.newtonsoft.com/json) NuGet package as follows: - -```bash -dotnet add package Newtonsoft.Json -v 13.0.1 -``` - -Now create a file called `Hello.cs` with the following content: - -Synchronous example: - -```csharp -using System; -using Newtonsoft.Json.Linq; - -namespace Apache.OpenWhisk.Example.Dotnet -{ - public class Hello - { - public JObject Main(JObject args) - { - string name = "stranger"; - if (args.ContainsKey("name")) { - name = args["name"].ToString(); - } - JObject message = new JObject(); - message.Add("greeting", new JValue($"Hello, {name}!")); - return (message); - } - } -} -``` - -Asynchronous example: - -```csharp -using System; -using Newtonsoft.Json.Linq; -using System.Threading.Tasks; - -namespace Apache.OpenWhisk.Example.Dotnet -{ - public class Hello - { - public async Task<JObject> MainAsync(JObject args) - { - await Task.Delay(10); // Just do a delay to have an async/await process occur. - string name = "stranger"; - if (args.ContainsKey("name")) { - name = args["name"].ToString(); - } - JObject message = new JObject(); - message.Add("greeting", new JValue($"Hello, {name}!")); - return (message); - } - } -} -``` - -Publish the project as follows: - -```bash -dotnet publish -c Release -o out -``` - -Zip the published files as follows: - -```bash -cd out -zip -r -0 helloDotNet.zip * -``` - -You need to specify the name of the function handler using `--main` argument. -The value for `main` needs to be in the following format: -`{Assembly}::{Class Full Name}::{Method}`, e.q.: - -+ Synchronous: `Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::Main` -+ Asynchronous: `Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::MainAsync` - -## Create the .NET Core Action - -To use on a deployment of OpenWhisk that contains the runtime as a kind: - -Synchronous: - -```bash -wsk action update helloDotNet helloDotNet.zip --main Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::Main --kind dotnet:3.1 -``` - -Asynchronous: - -```bash -wsk action update helloDotNet helloDotNet.zip --main Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::MainAsync --kind dotnet:3.1 -``` - -## Invoke the .NET Core Action - -Action invocation is the same for .NET Core actions as it is for Swift and JavaScript actions: - -```bash -wsk action invoke --result helloDotNet --param name World -``` - -```json - { - "greeting": "Hello World!" - } -``` - -## Local Development - -```bash -./gradlew core:dotnet3.1:distDocker -``` - -This will produce the image `whisk/action-dotnet-v3.1` - -Build and Push image - -```bash -docker login -./gradlew core:action-dotnet-v3.1:distDocker -PdockerImagePrefix=$prefix-user -PdockerRegistry=docker.io -``` - -Deploy OpenWhisk using ansible environment that contains the kind `dotnet:3.1` -Assuming you have OpenWhisk already deploy locally and `OPENWHISK_HOME` pointing to root directory of OpenWhisk core repository. - -Set `ROOTDIR` to the root directory of this repository. - -Redeploy OpenWhisk - -```bash -cd $OPENWHISK_HOME/ansible -ANSIBLE_CMD="ansible-playbook -i ${ROOTDIR}/ansible/environments/local" -$ANSIBLE_CMD setup.yml -$ANSIBLE_CMD couchdb.yml -$ANSIBLE_CMD initdb.yml -$ANSIBLE_CMD wipe.yml -$ANSIBLE_CMD openwhisk.yml -``` - -Or you can use `wskdev` and create a soft link to the target ansible environment, for example: - -```bash -ln -s ${ROOTDIR}/ansible/environments/local ${OPENWHISK_HOME}/ansible/environments/local-dotnet -wskdev fresh -t local-dotnet -``` - -### Testing - -Install dependencies from the root directory on $OPENWHISK_HOME repository - -```bash -pushd $OPENWHISK_HOME -./gradlew install -popd -``` - -Using gradle to run all tests - -```bash -./gradlew :tests:test -``` - -Using gradle to run some tests - -```bash -./gradlew :tests:test --tests DotNet3_1ActionContainerTests -``` - -Using IntelliJ: - -- Import project as gradle project. -- Make sure working directory is root of the project/repo - -#### Using Container Image To Test - -To use as docker action push to your own dockerhub account - -```bash -docker tag whisk/action-dotnet-v3.1 $user_prefix/action-dotnet-v3.1 -docker push $user_prefix/action-dotnet-v3.1 -``` - -Then create the action using your the image from dockerhub - -```bash -wsk action update helloDotNet helloDotNet.zip --main Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::Main --docker $user_prefix/action-dotnet-v3.1 -``` - -The `$user_prefix` is usually your dockerhub user id. - -# License - -[Apache 2.0](../../LICENSE.txt) diff --git a/core/dotnet3.1/build.gradle b/core/dotnet3.1/build.gradle deleted file mode 100644 index 48d3de4..0000000 --- a/core/dotnet3.1/build.gradle +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -ext.dockerImageName = 'action-dotnet-v3.1' - -apply from: '../../gradle/docker.gradle' diff --git a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/Apache.OpenWhisk.Runtime.Common.csproj b/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/Apache.OpenWhisk.Runtime.Common.csproj deleted file mode 100644 index 719d367..0000000 --- a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/Apache.OpenWhisk.Runtime.Common.csproj +++ /dev/null @@ -1,33 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <TargetFramework>netcoreapp3.1</TargetFramework> - </PropertyGroup> - - <ItemGroup> - <FrameworkReference Include="Microsoft.AspNetCore.App" /> - </ItemGroup> - - <ItemGroup> - <PackageReference Include="Newtonsoft.Json"> - <Version>13.0.1</Version> - </PackageReference> - </ItemGroup> - -</Project> diff --git a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/HttpResponseExtension.cs b/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/HttpResponseExtension.cs deleted file mode 100644 index 4f63bd0..0000000 --- a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/HttpResponseExtension.cs +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace Apache.OpenWhisk.Runtime.Common -{ - public static class HttpResponseExtension - { - public static async Task WriteResponse(this HttpResponse response, int code, string content) - { - byte[] bytes = Encoding.UTF8.GetBytes(content); - response.ContentLength = bytes.Length; - response.StatusCode = code; - await response.WriteAsync(content); - } - - public static async Task WriteError(this HttpResponse response, string errorMessage) - { - JObject message = new JObject {{"error", new JValue(errorMessage)}}; - await WriteResponse(response, 502, JsonConvert.SerializeObject(message)); - } - - } -} diff --git a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/Init.cs b/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/Init.cs deleted file mode 100644 index 0a1a054..0000000 --- a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/Init.cs +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.IO; -using System.IO.Compression; -using System.Reflection; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Microsoft.AspNetCore.Http; -using Newtonsoft.Json.Linq; - -namespace Apache.OpenWhisk.Runtime.Common -{ - public class Init - { - private readonly SemaphoreSlim _initSemaphoreSlim = new SemaphoreSlim(1, 1); - - public bool Initialized { get; private set; } - private Type Type { get; set; } - private MethodInfo Method { get; set; } - private ConstructorInfo Constructor { get; set; } - private bool AwaitableMethod { get; set; } - - public Init() - { - Initialized = false; - Type = null; - Method = null; - Constructor = null; - } - - public async Task<Run> HandleRequest(HttpContext httpContext) - { - await _initSemaphoreSlim.WaitAsync(); - try - { - if (Initialized) - { - await httpContext.Response.WriteError("Cannot initialize the action more than once."); - Console.Error.WriteLine("Cannot initialize the action more than once."); - return (new Run(Type, Method, Constructor, AwaitableMethod)); - } - - string body = await new StreamReader(httpContext.Request.Body).ReadToEndAsync(); - JObject inputObject = JObject.Parse(body); - if (!inputObject.ContainsKey("value")) - { - await httpContext.Response.WriteError("Missing main/no code to execute."); - return (null); - } - - JToken message = inputObject["value"]; - - if (message["main"] == null || message["binary"] == null || message["code"] == null) - { - await httpContext.Response.WriteError("Missing main/no code to execute."); - return (null); - } - - string main = message["main"].ToString(); - - bool binary = message["binary"].ToObject<bool>(); - - if (!binary) - { - await httpContext.Response.WriteError("code must be binary (zip file)."); - return (null); - } - - string[] mainParts = main.Split("::"); - if (mainParts.Length != 3) - { - await httpContext.Response.WriteError("main required format is \"Assembly::Type::Function\"."); - return (null); - } - - string tempPath = Path.Combine(Environment.CurrentDirectory, Guid.NewGuid().ToString()); - string base64Zip = message["code"].ToString(); - try - { - using (MemoryStream stream = new MemoryStream(Convert.FromBase64String(base64Zip))) - { - using (ZipArchive archive = new ZipArchive(stream)) - { - archive.ExtractToDirectory(tempPath); - } - } - } - catch (Exception) - { - await httpContext.Response.WriteError("Unable to decompress package."); - return (null); - } - - Environment.CurrentDirectory = tempPath; - - string assemblyFile = $"{mainParts[0]}.dll"; - - string assemblyPath = Path.Combine(tempPath, assemblyFile); - - if (!File.Exists(assemblyPath)) - { - await httpContext.Response.WriteError($"Unable to locate requested assembly (\"{assemblyFile}\")."); - return (null); - } - - try - { - // Export init arguments as environment variables - if (message["env"] != null && message["env"].HasValues) - { - Dictionary<string, string> dictEnv = message["env"].ToObject<Dictionary<string, string>>(); - foreach (KeyValuePair<string, string> entry in dictEnv) { - // See https://docs.microsoft.com/en-us/dotnet/api/system.environment.setenvironmentvariable - // If entry.Value is null or the empty string, the variable is not set - Environment.SetEnvironmentVariable(entry.Key, entry.Value); - } - } - - Assembly assembly = Assembly.LoadFrom(assemblyPath); - Type = assembly.GetType(mainParts[1]); - if (Type == null) - { - await httpContext.Response.WriteError($"Unable to locate requested type (\"{mainParts[1]}\")."); - return (null); - } - Method = Type.GetMethod(mainParts[2]); - Constructor = Type.GetConstructor(Type.EmptyTypes); - } - catch (Exception ex) - { - Console.Error.WriteLine(ex.ToString()); - await httpContext.Response.WriteError(ex.Message -#if DEBUG - + ", " + ex.StackTrace -#endif - ); - return (null); - } - - if (Method == null) - { - await httpContext.Response.WriteError($"Unable to locate requested method (\"{mainParts[2]}\")."); - return (null); - } - - if (Constructor == null) - { - await httpContext.Response.WriteError($"Unable to locate appropriate constructor for (\"{mainParts[1]}\")."); - return (null); - } - - Initialized = true; - - AwaitableMethod = (Method.ReturnType.GetMethod(nameof(Task.GetAwaiter)) != null); - - return (new Run(Type, Method, Constructor, AwaitableMethod)); - } - catch (Exception ex) - { - Console.Error.WriteLine(ex.StackTrace); - await httpContext.Response.WriteError(ex.Message -#if DEBUG - + ", " + ex.StackTrace -#endif - ); - Startup.WriteLogMarkers(); - return (null); - } - finally - { - _initSemaphoreSlim.Release(); - } - } - } -} diff --git a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/Run.cs b/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/Run.cs deleted file mode 100644 index 0ee99ce..0000000 --- a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/Run.cs +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.IO; -using System.Reflection; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; -using Newtonsoft.Json.Linq; - -namespace Apache.OpenWhisk.Runtime.Common -{ - public class Run - { - private readonly Type _type; - private readonly MethodInfo _method; - private readonly ConstructorInfo _constructor; - private readonly bool _awaitableMethod; - - public Run(Type type, MethodInfo method, ConstructorInfo constructor, bool awaitableMethod) - { - _type = type; - _method = method; - _constructor = constructor; - _awaitableMethod = awaitableMethod; - } - - public async Task HandleRequest(HttpContext httpContext) - { - if (_type == null || _method == null || _constructor == null) - { - await httpContext.Response.WriteError("Cannot invoke an uninitialized action."); - return; - } - - try - { - string body = await new StreamReader(httpContext.Request.Body).ReadToEndAsync(); - - JObject inputObject = string.IsNullOrEmpty(body) ? null : JObject.Parse(body); - - JObject valObject = null; - JArray valArray = null; - - if (inputObject != null) - { - valObject = inputObject["value"] as JObject; - foreach (JToken token in inputObject.Children()) - { - try - { - if (token.Path.Equals("value", StringComparison.InvariantCultureIgnoreCase)) - continue; - string envKey = $"__OW_{token.Path.ToUpperInvariant()}"; - string envVal = token.First.ToString(); - Environment.SetEnvironmentVariable(envKey, envVal); - //Console.WriteLine($"Set environment variable \"{envKey}\" to \"{envVal}\"."); - } - catch (Exception) - { - await Console.Error.WriteLineAsync( - $"Unable to set environment variable for the \"{token.Path}\" token."); - } - } - if (valObject == null) { - valArray = inputObject["value"] as JArray; - } - } - - object owObject = _constructor.Invoke(new object[] { }); - - try - { - JContainer output; - - if(_awaitableMethod) { - if (valObject != null) { - output = (JContainer) await (dynamic) _method.Invoke(owObject, new object[] {valObject}); - } else { - output = (JContainer) await (dynamic) _method.Invoke(owObject, new object[] {valArray}); - } - } - else { - if (valObject != null) { - output = (JContainer) _method.Invoke(owObject, new object[] {valObject}); - } else { - output = (JContainer) _method.Invoke(owObject, new object[] {valArray}); - } - } - - if (output == null) - { - await httpContext.Response.WriteError("The action returned null"); - Console.Error.WriteLine("The action returned null"); - return; - } - - await httpContext.Response.WriteResponse(200, output.ToString()); - } - catch (Exception ex) - { - Console.Error.WriteLine(ex.StackTrace); - await httpContext.Response.WriteError(ex.Message -#if DEBUG - + ", " + ex.StackTrace -#endif - ); - } - } - finally - { - Startup.WriteLogMarkers(); - } - } - } -} diff --git a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/Startup.cs b/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/Startup.cs deleted file mode 100644 index 9851e54..0000000 --- a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Common/Startup.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; - -namespace Apache.OpenWhisk.Runtime.Common -{ - public class Startup - { - public static void WriteLogMarkers() - { - Console.WriteLine("XXX_THE_END_OF_A_WHISK_ACTIVATION_XXX"); - Console.Error.WriteLine("XXX_THE_END_OF_A_WHISK_ACTIVATION_XXX"); - } - - public void Configure(IApplicationBuilder app) - { - PathString initPath = new PathString("/init"); - PathString runPath = new PathString("/run"); - Init init = new Init(); - Run run = null; - app.Run(async (httpContext) => - { - if (httpContext.Request.Path.Equals(initPath)) - { - run = await init.HandleRequest(httpContext); - - if (run != null) - await httpContext.Response.WriteResponse(200, "OK"); - - return; - } - - if (httpContext.Request.Path.Equals(runPath)) - { - if (!init.Initialized) - { - await httpContext.Response.WriteError("Cannot invoke an uninitialized action."); - return; - } - - if (run == null) - { - await httpContext.Response.WriteError("Cannot invoke an uninitialized action."); - return; - } - - await run.HandleRequest(httpContext); - } - } - ); - } - } -} diff --git a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Apache.OpenWhisk.Runtime.Dotnet.Minimal.csproj b/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Apache.OpenWhisk.Runtime.Dotnet.Minimal.csproj deleted file mode 100644 index ce6efa6..0000000 --- a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Apache.OpenWhisk.Runtime.Dotnet.Minimal.csproj +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <OutputType>Exe</OutputType> - <TargetFramework>netcoreapp3.1</TargetFramework> - </PropertyGroup> - - <ItemGroup> - <ProjectReference Include="..\Apache.OpenWhisk.Runtime.Common\Apache.OpenWhisk.Runtime.Common.csproj" /> - </ItemGroup> - -</Project> diff --git a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Program.cs b/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Program.cs deleted file mode 100644 index 6d3c1d0..0000000 --- a/core/dotnet3.1/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Program.cs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using Apache.OpenWhisk.Runtime.Common; -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Logging; - -namespace Apache.OpenWhisk.Runtime.Dotnet.Minimal -{ - class Program - { - static void Main(string[] args) - { - CreateWebHostBuilder(args).Build().Run(); - } - - public static IWebHostBuilder CreateWebHostBuilder(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseKestrel(options => - { - options.Limits.MaxRequestBodySize = null; - }) - .ConfigureLogging((hostingContext, logging) => - { - logging.ClearProviders(); - }) - .SuppressStatusMessages(true) - .UseStartup<Startup>(); - - } -} - diff --git a/core/dotnet3.1/proxy/build.gradle b/core/dotnet3.1/proxy/build.gradle deleted file mode 100644 index 6a5d94e..0000000 --- a/core/dotnet3.1/proxy/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id "net.karlmartens.dotnet" version "0.2.20" -} - -repositories { - mavenCentral() -} - -dotnet { - configuration 'Release' -} diff --git a/core/dotnet3.1/proxy/gradle/wrapper/gradle-wrapper.jar b/core/dotnet3.1/proxy/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index f6b961f..0000000 Binary files a/core/dotnet3.1/proxy/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/core/dotnet3.1/proxy/gradle/wrapper/gradle-wrapper.properties b/core/dotnet3.1/proxy/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index d475d27..0000000 --- a/core/dotnet3.1/proxy/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip diff --git a/core/dotnet3.1/proxy/gradlew b/core/dotnet3.1/proxy/gradlew deleted file mode 100644 index d4ee78f..0000000 --- a/core/dotnet3.1/proxy/gradlew +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/core/dotnet3.1/proxy/gradlew.bat b/core/dotnet3.1/proxy/gradlew.bat deleted file mode 100644 index 9991c50..0000000 --- a/core/dotnet3.1/proxy/gradlew.bat +++ /dev/null @@ -1,100 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/core/dotnet3.1/proxy/openwhisk-runtime-dotnet.sln b/core/dotnet3.1/proxy/openwhisk-runtime-dotnet.sln deleted file mode 100644 index 25e60cc..0000000 --- a/core/dotnet3.1/proxy/openwhisk-runtime-dotnet.sln +++ /dev/null @@ -1,39 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 - -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.OpenWhisk.Runtime.Dotnet.Minimal", "Apache.OpenWhisk.Runtime.Dotnet.Minimal\Apache.OpenWhisk.Runtime.Dotnet.Minimal.csproj", "{F76F51C9-EB3B-4D4C-89C0-A71E0BEF88DC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.OpenWhisk.Runtime.Common", "Apache.OpenWhisk.Runtime.Common\Apache.OpenWhisk.Runtime.Common.csproj", "{26ADD70B-3101-4943-982C-16D380D4B044}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F76F51C9-EB3B-4D4C-89C0-A71E0BEF88DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F76F51C9-EB3B-4D4C-89C0-A71E0BEF88DC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F76F51C9-EB3B-4D4C-89C0-A71E0BEF88DC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F76F51C9-EB3B-4D4C-89C0-A71E0BEF88DC}.Release|Any CPU.Build.0 = Release|Any CPU - {26ADD70B-3101-4943-982C-16D380D4B044}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {26ADD70B-3101-4943-982C-16D380D4B044}.Debug|Any CPU.Build.0 = Debug|Any CPU - {26ADD70B-3101-4943-982C-16D380D4B044}.Release|Any CPU.ActiveCfg = Release|Any CPU - {26ADD70B-3101-4943-982C-16D380D4B044}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/core/net6.0/QUICKSTART.md b/core/net6.0/QUICKSTART.md index f596a3f..1e62f29 100644 --- a/core/net6.0/QUICKSTART.md +++ b/core/net6.0/QUICKSTART.md @@ -153,7 +153,7 @@ wsk action invoke --result helloDotNet --param name World ## Local Development ```bash -./gradlew core:dotnet3.1:distDocker +./gradlew core:net6.0:distDocker ``` This will produce the image `whisk/action-dotnet-v6.0` diff --git a/settings.gradle b/settings.gradle index 0515e6e..9fb37cf 100644 --- a/settings.gradle +++ b/settings.gradle @@ -16,12 +16,8 @@ */ include ':tests' -include ':tests:dotnet3.1' include ':tests:net6.0' -include ':core:dotnet3.1' -include ':core:dotnet3.1:proxy' - include ':core:net6.0' include ':core:net6.0:proxy' diff --git a/tests/build.gradle b/tests/build.gradle index d846cac..e6726fd 100644 --- a/tests/build.gradle +++ b/tests/build.gradle @@ -52,6 +52,5 @@ tasks.withType(ScalaCompile) { } compileTestScala { - dependsOn ':tests:dotnet3.1:prepare' dependsOn ':tests:net6.0:prepare' } diff --git a/tests/dotnet3.1/Apache.OpenWhisk.Tests.Dotnet/Apache.OpenWhisk.Tests.Dotnet.csproj b/tests/dotnet3.1/Apache.OpenWhisk.Tests.Dotnet/Apache.OpenWhisk.Tests.Dotnet.csproj deleted file mode 100644 index 757d77a..0000000 --- a/tests/dotnet3.1/Apache.OpenWhisk.Tests.Dotnet/Apache.OpenWhisk.Tests.Dotnet.csproj +++ /dev/null @@ -1,32 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <TargetFramework>netstandard2.1</TargetFramework> - </PropertyGroup> - - <ItemGroup> - <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> - </ItemGroup> - - <ItemGroup> - <Compile Include="..\..\dotnetshared\*.cs"> - </Compile> - </ItemGroup> - -</Project> diff --git a/tests/dotnet3.1/build.gradle b/tests/dotnet3.1/build.gradle deleted file mode 100644 index c23a22c..0000000 --- a/tests/dotnet3.1/build.gradle +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id "net.karlmartens.dotnet" version "0.2.20" -} - -repositories { - mavenCentral() -} - -dotnet { - configuration 'Release' -} - -task prepare_distro(dependsOn: distribution) { - doLast { - copy { - from tarTree(resources.gzip(file('build/dist/netstandard2.1.tar.gz'))) - into file('build/dist/out') - } - delete file('build/dist/netstandard2.1.tar.gz') - } -} - -task prepare_zip(type: Zip, dependsOn: prepare_distro) { - from file('build/dist/out') - include '*' - include '**/**' - archiveName 'dotnettests3.1.zip' - destinationDir(file('../src/test/resources')) -} - -task prepare(type: Delete, dependsOn: prepare_zip) { - delete getProject().getBuildDir().toPath().toFile() - followSymlinks = true -} diff --git a/tests/dotnet3.1/openwhisk-tests-dotnet.sln b/tests/dotnet3.1/openwhisk-tests-dotnet.sln deleted file mode 100644 index 0f4ec0d..0000000 --- a/tests/dotnet3.1/openwhisk-tests-dotnet.sln +++ /dev/null @@ -1,33 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 - -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.OpenWhisk.Tests.Dotnet", "Apache.OpenWhisk.Tests.Dotnet\Apache.OpenWhisk.Tests.Dotnet.csproj", "{4DA37A8E-7505-4C51-8C75-B18BDA45392C}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4DA37A8E-7505-4C51-8C75-B18BDA45392C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4DA37A8E-7505-4C51-8C75-B18BDA45392C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4DA37A8E-7505-4C51-8C75-B18BDA45392C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4DA37A8E-7505-4C51-8C75-B18BDA45392C}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/tests/src/test/scala/actionContainers/DotNet3_1ActionContainerTests.scala b/tests/src/test/scala/actionContainers/DotNet3_1ActionContainerTests.scala deleted file mode 100644 index dc9ee90..0000000 --- a/tests/src/test/scala/actionContainers/DotNet3_1ActionContainerTests.scala +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package actionContainers - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner -import common.WskActorSystem -import spray.json._ -import actionContainers.ActionContainer.withContainer -import java.nio.file.Paths - -@RunWith(classOf[JUnitRunner]) -class DotNet3_1ActionContainerTests extends BasicActionRunnerTests with WskActorSystem { - val functionb64 = ResourceHelpers.readAsBase64(Paths.get(getClass.getResource("/dotnettests3.1.zip").getPath)) - - // Helpers specific to java actions - override def withActionContainer(env: Map[String, String] = Map.empty)( - code: ActionContainer => Unit): (String, String) = withContainer("action-dotnet-v3.1", env)(code) - - behavior of "dotnet action" - - override val testNoSourceOrExec = { - TestConfig("") - } - - override val testNotReturningJson = { - // skip this test since and add own below (see Nuller) - TestConfig("", skipTest = true) - } - - override val testEnv = { - TestConfig(functionb64, main = "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Environment::Main") - } - - override val testEnvParameters = { - TestConfig(functionb64, main = "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Init::Main") - } - - override val testEcho = { - TestConfig(functionb64, main = "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.AltEcho::Main") - } - - val testEchoNoWrite = { - TestConfig(functionb64, main = "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Echo::MainAsync") - } - - override val testUnicode = { - TestConfig(functionb64, main = "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Unicode::Main") - } - - override val testInitCannotBeCalledMoreThanOnce = testEchoNoWrite - - override val testEntryPointOtherThanMain = testEchoNoWrite - - override val testLargeInput = testEchoNoWrite - - it should "fail to initialize with bad archive" in { - val (out, err) = withActionContainer() { c => - val brokenArchive = ("NOTAVALIDZIPFILE") - - val (initCode, initRes) = - c.init(initPayload(brokenArchive, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Invalid::Main")) - initCode should not be (200) - - initRes shouldBe defined - - initRes should { - be(Some(JsObject("error" -> JsString("Unable to decompress package.")))) - } - } - } - - it should "return some error on action error" in { - val (out, err) = withActionContainer() { c => - val (initCode, _) = - c.init(initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Exception::Main")) - initCode should be(200) - - val (runCode, runRes) = c.run(runPayload(JsObject.empty)) - runCode should not be (200) - - runRes shouldBe defined - runRes.get.fields.get("error") shouldBe defined - } - - checkStreams(out, err, { - case (o, e) => - (o + e).toLowerCase should include("exception") - }) - } - - it should "support a large payload" in { - val (out, err) = withActionContainer() { c => - val payload = functionb64 + (" " * 18000000) - val (initCode, _) = - c.init(initPayload(payload, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Error::Main")) - initCode should be(200) - } - } - - it should "support application errors" in { - val (out, err) = withActionContainer() { c => - val (initCode, _) = - c.init(initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Error::Main")) - initCode should be(200) - - val (runCode, runRes) = c.run(runPayload(JsObject.empty)) - runCode should be(200) - - runRes shouldBe defined - - runRes should { - be(Some(JsObject("error" -> JsString(".NETCoreApp,Version=v3.1")))) - } - } - - checkStreams(out, err, { - case (o, e) => - o shouldBe empty - e shouldBe empty - }) - } - - it should "fails on invalid assembly reference" in { - val (out, err) = withActionContainer() { c => - val (initCode, initRes) = c.init( - initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet.DoesntExist::Apache.OpenWhisk.Tests.Dotnet.Echo::Main")) - initCode should be(502) - - initRes shouldBe defined - - initRes should { - be( - Some(JsObject("error" -> JsString( - "Unable to locate requested assembly (\"Apache.OpenWhisk.Tests.Dotnet.DoesntExist.dll\").")))) - } - } - } - - it should "fails on invalid type reference" in { - val (out, err) = withActionContainer() { c => - val (initCode, initRes) = - c.init(initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.FakeType::Main")) - initCode should be(502) - - initRes should { - be( - Some(JsObject( - "error" -> JsString("Unable to locate requested type (\"Apache.OpenWhisk.Tests.Dotnet.FakeType\").")))) - } - } - } - - it should "fails on invalid method reference" in { - val (out, err) = withActionContainer() { c => - val (initCode, initRes) = c.init( - initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Echo::FakeMethod")) - initCode should be(502) - - initRes should { - be(Some(JsObject("error" -> JsString("Unable to locate requested method (\"FakeMethod\").")))) - } - } - } - - it should "fails on type with no empty constructor" in { - val (out, err) = withActionContainer() { c => - val (initCode, initRes) = c.init( - initPayload( - functionb64, - "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.NonEmptyConstructor::Main")) - initCode should be(502) - - initRes should { - be( - Some(JsObject("error" -> JsString( - "Unable to locate appropriate constructor for (\"Apache.OpenWhisk.Tests.Dotnet.NonEmptyConstructor\").")))) - } - } - } - - it should "validate main string format 1" in { - val (out, err) = withActionContainer() { c => - val (initCode, initRes) = c.init(initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet")) - initCode should not be (200) - - initRes should { - be(Some(JsObject("error" -> JsString("main required format is \"Assembly::Type::Function\".")))) - } - } - } - - it should "validate main string format 2" in { - val (out, err) = withActionContainer() { c => - val (initCode, initRes) = - c.init(initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Echo")) - initCode should not be (200) - - initRes should { - be(Some(JsObject("error" -> JsString("main required format is \"Assembly::Type::Function\".")))) - } - } - } - - it should "enforce that the user returns an object" in { - val (out, err) = withActionContainer() { c => - val (initCode, _) = - c.init(initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Nuller::Main")) - initCode should be(200) - - val (runCode, runRes) = c.run(runPayload(JsObject.empty)) - runCode should not be (200) - - runRes shouldBe defined - runRes.get.fields.get("error") shouldBe defined - } - - checkStreams(out, err, { - case (o, e) => - (o + e).toLowerCase should include("the action returned null") - }) - } - - it should "support return array result" in { - val (out, err) = withActionContainer() { c => - val (initCode, _) = - c.init( - initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.HelloArray::Main")) - initCode should be(200) - - val (runCode, runRes) = c.runForJsArray(runPayload(JsObject())) - runCode should be(200) - runRes shouldBe Some(JsArray(JsString("a"), JsString("b"))) - } - } - - it should "support array as input param" in { - val (out, err) = withActionContainer() { c => - val (initCode, _) = - c.init( - initPayload( - functionb64, - "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.HelloPassArrayParam::Main")) - initCode should be(200) - - val (runCode, runRes) = c.runForJsArray(runPayload(JsArray(JsString("a"), JsString("b")))) - runCode should be(200) - runRes shouldBe Some(JsArray(JsString("a"), JsString("b"))) - } - } -} diff --git a/tests/src/test/scala/actionContainers/DotNet3_1ActionContainerTests_2_2.scalaZ b/tests/src/test/scala/actionContainers/DotNet3_1ActionContainerTests_2_2.scalaZ deleted file mode 100644 index b3c9a99..0000000 --- a/tests/src/test/scala/actionContainers/DotNet3_1ActionContainerTests_2_2.scalaZ +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package actionContainers - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner -import common.WskActorSystem -import spray.json._ -import actionContainers.ActionContainer.withContainer -import java.nio.file.Paths - -@RunWith(classOf[JUnitRunner]) -class DotNet3_1ActionContainerTests_2_2 extends BasicActionRunnerTests with WskActorSystem { - val functionb64 = ResourceHelpers.readAsBase64(Paths.get(getClass.getResource("/dotnettests2.2.zip").getPath)) - - // Helpers specific to java actions - override def withActionContainer(env: Map[String, String] = Map.empty)( - code: ActionContainer => Unit): (String, String) = withContainer("action-dotnet-v3.1", env)(code) - - behavior of "dotnet action" - - override val testNoSourceOrExec = { - TestConfig("") - } - - override val testNotReturningJson = { - // skip this test since and add own below (see Nuller) - TestConfig("", skipTest = true) - } - - override val testEnv = { - TestConfig(functionb64, main = "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Environment::Main") - } - - override val testEcho = { - TestConfig(functionb64, main = "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.AltEcho::Main") - } - - override val testEnvParameters = { - TestConfig(functionb64, main = "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Init::Main") - } - - val testEchoNoWrite = { - TestConfig(functionb64, main = "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Echo::MainAsync") - } - - override val testUnicode = { - TestConfig(functionb64, main = "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Unicode::Main") - } - - override val testInitCannotBeCalledMoreThanOnce = testEchoNoWrite - - override val testEntryPointOtherThanMain = testEchoNoWrite - - override val testLargeInput = testEchoNoWrite - - it should "fail to initialize with bad archive" in { - val (out, err) = withActionContainer() { c => - val brokenArchive = ("NOTAVALIDZIPFILE") - - val (initCode, initRes) = - c.init(initPayload(brokenArchive, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Invalid::Main")) - initCode should not be (200) - - initRes shouldBe defined - - initRes should { - be(Some(JsObject("error" -> JsString("Unable to decompress package.")))) - } - } - } - - it should "return some error on action error" in { - val (out, err) = withActionContainer() { c => - val (initCode, _) = - c.init(initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Exception::Main")) - initCode should be(200) - - val (runCode, runRes) = c.run(runPayload(JsObject.empty)) - runCode should not be (200) - - runRes shouldBe defined - runRes.get.fields.get("error") shouldBe defined - } - - checkStreams(out, err, { - case (o, e) => - (o + e).toLowerCase should include("exception") - }) - } - - it should "support a large payload" in { - val (out, err) = withActionContainer() { c => - val payload = functionb64 + (" " * 18000000) - val (initCode, _) = - c.init(initPayload(payload, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Error::Main")) - initCode should be(200) - } - } - - it should "support application errors" in { - val (out, err) = withActionContainer() { c => - val (initCode, _) = - c.init(initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Error::Main")) - initCode should be(200) - - val (runCode, runRes) = c.run(runPayload(JsObject.empty)) - runCode should be(200) - - runRes shouldBe defined - - runRes should { - be(Some(JsObject("error" -> JsString(".NETCoreApp,Version=v3.1")))) - } - } - - checkStreams(out, err, { - case (o, e) => - o shouldBe empty - e shouldBe empty - }) - } - - it should "fails on invalid assembly reference" in { - val (out, err) = withActionContainer() { c => - val (initCode, initRes) = c.init( - initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet.DoesntExist::Apache.OpenWhisk.Tests.Dotnet.Echo::Main")) - initCode should be(502) - - initRes shouldBe defined - - initRes should { - be( - Some(JsObject("error" -> JsString( - "Unable to locate requested assembly (\"Apache.OpenWhisk.Tests.Dotnet.DoesntExist.dll\").")))) - } - } - } - - it should "fails on invalid type reference" in { - val (out, err) = withActionContainer() { c => - val (initCode, initRes) = - c.init(initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.FakeType::Main")) - initCode should be(502) - - initRes should { - be( - Some(JsObject( - "error" -> JsString("Unable to locate requested type (\"Apache.OpenWhisk.Tests.Dotnet.FakeType\").")))) - } - } - } - - it should "fails on invalid method reference" in { - val (out, err) = withActionContainer() { c => - val (initCode, initRes) = c.init( - initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Echo::FakeMethod")) - initCode should be(502) - - initRes should { - be(Some(JsObject("error" -> JsString("Unable to locate requested method (\"FakeMethod\").")))) - } - } - } - - it should "fails on type with no empty constructor" in { - val (out, err) = withActionContainer() { c => - val (initCode, initRes) = c.init( - initPayload( - functionb64, - "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.NonEmptyConstructor::Main")) - initCode should be(502) - - initRes should { - be( - Some(JsObject("error" -> JsString( - "Unable to locate appropriate constructor for (\"Apache.OpenWhisk.Tests.Dotnet.NonEmptyConstructor\").")))) - } - } - } - - it should "validate main string format 1" in { - val (out, err) = withActionContainer() { c => - val (initCode, initRes) = c.init(initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet")) - initCode should not be (200) - - initRes should { - be(Some(JsObject("error" -> JsString("main required format is \"Assembly::Type::Function\".")))) - } - } - } - - it should "validate main string format 2" in { - val (out, err) = withActionContainer() { c => - val (initCode, initRes) = - c.init(initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Echo")) - initCode should not be (200) - - initRes should { - be(Some(JsObject("error" -> JsString("main required format is \"Assembly::Type::Function\".")))) - } - } - } - - it should "enforce that the user returns an object" in { - val (out, err) = withActionContainer() { c => - val (initCode, _) = - c.init(initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Nuller::Main")) - initCode should be(200) - - val (runCode, runRes) = c.run(runPayload(JsObject.empty)) - runCode should not be (200) - - runRes shouldBe defined - runRes.get.fields.get("error") shouldBe defined - } - - checkStreams(out, err, { - case (o, e) => - (o + e).toLowerCase should include("the action returned null") - }) - } - - it should "support return array result" in { - val (out, err) = withActionContainer() { c => - val (initCode, _) = - c.init( - initPayload(functionb64, "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.HelloArray::Main")) - initCode should be(200) - - val (runCode, runRes) = c.runForJsArray(runPayload(JsObject())) - runCode should be(200) - runRes shouldBe Some(JsArray(JsString("a"), JsString("b"))) - } - } - - it should "support array as input param" in { - val (out, err) = withActionContainer() { c => - val (initCode, _) = - c.init( - initPayload( - functionb64, - "Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.HelloPassArrayParam::Main")) - initCode should be(200) - - val (runCode, runRes) = c.runForJsArray(runPayload(JsArray(JsString("a"), JsString("b")))) - runCode should be(200) - runRes shouldBe Some(JsArray(JsString("a"), JsString("b"))) - } - } -} diff --git a/tools/vagrant/README.md b/tools/vagrant/README.md index 45ce1e1..d2b0612 100644 --- a/tools/vagrant/README.md +++ b/tools/vagrant/README.md @@ -46,7 +46,6 @@ cd $OPENWHISK_HOME ./gradlew install cd .. cd openwhisk-runtime-dotnet -./gradlew core:dotnet3.1:distDocker ./gradlew core:net6.0:distDocker ./gradlew :tests:test ```