You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by we...@apache.org on 2015/02/05 22:05:25 UTC
[04/51] [partial] incubator-reef git commit: [REEF-131] Towards the
new .Net project structure This is to change .Net project structure for Tang,
Wake, REEF utilities, Common and Driver:
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/WAKE/Wake/src/main/cs/Examples/P2p/Pull2Push.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/WAKE/Wake/src/main/cs/Examples/P2p/Pull2Push.cs b/lang/cs/Source/WAKE/Wake/src/main/cs/Examples/P2p/Pull2Push.cs
deleted file mode 100644
index 3f596f2..0000000
--- a/lang/cs/Source/WAKE/Wake/src/main/cs/Examples/P2p/Pull2Push.cs
+++ /dev/null
@@ -1,103 +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 Org.Apache.Reef.Utilities.Logging;
-using Org.Apache.Reef.Wake;
-using Org.Apache.Reef.Wake.Util;
-using System;
-using System.Collections.Generic;
-
-namespace Wake.Examples.P2p
-{
- /// <summary>Performs a Pull-to-Push conversion in Wake.</summary>
- /// <remarks>
- /// Performs a Pull-to-Push conversion in Wake.
- /// The class pulls from a set of event sources, and pushes to a single
- /// EventHandler. If the downstream event handler blocks, this will block,
- /// providing a simple rate limiting scheme.
- /// The EventSources are managed in a basic Queue.
- /// </remarks>
- public sealed class Pull2Push<T> : IStartable, IDisposable
- {
- private static readonly Logger LOGGER = Logger.GetLogger(typeof(Pull2Push<T>));
-
- private readonly IEventHandler<T> _output;
-
- private readonly Queue<IEventSource<T>> _sources = new Queue<IEventSource<T>>();
-
- private bool _closed = false;
-
- /// <summary>
- /// Constructs a new Pull2Push object
- /// </summary>
- /// <param name="output">
- /// the EventHandler that receives the messages from this
- /// Pull2Push.
- /// </param>
- public Pull2Push(IEventHandler<T> output)
- {
- // The downstream EventHandler
- // The upstream event sources
- _output = output;
- }
-
- /// <summary>Registers an event source.</summary>
- /// <param name="source">
- /// The source that will be added to the queue of this
- /// Pull2Push
- /// </param>
- public void Register(IEventSource<T> source)
- {
- _sources.Enqueue(source);
- }
-
- /// <summary>Executes the message loop.</summary>
- public void Start()
- {
- while (!_closed)
- {
- // Grab the next available message source, if any
- IEventSource<T> nextSource = _sources.Dequeue();
- if (null != nextSource)
- {
- // Grab the next message from that source, if any
- T message = nextSource.GetNext();
- if (null != message)
- {
- // Add the source to the end of the queue again.
- _sources.Enqueue(nextSource);
- // Send the message. Note that this may block depending on the underlying EventHandler.
- _output.OnNext(message);
- }
- else
- {
- // The message source has returned null as the next message. We drop the message source in that case.
- LOGGER.Log(Level.Info, "Droping message source {0} from the queue " + nextSource.ToString());
- }
- }
- }
- }
-
- // No source where available. We could put a wait() here.
- public void Dispose()
- {
- _closed = true;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/WAKE/Wake/src/main/cs/PeriodicEvent.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/WAKE/Wake/src/main/cs/PeriodicEvent.cs b/lang/cs/Source/WAKE/Wake/src/main/cs/PeriodicEvent.cs
deleted file mode 100644
index a91e298..0000000
--- a/lang/cs/Source/WAKE/Wake/src/main/cs/PeriodicEvent.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright 2013 Microsoft.
- *
- * 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.
- */
-
-namespace Wake.Impl
-{
- /// <summary>Periodic event for timers</summary>
- public class PeriodicEvent
- {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/WAKE/Wake/testkey.snk
----------------------------------------------------------------------
diff --git a/lang/cs/Source/WAKE/Wake/testkey.snk b/lang/cs/Source/WAKE/Wake/testkey.snk
deleted file mode 100644
index 133423f..0000000
Binary files a/lang/cs/Source/WAKE/Wake/testkey.snk and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/Evaluator.Tests/EvaluatorConfigurationsTests.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Evaluator.Tests/EvaluatorConfigurationsTests.cs b/lang/cs/Tests/ReefTests/Evaluator.Tests/EvaluatorConfigurationsTests.cs
index 69fc9ae..f46446a 100644
--- a/lang/cs/Tests/ReefTests/Evaluator.Tests/EvaluatorConfigurationsTests.cs
+++ b/lang/cs/Tests/ReefTests/Evaluator.Tests/EvaluatorConfigurationsTests.cs
@@ -17,10 +17,10 @@
* under the License.
*/
-using Org.Apache.Reef.Common;
+using Org.Apache.REEF.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Org.Apache.Reef.Test
+namespace Org.Apache.REEF.Test
{
[TestClass]
public class EvaluatorConfigurationsTests
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/Evaluator.Tests/EvaluatorTests.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Evaluator.Tests/EvaluatorTests.cs b/lang/cs/Tests/ReefTests/Evaluator.Tests/EvaluatorTests.cs
index 2c3eaa2..b3185c0 100644
--- a/lang/cs/Tests/ReefTests/Evaluator.Tests/EvaluatorTests.cs
+++ b/lang/cs/Tests/ReefTests/Evaluator.Tests/EvaluatorTests.cs
@@ -17,18 +17,19 @@
* under the License.
*/
-using Org.Apache.Reef.Common.Avro;
-using Org.Apache.Reef.Common.Evaluator;
-using Org.Apache.Reef.Tasks;
-using Org.Apache.Reef.Tang.Formats;
-using Org.Apache.Reef.Tang.Implementations;
-using Org.Apache.Reef.Tang.Interface;
-using Org.Apache.Reef.Tang.Util;
+using Org.Apache.REEF.Common.Avro;
+using Org.Apache.REEF.Common.Evaluator;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Tang.Formats;
+using Org.Apache.REEF.Tang.Implementations;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.IO;
+using Org.Apache.REEF.Tang.Implementations.Tang;
-namespace Org.Apache.Reef.Test
+namespace Org.Apache.REEF.Test
{
[TestClass]
public class EvaluatorTests
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestBridgeClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestBridgeClient.cs b/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestBridgeClient.cs
index f0785f9..3e2cab3 100644
--- a/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestBridgeClient.cs
+++ b/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestBridgeClient.cs
@@ -17,15 +17,15 @@
* under the License.
*/
-using Org.Apache.Reef.Driver;
-using Org.Apache.Reef.Utilities.Logging;
+using Org.Apache.REEF.Driver;
+using Org.Apache.REEF.Utilities.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
-namespace Org.Apache.Reef.Test
+namespace Org.Apache.REEF.Test
{
[TestClass]
public class TestBridgeClient : ReefFunctionalTest
@@ -68,7 +68,7 @@ namespace Org.Apache.Reef.Test
private void RunClrBridgeClient(bool runOnYarn)
{
- const string clrBridgeClient = "Org.Apache.Reef.CLRBridgeClient.exe";
+ const string clrBridgeClient = "Org.Apache.REEF.CLRBridgeClient.exe";
List<string> arguments = new List<string>();
arguments.Add(runOnYarn.ToString());
arguments.Add(Constants.BridgeLaunchClass);
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestHelloBridgeHandlers.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestHelloBridgeHandlers.cs b/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestHelloBridgeHandlers.cs
index 7e896ec..1c4177a 100644
--- a/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestHelloBridgeHandlers.cs
+++ b/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestHelloBridgeHandlers.cs
@@ -21,17 +21,17 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using Org.Apache.Reef.Driver.Bridge;
-using Org.Apache.Reef.Driver.Defaults;
-using Org.Apache.Reef.Examples.HelloCLRBridge;
-using Org.Apache.Reef.Examples.HelloCLRBridge.Handlers;
-using Org.Apache.Reef.Tasks;
-using Org.Apache.Reef.Utilities.Logging;
-using Org.Apache.Reef.Tang.Interface;
-using Org.Apache.Reef.Tang.Util;
+using Org.Apache.REEF.Driver.Bridge;
+using Org.Apache.REEF.Driver.Defaults;
+using Org.Apache.REEF.Examples.HelloCLRBridge;
+using Org.Apache.REEF.Examples.HelloCLRBridge.Handlers;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Org.Apache.Reef.Test
+namespace Org.Apache.REEF.Test
{
[TestClass]
public class TestHelloBridgeHandlers : ReefFunctionalTest
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestSimpleEventHandlers.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestSimpleEventHandlers.cs b/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestSimpleEventHandlers.cs
index fb8a011..41a80cc 100644
--- a/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestSimpleEventHandlers.cs
+++ b/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestSimpleEventHandlers.cs
@@ -21,20 +21,20 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using Org.Apache.Reef.Common.Evaluator;
-using Org.Apache.Reef.Driver.Bridge;
-using Org.Apache.Reef.Driver.Defaults;
-using Org.Apache.Reef.Examples.HelloCLRBridge;
-using Org.Apache.Reef.Examples.HelloCLRBridge.handlers;
-using Org.Apache.Reef.Examples.HelloCLRBridge.Handlers;
-using Org.Apache.Reef.IO.Network.Naming;
-using Org.Apache.Reef.Tasks;
-using Org.Apache.Reef.Utilities.Logging;
-using Org.Apache.Reef.Tang.Interface;
-using Org.Apache.Reef.Tang.Util;
+using Org.Apache.REEF.Common.Evaluator;
+using Org.Apache.REEF.Driver.Bridge;
+using Org.Apache.REEF.Driver.Defaults;
+using Org.Apache.REEF.Examples.HelloCLRBridge;
+using Org.Apache.REEF.Examples.HelloCLRBridge.handlers;
+using Org.Apache.REEF.Examples.HelloCLRBridge.Handlers;
+using Org.Apache.REEF.IO.Network.Naming;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Org.Apache.Reef.Test
+namespace Org.Apache.REEF.Test
{
[TestClass]
public class TestSimpleEventHandlers : ReefFunctionalTest
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/Functional.Tests/Driver/DriverTestStartHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Functional.Tests/Driver/DriverTestStartHandler.cs b/lang/cs/Tests/ReefTests/Functional.Tests/Driver/DriverTestStartHandler.cs
index 4ab94dd..fc4bc15 100644
--- a/lang/cs/Tests/ReefTests/Functional.Tests/Driver/DriverTestStartHandler.cs
+++ b/lang/cs/Tests/ReefTests/Functional.Tests/Driver/DriverTestStartHandler.cs
@@ -17,13 +17,13 @@
* under the License.
*/
-using Org.Apache.Reef.Driver;
-using Org.Apache.Reef.Driver.bridge;
-using Org.Apache.Reef.Utilities.Logging;
-using Org.Apache.Reef.Tang.Annotations;
-using Org.Apache.Reef.Wake.Time;
+using Org.Apache.REEF.Driver;
+using Org.Apache.REEF.Driver.bridge;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Wake.Time;
-namespace Org.Apache.Reef.Test
+namespace Org.Apache.REEF.Test
{
public class DriverTestStartHandler : IStartHandler
{
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/Functional.Tests/Driver/TestDriver.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Functional.Tests/Driver/TestDriver.cs b/lang/cs/Tests/ReefTests/Functional.Tests/Driver/TestDriver.cs
index 8f7b36a..a771c7c 100644
--- a/lang/cs/Tests/ReefTests/Functional.Tests/Driver/TestDriver.cs
+++ b/lang/cs/Tests/ReefTests/Functional.Tests/Driver/TestDriver.cs
@@ -18,14 +18,14 @@
*/
using System.Collections.Generic;
-using Org.Apache.Reef.Driver.Bridge;
-using Org.Apache.Reef.Driver.Defaults;
-using Org.Apache.Reef.Utilities.Logging;
-using Org.Apache.Reef.Tang.Interface;
-using Org.Apache.Reef.Tang.Util;
+using Org.Apache.REEF.Driver.Bridge;
+using Org.Apache.REEF.Driver.Defaults;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Org.Apache.Reef.Test
+namespace Org.Apache.REEF.Test
{
[TestClass]
public class TestDriver : ReefFunctionalTest
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageDriver.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageDriver.cs b/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageDriver.cs
index c86c7ae..7199af1 100644
--- a/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageDriver.cs
+++ b/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageDriver.cs
@@ -22,23 +22,23 @@ using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Text;
-using Org.Apache.Reef.Driver;
-using Org.Apache.Reef.Driver.Bridge;
-using Org.Apache.Reef.Driver.Context;
-using Org.Apache.Reef.Driver.Evaluator;
-using Org.Apache.Reef.Driver.Task;
-using Org.Apache.Reef.IO.Network.Naming;
-using Org.Apache.Reef.Services;
-using Org.Apache.Reef.Tasks;
-using Org.Apache.Reef.Utilities;
-using Org.Apache.Reef.Utilities.Diagnostics;
-using Org.Apache.Reef.Utilities.Logging;
-using Org.Apache.Reef.Tang.Annotations;
-using Org.Apache.Reef.Tang.Implementations.Configuration;
-using Org.Apache.Reef.Tang.Interface;
-using Org.Apache.Reef.Tang.Util;
-
-namespace Org.Apache.Reef.Test
+using Org.Apache.REEF.Driver;
+using Org.Apache.REEF.Driver.Bridge;
+using Org.Apache.REEF.Driver.Context;
+using Org.Apache.REEF.Driver.Evaluator;
+using Org.Apache.REEF.Driver.Task;
+using Org.Apache.REEF.IO.Network.Naming;
+using Org.Apache.REEF.Services;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Implementations.Configuration;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
+
+namespace Org.Apache.REEF.Test
{
public class MessageDriver : IStartHandler, IObserver<IAllocatedEvaluator>, IObserver<IEvaluatorRequestor>, IObserver<ITaskMessage>, IObserver<IRunningTask>
{
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageTask.cs b/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageTask.cs
index 164724f..5c85426 100644
--- a/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageTask.cs
+++ b/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageTask.cs
@@ -22,15 +22,15 @@ using System.Globalization;
using System.Linq;
using System.Net;
using System.Threading;
-using Org.Apache.Reef.IO.Network.Naming;
-using Org.Apache.Reef.Tasks;
-using Org.Apache.Reef.Tasks.Events;
-using Org.Apache.Reef.Utilities;
-using Org.Apache.Reef.Utilities.Diagnostics;
-using Org.Apache.Reef.Utilities.Logging;
-using Org.Apache.Reef.Tang.Annotations;
+using Org.Apache.REEF.IO.Network.Naming;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Tasks.Events;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
-namespace Org.Apache.Reef.Test
+namespace Org.Apache.REEF.Test
{
public class MessageTask : ITask, ITaskMessageSource
{
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/TestTaskMessage.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/TestTaskMessage.cs b/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/TestTaskMessage.cs
index 89c6fc3..0aab664 100644
--- a/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/TestTaskMessage.cs
+++ b/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/TestTaskMessage.cs
@@ -18,15 +18,15 @@
*/
using System.Collections.Generic;
-using Org.Apache.Reef.Driver.Bridge;
-using Org.Apache.Reef.Driver.Defaults;
-using Org.Apache.Reef.Tasks;
-using Org.Apache.Reef.Utilities.Logging;
-using Org.Apache.Reef.Tang.Interface;
-using Org.Apache.Reef.Tang.Util;
+using Org.Apache.REEF.Driver.Bridge;
+using Org.Apache.REEF.Driver.Defaults;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Org.Apache.Reef.Test
+namespace Org.Apache.REEF.Test
{
[TestClass]
public class TestTaskMessage : ReefFunctionalTest
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/Functional.Tests/ReefFunctionalTest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Functional.Tests/ReefFunctionalTest.cs b/lang/cs/Tests/ReefTests/Functional.Tests/ReefFunctionalTest.cs
index 0dd2b46..adc8448 100644
--- a/lang/cs/Tests/ReefTests/Functional.Tests/ReefFunctionalTest.cs
+++ b/lang/cs/Tests/ReefTests/Functional.Tests/ReefFunctionalTest.cs
@@ -25,17 +25,17 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
-using Org.Apache.Reef.Driver;
-using Org.Apache.Reef.Driver.bridge;
-using Org.Apache.Reef.Utilities;
-using Org.Apache.Reef.Utilities.Logging;
-using Org.Apache.Reef.Tang.Interface;
+using Org.Apache.REEF.Driver;
+using Org.Apache.REEF.Driver.bridge;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Interface;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using Timer = System.Timers.Timer;
-namespace Org.Apache.Reef.Test
+namespace Org.Apache.REEF.Test
{
public class ReefFunctionalTest
{
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/IO.Tests/BlockingCollectionExtensionTests.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/IO.Tests/BlockingCollectionExtensionTests.cs b/lang/cs/Tests/ReefTests/IO.Tests/BlockingCollectionExtensionTests.cs
index 3ccd3e9..2ae67d2 100644
--- a/lang/cs/Tests/ReefTests/IO.Tests/BlockingCollectionExtensionTests.cs
+++ b/lang/cs/Tests/ReefTests/IO.Tests/BlockingCollectionExtensionTests.cs
@@ -17,7 +17,7 @@
* under the License.
*/
-using Org.Apache.Reef.IO.Network.Utilities;
+using Org.Apache.REEF.IO.Network.Utilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Concurrent;
@@ -26,7 +26,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace Org.Apache.Reef.Test.IO.Tests
+namespace Org.Apache.REEF.Test.IO.Tests
{
[TestClass]
public class BlockingCollectionExtensionTests
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/IO.Tests/NameServerTests.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/IO.Tests/NameServerTests.cs b/lang/cs/Tests/ReefTests/IO.Tests/NameServerTests.cs
index ee118da..6caac93 100644
--- a/lang/cs/Tests/ReefTests/IO.Tests/NameServerTests.cs
+++ b/lang/cs/Tests/ReefTests/IO.Tests/NameServerTests.cs
@@ -24,17 +24,18 @@ using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using Org.Apache.Reef.Common.io;
-using Org.Apache.Reef.IO.Network.Naming;
-using Org.Apache.Reef.IO.Network.Naming.Events;
-using Org.Apache.Reef.Tang.Annotations;
-using Org.Apache.Reef.Tang.Implementations;
-using Org.Apache.Reef.Tang.Interface;
-using Org.Apache.Reef.Tang.Util;
+using Org.Apache.REEF.Common.io;
+using Org.Apache.REEF.IO.Network.Naming;
+using Org.Apache.REEF.IO.Network.Naming.Events;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Implementations;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Org.Apache.Reef.Wake.Util;
+using Org.Apache.REEF.Wake.Util;
+using Org.Apache.REEF.Tang.Implementations.Tang;
-namespace Org.Apache.Reef.Test
+namespace Org.Apache.REEF.Test
{
[TestClass]
public class NameServerTests
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/IO.Tests/NetworkServiceTests.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/IO.Tests/NetworkServiceTests.cs b/lang/cs/Tests/ReefTests/IO.Tests/NetworkServiceTests.cs
index 46dce1b..1f827e2 100644
--- a/lang/cs/Tests/ReefTests/IO.Tests/NetworkServiceTests.cs
+++ b/lang/cs/Tests/ReefTests/IO.Tests/NetworkServiceTests.cs
@@ -17,18 +17,18 @@
* under the License.
*/
-using Org.Apache.Reef.Common.io;
-using Org.Apache.Reef.IO.Network.Naming;
-using Org.Apache.Reef.IO.Network.NetworkService;
-using Org.Apache.Reef.Tang.Annotations;
-using Org.Apache.Reef.Tang.Implementations;
-using Org.Apache.Reef.Tang.Interface;
-using Org.Apache.Reef.Tang.Util;
+using Org.Apache.REEF.Common.io;
+using Org.Apache.REEF.IO.Network.Naming;
+using Org.Apache.REEF.IO.Network.NetworkService;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Implementations;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Org.Apache.Reef.Wake;
-using Org.Apache.Reef.Wake.Remote;
-using Org.Apache.Reef.Wake.Remote.Impl;
-using Org.Apache.Reef.Wake.Util;
+using Org.Apache.REEF.Wake;
+using Org.Apache.REEF.Wake.Remote;
+using Org.Apache.REEF.Wake.Remote.Impl;
+using Org.Apache.REEF.Wake.Util;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -37,8 +37,9 @@ using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
+using Org.Apache.REEF.Tang.Implementations.Tang;
-namespace Org.Apache.Reef.Test.IO.Tests
+namespace Org.Apache.REEF.Test.IO.Tests
{
[TestClass]
public class NetworkServiceTests
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/ReefTests.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/ReefTests.csproj b/lang/cs/Tests/ReefTests/ReefTests.csproj
index cd5cb06..fce90f6 100644
--- a/lang/cs/Tests/ReefTests/ReefTests.csproj
+++ b/lang/cs/Tests/ReefTests/ReefTests.csproj
@@ -144,6 +144,26 @@ under the License.
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\..\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="..\..\Org.Apache.Reef.Driver\Org.Apache.Reef.Driver.csproj">
+ <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
+ <Name>Org.Apache.Reef.Driver</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\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="..\..\Org.Apache.Reef.Utilities\Org.Apache.Reef.Utilities.csproj">
+ <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project>
+ <Name>Org.Apache.Reef.Utilities</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Org.Apache.Reef.Wake\Org.Apache.Reef.Wake.csproj">
+ <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
+ <Name>Org.Apache.Reef.Wake</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Source\REEF\reef-applications\CLRBridgeClient\CLRBridgeClient.csproj">
<Project>{5094c35b-4fdb-4322-ac05-45d684501cbf}</Project>
<Name>CLRBridgeClient</Name>
@@ -152,14 +172,6 @@ under the License.
<Project>{1b983182-9c30-464c-948d-f87eb93a8240}</Project>
<Name>Evaluator</Name>
</ProjectReference>
- <ProjectReference Include="..\..\Source\REEF\reef-common\ReefCommon\ReefCommon.csproj">
- <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
- <Name>ReefCommon</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\Source\REEF\reef-common\ReefDriver\ReefDriver.csproj">
- <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
- <Name>ReefDriver</Name>
- </ProjectReference>
<ProjectReference Include="..\..\Source\REEF\reef-examples\HelloCLRBridge\HelloCLRBridge.csproj">
<Project>{a78dd8e8-31d0-4506-8738-daa9da86d55b}</Project>
<Name>HelloCLRBridge</Name>
@@ -172,18 +184,6 @@ under the License.
<Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project>
<Name>Tasks</Name>
</ProjectReference>
- <ProjectReference Include="..\..\Source\TANG\Tang\Tang.csproj">
- <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project>
- <Name>Tang</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\Source\Utilities\Utilities.csproj">
- <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project>
- <Name>Utilities</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\Source\WAKE\Wake\Wake.csproj">
- <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
- <Name>Wake</Name>
- </ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="bin\reef-bridge-0.11.0-incubating-SNAPSHOT-shaded.jar">
@@ -206,4 +206,4 @@ under the License.
<Target Name="AfterBuild">
</Target>
-->
-</Project>
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/Utility.Test/TestDriverConfigGenerator.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Utility.Test/TestDriverConfigGenerator.cs b/lang/cs/Tests/ReefTests/Utility.Test/TestDriverConfigGenerator.cs
index 214188a..c8b2c8f 100644
--- a/lang/cs/Tests/ReefTests/Utility.Test/TestDriverConfigGenerator.cs
+++ b/lang/cs/Tests/ReefTests/Utility.Test/TestDriverConfigGenerator.cs
@@ -18,10 +18,10 @@
*/
using System;
-using Org.Apache.Reef.Driver;
+using Org.Apache.REEF.Driver;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Org.Apache.Reef.Test.Utility.Test
+namespace Org.Apache.REEF.Test.Utility.Test
{
[TestClass]
public class TestDriverConfigGenerator
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/Utility.Test/TestExceptions.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Utility.Test/TestExceptions.cs b/lang/cs/Tests/ReefTests/Utility.Test/TestExceptions.cs
index 16bde92..6dc8120 100644
--- a/lang/cs/Tests/ReefTests/Utility.Test/TestExceptions.cs
+++ b/lang/cs/Tests/ReefTests/Utility.Test/TestExceptions.cs
@@ -18,11 +18,11 @@
*/
using System;
-using Org.Apache.Reef.Utilities.Diagnostics;
-using Org.Apache.Reef.Utilities.Logging;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Org.Apache.Reef.Test.Utility.Test
+namespace Org.Apache.REEF.Test.Utility.Test
{
[TestClass]
public class TestExceptions
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/ReefTests/bin/reef-bridge-0.11.0-incubating-SNAPSHOT-shaded.jar
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/bin/reef-bridge-0.11.0-incubating-SNAPSHOT-shaded.jar b/lang/cs/Tests/ReefTests/bin/reef-bridge-0.11.0-incubating-SNAPSHOT-shaded.jar
index 9f25ae3..437d140 100644
Binary files a/lang/cs/Tests/ReefTests/bin/reef-bridge-0.11.0-incubating-SNAPSHOT-shaded.jar and b/lang/cs/Tests/ReefTests/bin/reef-bridge-0.11.0-incubating-SNAPSHOT-shaded.jar differ
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/TangTests/ClassHierarchy/TestAnonymousType.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/TangTests/ClassHierarchy/TestAnonymousType.cs b/lang/cs/Tests/TangTests/ClassHierarchy/TestAnonymousType.cs
deleted file mode 100644
index 262ea7a..0000000
--- a/lang/cs/Tests/TangTests/ClassHierarchy/TestAnonymousType.cs
+++ /dev/null
@@ -1,63 +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.Collections.Generic;
-using System.IO;
-using Org.Apache.Reef.Tang.Examples;
-using Org.Apache.Reef.Tang.Implementations;
-using Org.Apache.Reef.Tang.Interface;
-using Org.Apache.Reef.Tang.Protobuf;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Org.Apache.Reef.Tang.Test.ClassHierarchy
-{
- [TestClass]
- public class TestAnonymousType
- {
- const string ClassHierarchyBinFileName = "example.bin";
-
- [ClassInitialize]
- public static void ClassSetup(TestContext context)
- {
- TangImpl.Reset();
- }
-
- [TestMethod]
- public void TestAnonymousTypeWithDictionary()
- {
- List<string> appDlls = new List<string>();
- appDlls.Add(typeof(AnonymousType).Assembly.GetName().Name);
- var c = TangFactory.GetTang().GetClassHierarchy(appDlls.ToArray());
- c.GetNode(typeof(AnonymousType).AssemblyQualifiedName);
-
- IConfiguration conf = TangFactory.GetTang().NewConfigurationBuilder(c).Build();
- IInjector injector = TangFactory.GetTang().NewInjector(conf);
- var obj = injector.GetInstance<AnonymousType>();
- Assert.IsNotNull(obj);
-
- var cd = Directory.GetCurrentDirectory();
- Console.WriteLine(cd);
-
- ProtocolBufferClassHierarchy.Serialize(ClassHierarchyBinFileName, c);
- IClassHierarchy ch = ProtocolBufferClassHierarchy.DeSerialize(ClassHierarchyBinFileName);
- ch.GetNode(typeof(AnonymousType).AssemblyQualifiedName);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/TangTests/ClassHierarchy/TestClassHierarchy.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/TangTests/ClassHierarchy/TestClassHierarchy.cs b/lang/cs/Tests/TangTests/ClassHierarchy/TestClassHierarchy.cs
deleted file mode 100644
index 49f9802..0000000
--- a/lang/cs/Tests/TangTests/ClassHierarchy/TestClassHierarchy.cs
+++ /dev/null
@@ -1,717 +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.Tang.Annotations;
-using Org.Apache.Reef.Tang.Examples;
-using Org.Apache.Reef.Tang.Exceptions;
-using Org.Apache.Reef.Tang.Implementations;
-using Org.Apache.Reef.Tang.Interface;
-using Org.Apache.Reef.Tang.Types;
-using Org.Apache.Reef.Tang.Util;
-using System;
-using System.Collections.Generic;
-
-namespace Org.Apache.Reef.Tang.Test.ClassHierarchy
-{
- [TestClass]
- public class TestClassHierarchy
- {
- public static IClassHierarchy ns;
-
- [ClassInitialize]
- public static void ClassSetup(TestContext context)
- {
- TangImpl.Reset();
- ns = TangFactory.GetTang().GetClassHierarchy(new string[] { FileNames.Examples, FileNames.Common, FileNames.Tasks });
- }
-
- [ClassCleanup]
- public static void ClassCleanup()
- {
- }
-
- [TestInitialize()]
- public void TestSetup()
- {
- }
-
- [TestCleanup()]
- public void TestCleanup()
- {
- }
-
- [TestMethod]
- public void TestString()
- {
- INode n = null;
- try
- {
- n = ns.GetNode("System");
- }
- catch (ApplicationException)
- {
- }
- catch (NameResolutionException)
- {
- }
- Assert.IsNull(n);
-
- Assert.IsNotNull(ns.GetNode(typeof(System.String).AssemblyQualifiedName));
-
- string msg = null;
- try
- {
- ns.GetNode("org.apache");
- msg = "Didn't get expected exception";
- }
- catch (ApplicationException)
- {
- }
- catch (NameResolutionException)
- {
-
- }
- Assert.IsNull(msg, msg);
- }
-
- [TestMethod]
- public void TestInt()
- {
- INode n = null;
- try
- {
- n = ns.GetNode("System");
- }
- catch (ApplicationException)
- {
- }
- catch (NameResolutionException)
- {
- }
- Assert.IsNull(n);
-
- Assert.IsNotNull(ns.GetNode(typeof(System.Int32).AssemblyQualifiedName));
-
- string msg = null;
- try
- {
- ns.GetNode("org.apache");
- msg = "Didn't get expected exception";
- }
- catch (ApplicationException)
- {
- }
- catch (NameResolutionException)
- {
-
- }
- Assert.IsNull(msg, msg);
- }
-
- [TestMethod]
- public void TestSimpleConstructors()
- {
- IClassNode cls = (IClassNode)ns.GetNode(typeof(SimpleConstructors).AssemblyQualifiedName);
- Assert.IsTrue(cls.GetChildren().Count == 0);
- IList<IConstructorDef> def = cls.GetInjectableConstructors();
- Assert.AreEqual(3, def.Count);
- }
-
- [TestMethod]
- public void TestTimer()
- {
- IClassNode timerClassNode = (IClassNode)ns.GetNode(typeof(Timer).AssemblyQualifiedName);
- INode secondNode = ns.GetNode(typeof(Timer.Seconds).AssemblyQualifiedName);
- Assert.AreEqual(secondNode.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(Timer.Seconds)));
-
- }
-
- [TestMethod]
- public void TestNamedParameterConstructors()
- {
- var node = ns.GetNode(typeof(NamedParameterConstructors).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(NamedParameterConstructors)));
- }
-
- [TestMethod]
- public void TestArray()
- {
- Type t = (new string[0]).GetType();
- INode node = ns.GetNode(t.AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), t.AssemblyQualifiedName);
- }
-
- [TestMethod]
- public void TestRepeatConstructorArg()
- {
- TestNegativeCase(typeof(RepeatConstructorArg),
- "Repeated constructor parameter detected. Cannot inject constructor RepeatConstructorArg(int,int).");
- }
-
- [TestMethod]
- public void TestRepeatConstructorArgClasses()
- {
- TestNegativeCase(typeof(RepeatConstructorArgClasses),
- "Repeated constructor parameter detected. Cannot inject constructor RepeatConstructorArgClasses(A, A).");
- }
-
- [TestMethod]
- public void testLeafRepeatedConstructorArgClasses()
- {
- INode node = ns.GetNode(typeof(LeafRepeatedConstructorArgClasses).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(LeafRepeatedConstructorArgClasses).AssemblyQualifiedName);
- }
-
- [TestMethod]
- public void TestNamedRepeatConstructorArgClasses()
- {
- INode node = ns.GetNode(typeof(NamedRepeatConstructorArgClasses).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(NamedRepeatConstructorArgClasses).AssemblyQualifiedName);
- }
-
- [TestMethod]
- public void TestResolveDependencies()
- {
- ns.GetNode(typeof(SimpleConstructors).AssemblyQualifiedName);
- Assert.IsNotNull(ns.GetNode(typeof(string).AssemblyQualifiedName));
- }
-
- [TestMethod]
- public void TestDocumentedLocalNamedParameter()
- {
- var node = ns.GetNode(typeof(DocumentedLocalNamedParameter).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(DocumentedLocalNamedParameter)));
- }
-
- [TestMethod]
- public void TestNamedParameterTypeMismatch()
- {
- TestNegativeCase(typeof(NamedParameterTypeMismatch),
- "Named parameter type mismatch in NamedParameterTypeMismatch. Constructor expects a System.String but Foo is a System.Int32.");
- }
-
- [TestMethod]
- public void TestUnannotatedName()
- {
- TestNegativeCase(typeof(UnannotatedName),
- "Named parameter UnannotatedName is missing its [NamedParameter] attribute.");
- }
-
- [TestMethod]
- public void TestAnnotatedNotName()
- {
- TestNegativeCase(typeof(AnnotatedNotName),
- "Found illegal [NamedParameter] AnnotatedNotName does not implement Name<T>.");
- }
-
- [TestMethod]
- public void TestAnnotatedNameWrongInterface()
- {
- TestNegativeCase(typeof(AnnotatedNameWrongInterface),
- "Found illegal [NamedParameter] AnnotatedNameWrongInterface does not implement Name<T>.");
- }
-
- [TestMethod]
- public void TestAnnotatedNameMultipleInterfaces()
- {
- TestNegativeCase(typeof(AnnotatedNameMultipleInterfaces),
- "Named parameter Org.Apache.Reef.Tang.Implementation.AnnotatedNameMultipleInterfaces implements multiple interfaces. It is only allowed to implement Name<T>.");
- }
-
- [TestMethod]
- public void TestUnAnnotatedNameMultipleInterfaces()
- {
- TestNegativeCase(typeof(UnAnnotatedNameMultipleInterfaces),
- "Named parameter Org.Apache.Reef.Tang.Implementation.UnAnnotatedNameMultipleInterfaces is missing its @NamedParameter annotation.");
- }
-
- [TestMethod]
- public void TestNameWithConstructor()
- {
- TestNegativeCase(typeof(NameWithConstructor),
- "Named parameter Org.Apache.Reef.Tang.Implementation.NameWithConstructor has a constructor. Named parameters must not declare any constructors.");
- }
-
- [TestMethod]
- public void TestNameWithZeroArgInject()
- {
- TestNegativeCase(typeof(NameWithZeroArgInject),
- "Named parameter Org.Apache.Reef.Tang.Implementation.NameWithZeroArgInject has an injectable constructor. Named parameters must not declare any constructors.");
- }
-
- [TestMethod]
- public void TestInjectNonStaticLocalArgClass()
- {
- var node = ns.GetNode(typeof(InjectNonStaticLocalArgClass).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(InjectNonStaticLocalArgClass).AssemblyQualifiedName);
- }
-
- [TestMethod]
- public void TestInjectNonStaticLocalType()
- {
- var node = ns.GetNode(typeof(InjectNonStaticLocalType).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(InjectNonStaticLocalType).AssemblyQualifiedName);
- }
-
- [TestMethod]
- public void TestOKShortNames()
- {
- var node = ns.GetNode(typeof(ShortNameFooA).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(ShortNameFooA).AssemblyQualifiedName);
- }
-
- public void TestConflictingShortNames()
- {
- string msg = null;
- try
- {
- var nodeA = ns.GetNode(typeof(ShortNameFooA).AssemblyQualifiedName);
- var nodeB = ns.GetNode(typeof(ShortNameFooB).AssemblyQualifiedName);
- msg =
- "ShortNameFooA and ShortNameFooB have the same short name" +
- nodeA.GetName() + nodeB.GetName();
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- }
- Assert.IsNull(msg, msg);
- }
-
- [TestMethod]
- public void TestRoundTripInnerClassNames()
- {
- INode node = ns.GetNode(typeof(Nested.Inner).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(Nested.Inner).AssemblyQualifiedName);
- }
-
- [TestMethod]
- public void TestRoundTripAnonInnerClassNames()
- {
- INode node1 = ns.GetNode(typeof(AnonNested.X1).AssemblyQualifiedName);
- INode node2 = ns.GetNode(typeof(AnonNested.Y1).AssemblyQualifiedName);
- Assert.AreNotEqual(node1.GetFullName(), node2.GetFullName());
-
- Type t1 = ReflectionUtilities.GetTypeByName(node1.GetFullName());
- Type t2 = ReflectionUtilities.GetTypeByName(node2.GetFullName());
-
- Assert.AreNotSame(t1, t2);
- }
-
- [TestMethod]
- public void TestNameCantBindWrongSubclassAsDefault()
- {
- TestNegativeCase(typeof(BadName),
- "class org.apache.reef.tang.implementation.BadName defines a default class Int32 with a type that does not extend of its target's type string");
- }
-
-
- [TestMethod]
- public void TestNameCantBindWrongSubclassOfArgumentAsDefault()
- {
- TestNegativeCase(typeof(BadNameForGeneric),
- "class BadNameForGeneric defines a default class Int32 with a type that does not extend of its target's string in ISet<string>");
- }
-
- [TestMethod]
- public void TestNameCantBindSubclassOfArgumentAsDefault()
- {
- INode node = ns.GetNode(typeof(GoodNameForGeneric).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(GoodNameForGeneric).AssemblyQualifiedName);
- }
-
- [TestMethod]
- public void TestInterfaceCantBindWrongImplAsDefault()
- {
- TestNegativeCase(typeof(IBadIfaceDefault),
- "interface IBadIfaceDefault declares its default implementation to be non-subclass class string");
- }
-
- private void TestNegativeCase(Type clazz, string message)
- {
- string msg = null;
- try
- {
- var node = ns.GetNode(typeof(IBadIfaceDefault).AssemblyQualifiedName);
- msg = message + node.GetName();
- }
- catch (Exception)
- {
- }
- Assert.IsNull(msg, msg);
- }
-
- [TestMethod]
- public void TestParseableDefaultClassNotOK()
- {
- TestNegativeCase(typeof(BadParsableDefaultClass),
- "Named parameter BadParsableDefaultClass defines default implementation for parsable type System.string");
- }
-
- [TestMethod]
- public void testGenericTorture1()
- {
- g(typeof(GenericTorture1));
- }
- [TestMethod]
- public void testGenericTorture2()
- {
- g(typeof(GenericTorture2));
- }
- [TestMethod]
- public void testGenericTorture3()
- {
- g(typeof(GenericTorture3));
- }
- [TestMethod]
- public void testGenericTorture4()
- {
- g(typeof(GenericTorture4));
- }
-
- public string s(Type t)
- {
- return ReflectionUtilities.GetAssemblyQualifiedName(t);
- }
- public INode g(Type t)
- {
- INode n = ns.GetNode(s(t));
- Assert.IsNotNull(n);
- return n;
- }
-
- [TestMethod]
- public void TestHelloTaskNode()
- {
- var node = ns.GetNode(typeof(Org.Apache.Reef.Tasks.HelloTask).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(Org.Apache.Reef.Tasks.HelloTask)));
- }
-
- [TestMethod]
- public void TestITackNode()
- {
- var node = ns.GetNode(typeof(Org.Apache.Reef.Tasks.ITask).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(Org.Apache.Reef.Tasks.ITask)));
- }
-
- [TestMethod]
- public void TestNamedParameterIdentifier()
- {
- var node = ns.GetNode(typeof(Org.Apache.Reef.Tasks.TaskConfigurationOptions.Identifier).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(Org.Apache.Reef.Tasks.TaskConfigurationOptions.Identifier)));
- }
- [TestMethod]
- public void TestInterface()
- {
- g(typeof(A));
- g(typeof(MyInterface<int>));
- g(typeof(MyInterface<string>));
- g(typeof(B));
-
- ITang tang = TangFactory.GetTang();
- ICsConfigurationBuilder cb = tang.NewConfigurationBuilder();
-
- cb.BindImplementation(GenericType<MyInterface<string>>.Class, GenericType<MyImplString>.Class);
- cb.BindImplementation(GenericType<MyInterface<int>>.Class, GenericType<MyImplInt>.Class);
- IConfiguration conf = cb.Build();
- IInjector i = tang.NewInjector(conf);
-
- var a = (A)i.GetInstance(typeof(A));
- var implString = (MyImplString)i.GetInstance(typeof(MyImplString));
- var implInt = (MyImplString)i.GetInstance(typeof(MyImplString));
- var b = (B)i.GetInstance(typeof(B));
- var c = (C)i.GetInstance(typeof(C));
-
- Assert.IsNotNull(a);
- Assert.IsNotNull(implString);
- Assert.IsNotNull(implInt);
- Assert.IsNotNull(b);
- Assert.IsNotNull(c);
- }
- }
-
- [NamedParameter]
- class GenericTorture1 : Name<ISet<string>> {
- }
- [NamedParameter]
- class GenericTorture2 : Name<ISet<ISet<string>>>
- {
- }
- [NamedParameter]
- class GenericTorture3 : Name<IDictionary<ISet<string>, ISet<string>>>
- {
- }
- [NamedParameter]
- class GenericTorture4 : Name<IDictionary<string, string>>
- {
- }
-
- public interface MyInterface<T>
- {
-
- }
-
- public class RepeatConstructorArg
- {
- [Inject]
- public RepeatConstructorArg(int x, int y)
- {
- }
- }
-
- public class RepeatConstructorArgClasses
- {
- [Inject]
- public RepeatConstructorArgClasses(A x, A y)
- {
- }
- }
-
- public class A : MyInterface<int>, MyInterface<string>
- {
- [Inject]
- A()
- {
- }
- }
-
- public class MyImplString : MyInterface<string>
- {
- [Inject]
- public MyImplString()
- {
- }
- }
-
- public class B
- {
- [Inject]
- public B(MyInterface<string> b)
- {
- }
- }
-
- public class MyImplInt : MyInterface<int>
- {
- [Inject]
- public MyImplInt()
- {
- }
- }
- public class C
- {
- [Inject]
- public C(MyInterface<int> b)
- {
- }
- }
- public class LeafRepeatedConstructorArgClasses
- {
-
- public static class A
- {
- public class AA
- {
- }
- }
-
- public static class B
- {
- public class AA
- {
- }
- }
-
- public class C
- {
- [Inject]
- public C(A.AA a, B.AA b)
- {
- }
- }
- }
-
- class D
- {
- }
- [NamedParameter]
- class D1 : Name<D>
- {
- }
-
- [NamedParameter]
- class D2 : Name<D>
- {
- }
-
- class NamedRepeatConstructorArgClasses
- {
- [Inject]
- public NamedRepeatConstructorArgClasses([Parameter(typeof(D1))] D x, [Parameter(typeof(D2))] D y)
- {
- }
- }
-
- class NamedParameterTypeMismatch
- {
- [NamedParameter(Documentation = "doc.stuff", DefaultValue = "1")]
- class Foo : Name<Int32>
- {
- }
-
- [Inject]
- public NamedParameterTypeMismatch([Parameter(Value = typeof(Foo))] string s)
- {
- }
- }
-
- class UnannotatedName : Name<string> {
- }
-
- interface I1
- {
- }
-
- [NamedParameter(Documentation = "c")]
- class AnnotatedNotName
- {
- }
-
- [NamedParameter(Documentation = "c")]
- class AnnotatedNameWrongInterface : I1
- {
- }
-
- class UnAnnotatedNameMultipleInterfaces : Name<object>, I1
- {
- }
-
- [NamedParameter(Documentation = "c")]
- class AnnotatedNameMultipleInterfaces : Name<object>, I1
- {
- }
-
- [NamedParameter(Documentation = "c")]
- class NameWithConstructor : Name<object>
- {
- private NameWithConstructor(int i)
- {
- }
- }
-
- [NamedParameter]
- class NameWithZeroArgInject : Name<object>
- {
- [Inject]
- public NameWithZeroArgInject()
- {
- }
- }
-
- class InjectNonStaticLocalArgClass
- {
- class NonStaticLocal
- {
- }
-
- [Inject]
- InjectNonStaticLocalArgClass(NonStaticLocal x)
- {
- }
- }
-
- class InjectNonStaticLocalType
- {
- class NonStaticLocal
- {
- [Inject]
- NonStaticLocal(NonStaticLocal x)
- {
- }
- }
- }
-
- [NamedParameter(ShortName = "foo")]
- public class ShortNameFooA : Name<String>
- {
- }
-
- //when same short name is used, exception would throw when building the class hierarchy
- [NamedParameter(ShortName = "foo")]
- public class ShortNameFooB : Name<Int32>
- {
- }
-
- class Nested
- {
- public class Inner
- {
- }
- }
-
- class AnonNested
- {
- public interface X
- {
- }
-
- public class X1 : X
- {
- //int i;
- }
-
- public class Y1 : X
- {
- //int j;
- }
-
- public static X XObj = new X1();
- public static X YObj = new Y1();
- }
-
- //Negative case: Int32 doesn't match string
- [NamedParameter(DefaultClass = typeof(Int32))]
- class BadName : Name<string>
- {
- }
-
- //Negative case: Int32 doesn't match string in the ISet
- [NamedParameter(DefaultClass = typeof(Int32))]
- class BadNameForGeneric : Name<ISet<string>>
- {
- }
-
- //Positive case: type matched. ISet is not in parsable list
- [NamedParameter(DefaultClass = typeof(string))]
- class GoodNameForGeneric : Name<ISet<string>>
- {
- }
-
- [DefaultImplementation(typeof(string))]
- interface IBadIfaceDefault
- {
- }
-
- //negative case: type matched. However, string is in the parsable list and DefaultClass is not null.
- [NamedParameter(DefaultClass = typeof(string))]
- class BadParsableDefaultClass : Name<string>
- {
- }
- }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/TangTests/ClassHierarchy/TestClassHierarchyRoundTrip.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/TangTests/ClassHierarchy/TestClassHierarchyRoundTrip.cs b/lang/cs/Tests/TangTests/ClassHierarchy/TestClassHierarchyRoundTrip.cs
deleted file mode 100644
index e8c48f6..0000000
--- a/lang/cs/Tests/TangTests/ClassHierarchy/TestClassHierarchyRoundTrip.cs
+++ /dev/null
@@ -1,69 +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.Globalization;
-using System.IO;
-using Org.Apache.Reef.Tang.Implementations;
-using Org.Apache.Reef.Tang.Protobuf;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Org.Apache.Reef.Tang.Examples;
-
-namespace Org.Apache.Reef.Tang.Test.ClassHierarchy
-{
- [TestClass]
- public class TestClassHierarchyRoundTrip : TestClassHierarchy
- {
- private void setup1()
- {
- TangImpl.Reset();
- ns = TangFactory.GetTang().GetClassHierarchy(new string[] { FileNames.Examples, FileNames.Common, FileNames.Tasks });
- }
-
- private void setup2()
- {
- TangImpl.Reset();
- ns = new ProtocolBufferClassHierarchy(ProtocolBufferClassHierarchy.Serialize(ns));
- }
-
- private void setup3()
- {
- TangImpl.Reset();
- try
- {
- ProtocolBufferClassHierarchy.Serialize("testProto.bin", ns);
- ns = ProtocolBufferClassHierarchy.DeSerialize("testProto.bin");
- }
- catch (IOException e)
- {
- Assert.Fail(string.Format(CultureInfo.CurrentCulture, "IOException when serialize/deserialize proto buffer file", e));
- }
- }
-
- //[TestMethod]
- //public new void TestString()
- //{
- // setup1();
- // base.TestSimpleConstructors();
- // setup2();
- // base.TestSimpleConstructors();
- // setup3();
- // base.TestSimpleConstructors();
- //}
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/TangTests/ClassHierarchy/TestGeneric.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/TangTests/ClassHierarchy/TestGeneric.cs b/lang/cs/Tests/TangTests/ClassHierarchy/TestGeneric.cs
deleted file mode 100644
index 80a95fe..0000000
--- a/lang/cs/Tests/TangTests/ClassHierarchy/TestGeneric.cs
+++ /dev/null
@@ -1,46 +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.Collections.Generic;
-using Org.Apache.Reef.Tang.Examples;
-using Org.Apache.Reef.Tang.Implementations;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Org.Apache.Reef.Wake.RX;
-
-namespace Org.Apache.Reef.Tang.Test.ClassHierarchy
-{
- [TestClass]
- public class TestGeneric
- {
- [ClassInitialize]
- public static void ClassSetup(TestContext context)
- {
- TangImpl.Reset();
- }
-
- [TestMethod]
- public void TestGenericClassWithT()
- {
- List<string> appDlls = new List<string>();
- appDlls.Add(typeof(GenericArgument<>).Assembly.GetName().Name);
- appDlls.Add(typeof(AbstractObserver<>).Assembly.GetName().Name);
- TangFactory.GetTang().GetClassHierarchy(appDlls.ToArray());
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/TangTests/ClassHierarchy/TestMultipleInterface.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/TangTests/ClassHierarchy/TestMultipleInterface.cs b/lang/cs/Tests/TangTests/ClassHierarchy/TestMultipleInterface.cs
deleted file mode 100644
index 3567a4b..0000000
--- a/lang/cs/Tests/TangTests/ClassHierarchy/TestMultipleInterface.cs
+++ /dev/null
@@ -1,103 +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 Org.Apache.Reef.Tang.Annotations;
-using Org.Apache.Reef.Tang.Implementations;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Org.Apache.Reef.Tang.Test.ClassHierarchy
-{
- [TestClass]
- public class TestMultipleInterface
- {
- [TestMethod]
- public void TestFoo()
- {
- var ch = TangFactory.GetTang().GetDefaultClassHierarchy();
- var fNode = ch.GetNode(typeof(Org.Apache.Reef.Tang.Test.ClassHierarchy.Foo));
- var bNode = ch.GetNode(typeof(Org.Apache.Reef.Tang.Test.ClassHierarchy.Bar));
- var fbNode = ch.GetNode(typeof(Org.Apache.Reef.Tang.Test.ClassHierarchy.BarFoo));
- }
- }
-
- public class Foo : IObserver<int>
- {
- [Inject]
- public Foo()
- {
- }
-
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
-
- public void OnError(Exception error)
- {
- throw new NotImplementedException();
- }
-
- public void OnNext(int value)
- {
- throw new NotImplementedException();
- }
- }
-
- public class Bar : IObserver<string>
- {
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
-
- public void OnError(Exception error)
- {
- throw new NotImplementedException();
- }
-
- public void OnNext(string value)
- {
- throw new NotImplementedException();
- }
- }
-
- public class BarFoo : IObserver<string>, IObserver<int>
- {
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
-
- public void OnError(Exception error)
- {
- throw new NotImplementedException();
- }
-
- public void OnNext(string value)
- {
- throw new NotImplementedException();
- }
-
- public void OnNext(int value)
- {
- throw new NotImplementedException();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/TangTests/ClassHierarchy/TestParameterParser.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/TangTests/ClassHierarchy/TestParameterParser.cs b/lang/cs/Tests/TangTests/ClassHierarchy/TestParameterParser.cs
deleted file mode 100644
index efd1ba7..0000000
--- a/lang/cs/Tests/TangTests/ClassHierarchy/TestParameterParser.cs
+++ /dev/null
@@ -1,323 +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 Org.Apache.Reef.Tang.Annotations;
-using Org.Apache.Reef.Tang.Implementations;
-using Org.Apache.Reef.Tang.Interface;
-using Org.Apache.Reef.Tang.Util;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Org.Apache.Reef.Tang.Test.ClassHierarchy
-{
- [TestClass]
- public class TestParameterParser
- {
- [TestMethod]
- public void ParseIntTest()
- {
- var parser = new ParameterParser();
- Int32 o = (Int32)parser.Parse(typeof(Int32), "4");
-
- }
-
- [TestMethod]
- public void ParseBoolTest()
- {
- var parser = new ParameterParser();
- Boolean o = (Boolean)parser.Parse(typeof(Boolean), "false");
- }
-
- [TestMethod]
- public void ParseLongTest()
- {
- var parser = new ParameterParser();
- long o = (long)parser.Parse(typeof(long), "8675309");
- }
-
- [TestMethod]
- public void ParseStringTest()
- {
- var parser = new ParameterParser();
- string o = (string)parser.Parse(typeof(string), "hello");
- }
-
- [TestMethod]
- public void ParseDoubleTest()
- {
- var parser = new ParameterParser();
- Double o = (Double)parser.Parse(typeof(double), "12.6");
- }
-
- [TestMethod]
- public void ParseCharTest()
- {
- var parser = new ParameterParser();
- Char o = (Char)parser.Parse(typeof(char), "c");
- }
-
- [TestMethod]
- public void ParseByteTest()
- {
- var parser = new ParameterParser();
- Byte o = (Byte)parser.Parse(typeof(byte), "8");
- }
-
- [TestMethod]
- public void ParseShortTest()
- {
- var parser = new ParameterParser();
- Int16 o = (Int16)parser.Parse(typeof(short), "8");
- }
-
- [TestMethod]
- public void ParseFloatTest()
- {
- var parser = new ParameterParser();
- Single o = (Single)parser.Parse(typeof(float), "8.567");
- }
-
- [TestMethod]
- public void ParseByteArrayTest()
- {
- var parser = new ParameterParser();
- byte[] o = (byte[])parser.Parse(typeof(byte[]), "hello");
- }
-
- [TestMethod]
- public void ParameterParserTest()
- {
- ParameterParser p = new ParameterParser();
- p.AddParser(typeof(FooParser));
- Foo f = (Foo)p.Parse(typeof(Foo), "woot");
- Assert.AreEqual(f.s, "woot");
- }
-
- [TestMethod]
- public void TestUnregisteredParameterParser()
- {
- ParameterParser p = new ParameterParser();
-
- //p.AddParser(typeof(FooParser));
- Foo f = null;
- try
- {
- f = (Foo) p.Parse(typeof (Foo), "woot");
- }
- catch (NotSupportedException)
- {
- }
- Assert.IsNull(f);
- }
-
- [TestMethod]
- public void TestReturnSubclass()
- {
- ParameterParser p = new ParameterParser();
- p.AddParser(typeof(BarParser));
- Bar f = (Bar)p.Parse(typeof(Foo), "woot");
- Assert.AreEqual(f.s, "woot");
- }
-
- [TestMethod]
- public void TestGoodMerge()
- {
- ParameterParser old = new ParameterParser();
- old.AddParser(typeof(BarParser));
- ParameterParser nw = new ParameterParser();
- nw.MergeIn(old);
- Bar f = (Bar)nw.Parse(typeof(Foo), "woot");
- Assert.AreEqual(f.s, "woot");
- }
-
- [TestMethod]
- public void TestGoodMerge2()
- {
- ParameterParser old = new ParameterParser();
- old.AddParser(typeof(BarParser));
- ParameterParser nw = new ParameterParser();
- nw.AddParser(typeof(BarParser));
- nw.MergeIn(old);
- Bar f = (Bar)nw.Parse(typeof(Foo), "woot");
- Assert.AreEqual(f.s, "woot");
- }
-
- [TestMethod]
- public void TestBadMerge()
- {
- string msg = null;
- try
- {
- ParameterParser old = new ParameterParser();
- old.AddParser(typeof(BarParser));
- ParameterParser nw = new ParameterParser();
- nw.AddParser(typeof(FooParser));
- nw.MergeIn(old);
- msg = "Conflict detected when merging parameter parsers! To parse org.apache.reef.tang.implementation.java.TestParameterParser$Foo I have a: TestParameterParser$FooParser the other instance has a: TestParameterParser$BarParser";
- }
- catch (ArgumentException)
- {
- }
- Assert.IsNull(msg);
- }
-
- [TestMethod]
- public void testEndToEnd()
- {
- ITang tang = TangFactory.GetTang();
- ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(new Type[] {typeof(BarParser) });
- cb.BindNamedParameter<SomeNamedFoo, Foo>(GenericType<SomeNamedFoo>.Class, "hdfs://woot");
- ILikeBars ilb = tang.NewInjector(cb.Build()).GetInstance<ILikeBars>();
- Assert.IsNotNull(ilb);
- }
-
- [TestMethod]
- public void TestDelegatingParser()
- {
- ITang tang = TangFactory.GetTang();
- ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(new string[] { }, new IConfiguration[] { }, new Type[] { typeof(TypeParser) });
-
- ICsConfigurationBuilder cb2 = tang.NewConfigurationBuilder(new IConfiguration[] { cb.Build() });
-
- cb2.BindNamedParameter<ParseName, ParseableType>(GenericType<ParseName>.Class, "a"); //ParseName : Name<ParseableType>
-
- ParseableType t = (ParseableType)tang.NewInjector(cb2.Build()).GetNamedInstance(typeof(ParseName));
- Assert.IsTrue(t is ParseTypeA);
-
- cb2 = tang.NewConfigurationBuilder(cb.Build());
- cb2.BindNamedParameter<ParseNameB, ParseTypeB>(GenericType<ParseNameB>.Class, "b"); //ParseNameB : Name<ParseTypeB : ParseableType>
- cb2.BindNamedParameter<ParseNameA, ParseableType>(GenericType<ParseNameA>.Class, "a"); //ParseNameA : Name<ParseableType>
-
- tang.NewInjector(cb2.Build()).GetInstance(typeof(NeedsA));
- tang.NewInjector(cb2.Build()).GetInstance(typeof(NeedsB));
- }
-
- class FooParser : IExternalConstructor<Foo>
- {
- private Foo foo;
- [Inject]
- public FooParser(string s)
- {
- this.foo = new Foo(s);
- }
-
- public Foo NewInstance()
- {
- return foo;
- }
- }
-
- class BarParser : IExternalConstructor<Foo>
- {
- private Bar bar;
- [Inject]
- public BarParser(String s)
- {
- this.bar = new Bar(s);
- }
- public Foo NewInstance()
- {
- return bar;
- }
- }
-
- class Foo
- {
- public readonly string s;
- public Foo(string s) { this.s = s; }
- }
- class Bar : Foo
- {
- public Bar(string s) : base(s) { }
- }
-
- [NamedParameter]
- class SomeNamedFoo : Name<Foo> { }
-
- class ILikeBars
- {
- [Inject]
- ILikeBars([Parameter(typeof(SomeNamedFoo))] Foo bar)
- {
- Bar b = (Bar)bar;
- Assert.AreEqual(b.s, "hdfs://woot");
- }
- }
-
- class ParseableType
- {
- }
-
- class ParseTypeA : ParseableType
- {
- }
-
- class ParseTypeB : ParseableType
- {
- }
-
- class TypeParser : IExternalConstructor<ParseableType>
- {
- ParseableType instance;
- [Inject]
- public TypeParser(String s)
- {
- if (s.Equals("a")) { instance = new ParseTypeA(); }
- if (s.Equals("b")) { instance = new ParseTypeB(); }
- }
-
- public ParseableType NewInstance()
- {
- return instance;
- }
- }
-
- [NamedParameter]
- class ParseName : Name<ParseableType>
- {
- }
-
- [NamedParameter]
- class ParseNameA : Name<ParseableType>
- {
- }
-
- [NamedParameter]
- class ParseNameB : Name<ParseTypeB>
- {
- }
-
- class NeedsA
- {
- [Inject]
- public NeedsA([Parameter(typeof(ParseNameA))] ParseableType a)
- {
- Assert.IsTrue(a is ParseTypeA);
- }
- }
-
- class NeedsB
- {
- [Inject]
- public NeedsB([Parameter(typeof(ParseNameB))] ParseTypeB b)
- {
- Assert.IsTrue(b is ParseTypeB);
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Tests/TangTests/ClassHierarchy/TestSerilization.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/TangTests/ClassHierarchy/TestSerilization.cs b/lang/cs/Tests/TangTests/ClassHierarchy/TestSerilization.cs
deleted file mode 100644
index 9313fb1..0000000
--- a/lang/cs/Tests/TangTests/ClassHierarchy/TestSerilization.cs
+++ /dev/null
@@ -1,234 +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.Collections.Generic;
-using System.Reflection;
-using Org.Apache.Reef.Tasks;
-using Org.Apache.Reef.Tang.Implementations;
-using Org.Apache.Reef.Tang.Interface;
-using Org.Apache.Reef.Tang.Protobuf;
-using Org.Apache.Reef.Tang.Types;
-using Org.Apache.Reef.Tang.Util;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Org.Apache.Reef.Tang.Examples;
-
-namespace Org.Apache.Reef.Tang.Test.ClassHierarchy
-{
- [TestClass]
- public class TestSerilization
- {
- static Assembly asm = null;
-
- [ClassInitialize]
- public static void ClassSetup(TestContext context)
- {
- asm = Assembly.Load(FileNames.Examples);
- Assembly.Load(FileNames.Examples);
- }
-
- [ClassCleanup]
- public static void ClassCleanup()
- {
- }
-
- [TestInitialize()]
- public void TestSetup()
- {
- }
-
- [TestCleanup()]
- public void TestCleanup()
- {
- }
-
- [TestMethod]
- public void TestSerializeClassHierarchy()
- {
- IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(Timer).Assembly.GetName().Name });
- ProtocolBufferClassHierarchy.Serialize("node.bin", ns);
- }
-
- [TestMethod]
- public void TestDeSerializeClassHierarchy()
- {
- Type timerType = typeof (Timer);
- Type SecondType = typeof (Timer.Seconds);
- Type simpleCOnstuctorType = typeof (SimpleConstructors);
-
- IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(Timer).Assembly.GetName().Name });
- IClassNode timerClassNode = (IClassNode)ns.GetNode(timerType.AssemblyQualifiedName);
- INode secondNode = (INode)ns.GetNode(SecondType.AssemblyQualifiedName);
- IClassNode SimpleConstructorsClassNode = (IClassNode)ns.GetNode(simpleCOnstuctorType.AssemblyQualifiedName);
-
- ProtocolBufferClassHierarchy.Serialize("node.bin", ns);
- IClassHierarchy ch = ProtocolBufferClassHierarchy.DeSerialize("node.bin");
-
- IClassNode timerClassNode2 = (IClassNode)ch.GetNode(timerType.AssemblyQualifiedName);
- INode secondNode2 = ch.GetNode(SecondType.AssemblyQualifiedName);
- IClassNode SimpleConstructorsClassNode2 = (IClassNode)ch.GetNode(simpleCOnstuctorType.AssemblyQualifiedName);
-
- Assert.AreEqual(timerClassNode.GetFullName(), timerClassNode2.GetFullName());
- Assert.AreEqual(secondNode.GetFullName(), secondNode2.GetFullName());
- Assert.AreEqual(SimpleConstructorsClassNode.GetFullName(), SimpleConstructorsClassNode2.GetFullName());
-
- Assert.IsTrue(SimpleConstructorsClassNode2.GetChildren().Count == 0);
- IList<IConstructorDef> def = SimpleConstructorsClassNode2.GetInjectableConstructors();
- Assert.AreEqual(3, def.Count);
- }
-
- [TestMethod]
- public void TestDeSerializeClassHierarchyForTask()
- {
- Type streamTask1Type = typeof (Org.Apache.Reef.Tasks.StreamTask1);
- Type helloTaskType = typeof (Org.Apache.Reef.Tasks.HelloTask);
-
- IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(Org.Apache.Reef.Tasks.HelloTask).Assembly.GetName().Name });
- IClassNode StreamTask1ClassNode = (IClassNode)ns.GetNode(streamTask1Type.AssemblyQualifiedName);
- IClassNode HelloTaskClassNode = (IClassNode)ns.GetNode(helloTaskType.AssemblyQualifiedName);
-
- ProtocolBufferClassHierarchy.Serialize("task.bin", ns);
- IClassHierarchy ch = ProtocolBufferClassHierarchy.DeSerialize("task.bin");
- IClassNode StreamTask1ClassNode2 = (IClassNode)ch.GetNode(streamTask1Type.AssemblyQualifiedName);
- IClassNode HelloTaskClassNode2 = (IClassNode)ch.GetNode(helloTaskType.AssemblyQualifiedName);
-
- Assert.AreEqual(StreamTask1ClassNode.GetFullName(), StreamTask1ClassNode2.GetFullName());
- Assert.AreEqual(HelloTaskClassNode.GetFullName(), HelloTaskClassNode2.GetFullName());
- }
-
- [TestMethod]
- [DeploymentItem(@".")]
- public void TestDeSerializeClassHierarchyFromJava()
- {
- //the file comes from Java TestClassHierarchyRoundTrip SetUp3 testSimpleConstructors
- IClassHierarchy ch = ProtocolBufferClassHierarchy.DeSerialize("simpleConstructorJavaProto.bin");
- IClassNode simpleConstructorNode = (IClassNode)ch.GetNode("org.apache.reef.tang.implementation.SimpleConstructors");
- Assert.AreEqual(simpleConstructorNode.GetChildren().Count, 0);
- Assert.AreEqual(simpleConstructorNode.GetInjectableConstructors().Count, 3);
- }
-
- [TestMethod]
- public void TestSerializeClassHierarchyForAvro()
- {
- IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(Microsoft.Hadoop.Avro.AvroSerializer).Assembly.GetName().Name });
- Assert.IsNotNull(ns);
- ProtocolBufferClassHierarchy.Serialize("avro.bin", ns);
- IClassHierarchy ch = ProtocolBufferClassHierarchy.DeSerialize("avro.bin");
- Assert.IsNotNull(ch);
- }
-
- [TestMethod]
- public void TestDeSerializeClassHierarchyAndBind()
- {
- Type streamTask1Type = typeof(Org.Apache.Reef.Tasks.StreamTask1);
- Type helloTaskType = typeof(Org.Apache.Reef.Tasks.HelloTask);
-
- IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(Org.Apache.Reef.Tasks.HelloTask).Assembly.GetName().Name });
- IClassNode StreamTask1ClassNode = (IClassNode)ns.GetNode(streamTask1Type.AssemblyQualifiedName);
- IClassNode HelloTaskClassNode = (IClassNode)ns.GetNode(helloTaskType.AssemblyQualifiedName);
-
- ProtocolBufferClassHierarchy.Serialize("task.bin", ns);
- IClassHierarchy ch = ProtocolBufferClassHierarchy.DeSerialize("task.bin");
- IClassNode StreamTask1ClassNode2 = (IClassNode)ch.GetNode(streamTask1Type.AssemblyQualifiedName);
- IClassNode HelloTaskClassNode2 = (IClassNode)ch.GetNode(helloTaskType.AssemblyQualifiedName);
-
- Assert.AreEqual(StreamTask1ClassNode.GetName(), StreamTask1ClassNode2.GetName());
- Assert.AreEqual(HelloTaskClassNode.GetName(), HelloTaskClassNode2.GetName());
-
- //have to use original class hierarchy for the merge. ClassHierarchy from ProtoBuffer doesn't support merge.
- IConfigurationBuilder cb = TangFactory.GetTang()
- .NewConfigurationBuilder(ns);
- cb.AddConfiguration(TaskConfiguration.ConfigurationModule
- .Set(TaskConfiguration.Identifier, "Hello_From_Streaming1")
- .Set(TaskConfiguration.Task, GenericType<Org.Apache.Reef.Tasks.StreamTask1>.Class)
- .Build());
-
- IConfiguration taskConfiguration = cb.Build();
- StreamTask1 st = TangFactory.GetTang().NewInjector(taskConfiguration).GetInstance<StreamTask1>();
- Assert.IsNotNull(st);
- }
-
- [TestMethod]
- public void TestSerirializeInjectionPlanForTimer()
- {
- Type timerType = typeof(Timer);
- ITang tang = TangFactory.GetTang();
- ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(new string[] { FileNames.Examples });
- cb.BindNamedParameter<Timer.Seconds, Int32>(GenericType < Timer.Seconds>.Class, "2");
- IConfiguration conf = cb.Build();
- IInjector injector = tang.NewInjector(conf);
- InjectionPlan ip = injector.GetInjectionPlan(timerType);
- ProtocolBufferInjectionPlan.Serialize("timerplan.bin", ip);
- var ch = conf.GetClassHierarchy();
- var ip1 = ProtocolBufferInjectionPlan.DeSerialize("timerplan.bin", ch);
- Assert.IsNotNull(ip1);
- }
-
- [TestMethod]
- public void TestSerirializeInjectionPlanForSimpleConstructor()
- {
- Type simpleConstructorType = typeof(SimpleConstructors);
-
- ITang tang = TangFactory.GetTang();
- ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(new string[] { FileNames.Examples });
- IConfiguration conf = cb.Build();
- IInjector injector = tang.NewInjector(conf);
- InjectionPlan ip = injector.GetInjectionPlan(simpleConstructorType);
-
- ProtocolBufferInjectionPlan.Serialize("plan.bin", ip);
- var ch = conf.GetClassHierarchy();
- var ipRecovered = ProtocolBufferInjectionPlan.DeSerialize("plan.bin", ch);
- Assert.IsNotNull(ipRecovered);
- }
-
- [TestMethod]
- public void TestGenericClass()
- {
- IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(Timer).Assembly.GetName().Name });
-
- Type t = typeof(Timer);
- IClassNode EventClassNode = (IClassNode)ns.GetNode(t.AssemblyQualifiedName);
- ProtocolBufferClassHierarchy.Serialize("event.bin", ns);
- IClassHierarchy ch = ProtocolBufferClassHierarchy.DeSerialize("event.bin");
- IClassNode EventClassNode1 = (IClassNode)ns.GetNode(t.AssemblyQualifiedName);
- Assert.AreEqual(EventClassNode.GetName(), EventClassNode1.GetName());
- }
-
- [TestMethod]
- public void TestGenericArgument()
- {
- IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(ClassWithGenericArgument<>).Assembly.GetName().Name });
-
- Type t = typeof(ClassWithGenericArgument<>);
- IClassNode classNode = (IClassNode)ns.GetNode(t.AssemblyQualifiedName);
- var cons = classNode.GetAllConstructors();
- foreach (var c in cons)
- {
- var args = c.GetArgs();
- foreach (var a in args)
- {
- Assert.IsNotNull(a.GetName());
- }
- }
- ProtocolBufferClassHierarchy.Serialize("generic.bin", ns);
- IClassHierarchy ch = ProtocolBufferClassHierarchy.DeSerialize("generic.bin");
- IClassNode classNode1 = (IClassNode)ns.GetNode(t.AssemblyQualifiedName);
- Assert.AreEqual(classNode.GetName(), classNode1.GetName());
- }
- }
-}
\ No newline at end of file