Repository: incubator-reef Updated Branches: refs/heads/master 7d7321496 -> 7b4f9f13c
[REEF-496] Adding Org.Apache.REEF.Evaluator.Test This PR * created new test project for Evaluator * moves evaluator tests from REEF.Tests to the new project * Updated and added tests JIRA: [REEF-496](https://issues.apache.org/jira/browse/REEF-496) Pull Request: This closes #313 Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/7b4f9f13 Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/7b4f9f13 Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/7b4f9f13 Branch: refs/heads/master Commit: 7b4f9f13c3851ee590e9caf345b5bf29c8cb1501 Parents: 7d73214 Author: Julia Wang <[email protected]> Authored: Thu Jul 23 18:15:59 2015 -0700 Committer: Markus Weimer <[email protected]> Committed: Mon Jul 27 08:44:04 2015 -0700 ---------------------------------------------------------------------- .../EvaluatorConfigurationsTests.cs | 76 +++++++++++++++ .../EvaluatorTests.cs | 96 +++++++++++++++++++ .../Org.Apache.REEF.Evaluator.Tests.csproj | 72 ++++++++++++++ .../Properties/AssemblyInfo.cs | 54 +++++++++++ .../Properties/AssemblyInfo.cs | 12 +++ .../ConfigFiles/evaluator.conf | Bin 0 -> 3309 bytes .../Org.Apache.REEF.Examples.csproj | 5 + .../Org.Apache.REEF.Tang.Tests.csproj | 2 +- .../Org.Apache.REEF.Tang.Tests/evaluator.conf | Bin 2837 -> 0 bytes .../ConfigFiles/evaluator.conf | Bin 2837 -> 0 bytes .../Evaluator/EvaluatorConfigurationsTests.cs | 42 -------- .../Evaluator/EvaluatorTests.cs | 96 ------------------- .../Org.Apache.REEF.Tests.csproj | 5 - lang/cs/Org.Apache.REEF.sln | Bin 29004 -> 30034 bytes pom.xml | 3 +- 15 files changed, 317 insertions(+), 146 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.Evaluator.Tests/EvaluatorConfigurationsTests.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Evaluator.Tests/EvaluatorConfigurationsTests.cs b/lang/cs/Org.Apache.REEF.Evaluator.Tests/EvaluatorConfigurationsTests.cs new file mode 100644 index 0000000..8c3e010 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Evaluator.Tests/EvaluatorConfigurationsTests.cs @@ -0,0 +1,76 @@ +/** + * 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.Globalization; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Org.Apache.REEF.Common.Runtime.Evaluator.Utils; +using Org.Apache.REEF.Tang.Formats; +using Org.Apache.REEF.Utilities.Logging; + +namespace Org.Apache.REEF.Evaluator.Tests +{ + [TestClass] + public class EvaluatorConfigurationsTests + { + private static readonly Logger Logger = Logger.GetLogger(typeof(EvaluatorConfigurationsTests)); + + + [TestMethod, Priority(0), TestCategory("Unit")] + [DeploymentItem(@"ConfigFiles")] + public void TestEvaluatorConfigurations() + { + EvaluatorConfigurations evaluatorConfigurations = new EvaluatorConfigurations("evaluator.conf"); + + var eId = evaluatorConfigurations.EvaluatorId; + var aId = evaluatorConfigurations.ApplicationId; + var rId = evaluatorConfigurations.ErrorHandlerRID; + + Logger.Log(Level.Info, "EvaluatorId = " + eId); + Logger.Log(Level.Info, "ApplicationId = " + aId); + Logger.Log(Level.Info, "ErrorHandlerRID = " + rId); + + Assert.IsTrue(eId.Equals("Node-1-1437686223482")); + Assert.IsTrue(aId.Equals("REEF_LOCAL_RUNTIME")); + Assert.IsTrue(rId.Equals("socket://10.130.68.76:9267")); + + var contextConfigString = evaluatorConfigurations.RootContextConfigurationString; + var serviceConfigString = evaluatorConfigurations.RootServiceConfigurationString; + var taskConfigString = evaluatorConfigurations.TaskConfigurationString; + + Assert.IsFalse(string.IsNullOrWhiteSpace(contextConfigString)); + Assert.IsFalse(string.IsNullOrWhiteSpace(taskConfigString)); + } + + [TestMethod, Priority(0), TestCategory("Unit")] + [DeploymentItem(@"ConfigFiles")] + public void TestEvaluatorConfigurationFile() + { + AvroConfigurationSerializer serializer = new AvroConfigurationSerializer(); + var avroConfiguration = serializer.AvroDeseriaizeFromFile("evaluator.conf"); + + Assert.IsNotNull(avroConfiguration); + + foreach (var b in avroConfiguration.Bindings) + { + Logger.Log(Level.Info, "Key = " + b.key + " Value = " + b.value); + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.Evaluator.Tests/EvaluatorTests.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Evaluator.Tests/EvaluatorTests.cs b/lang/cs/Org.Apache.REEF.Evaluator.Tests/EvaluatorTests.cs new file mode 100644 index 0000000..8779d8b --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Evaluator.Tests/EvaluatorTests.cs @@ -0,0 +1,96 @@ +/** + * 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 Microsoft.VisualStudio.TestTools.UnitTesting; +using Org.Apache.REEF.Common.Avro; +using Org.Apache.REEF.Common.Evaluator; +using Org.Apache.REEF.Common.Tasks; +using Org.Apache.REEF.Examples.Tasks.ShellTask; +using Org.Apache.REEF.Tang.Formats; +using Org.Apache.REEF.Tang.Formats.AvroConfigurationDataContract; +using Org.Apache.REEF.Tang.Implementations.Tang; +using Org.Apache.REEF.Tang.Interface; +using Org.Apache.REEF.Tang.Util; + +namespace Org.Apache.REEF.Evaluator.Tests +{ + [TestClass] + public class EvaluatorTests + { + [TestMethod, Priority(0), TestCategory("Functional")] + [Description("Parse Evaluator configuration from Java, inject and execute Shell task with DIR command based on the configuration")] + [DeploymentItem(@"ConfigFiles")] + public void CanInjectAndExecuteTask() + { + //To enforce that shell task dll be copied to output directory. + ShellTask tmpTask = new ShellTask("invalid"); + Assert.IsNotNull(tmpTask); + + string tmp = Directory.GetCurrentDirectory(); + Assert.IsNotNull(tmp); + + AvroConfigurationSerializer serializer = new AvroConfigurationSerializer(); + AvroConfiguration avroConfiguration = serializer.AvroDeseriaizeFromFile("evaluator.conf"); + Assert.IsNotNull(avroConfiguration); + + ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); + cb.AddConfiguration(TaskConfiguration.ConfigurationModule + .Set(TaskConfiguration.Identifier, "Test_CLRContext_task") + .Set(TaskConfiguration.Task, GenericType<ShellTask>.Class) + .Build()); + cb.BindNamedParameter<ShellTask.Command, string>(GenericType<ShellTask.Command>.Class, "dir"); + + IConfiguration taskConfiguration = cb.Build(); + + string taskConfig = serializer.ToString(taskConfiguration); + + ITask task = null; + TaskConfiguration config = new TaskConfiguration(taskConfig); + Assert.IsNotNull(config); + try + { + IInjector injector = TangFactory.GetTang().NewInjector(config.TangConfig); + task = (ITask)injector.GetInstance(typeof(ITask)); + } + catch (Exception e) + { + throw new InvalidOperationException("unable to inject task with configuration: " + taskConfig, e); + } + + byte[] bytes = task.Call(null); + string result = System.Text.Encoding.Default.GetString(bytes); + + //a dir command is executed in the container directory, which includes the file "evaluator.conf" + Assert.IsTrue(result.Contains("evaluator.conf")); + } + + [TestMethod, Priority(0), TestCategory("Unit")] + [Description("Test driver information extracted from Http server")] + public void CanExtractDriverInformaiton() + { + const string infoString = "{\"remoteId\":\"socket://10.121.136.231:14272\",\"startTime\":\"2014 08 28 10:50:32\",\"services\":[{\"serviceName\":\"NameServer\",\"serviceInfo\":\"10.121.136.231:16663\"}]}"; + AvroDriverInfo info = AvroJsonSerializer<AvroDriverInfo>.FromString(infoString); + Assert.IsTrue(info.remoteId.Equals("socket://10.121.136.231:14272")); + Assert.IsTrue(info.startTime.Equals("2014 08 28 10:50:32")); + Assert.IsTrue(new DriverInformation(info.remoteId, info.startTime, info.services).NameServerId.Equals("10.121.136.231:16663")); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.Evaluator.Tests/Org.Apache.REEF.Evaluator.Tests.csproj ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Evaluator.Tests/Org.Apache.REEF.Evaluator.Tests.csproj b/lang/cs/Org.Apache.REEF.Evaluator.Tests/Org.Apache.REEF.Evaluator.Tests.csproj new file mode 100644 index 0000000..c4d6439 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Evaluator.Tests/Org.Apache.REEF.Evaluator.Tests.csproj @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +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 ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <ProjectGuid>{0B596FAC-53B0-435A-ACE5-6725309E414A}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Org.Apache.REEF.Evaluator.Tests</RootNamespace> + <AssemblyName>Org.Apache.REEF.Evaluator.Tests</AssemblyName> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..</SolutionDir> + <RestorePackages>true</RestorePackages> + <BuildPackage>false</BuildPackage> + <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> + <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath> + <IsCodedUITest>False</IsCodedUITest> + <TestProjectType>UnitTest</TestProjectType> + </PropertyGroup> + <Import Project="$(SolutionDir)\build.props" /> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> + </ItemGroup> + <ItemGroup> + <Compile Include="EvaluatorConfigurationsTests.cs" /> + <Compile Include="EvaluatorTests.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Common\Org.Apache.REEF.Common.csproj"> + <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project> + <Name>Org.Apache.REEF.Common</Name> + </ProjectReference> + <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Examples\Org.Apache.REEF.Examples.csproj"> + <Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project> + <Name>Org.Apache.REEF.Examples</Name> + </ProjectReference> + <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Tang\Org.Apache.REEF.Tang.csproj"> + <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project> + <Name>Org.Apache.REEF.Tang</Name> + </ProjectReference> + <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Utilities\Org.Apache.REEF.Utilities.csproj"> + <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project> + <Name>Org.Apache.REEF.Utilities</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="$(SolutionDir)\Org.Apache.REEF.Examples\ConfigFiles\evaluator.conf"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + </ItemGroup> + <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" /> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.Evaluator.Tests/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Evaluator.Tests/Properties/AssemblyInfo.cs b/lang/cs/Org.Apache.REEF.Evaluator.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b356a25 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Evaluator.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,54 @@ +/** + * 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.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Org.Apache.REEF.Evaluator.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Org.Apache.REEF.Evaluator.Tests")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("974cc59d-5bbd-4ba6-b31d-ebe117cd4c2f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.12.0.0")] +[assembly: AssemblyFileVersion("0.12.0.0")] http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.Evaluator/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Evaluator/Properties/AssemblyInfo.cs b/lang/cs/Org.Apache.REEF.Evaluator/Properties/AssemblyInfo.cs index 94c3277..16ac1aa 100644 --- a/lang/cs/Org.Apache.REEF.Evaluator/Properties/AssemblyInfo.cs +++ b/lang/cs/Org.Apache.REEF.Evaluator/Properties/AssemblyInfo.cs @@ -18,6 +18,7 @@ */ using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -52,3 +53,14 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.12.0.0")] [assembly: AssemblyFileVersion("0.12.0.0")] + +// Allow the tests access to `internal` APIs +#if DEBUG +[assembly: InternalsVisibleTo("Org.Apache.REEF.Evaluator.Tests")] +#else +[assembly: InternalsVisibleTo("Org.Apache.REEF.Tang.Tests, publickey=" + + "00240000048000009400000006020000002400005253413100040000010001005df3e621d886a9" + + "9c03469d0f93a9f5d45aa2c883f50cd158759e93673f759ec4657fd84cc79d2db38ef1a2d914cc" + + "b7c717846a897e11dd22eb260a7ce2da2dccf0263ea63e2b3f7dac24f28882aa568ef544341d17" + + "618392a1095f4049ad079d4f4f0b429bb535699155fd6a7652ec7d6c1f1ba2b560f11ef3a86b5945d288cf")] +#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.Examples/ConfigFiles/evaluator.conf ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Examples/ConfigFiles/evaluator.conf b/lang/cs/Org.Apache.REEF.Examples/ConfigFiles/evaluator.conf new file mode 100644 index 0000000..1136a5a Binary files /dev/null and b/lang/cs/Org.Apache.REEF.Examples/ConfigFiles/evaluator.conf differ http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.Examples/Org.Apache.REEF.Examples.csproj ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Examples/Org.Apache.REEF.Examples.csproj b/lang/cs/Org.Apache.REEF.Examples/Org.Apache.REEF.Examples.csproj index ee1c3f9..7dae616 100644 --- a/lang/cs/Org.Apache.REEF.Examples/Org.Apache.REEF.Examples.csproj +++ b/lang/cs/Org.Apache.REEF.Examples/Org.Apache.REEF.Examples.csproj @@ -91,6 +91,11 @@ under the License. <ItemGroup> <Folder Include="HelloCLRBridge\Handlers\" /> </ItemGroup> + <ItemGroup> + <None Include="ConfigFiles\evaluator.conf"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.Tang.Tests/Org.Apache.REEF.Tang.Tests.csproj ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Org.Apache.REEF.Tang.Tests.csproj b/lang/cs/Org.Apache.REEF.Tang.Tests/Org.Apache.REEF.Tang.Tests.csproj index 6c11856..b88cde8 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Org.Apache.REEF.Tang.Tests.csproj +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Org.Apache.REEF.Tang.Tests.csproj @@ -112,7 +112,7 @@ under the License. <Compile Include="Utilities\Utilities.cs" /> </ItemGroup> <ItemGroup> - <None Include="evaluator.conf"> + <None Include="$(SolutionDir)\Org.Apache.REEF.Examples\ConfigFiles\evaluator.conf"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> <None Include="packages.config"> http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.Tang.Tests/evaluator.conf ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/evaluator.conf b/lang/cs/Org.Apache.REEF.Tang.Tests/evaluator.conf deleted file mode 100644 index 67256f5..0000000 Binary files a/lang/cs/Org.Apache.REEF.Tang.Tests/evaluator.conf and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.Tests/ConfigFiles/evaluator.conf ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tests/ConfigFiles/evaluator.conf b/lang/cs/Org.Apache.REEF.Tests/ConfigFiles/evaluator.conf deleted file mode 100644 index 67256f5..0000000 Binary files a/lang/cs/Org.Apache.REEF.Tests/ConfigFiles/evaluator.conf and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.Tests/Evaluator/EvaluatorConfigurationsTests.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tests/Evaluator/EvaluatorConfigurationsTests.cs b/lang/cs/Org.Apache.REEF.Tests/Evaluator/EvaluatorConfigurationsTests.cs deleted file mode 100644 index ef9f564..0000000 --- a/lang/cs/Org.Apache.REEF.Tests/Evaluator/EvaluatorConfigurationsTests.cs +++ /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. - */ - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Org.Apache.REEF.Common.Runtime.Evaluator.Utils; - -namespace Org.Apache.REEF.Tests.Evaluator -{ - [TestClass] - public class EvaluatorConfigurationsTests - { - [TestMethod, Priority(0), TestCategory("Unit")] - [DeploymentItem(@"ConfigFiles")] - public void TestEvaluatorConfigurations() - { - EvaluatorConfigurations evaluatorConfigurations = new EvaluatorConfigurations("evaluator.conf"); - - Assert.IsTrue(evaluatorConfigurations.EvaluatorId.Equals("Node-1-1414443998204")); - - Assert.IsTrue(evaluatorConfigurations.ApplicationId.Equals("REEF_LOCAL_RUNTIME")); - - string rootContextConfigString = evaluatorConfigurations.RootContextConfigurationString; - Assert.IsFalse(string.IsNullOrWhiteSpace(rootContextConfigString)); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.Tests/Evaluator/EvaluatorTests.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tests/Evaluator/EvaluatorTests.cs b/lang/cs/Org.Apache.REEF.Tests/Evaluator/EvaluatorTests.cs deleted file mode 100644 index 460f4d7..0000000 --- a/lang/cs/Org.Apache.REEF.Tests/Evaluator/EvaluatorTests.cs +++ /dev/null @@ -1,96 +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 Microsoft.VisualStudio.TestTools.UnitTesting; -using Org.Apache.REEF.Common.Avro; -using Org.Apache.REEF.Common.Evaluator; -using Org.Apache.REEF.Common.Tasks; -using Org.Apache.REEF.Examples.Tasks.ShellTask; -using Org.Apache.REEF.Tang.Formats; -using Org.Apache.REEF.Tang.Formats.AvroConfigurationDataContract; -using Org.Apache.REEF.Tang.Implementations.Tang; -using Org.Apache.REEF.Tang.Interface; -using Org.Apache.REEF.Tang.Util; - -namespace Org.Apache.REEF.Tests.Evaluator -{ - [TestClass] - public class EvaluatorTests - { - [TestMethod, Priority(0), TestCategory("Functional")] - [Description("Parse Evaluator configuration from Java, inject and execute Shell task with DIR command based on the configuration")] - [DeploymentItem(@"ConfigFiles")] - public void CanInjectAndExecuteTask() - { - //To enforce that shell task dll be copied to output directory. - ShellTask tmpTask = new ShellTask("invalid"); - Assert.IsNotNull(tmpTask); - - string tmp = Directory.GetCurrentDirectory(); - Assert.IsNotNull(tmp); - - AvroConfigurationSerializer serializer = new AvroConfigurationSerializer(); - AvroConfiguration avroConfiguration = serializer.AvroDeseriaizeFromFile("evaluator.conf"); - Assert.IsNotNull(avroConfiguration); - - ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); - cb.AddConfiguration(TaskConfiguration.ConfigurationModule - .Set(TaskConfiguration.Identifier, "Test_CLRContext_task") - .Set(TaskConfiguration.Task, GenericType<ShellTask>.Class) - .Build()); - cb.BindNamedParameter<ShellTask.Command, string>(GenericType<ShellTask.Command>.Class, "dir"); - - IConfiguration taskConfiguration = cb.Build(); - - string taskConfig = serializer.ToString(taskConfiguration); - - ITask task = null; - TaskConfiguration config = new TaskConfiguration(taskConfig); - Assert.IsNotNull(config); - try - { - IInjector injector = TangFactory.GetTang().NewInjector(config.TangConfig); - task = (ITask)injector.GetInstance(typeof(ITask)); - } - catch (Exception e) - { - throw new InvalidOperationException("unable to inject task with configuration: " + taskConfig, e); - } - - byte[] bytes = task.Call(null); - string result = System.Text.Encoding.Default.GetString(bytes); - - //a dir command is executed in the container directory, which includes the file "evaluator.conf" - Assert.IsTrue(result.Contains("evaluator.conf")); - } - - [TestMethod, Priority(0), TestCategory("Unit")] - [Description("Test driver information extacted from Http server")] - public void CanExtractDriverInformaiton() - { - const string InfoString = "{\"remoteId\":\"socket://10.121.136.231:14272\",\"startTime\":\"2014 08 28 10:50:32\",\"services\":[{\"serviceName\":\"NameServer\",\"serviceInfo\":\"10.121.136.231:16663\"}]}"; - AvroDriverInfo info = AvroJsonSerializer<AvroDriverInfo>.FromString(InfoString); - Assert.IsTrue(info.remoteId.Equals("socket://10.121.136.231:14272")); - Assert.IsTrue(info.startTime.Equals("2014 08 28 10:50:32")); - Assert.IsTrue(new DriverInformation(info.remoteId, info.startTime, info.services).NameServerId.Equals("10.121.136.231:16663")); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj b/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj index 1dc5182..a8d2b92 100644 --- a/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj +++ b/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj @@ -47,8 +47,6 @@ under the License. </Reference> </ItemGroup> <ItemGroup> - <Compile Include="Evaluator\EvaluatorConfigurationsTests.cs" /> - <Compile Include="Evaluator\EvaluatorTests.cs" /> <Compile Include="Functional\Bridge\HelloSimpleEventHandlers.cs" /> <Compile Include="Functional\Bridge\TestBridgeClient.cs" /> <Compile Include="Functional\Bridge\TestSimpleEventHandlers.cs" /> @@ -67,9 +65,6 @@ under the License. <Compile Include="Utility\TestExceptions.cs" /> </ItemGroup> <ItemGroup> - <None Include="ConfigFiles\evaluator.conf"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </None> <None Include="$(SolutionDir)\Org.Apache.REEF.Client\run.cmd"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/lang/cs/Org.Apache.REEF.sln ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.sln b/lang/cs/Org.Apache.REEF.sln index 21cb979..edb3416 100644 Binary files a/lang/cs/Org.Apache.REEF.sln and b/lang/cs/Org.Apache.REEF.sln differ http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7b4f9f13/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 1ca5725..8839886 100644 --- a/pom.xml +++ b/pom.xml @@ -268,8 +268,7 @@ under the License. <exclude>Org.Apache.REEF.Common/Protobuf/ReefProtocol/*</exclude> <exclude>Org.Apache.REEF.Common/Avro/*</exclude> <!-- The below are binary data files used in tests --> - <exclude>Org.Apache.REEF.Tests/ConfigFiles/evaluator.conf</exclude> - <exclude>Org.Apache.REEF.Tang.Tests/evaluator.conf</exclude> + <exclude>Org.Apache.REEF.Examples/ConfigFiles/evaluator.conf</exclude> <exclude>Org.Apache.REEF.Tang.Tests/simpleConstructorJavaProto.bin</exclude> </excludes> </configuration>
