[REEF-487] Enable checkstyle for test source directories This addressed the issue by * turning on includeTestSourceDirectory param in checkstyle * fixing checkstyle violations in test sources
JIRA: [REEF-487](https://issues.apache.org/jira/browse/REEF-487) Pull Request: This closes #320 Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/a5cc9729 Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/a5cc9729 Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/a5cc9729 Branch: refs/heads/master Commit: a5cc9729912e8df430e1d8f37414b9eaff7d5107 Parents: 7b4f9f1 Author: Mariia Mykhailova <[email protected]> Authored: Tue Jul 21 17:37:39 2015 -0700 Committer: Markus Weimer <[email protected]> Committed: Mon Jul 27 12:41:15 2015 -0700 ---------------------------------------------------------------------- .../driver/EvaluatorRequestorImplTest.java | 24 ++++--- .../common/driver/catalog/CatalogTest.java | 2 +- .../common/driver/catalog/package-info.java | 22 ++++++ .../runtime/common/driver/package-info.java | 22 ++++++ .../org/apache/reef/util/DeadlockInfoTest.java | 10 +-- .../org/apache/reef/util/LoggingScopeTest.java | 24 +++---- .../java/org/apache/reef/util/package-info.java | 22 ++++++ .../reef/examples/hello/package-info.java | 22 ++++++ .../reef/examples/suspend/package-info.java | 22 ++++++ .../reef/io/data/loading/impl/package-info.java | 22 ++++++ .../GroupCommunicationMessageCodecTest.java | 9 ++- .../reef/io/network/group/package-info.java | 22 ++++++ .../apache/reef/io/network/util/TestUtils.java | 48 ++++++++----- .../reef/io/network/util/package-info.java | 22 ++++++ .../reef/services/network/NameClientTest.java | 14 ++-- .../reef/services/network/NamingTest.java | 52 ++++++++------ .../network/NetworkConnectionServiceTest.java | 39 ++++++---- .../services/network/NetworkServiceTest.java | 53 ++++++++------ .../apache/reef/services/network/TestEvent.java | 2 +- .../reef/services/network/package-info.java | 22 ++++++ .../services/network/util/LoggingUtils.java | 8 ++- .../reef/services/network/util/Monitor.java | 3 +- .../util/NetworkMessagingTestService.java | 6 +- .../services/network/util/package-info.java | 3 + .../reef/services/storage/SpoolFileTest.java | 7 +- .../reef/services/storage/package-info.java | 22 ++++++ .../TestHDInsightRESTJsonSerialization.java | 35 +++++---- .../reef/runtime/hdinsight/package-info.java | 22 ++++++ .../local/driver/ResourceRequestQueueTest.java | 3 +- .../reef/runtime/local/driver/package-info.java | 22 ++++++ .../reef/tang/implementation/Subplan.java | 2 +- .../tang/ClassHierarchyDeserializationTest.java | 30 +++++--- .../org/apache/reef/tang/TestBindSingleton.java | 6 +- .../org/apache/reef/tang/TestClassLoaders.java | 6 +- .../apache/reef/tang/TestConfFileParser.java | 2 +- .../reef/tang/TestImplicitConversions.java | 24 +++---- .../apache/reef/tang/TestInjectionFuture.java | 12 ++-- .../org/apache/reef/tang/TestListInjection.java | 18 ++--- .../reef/tang/TestNamedParameterRoundTrip.java | 65 ++++++++--------- .../java/org/apache/reef/tang/TestTang.java | 59 +++++++++------ .../org/apache/reef/tang/TestTweetExample.java | 19 ++--- ...onfigurationSerializerAvroRoundtripTest.java | 3 +- ...figurationSerializerStringRoundtripTest.java | 3 +- .../tang/formats/ConfigurationFileTest.java | 3 +- .../reef/tang/formats/TestCommandLine.java | 4 +- .../tang/formats/TestConfigurationModule.java | 14 ++-- .../apache/reef/tang/formats/package-info.java | 22 ++++++ .../tang/implementation/TestClassHierarchy.java | 73 +++++++++++-------- .../tang/implementation/avro/package-info.java | 22 ++++++ .../java/TestConfigurationBuilder.java | 7 +- .../java/TestParameterParser.java | 5 +- .../tang/implementation/java/package-info.java | 22 ++++++ .../reef/tang/implementation/package-info.java | 22 ++++++ .../java/org/apache/reef/tang/package-info.java | 22 ++++++ .../org/apache/reef/tang/test/AnInterface.java | 2 +- .../tang/test/AnInterfaceImplementation.java | 12 +++- .../apache/reef/tang/test/CyclicDependency.java | 18 +++-- .../tang/test/CyclicDependencyClassOne.java | 14 ++-- .../tang/test/CyclicDependencyClassTwo.java | 8 ++- .../java/org/apache/reef/tang/test/Handler.java | 2 +- .../apache/reef/tang/test/InjectableClass.java | 12 +++- .../apache/reef/tang/test/ListOfBaseTypes.java | 20 ++++-- .../reef/tang/test/ListOfImplementations.java | 12 +++- .../apache/reef/tang/test/ObjectTreeTest.java | 6 +- .../reef/tang/test/RootImplementation.java | 58 ++++++++++----- .../test/RootImplementationWithoutList.java | 52 ++++++++++---- .../apache/reef/tang/test/RootInterface.java | 2 +- .../apache/reef/tang/test/RoundTripTest.java | 3 +- .../reef/tang/test/SetInterfaceImplOne.java | 12 +++- .../reef/tang/test/SetInterfaceImplTwo.java | 12 +++- .../apache/reef/tang/test/SetOfBaseTypes.java | 20 ++++-- .../reef/tang/test/SetOfImplementations.java | 12 +++- .../reef/tang/test/TestConfiguration.java | 18 ++--- .../tang/test/TestConfigurationWithoutList.java | 2 +- .../org/apache/reef/tang/test/UnitClass.java | 42 ++++++++--- .../org/apache/reef/tests/AllTestsSuite.java | 2 +- .../java/org/apache/reef/tests/FailureTest.java | 3 +- .../apache/reef/tests/LocalTestEnvironment.java | 8 +-- .../apache/reef/tests/MesosTestEnvironment.java | 7 +- .../apache/reef/tests/ProbabilisticTests.java | 2 +- .../apache/reef/tests/TestEnvironmentBase.java | 2 +- .../reef/tests/TestEnvironmentFactory.java | 8 ++- .../java/org/apache/reef/tests/TestUtils.java | 6 ++ .../apache/reef/tests/YarnTestEnvironment.java | 6 +- .../reef/tests/close_eval/package-info.java | 22 ++++++ .../ConfigurationProviderTest.java | 12 ++-- .../parameters/DriverAndEvaluatorParameter.java | 5 ++ .../parameters/DriverParameter.java | 8 ++- .../parameters/EvaluatorParameter.java | 8 ++- .../parameters/package-info.java | 4 +- .../apache/reef/tests/driver/package-info.java | 22 ++++++ .../evaluatorexit/EvaluatorExitTestTask.java | 2 +- .../evaluatorfailure/EvaluatorFailureTest.java | 9 ++- .../reef/tests/evaluatorreuse/package-info.java | 22 ++++++ .../tests/evaluatorsize/EvaluatorSizeTest.java | 5 +- .../evaluatorsize/EvaluatorSizeTestDriver.java | 2 +- .../tests/evaluatorsize/MemorySizeTask.java | 6 +- .../reef/tests/examples/ExamplesTestSuite.java | 2 +- .../reef/tests/examples/package-info.java | 2 +- .../apache/reef/tests/fail/FailTestSuite.java | 2 +- .../apache/reef/tests/fail/package-info.java | 22 ++++++ .../reef/tests/files/FileResourceTest.java | 5 +- .../tests/files/FileResourceTestDriver.java | 3 +- .../reef/tests/files/FileResourceTestTask.java | 5 +- .../ActiveContextHandler.java | 2 +- .../AllocatedEvaluatorHandler.java | 5 +- .../CompletedTaskHandler.java | 3 +- .../StartHandler.java | 5 +- .../package-info.java | 22 ++++++ .../org/apache/reef/tests/package-info.java | 22 ++++++ .../awareness/RackAwareEvaluatorTestDriver.java | 5 +- .../reef/tests/rack/awareness/package-info.java | 2 +- .../tests/subcontexts/SubContextDriver.java | 4 +- .../tests/taskcounting/TaskCountingDriver.java | 2 +- .../util/cache/CacheImplConcurrentTest.java | 2 +- .../apache/reef/util/cache/CacheImplTest.java | 6 +- .../reef/util/cache/ImmediateInteger.java | 2 +- .../apache/reef/util/cache/SleepingInteger.java | 4 +- .../reef/util/cache/WrappedValueTest.java | 18 ++--- .../apache/reef/util/cache/package-info.java | 22 ++++++ .../java/org/apache/reef/util/package-info.java | 22 ++++++ .../wake/test/BlockingEventHandlerTest.java | 9 ++- .../test/BlockingSignalEventHandlerTest.java | 35 +++++---- .../reef/wake/test/ForkPoolStageTest.java | 15 ++-- ...ndependentIterationsThreadPoolStageTest.java | 28 ++++---- .../org/apache/reef/wake/test/MetricsTest.java | 4 +- .../wake/test/PubSubThreadPoolStageTest.java | 7 +- .../apache/reef/wake/test/StageManagerTest.java | 2 - .../apache/reef/wake/test/SyncStageTest.java | 4 +- .../reef/wake/test/ThreadPoolStageTest.java | 17 +++-- .../apache/reef/wake/test/TimerStageTest.java | 11 +-- .../reef/wake/test/examples/SkipListTest.java | 59 ++++++++++----- .../reef/wake/test/examples/TestCombiner.java | 76 ++++++++++---------- .../reef/wake/test/examples/package-info.java | 22 ++++++ .../reef/wake/test/remote/LargeMsgTest.java | 55 +++++++------- .../remote/RemoteIdentifierFactoryTest.java | 8 +-- .../wake/test/remote/RemoteManagerTest.java | 47 ++++++------ .../reef/wake/test/remote/RemoteTest.java | 14 ++-- .../wake/test/remote/SmallMessagesTest.java | 11 +-- .../reef/wake/test/remote/TestEventCodec.java | 2 +- .../reef/wake/test/remote/TestRemote.java | 3 +- .../wake/test/remote/TransportRaceTest.java | 9 +-- .../reef/wake/test/remote/TransportTest.java | 13 ++-- .../org/apache/reef/wake/test/rx/RxTest.java | 5 +- .../wake/test/rx/RxThreadPoolStageTest.java | 2 - .../apache/reef/wake/test/time/ClockTest.java | 3 +- .../reef/webserver/TestAvroHttpSerializer.java | 24 +++---- .../webserver/TestAvroSerializerForHttp.java | 41 +++++++---- .../reef/webserver/TestHttpConfiguration.java | 12 ++-- .../apache/reef/webserver/TestHttpServer.java | 4 +- .../apache/reef/webserver/TestJettyHandler.java | 2 +- .../reef/webserver/TestReefEventHandler.java | 2 +- .../webserver/TestReefEventStateManager.java | 4 +- .../reef/webserver/TestRuntimeStartHandler.java | 21 +++--- .../apache/reef/webserver/TestTrackingUri.java | 12 ++-- .../org/apache/reef/webserver/package-info.java | 22 ++++++ pom.xml | 1 + 157 files changed, 1672 insertions(+), 704 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/EvaluatorRequestorImplTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/EvaluatorRequestorImplTest.java b/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/EvaluatorRequestorImplTest.java index 3ef77f8..a786be9 100644 --- a/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/EvaluatorRequestorImplTest.java +++ b/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/EvaluatorRequestorImplTest.java @@ -51,9 +51,11 @@ public class EvaluatorRequestorImplTest { public void testMemoryOnly() { final int memory = 777; final DummyRequestHandler requestHandler = new DummyRequestHandler(); - final EvaluatorRequestor evaluatorRequestor = new EvaluatorRequestorImpl(resourceCatalog, requestHandler, loggingScopeFactory); + final EvaluatorRequestor evaluatorRequestor = + new EvaluatorRequestorImpl(resourceCatalog, requestHandler, loggingScopeFactory); evaluatorRequestor.submit(EvaluatorRequest.newBuilder().setMemory(memory).build()); - Assert.assertEquals("Memory request did not make it", memory, requestHandler.get().getMemorySize().get().intValue()); + Assert.assertEquals("Memory request did not make it", + memory, requestHandler.get().getMemorySize().get().intValue()); Assert.assertEquals("Number of requests did not make it", 1, requestHandler.get().getResourceCount()); } @@ -65,9 +67,11 @@ public class EvaluatorRequestorImplTest { final int memory = 777; final int count = 9; final DummyRequestHandler requestHandler = new DummyRequestHandler(); - final EvaluatorRequestor evaluatorRequestor = new EvaluatorRequestorImpl(resourceCatalog, requestHandler, loggingScopeFactory); + final EvaluatorRequestor evaluatorRequestor = + new EvaluatorRequestorImpl(resourceCatalog, requestHandler, loggingScopeFactory); evaluatorRequestor.submit(EvaluatorRequest.newBuilder().setMemory(memory).setNumber(count).build()); - Assert.assertEquals("Memory request did not make it", memory, requestHandler.get().getMemorySize().get().intValue()); + Assert.assertEquals("Memory request did not make it", + memory, requestHandler.get().getMemorySize().get().intValue()); Assert.assertEquals("Number of requests did not make it", count, requestHandler.get().getResourceCount()); } @@ -79,8 +83,10 @@ public class EvaluatorRequestorImplTest { final int memory = 0; final int count = 1; final DummyRequestHandler requestHandler = new DummyRequestHandler(); - final EvaluatorRequestor evaluatorRequestor = new EvaluatorRequestorImpl(resourceCatalog, requestHandler, loggingScopeFactory); - evaluatorRequestor.submit(EvaluatorRequest.newBuilder().setMemory(memory).setNumberOfCores(1).setNumber(count).build()); + final EvaluatorRequestor evaluatorRequestor = + new EvaluatorRequestorImpl(resourceCatalog, requestHandler, loggingScopeFactory); + evaluatorRequestor.submit(EvaluatorRequest.newBuilder().setMemory(memory).setNumberOfCores(1).setNumber(count) + .build()); } /** @@ -91,8 +97,10 @@ public class EvaluatorRequestorImplTest { final int memory = 128; final int count = 0; final DummyRequestHandler requestHandler = new DummyRequestHandler(); - final EvaluatorRequestor evaluatorRequestor = new EvaluatorRequestorImpl(resourceCatalog, requestHandler, loggingScopeFactory); - evaluatorRequestor.submit(EvaluatorRequest.newBuilder().setMemory(memory).setNumberOfCores(1).setNumber(count).build()); + final EvaluatorRequestor evaluatorRequestor = + new EvaluatorRequestorImpl(resourceCatalog, requestHandler, loggingScopeFactory); + evaluatorRequestor.submit(EvaluatorRequest.newBuilder().setMemory(memory).setNumberOfCores(1).setNumber(count) + .build()); } private class DummyRequestHandler implements ResourceRequestHandler { http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/catalog/CatalogTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/catalog/CatalogTest.java b/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/catalog/CatalogTest.java index b9e9df9..e24661c 100644 --- a/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/catalog/CatalogTest.java +++ b/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/catalog/CatalogTest.java @@ -30,7 +30,7 @@ public final class CatalogTest { * that they exist. */ @Test - public final void TestResourceCatalog() { + public void testResourceCatalog() { final int nodes = 10; final ResourceCatalogImpl catalog = new ResourceCatalogImpl(); http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/catalog/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/catalog/package-info.java b/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/catalog/package-info.java new file mode 100644 index 0000000..777db78 --- /dev/null +++ b/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/catalog/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +/** + * TODO: Document. + */ +package org.apache.reef.runtime.common.driver.catalog; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/package-info.java b/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/package-info.java new file mode 100644 index 0000000..030173e --- /dev/null +++ b/lang/java/reef-common/src/test/java/org/apache/reef/runtime/common/driver/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +/** + * TODO: Document. + */ +package org.apache.reef.runtime.common.driver; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-common/src/test/java/org/apache/reef/util/DeadlockInfoTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/test/java/org/apache/reef/util/DeadlockInfoTest.java b/lang/java/reef-common/src/test/java/org/apache/reef/util/DeadlockInfoTest.java index 3e7b1d4..dc017ed 100644 --- a/lang/java/reef-common/src/test/java/org/apache/reef/util/DeadlockInfoTest.java +++ b/lang/java/reef-common/src/test/java/org/apache/reef/util/DeadlockInfoTest.java @@ -34,17 +34,17 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; /** - * Test DeadlockInfo by creating a deadlock + * Test DeadlockInfo by creating a deadlock. */ public final class DeadlockInfoTest { private static final Logger LOG = Logger.getLogger(DeadlockInfoTest.class.getName()); - private static final long timeoutMillis = 50; + private static final long TIMEOUT_MILLIS = 50; /** * Create a deadlock consisting of two threads. * The threads wait on a barrier, and once the barrier is met they proceed to deadlock. - * setUpClass sleeps for timeoutMillis to allow the threads time to progress past the barrier into deadlock. + * setUpClass sleeps for TIMEOUT_MILLIS to allow the threads time to progress past the barrier into deadlock. * * One thread holds an Object and Long lock, and is waiting on an Integer lock. * The other thread holds the Integer lock and is waiting on the Long lock. @@ -52,7 +52,7 @@ public final class DeadlockInfoTest { @BeforeClass public static void setUpClass() { createDeadlock(); - threadSleep(timeoutMillis); + threadSleep(TIMEOUT_MILLIS); } /** @@ -130,7 +130,7 @@ public final class DeadlockInfoTest { private static void barrierAwait(final CyclicBarrier barrier) { try { - barrier.await(timeoutMillis, TimeUnit.MILLISECONDS); + barrier.await(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { e.printStackTrace(); fail("Unexpected exception"); http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-common/src/test/java/org/apache/reef/util/LoggingScopeTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/test/java/org/apache/reef/util/LoggingScopeTest.java b/lang/java/reef-common/src/test/java/org/apache/reef/util/LoggingScopeTest.java index a6a3989..628ae23 100644 --- a/lang/java/reef-common/src/test/java/org/apache/reef/util/LoggingScopeTest.java +++ b/lang/java/reef-common/src/test/java/org/apache/reef/util/LoggingScopeTest.java @@ -20,7 +20,6 @@ package org.apache.reef.util; import org.apache.reef.tang.ConfigurationBuilder; -import org.apache.reef.tang.ExternalConstructor; import org.apache.reef.tang.Injector; import org.apache.reef.tang.Tang; import org.apache.reef.tang.exceptions.InjectionException; @@ -29,12 +28,8 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import javax.inject.Inject; -import java.util.logging.Level; -import java.util.logging.Logger; - /** - * Test LoggingScope + * Test LoggingScope. */ public class LoggingScopeTest { @@ -50,30 +45,31 @@ public class LoggingScopeTest { } /** - * Test getNewLoggingScope() in LoggingScopeFactory that injects LoggingScope object + * Test getNewLoggingScope() in LoggingScopeFactory that injects LoggingScope object. * * @throws Exception */ @Test public void testGetNewLoggingScope() throws InjectionException { try (final LoggingScope ls = logFactory.getNewLoggingScope("test")) { - Assert.assertTrue(true); + Assert.assertTrue(true); } } /** - * Test getNewLoggingScope() in LoggingScopeFactory that injects LoggingScope object with param as a parameter + * Test getNewLoggingScope() in LoggingScopeFactory that injects LoggingScope object with param as a parameter. * @throws InjectionException */ @Test public void testGetNewLoggingScopeWithParam() throws InjectionException { - try (final LoggingScope ls = logFactory.getNewLoggingScope("test first string = {0}, second = {1}", new Object[] { "first", "second" })) { + try (final LoggingScope ls = logFactory.getNewLoggingScope("test first string = {0}, second = {1}", + new Object[] {"first", "second"})) { Assert.assertTrue(true); } } /** - * Test calling predefined method in LoggingScopeFactory + * Test calling predefined method in LoggingScopeFactory. * * @throws Exception */ @@ -85,15 +81,15 @@ public class LoggingScopeTest { } /** - * Use default log level in injecting LoggingScopeFactory constructor + * Use default log level in injecting LoggingScopeFactory constructor. * @throws InjectionException */ @Test public void testLoggingScopeFactoryWithDefaultLogLevel() throws InjectionException { final Injector i = Tang.Factory.getTang().newInjector(Tang.Factory.getTang().newConfigurationBuilder().build()); - final LoggingScopeFactory logFactory = i.getInstance(LoggingScopeFactory.class); + final LoggingScopeFactory localLogFactory = i.getInstance(LoggingScopeFactory.class); - try (final LoggingScope ls = logFactory.activeContextReceived("test")) { + try (final LoggingScope ls = localLogFactory.activeContextReceived("test")) { Assert.assertTrue(true); } } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-common/src/test/java/org/apache/reef/util/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/test/java/org/apache/reef/util/package-info.java b/lang/java/reef-common/src/test/java/org/apache/reef/util/package-info.java new file mode 100644 index 0000000..9c0bc9e --- /dev/null +++ b/lang/java/reef-common/src/test/java/org/apache/reef/util/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +/** + * TODO: Document. + */ +package org.apache.reef.util; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-examples/src/test/java/org/apache/reef/examples/hello/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-examples/src/test/java/org/apache/reef/examples/hello/package-info.java b/lang/java/reef-examples/src/test/java/org/apache/reef/examples/hello/package-info.java new file mode 100644 index 0000000..d2fe07b --- /dev/null +++ b/lang/java/reef-examples/src/test/java/org/apache/reef/examples/hello/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +/** + * TODO: Document. + */ +package org.apache.reef.examples.hello; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-examples/src/test/java/org/apache/reef/examples/suspend/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-examples/src/test/java/org/apache/reef/examples/suspend/package-info.java b/lang/java/reef-examples/src/test/java/org/apache/reef/examples/suspend/package-info.java new file mode 100644 index 0000000..e7524c0 --- /dev/null +++ b/lang/java/reef-examples/src/test/java/org/apache/reef/examples/suspend/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +/** + * TODO: Document. + */ +package org.apache.reef.examples.suspend; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/io/data/loading/impl/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/io/data/loading/impl/package-info.java b/lang/java/reef-io/src/test/java/org/apache/reef/io/data/loading/impl/package-info.java new file mode 100644 index 0000000..627f2f8 --- /dev/null +++ b/lang/java/reef-io/src/test/java/org/apache/reef/io/data/loading/impl/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +/** + * TODO: Document. + */ +package org.apache.reef.io.data.loading.impl; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/io/network/group/GroupCommunicationMessageCodecTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/io/network/group/GroupCommunicationMessageCodecTest.java b/lang/java/reef-io/src/test/java/org/apache/reef/io/network/group/GroupCommunicationMessageCodecTest.java index 2ba2fb6..e41ab8c 100644 --- a/lang/java/reef-io/src/test/java/org/apache/reef/io/network/group/GroupCommunicationMessageCodecTest.java +++ b/lang/java/reef-io/src/test/java/org/apache/reef/io/network/group/GroupCommunicationMessageCodecTest.java @@ -50,7 +50,8 @@ public class GroupCommunicationMessageCodecTest { @Test(timeout = 100) public final void testInstantiation() throws InjectionException { - final GroupCommunicationMessageCodec codec = Tang.Factory.getTang().newInjector().getInstance(GroupCommunicationMessageCodec.class); + final GroupCommunicationMessageCodec codec = + Tang.Factory.getTang().newInjector().getInstance(GroupCommunicationMessageCodec.class); Assert.assertNotNull("tang.getInstance(GroupCommunicationMessageCodec.class): ", codec); } @@ -59,14 +60,16 @@ public class GroupCommunicationMessageCodecTest { final Random r = new Random(); final byte[] data = new byte[100]; r.nextBytes(data); - final GroupCommunicationMessage expMsg = Utils.bldVersionedGCM(GroupName.class, OperName.class, ReefNetworkGroupCommProtos.GroupCommMessage.Type.ChildAdd, "From", 0, "To", 1, data); + final GroupCommunicationMessage expMsg = Utils.bldVersionedGCM(GroupName.class, OperName.class, + ReefNetworkGroupCommProtos.GroupCommMessage.Type.ChildAdd, "From", 0, "To", 1, data); final GroupCommunicationMessageCodec codec = new GroupCommunicationMessageCodec(); final GroupCommunicationMessage actMsg1 = codec.decode(codec.encode(expMsg)); Assert.assertEquals("decode(encode(msg)): ", expMsg, actMsg1); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final DataOutputStream daos = new DataOutputStream(baos); codec.encodeToStream(expMsg, daos); - final GroupCommunicationMessage actMsg2 = codec.decodeFromStream(new DataInputStream(new ByteArrayInputStream(baos.toByteArray()))); + final GroupCommunicationMessage actMsg2 = + codec.decodeFromStream(new DataInputStream(new ByteArrayInputStream(baos.toByteArray()))); Assert.assertEquals("decodeFromStream(encodeToStream(msg)): ", expMsg, actMsg2); } } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/io/network/group/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/io/network/group/package-info.java b/lang/java/reef-io/src/test/java/org/apache/reef/io/network/group/package-info.java new file mode 100644 index 0000000..eafc13b --- /dev/null +++ b/lang/java/reef-io/src/test/java/org/apache/reef/io/network/group/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +/** + * TODO: Document. + */ +package org.apache.reef.io.network.group; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/io/network/util/TestUtils.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/io/network/util/TestUtils.java b/lang/java/reef-io/src/test/java/org/apache/reef/io/network/util/TestUtils.java index ec861d0..ee305ec 100644 --- a/lang/java/reef-io/src/test/java/org/apache/reef/io/network/util/TestUtils.java +++ b/lang/java/reef-io/src/test/java/org/apache/reef/io/network/util/TestUtils.java @@ -22,18 +22,22 @@ import com.google.protobuf.ByteString; import org.apache.reef.io.network.proto.ReefNetworkGroupCommProtos; import org.apache.reef.wake.Identifier; -public class TestUtils { - public static ReefNetworkGroupCommProtos.GroupCommMessage bldGCM(final ReefNetworkGroupCommProtos.GroupCommMessage.Type msgType, final Identifier from, final Identifier to, final byte[]... elements) { - final ReefNetworkGroupCommProtos.GroupCommMessage.Builder GCMBuilder = ReefNetworkGroupCommProtos.GroupCommMessage.newBuilder(); - GCMBuilder.setType(msgType); - GCMBuilder.setSrcid(from.toString()); - GCMBuilder.setDestid(to.toString()); - final ReefNetworkGroupCommProtos.GroupMessageBody.Builder bodyBuilder = ReefNetworkGroupCommProtos.GroupMessageBody.newBuilder(); +public final class TestUtils { + public static ReefNetworkGroupCommProtos.GroupCommMessage bldGCM( + final ReefNetworkGroupCommProtos.GroupCommMessage.Type msgType, + final Identifier from, final Identifier to, final byte[]... elements) { + final ReefNetworkGroupCommProtos.GroupCommMessage.Builder gcmBuilder = + ReefNetworkGroupCommProtos.GroupCommMessage.newBuilder(); + gcmBuilder.setType(msgType); + gcmBuilder.setSrcid(from.toString()); + gcmBuilder.setDestid(to.toString()); + final ReefNetworkGroupCommProtos.GroupMessageBody.Builder bodyBuilder = + ReefNetworkGroupCommProtos.GroupMessageBody.newBuilder(); for (final byte[] element : elements) { bodyBuilder.setData(ByteString.copyFrom(element)); - GCMBuilder.addMsgs(bodyBuilder.build()); + gcmBuilder.addMsgs(bodyBuilder.build()); } - final ReefNetworkGroupCommProtos.GroupCommMessage msg = GCMBuilder.build(); + final ReefNetworkGroupCommProtos.GroupCommMessage msg = gcmBuilder.build(); return msg; } @@ -44,17 +48,23 @@ public class TestUtils { public static boolean controlMessage(final ReefNetworkGroupCommProtos.GroupCommMessage.Type type) { switch (type) { - case AllGather: - case AllReduce: - case Broadcast: - case Gather: - case Reduce: - case ReduceScatter: - case Scatter: - return false; + case AllGather: + case AllReduce: + case Broadcast: + case Gather: + case Reduce: + case ReduceScatter: + case Scatter: + return false; - default: - return true; + default: + return true; } } + + /** + * Empty private constructor to prohibit instantiation of utility class. + */ + private TestUtils() { + } } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/io/network/util/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/io/network/util/package-info.java b/lang/java/reef-io/src/test/java/org/apache/reef/io/network/util/package-info.java new file mode 100644 index 0000000..819a2df --- /dev/null +++ b/lang/java/reef-io/src/test/java/org/apache/reef/io/network/util/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +/** + * TODO: Document. + */ +package org.apache.reef.io.network.util; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NameClientTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NameClientTest.java b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NameClientTest.java index c46e2be..d4afd3e 100644 --- a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NameClientTest.java +++ b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NameClientTest.java @@ -96,7 +96,8 @@ public class NameClientTest { .set(NameResolverConfiguration.RETRY_COUNT, retryCount) .build(); - try (final NameResolver client = Tang.Factory.getTang().newInjector(nameResolverConf).getInstance(NameClient.class)) { + try (final NameResolver client = + Tang.Factory.getTang().newInjector(nameResolverConf).getInstance(NameClient.class)) { final Identifier id = factory.getNewInstance("Task1"); client.register(id, new InetSocketAddress(localAddress, 7001)); client.unregister(id); @@ -130,10 +131,11 @@ public class NameClientTest { .set(NameResolverConfiguration.RETRY_COUNT, retryCount) .build(); - try (final NameResolver client = Tang.Factory.getTang().newInjector(nameResolverConf).getInstance(NameClient.class)) { + try (final NameResolver client = + Tang.Factory.getTang().newInjector(nameResolverConf).getInstance(NameClient.class)) { final Identifier id = factory.getNewInstance("Task1"); client.register(id, new InetSocketAddress(localAddress, 7001)); - client.lookup(id);// caches the entry + client.lookup(id); // caches the entry client.unregister(id); Thread.sleep(100); try { @@ -147,9 +149,11 @@ public class NameClientTest { Assert.assertNull("client.lookup(id)", addr); } catch (Exception e) { if (e instanceof ExecutionException) { - Assert.assertTrue("Execution Exception cause is instanceof NamingException", e.getCause() instanceof NamingException); - } else + Assert.assertTrue("Execution Exception cause is instanceof NamingException", + e.getCause() instanceof NamingException); + } else { throw e; + } } } } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NamingTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NamingTest.java b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NamingTest.java index b726b78..6137155 100644 --- a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NamingTest.java +++ b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NamingTest.java @@ -45,19 +45,19 @@ import java.util.logging.Level; import java.util.logging.Logger; /** - * Naming server and client test + * Naming server and client test. */ public class NamingTest { private static final Logger LOG = Logger.getLogger(NamingTest.class.getName()); - private static final int retryCount; - private static final int retryTimeout; + private static final int RETRY_COUNT; + private static final int RETRY_TIMEOUT; static { try { final Injector injector = Tang.Factory.getTang().newInjector(); - retryCount = injector.getNamedInstance(NameResolverRetryCount.class); - retryTimeout = injector.getNamedInstance(NameResolverRetryTimeout.class); + RETRY_COUNT = injector.getNamedInstance(NameResolverRetryCount.class); + RETRY_TIMEOUT = injector.getNamedInstance(NameResolverRetryTimeout.class); } catch (final InjectionException ex) { final String msg = "Exception while trying to find default values for retryCount & Timeout"; LOG.log(Level.SEVERE, msg, ex); @@ -68,7 +68,7 @@ public class NamingTest { private final LocalAddressProvider localAddressProvider; @Rule public final TestName name = new TestName(); - final long TTL = 30000; + static final long TTL = 30000; final IdentifierFactory factory = new StringIdentifierFactory(); int port; @@ -77,7 +77,7 @@ public class NamingTest { } /** - * NameServer and NameLookupClient test + * NameServer and NameLookupClient test. * * @throws Exception */ @@ -104,7 +104,7 @@ public class NamingTest { // run a client try (final NameLookupClient client = new NameLookupClient(localAddress, this.port, - 10000, this.factory, retryCount, retryTimeout, new NameCache(this.TTL), this.localAddressProvider)) { + 10000, this.factory, RETRY_COUNT, RETRY_TIMEOUT, new NameCache(this.TTL), this.localAddressProvider)) { final Identifier id1 = this.factory.getNewInstance("task1"); final Identifier id2 = this.factory.getNewInstance("task2"); @@ -125,7 +125,7 @@ public class NamingTest { } /** - * Test concurrent lookups (threads share a client) + * Test concurrent lookups (threads share a client). * * @throws Exception */ @@ -158,7 +158,7 @@ public class NamingTest { // run a client try (final NameLookupClient client = new NameLookupClient(localAddress, this.port, - 10000, this.factory, retryCount, retryTimeout, new NameCache(this.TTL), this.localAddressProvider)) { + 10000, this.factory, RETRY_COUNT, RETRY_TIMEOUT, new NameCache(this.TTL), this.localAddressProvider)) { final Identifier id1 = this.factory.getNewInstance("task1"); final Identifier id2 = this.factory.getNewInstance("task2"); @@ -166,7 +166,8 @@ public class NamingTest { final ExecutorService e = Executors.newCachedThreadPool(); - final ConcurrentMap<Identifier, InetSocketAddress> respMap = new ConcurrentHashMap<Identifier, InetSocketAddress>(); + final ConcurrentMap<Identifier, InetSocketAddress> respMap = + new ConcurrentHashMap<Identifier, InetSocketAddress>(); final Future<?> f1 = e.submit(new Runnable() { @Override @@ -223,7 +224,7 @@ public class NamingTest { } /** - * NameServer and NameRegistryClient test + * NameServer and NameRegistryClient test. * * @throws Exception */ @@ -246,8 +247,8 @@ public class NamingTest { // registration // invoke registration from the client side - try (final NameRegistryClient client = new NameRegistryClient(localAddress, - this.port, this.factory, this.localAddressProvider)) { + try (final NameRegistryClient client = + new NameRegistryClient(localAddress, this.port, this.factory, this.localAddressProvider)) { for (final Identifier id : idToAddrMap.keySet()) { client.register(id, idToAddrMap.get(id)); } @@ -278,8 +279,9 @@ public class NamingTest { serverMap = new HashMap<Identifier, InetSocketAddress>(); nas = server.lookup(ids); - for (final NameAssignment na : nas) + for (final NameAssignment na : nas) { serverMap.put(na.getIdentifier(), na.getAddress()); + } Assert.assertEquals(0, serverMap.size()); } @@ -287,7 +289,7 @@ public class NamingTest { } /** - * NameServer and NameClient test + * NameServer and NameClient test. * * @throws Exception */ @@ -313,8 +315,8 @@ public class NamingTest { .set(NameResolverConfiguration.NAME_SERVER_HOSTNAME, localAddress) .set(NameResolverConfiguration.NAME_SERVICE_PORT, this.port) .set(NameResolverConfiguration.CACHE_TIMEOUT, this.TTL) - .set(NameResolverConfiguration.RETRY_TIMEOUT, retryTimeout) - .set(NameResolverConfiguration.RETRY_COUNT, retryCount) + .set(NameResolverConfiguration.RETRY_TIMEOUT, RETRY_TIMEOUT) + .set(NameResolverConfiguration.RETRY_COUNT, RETRY_COUNT) .build(); try (final NameResolver client @@ -353,9 +355,13 @@ public class NamingTest { final Map<Identifier, InetSocketAddress> serverMap = new HashMap<Identifier, InetSocketAddress>(); addr1 = server.lookup(id1); - if (addr1 != null) serverMap.put(id1, addr1); + if (addr1 != null) { + serverMap.put(id1, addr1); + } addr2 = server.lookup(id1); - if (addr2 != null) serverMap.put(id2, addr2); + if (addr2 != null) { + serverMap.put(id2, addr2); + } Assert.assertEquals(0, serverMap.size()); } @@ -382,9 +388,9 @@ public class NamingTest { private void busyWait(final NameServer server, final int expected, final Set<Identifier> ids) { int count = 0; - for (; ; ) { + for (;;) { final Iterable<NameAssignment> nas = server.lookup(ids); - for (final @SuppressWarnings("unused") NameAssignment na : nas) { + for (@SuppressWarnings("unused") final NameAssignment na : nas) { ++count; } if (count == expected) { @@ -393,4 +399,4 @@ public class NamingTest { count = 0; } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NetworkConnectionServiceTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NetworkConnectionServiceTest.java b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NetworkConnectionServiceTest.java index 3cb1310..e9c903c 100644 --- a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NetworkConnectionServiceTest.java +++ b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NetworkConnectionServiceTest.java @@ -101,7 +101,8 @@ public class NetworkConnectionServiceTest { runMessagingNetworkConnectionService(new StreamingStringCodec()); } - public void runNetworkConnServiceWithMultipleConnFactories(Codec<String> stringCodec, Codec<Integer> integerCodec) throws Exception { + public void runNetworkConnServiceWithMultipleConnFactories(Codec<String> stringCodec, Codec<Integer> integerCodec) + throws Exception { final ExecutorService executor = Executors.newFixedThreadPool(5); final int groupcommMessages = 1000; @@ -117,7 +118,8 @@ public class NetworkConnectionServiceTest { executor.submit(new Runnable() { @Override public void run() { - try (final Connection<String> conn = messagingTestService.getConnectionFromSenderToReceiver(groupCommClientId)) { + try (final Connection<String> conn = + messagingTestService.getConnectionFromSenderToReceiver(groupCommClientId)) { conn.open(); for (int count = 0; count < groupcommMessages; ++count) { // send messages to the receiver. @@ -134,7 +136,8 @@ public class NetworkConnectionServiceTest { executor.submit(new Runnable() { @Override public void run() { - try (final Connection<Integer> conn = messagingTestService.getConnectionFromSenderToReceiver(shuffleClientId)) { + try (final Connection<Integer> conn = + messagingTestService.getConnectionFromSenderToReceiver(shuffleClientId)) { conn.open(); for (int count = 0; count < shuffleMessages; ++count) { // send messages to the receiver. @@ -194,7 +197,8 @@ public class NetworkConnectionServiceTest { } final String message = msb.toString(); - try (final Connection<String> conn = messagingTestService.getConnectionFromSenderToReceiver(groupCommClientId)) { + try (final Connection<String> conn = + messagingTestService.getConnectionFromSenderToReceiver(groupCommClientId)) { long start = System.currentTimeMillis(); try { @@ -211,7 +215,8 @@ public class NetworkConnectionServiceTest { final long end = System.currentTimeMillis(); final double runtime = ((double) end - start) / 1000; - LOG.log(Level.INFO, "size: " + size + "; messages/s: " + numMessages / runtime + " bandwidth(bytes/s): " + ((double) numMessages * 2 * size) / runtime);// x2 for unicode chars + LOG.log(Level.INFO, "size: " + size + "; messages/s: " + numMessages / runtime + + " bandwidth(bytes/s): " + ((double) numMessages * 2 * size) / runtime); // x2 for unicode chars } } } @@ -241,7 +246,8 @@ public class NetworkConnectionServiceTest { final Codec<String> codec = new StringCodec(); messagingTestService.registerTestConnectionFactory(groupCommClientId, numMessages, monitor, codec); - try (final Connection<String> conn = messagingTestService.getConnectionFromSenderToReceiver(groupCommClientId)) { + try (final Connection<String> conn = + messagingTestService.getConnectionFromSenderToReceiver(groupCommClientId)) { // build the message final StringBuilder msb = new StringBuilder(); @@ -272,18 +278,21 @@ public class NetworkConnectionServiceTest { // start and time final long start = System.currentTimeMillis(); final Object ignore = new Object(); - for (int i = 0; i < numThreads; i++) barrier.add(ignore); + for (int i = 0; i < numThreads; i++) { + barrier.add(ignore); + } e.shutdown(); e.awaitTermination(100, TimeUnit.SECONDS); final long end = System.currentTimeMillis(); final double runtime = ((double) end - start) / 1000; - LOG.log(Level.INFO, "size: " + size + "; messages/s: " + totalNumMessages / runtime + " bandwidth(bytes/s): " + ((double) totalNumMessages * 2 * size) / runtime);// x2 for unicode chars + LOG.log(Level.INFO, "size: " + size + "; messages/s: " + totalNumMessages / runtime + + " bandwidth(bytes/s): " + ((double) totalNumMessages * 2 * size) / runtime); // x2 for unicode chars } @Test public void testMultithreadedSharedConnMessagingNetworkConnServiceRate() throws Exception { LOG.log(Level.FINEST, name.getMethodName()); - final int[] messageSizes = {2000};// {1,16,32,64,512,64*1024,1024*1024}; + final int[] messageSizes = {2000}; // {1,16,32,64,512,64*1024,1024*1024}; for (int size : messageSizes) { final int numMessages = 300000 / (Math.max(1, size / 512)); @@ -302,7 +311,8 @@ public class NetworkConnectionServiceTest { msb.append("1"); } final String message = msb.toString(); - try (final Connection<String> conn = messagingTestService.getConnectionFromSenderToReceiver(groupCommClientId)) { + try (final Connection<String> conn = + messagingTestService.getConnectionFromSenderToReceiver(groupCommClientId)) { final long start = System.currentTimeMillis(); for (int i = 0; i < numThreads; i++) { @@ -328,7 +338,8 @@ public class NetworkConnectionServiceTest { monitor.mwait(); final long end = System.currentTimeMillis(); final double runtime = ((double) end - start) / 1000; - LOG.log(Level.INFO, "size: " + size + "; messages/s: " + totalNumMessages / runtime + " bandwidth(bytes/s): " + ((double) totalNumMessages * 2 * size) / runtime);// x2 for unicode chars + LOG.log(Level.INFO, "size: " + size + "; messages/s: " + totalNumMessages / runtime + + " bandwidth(bytes/s): " + ((double) totalNumMessages * 2 * size) / runtime); // x2 for unicode chars } } } @@ -350,7 +361,8 @@ public class NetworkConnectionServiceTest { final Codec<String> codec = new StringCodec(); try (final NetworkMessagingTestService messagingTestService = new NetworkMessagingTestService(localAddress)) { messagingTestService.registerTestConnectionFactory(groupCommClientId, numMessages, monitor, codec); - try (final Connection<String> conn = messagingTestService.getConnectionFromSenderToReceiver(groupCommClientId)) { + try (final Connection<String> conn = + messagingTestService.getConnectionFromSenderToReceiver(groupCommClientId)) { // build the message final StringBuilder msb = new StringBuilder(); @@ -378,7 +390,8 @@ public class NetworkConnectionServiceTest { final long end = System.currentTimeMillis(); final double runtime = ((double) end - start) / 1000; final long numAppMessages = numMessages * batchSize / size; - LOG.log(Level.INFO, "size: " + size + "; messages/s: " + numAppMessages / runtime + " bandwidth(bytes/s): " + ((double) numAppMessages * 2 * size) / runtime);// x2 for unicode chars + LOG.log(Level.INFO, "size: " + size + "; messages/s: " + numAppMessages / runtime + + " bandwidth(bytes/s): " + ((double) numAppMessages * 2 * size) / runtime); // x2 for unicode chars } } } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NetworkServiceTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NetworkServiceTest.java b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NetworkServiceTest.java index 2b96c11..85b2860 100644 --- a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NetworkServiceTest.java +++ b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/NetworkServiceTest.java @@ -47,7 +47,7 @@ import java.util.logging.Level; import java.util.logging.Logger; /** - * Network service test + * Network service test. */ public class NetworkServiceTest { private static final Logger LOG = Logger.getLogger(NetworkServiceTest.class.getName()); @@ -64,7 +64,7 @@ public class NetworkServiceTest { public TestName name = new TestName(); /** - * NetworkService messaging test + * NetworkService messaging test. */ @Test public void testMessagingNetworkService() throws Exception { @@ -85,7 +85,8 @@ public class NetworkServiceTest { // network service final String name2 = "task2"; final String name1 = "task1"; - final Configuration nameResolverConf = Tang.Factory.getTang().newConfigurationBuilder(NameResolverConfiguration.CONF + final Configuration nameResolverConf = + Tang.Factory.getTang().newConfigurationBuilder(NameResolverConfiguration.CONF .set(NameResolverConfiguration.NAME_SERVER_HOSTNAME, this.localAddress) .set(NameResolverConfiguration.NAME_SERVICE_PORT, nameServerPort) .build()) @@ -129,7 +130,7 @@ public class NetworkServiceTest { } /** - * NetworkService messaging rate benchmark + * NetworkService messaging rate benchmark. */ @Test public void testMessagingNetworkServiceRate() throws Exception { @@ -153,7 +154,8 @@ public class NetworkServiceTest { // network service final String name2 = "task2"; final String name1 = "task1"; - final Configuration nameResolverConf = Tang.Factory.getTang().newConfigurationBuilder(NameResolverConfiguration.CONF + final Configuration nameResolverConf = + Tang.Factory.getTang().newConfigurationBuilder(NameResolverConfiguration.CONF .set(NameResolverConfiguration.NAME_SERVER_HOSTNAME, this.localAddress) .set(NameResolverConfiguration.NAME_SERVICE_PORT, nameServerPort) .build()) @@ -201,14 +203,15 @@ public class NetworkServiceTest { } long end = System.currentTimeMillis(); double runtime = ((double) end - start) / 1000; - LOG.log(Level.FINEST, "size: " + size + "; messages/s: " + numMessages / runtime + " bandwidth(bytes/s): " + ((double) numMessages * 2 * size) / runtime);// x2 for unicode chars + LOG.log(Level.FINEST, "size: " + size + "; messages/s: " + numMessages / runtime + + " bandwidth(bytes/s): " + ((double) numMessages * 2 * size) / runtime); // x2 for unicode chars } } } } /** - * NetworkService messaging rate benchmark + * NetworkService messaging rate benchmark. */ @Test public void testMessagingNetworkServiceRateDisjoint() throws Exception { @@ -243,7 +246,8 @@ public class NetworkServiceTest { // network service final String name2 = "task2-" + tt; final String name1 = "task1-" + tt; - final Configuration nameResolverConf = Tang.Factory.getTang().newConfigurationBuilder(NameResolverConfiguration.CONF + final Configuration nameResolverConf = + Tang.Factory.getTang().newConfigurationBuilder(NameResolverConfiguration.CONF .set(NameResolverConfiguration.NAME_SERVER_HOSTNAME, localAddress) .set(NameResolverConfiguration.NAME_SERVICE_PORT, nameServerPort) .build()) @@ -256,7 +260,8 @@ public class NetworkServiceTest { try (final NameResolver nameResolver = injector.getInstance(NameResolver.class); NetworkService<String> ns2 = new NetworkService<String>(factory, 0, nameResolver, new StringCodec(), new MessagingTransportFactory(localAddressProvider), - new MessageHandler<String>(name2, monitor, numMessages), new ExceptionHandler(), localAddressProvider); + new MessageHandler<String>(name2, monitor, numMessages), + new ExceptionHandler(), localAddressProvider); NetworkService<String> ns1 = new NetworkService<String>(factory, 0, nameResolver, new StringCodec(), new MessagingTransportFactory(localAddressProvider), new MessageHandler<String>(name1, null, 0), new ExceptionHandler(), localAddressProvider)) { @@ -300,13 +305,16 @@ public class NetworkServiceTest { // start and time long start = System.currentTimeMillis(); Object ignore = new Object(); - for (int i = 0; i < numThreads; i++) barrier.add(ignore); + for (int i = 0; i < numThreads; i++) { + barrier.add(ignore); + } e.shutdown(); e.awaitTermination(100, TimeUnit.SECONDS); long end = System.currentTimeMillis(); double runtime = ((double) end - start) / 1000; - LOG.log(Level.FINEST, "size: " + size + "; messages/s: " + totalNumMessages / runtime + " bandwidth(bytes/s): " + ((double) totalNumMessages * 2 * size) / runtime);// x2 for unicode chars + LOG.log(Level.FINEST, "size: " + size + "; messages/s: " + totalNumMessages / runtime + + " bandwidth(bytes/s): " + ((double) totalNumMessages * 2 * size) / runtime); // x2 for unicode chars } } @@ -322,7 +330,7 @@ public class NetworkServiceTest { try (final NameServer server = injector.getInstance(NameServer.class)) { int nameServerPort = server.getPort(); - final int[] messageSizes = {2000};// {1,16,32,64,512,64*1024,1024*1024}; + final int[] messageSizes = {2000}; // {1,16,32,64,512,64*1024,1024*1024}; for (int size : messageSizes) { final int numMessages = 300000 / (Math.max(1, size / 512)); @@ -334,7 +342,8 @@ public class NetworkServiceTest { // network service final String name2 = "task2"; final String name1 = "task1"; - final Configuration nameResolverConf = Tang.Factory.getTang().newConfigurationBuilder(NameResolverConfiguration.CONF + final Configuration nameResolverConf = + Tang.Factory.getTang().newConfigurationBuilder(NameResolverConfiguration.CONF .set(NameResolverConfiguration.NAME_SERVER_HOSTNAME, this.localAddress) .set(NameResolverConfiguration.NAME_SERVICE_PORT, nameServerPort) .build()) @@ -347,7 +356,8 @@ public class NetworkServiceTest { try (final NameResolver nameResolver = injector2.getInstance(NameResolver.class); NetworkService<String> ns2 = new NetworkService<String>(factory, 0, nameResolver, new StringCodec(), new MessagingTransportFactory(localAddressProvider), - new MessageHandler<String>(name2, monitor, totalNumMessages), new ExceptionHandler(), localAddressProvider); + new MessageHandler<String>(name2, monitor, totalNumMessages), + new ExceptionHandler(), localAddressProvider); NetworkService<String> ns1 = new NetworkService<String>(factory, 0, nameResolver, new StringCodec(), new MessagingTransportFactory(localAddressProvider), new MessageHandler<String>(name1, null, 0), new ExceptionHandler(), localAddressProvider)) { @@ -395,7 +405,8 @@ public class NetworkServiceTest { long end = System.currentTimeMillis(); double runtime = ((double) end - start) / 1000; - LOG.log(Level.FINEST, "size: " + size + "; messages/s: " + totalNumMessages / runtime + " bandwidth(bytes/s): " + ((double) totalNumMessages * 2 * size) / runtime);// x2 for unicode chars + LOG.log(Level.FINEST, "size: " + size + "; messages/s: " + totalNumMessages / runtime + + " bandwidth(bytes/s): " + ((double) totalNumMessages * 2 * size) / runtime); // x2 for unicode chars } } } @@ -403,7 +414,7 @@ public class NetworkServiceTest { } /** - * NetworkService messaging rate benchmark + * NetworkService messaging rate benchmark. */ @Test public void testMessagingNetworkServiceBatchingRate() throws Exception { @@ -428,7 +439,8 @@ public class NetworkServiceTest { // network service final String name2 = "task2"; final String name1 = "task1"; - final Configuration nameResolverConf = Tang.Factory.getTang().newConfigurationBuilder(NameResolverConfiguration.CONF + final Configuration nameResolverConf = + Tang.Factory.getTang().newConfigurationBuilder(NameResolverConfiguration.CONF .set(NameResolverConfiguration.NAME_SERVER_HOSTNAME, this.localAddress) .set(NameResolverConfiguration.NAME_SERVICE_PORT, nameServerPort) .build()) @@ -481,14 +493,15 @@ public class NetworkServiceTest { long end = System.currentTimeMillis(); double runtime = ((double) end - start) / 1000; long numAppMessages = numMessages * batchSize / size; - LOG.log(Level.FINEST, "size: " + size + "; messages/s: " + numAppMessages / runtime + " bandwidth(bytes/s): " + ((double) numAppMessages * 2 * size) / runtime);// x2 for unicode chars + LOG.log(Level.FINEST, "size: " + size + "; messages/s: " + numAppMessages / runtime + + " bandwidth(bytes/s): " + ((double) numAppMessages * 2 * size) / runtime); // x2 for unicode chars } } } } /** - * Test message handler + * Test message handler. */ class MessageHandler<T> implements EventHandler<Message<T>> { @@ -523,7 +536,7 @@ public class NetworkServiceTest { } /** - * Test exception handler + * Test exception handler. */ class ExceptionHandler implements EventHandler<Exception> { @Override http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/services/network/TestEvent.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/TestEvent.java b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/TestEvent.java index 21a07ae..494f2e0 100644 --- a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/TestEvent.java +++ b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/TestEvent.java @@ -21,7 +21,7 @@ package org.apache.reef.services.network; import java.io.Serializable; /** - * Event for testing + * Event for testing. */ public class TestEvent implements Serializable { http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/services/network/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/package-info.java b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/package-info.java new file mode 100644 index 0000000..2556f21 --- /dev/null +++ b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +/** + * TODO: Document. + */ +package org.apache.reef.services.network; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/LoggingUtils.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/LoggingUtils.java b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/LoggingUtils.java index e927ec0..d27f4cf 100644 --- a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/LoggingUtils.java +++ b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/LoggingUtils.java @@ -23,7 +23,7 @@ import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.Logger; -public class LoggingUtils { +public final class LoggingUtils { public static void setLoggingLevel(Level level) { Handler[] handlers = Logger.getLogger("").getHandlers(); ConsoleHandler ch = null; @@ -40,4 +40,10 @@ public class LoggingUtils { ch.setLevel(level); Logger.getLogger("").setLevel(level); } + + /** + * Empty private constructor to prohibit instantiation of utility class. + */ + private LoggingUtils() { + } } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/Monitor.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/Monitor.java b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/Monitor.java index 8734a22..161ee6a 100644 --- a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/Monitor.java +++ b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/Monitor.java @@ -25,8 +25,9 @@ public class Monitor { public void mwait() throws InterruptedException { synchronized (this) { - while (!finished.get()) + while (!finished.get()) { this.wait(); + } } } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/NetworkMessagingTestService.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/NetworkMessagingTestService.java b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/NetworkMessagingTestService.java index 0b188c5..ccc2e4b 100644 --- a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/NetworkMessagingTestService.java +++ b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/NetworkMessagingTestService.java @@ -86,8 +86,10 @@ public final class NetworkMessagingTestService implements AutoCloseable { public <T> void registerTestConnectionFactory(final Identifier connFactoryId, final int numMessages, final Monitor monitor, final Codec<T> codec) throws NetworkException { - receiverNetworkConnService.registerConnectionFactory(connFactoryId, codec, new MessageHandler<T>(monitor, numMessages), new TestListener<T>()); - senderNetworkConnService.registerConnectionFactory(connFactoryId, codec, new MessageHandler<T>(monitor, numMessages), new TestListener<T>()); + receiverNetworkConnService.registerConnectionFactory(connFactoryId, codec, + new MessageHandler<T>(monitor, numMessages), new TestListener<T>()); + senderNetworkConnService.registerConnectionFactory(connFactoryId, codec, + new MessageHandler<T>(monitor, numMessages), new TestListener<T>()); } public <T> Connection<T> getConnectionFromSenderToReceiver(final Identifier connFactoryId) { http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/package-info.java b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/package-info.java index 47f0766..5630dec 100644 --- a/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/package-info.java +++ b/lang/java/reef-io/src/test/java/org/apache/reef/services/network/util/package-info.java @@ -16,4 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +/** + * TODO: Document. + */ package org.apache.reef.services.network.util; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/services/storage/SpoolFileTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/services/storage/SpoolFileTest.java b/lang/java/reef-io/src/test/java/org/apache/reef/services/storage/SpoolFileTest.java index ec126ef..9a76b27 100644 --- a/lang/java/reef-io/src/test/java/org/apache/reef/services/storage/SpoolFileTest.java +++ b/lang/java/reef-io/src/test/java/org/apache/reef/services/storage/SpoolFileTest.java @@ -137,9 +137,10 @@ public class SpoolFileTest { final Tang t = Tang.Factory.getTang(); final ConfigurationBuilder configurationBuilderOne = t.newConfigurationBuilder(RamConf.CONF.build()); - final AvroConfigurationSerializer serializer = new AvroConfigurationSerializer(); - final String serializedConfiguration = serializer.toString(configurationBuilderOne.build()); - final ConfigurationBuilder configurationBuilderTwo = t.newConfigurationBuilder(serializer.fromString(serializedConfiguration)); + final AvroConfigurationSerializer avroSerializer = new AvroConfigurationSerializer(); + final String serializedConfiguration = avroSerializer.toString(configurationBuilderOne.build()); + final ConfigurationBuilder configurationBuilderTwo = + t.newConfigurationBuilder(avroSerializer.fromString(serializedConfiguration)); @SuppressWarnings("unchecked") final Spool<Integer> f = (Spool<Integer>) t.newInjector(configurationBuilderTwo.build()).getInstance( http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-io/src/test/java/org/apache/reef/services/storage/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-io/src/test/java/org/apache/reef/services/storage/package-info.java b/lang/java/reef-io/src/test/java/org/apache/reef/services/storage/package-info.java new file mode 100644 index 0000000..15f78cd --- /dev/null +++ b/lang/java/reef-io/src/test/java/org/apache/reef/services/storage/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +/** + * TODO: Document. + */ +package org.apache.reef.services.storage; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-runtime-hdinsight/src/test/java/org/apache/reef/runtime/hdinsight/TestHDInsightRESTJsonSerialization.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-runtime-hdinsight/src/test/java/org/apache/reef/runtime/hdinsight/TestHDInsightRESTJsonSerialization.java b/lang/java/reef-runtime-hdinsight/src/test/java/org/apache/reef/runtime/hdinsight/TestHDInsightRESTJsonSerialization.java index 7af724d..8dc37c4 100644 --- a/lang/java/reef-runtime-hdinsight/src/test/java/org/apache/reef/runtime/hdinsight/TestHDInsightRESTJsonSerialization.java +++ b/lang/java/reef-runtime-hdinsight/src/test/java/org/apache/reef/runtime/hdinsight/TestHDInsightRESTJsonSerialization.java @@ -38,7 +38,7 @@ import java.util.Map; public final class TestHDInsightRESTJsonSerialization { @Test - public void TestSerializeApplicationSubmission() throws IOException { + public void testSerializeApplicationSubmission() throws IOException { // Define expected values final Map<String, LocalResource> localResourceMap = new HashMap<>(); final String archiveKey = "archive"; @@ -84,7 +84,8 @@ public final class TestHDInsightRESTJsonSerialization { Assert.assertEquals(rootJsonNode.get(Constants.APPLICATION_ID).asText(), submission.getApplicationId()); Assert.assertEquals(rootJsonNode.get(Constants.APPLICATION_NAME).asText(), submission.getApplicationName()); Assert.assertEquals(rootJsonNode.get(Constants.MAX_APP_ATTEMPTS).asInt(), submission.getMaxAppAttempts()); - Assert.assertEquals(rootJsonNode.get(Constants.KEEP_CONTAINERS_ACROSS_APPLICATION_ATTEMPTS).asBoolean(), submission.isKeepContainers()); + Assert.assertEquals(rootJsonNode.get(Constants.KEEP_CONTAINERS_ACROSS_APPLICATION_ATTEMPTS).asBoolean(), + submission.isKeepContainers()); Assert.assertEquals(rootJsonNode.get(Constants.QUEUE).asText(), submission.getQueue()); Assert.assertEquals(rootJsonNode.get(Constants.PRIORITY).asInt(), submission.getPriority()); Assert.assertEquals(rootJsonNode.get(Constants.UNMANAGED_AM).asBoolean(), submission.isUnmanagedAM()); @@ -96,7 +97,8 @@ public final class TestHDInsightRESTJsonSerialization { JsonNode amSpecNode = rootJsonNode.get(Constants.AM_CONTAINER_SPEC); Assert.assertNotNull(amSpecNode); - Assert.assertEquals(amSpecNode.get(Constants.COMMANDS).get(Constants.COMMAND).asText(), containerSpec.getCommands().getCommand()); + Assert.assertEquals(amSpecNode.get(Constants.COMMANDS).get(Constants.COMMAND).asText(), + containerSpec.getCommands().getCommand()); JsonNode locResourcesNode = amSpecNode.get(Constants.LOCAL_RESOURCES).get(Constants.ENTRY); Assert.assertTrue(locResourcesNode.isArray()); for (final JsonNode localResourceKVNode : locResourcesNode) { @@ -162,7 +164,7 @@ public final class TestHDInsightRESTJsonSerialization { } @Test - public void TestDeserializeGetApplicationId() throws IOException { + public void testDeserializeGetApplicationId() throws IOException { final String appIdStr = "application_1404198295326_0003"; final int memory = 8192; final int vCores = 32; @@ -183,9 +185,10 @@ public final class TestHDInsightRESTJsonSerialization { } @Test - public void TestDeserializeGetApplication() throws IOException { + public void testDeserializeGetApplication() throws IOException { final long finishedTime = 1326824991300L; - final String amContainerLogs = "http://host.domain.com:8042/node/containerlogs/container_1326821518301_0005_01_000001"; + final String amContainerLogs = + "http://host.domain.com:8042/node/containerlogs/container_1326821518301_0005_01_000001"; final String trackingUI = "History"; final String state = "FINISHED"; final String user = "user1"; @@ -199,7 +202,8 @@ public final class TestHDInsightRESTJsonSerialization { final long startedTime = 1326824544552L; final long elapsedTime = 446748L; final String diagnostics = ""; - final String trackingUrl = "http://host.domain.com:8088/proxy/application_1326821518301_0005/jobhistory/job/job_1326821518301_5_5"; + final String trackingUrl = + "http://host.domain.com:8088/proxy/application_1326821518301_0005/jobhistory/job/job_1326821518301_5_5"; final String queue = "a1"; final long memorySeconds = 151730L; final long vcoreSeconds = 103L; @@ -252,7 +256,7 @@ public final class TestHDInsightRESTJsonSerialization { } @Test - public void TestDeserializeListApplications() throws IOException { + public void testDeserializeListApplications() throws IOException { final String listAppsBody = "{\n" + " \"apps\":\n" + " {\n" + @@ -260,7 +264,8 @@ public final class TestHDInsightRESTJsonSerialization { " [\n" + " {\n" + " \"finishedTime\" : 1326815598530,\n" + - " \"amContainerLogs\" : \"http://host.domain.com:8042/node/containerlogs/container_1326815542473_0001_01_000001\",\n" + + " \"amContainerLogs\" : " + + "\"http://host.domain.com:8042/node/containerlogs/container_1326815542473_0001_01_000001\",\n" + " \"trackingUI\" : \"History\",\n" + " \"state\" : \"FINISHED\",\n" + " \"user\" : \"user1\",\n" + @@ -273,7 +278,8 @@ public final class TestHDInsightRESTJsonSerialization { " \"startedTime\" : 1326815573334,\n" + " \"elapsedTime\" : 25196,\n" + " \"diagnostics\" : \"\",\n" + - " \"trackingUrl\" : \"http://host.domain.com:8088/proxy/application_1326815542473_0001/jobhistory/job/job_1326815542473_1_1\",\n" + + " \"trackingUrl\" : " + + "\"http://host.domain.com:8088/proxy/application_1326815542473_0001/jobhistory/job/job_1326815542473_1_1\",\n" + " \"queue\" : \"default\",\n" + " \"allocatedMB\" : 0,\n" + " \"allocatedVCores\" : 0,\n" + @@ -283,7 +289,8 @@ public final class TestHDInsightRESTJsonSerialization { " },\n" + " {\n" + " \"finishedTime\" : 1326815789546,\n" + - " \"amContainerLogs\" : \"http://host.domain.com:8042/node/containerlogs/container_1326815542473_0002_01_000001\",\n" + + " \"amContainerLogs\" : " + + "\"http://host.domain.com:8042/node/containerlogs/container_1326815542473_0002_01_000001\",\n" + " \"trackingUI\" : \"History\",\n" + " \"state\" : \"FINISHED\",\n" + " \"user\" : \"user1\",\n" + @@ -296,7 +303,8 @@ public final class TestHDInsightRESTJsonSerialization { " \"startedTime\" : 1326815641380,\n" + " \"elapsedTime\" : 148166,\n" + " \"diagnostics\" : \"\",\n" + - " \"trackingUrl\" : \"http://host.domain.com:8088/proxy/application_1326815542473_0002/jobhistory/job/job_1326815542473_2_2\",\n" + + " \"trackingUrl\" : " + + "\"http://host.domain.com:8088/proxy/application_1326815542473_0002/jobhistory/job/job_1326815542473_2_2\",\n" + " \"queue\" : \"default\",\n" + " \"allocatedMB\" : 0,\n" + " \"allocatedVCores\" : 0,\n" + @@ -308,7 +316,8 @@ public final class TestHDInsightRESTJsonSerialization { " }\n" + "}"; - ListApplicationResponse listAppsResponse = new ObjectMapper().readValue(listAppsBody, ListApplicationResponse.class); + ListApplicationResponse listAppsResponse = + new ObjectMapper().readValue(listAppsBody, ListApplicationResponse.class); Assert.assertTrue(listAppsResponse.getApps().containsKey(Constants.APP)); Assert.assertEquals(listAppsResponse.getApplicationStates().size(), 2); for (ApplicationState state : listAppsResponse.getApplicationStates()) { http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-runtime-hdinsight/src/test/java/org/apache/reef/runtime/hdinsight/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-runtime-hdinsight/src/test/java/org/apache/reef/runtime/hdinsight/package-info.java b/lang/java/reef-runtime-hdinsight/src/test/java/org/apache/reef/runtime/hdinsight/package-info.java new file mode 100644 index 0000000..de9c7ac --- /dev/null +++ b/lang/java/reef-runtime-hdinsight/src/test/java/org/apache/reef/runtime/hdinsight/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +/** + * TODO: Document. + */ +package org.apache.reef.runtime.hdinsight; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-runtime-local/src/test/java/org/apache/reef/runtime/local/driver/ResourceRequestQueueTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-runtime-local/src/test/java/org/apache/reef/runtime/local/driver/ResourceRequestQueueTest.java b/lang/java/reef-runtime-local/src/test/java/org/apache/reef/runtime/local/driver/ResourceRequestQueueTest.java index 5e1eaa8..a4271f1 100644 --- a/lang/java/reef-runtime-local/src/test/java/org/apache/reef/runtime/local/driver/ResourceRequestQueueTest.java +++ b/lang/java/reef-runtime-local/src/test/java/org/apache/reef/runtime/local/driver/ResourceRequestQueueTest.java @@ -44,7 +44,8 @@ public class ResourceRequestQueueTest { q.add(getAlmostSatisfied()); Assert.assertTrue("A queue should not be empty after an insert.", q.hasOutStandingRequests()); q.satisfyOne(); - Assert.assertFalse("The queue should be empty after all requests have been satisfied", q.hasOutStandingRequests()); + Assert.assertFalse("The queue should be empty after all requests have been satisfied", + q.hasOutStandingRequests()); } final int nInsert = 10; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-runtime-local/src/test/java/org/apache/reef/runtime/local/driver/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-runtime-local/src/test/java/org/apache/reef/runtime/local/driver/package-info.java b/lang/java/reef-runtime-local/src/test/java/org/apache/reef/runtime/local/driver/package-info.java new file mode 100644 index 0000000..2778f33 --- /dev/null +++ b/lang/java/reef-runtime-local/src/test/java/org/apache/reef/runtime/local/driver/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +/** + * TODO: Document. + */ +package org.apache.reef.runtime.local.driver; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/Subplan.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/Subplan.java b/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/Subplan.java index 5ec7ec5..8a59299 100644 --- a/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/Subplan.java +++ b/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/Subplan.java @@ -150,7 +150,7 @@ public final class Subplan<T> extends InjectionPlan<T> { ambig.add(alt); } } - StringBuffer sb = new StringBuffer("Ambigous subplan " + getNode().getFullName()); + StringBuffer sb = new StringBuffer("Ambiguous subplan " + getNode().getFullName()); for (InjectionPlan<?> alt : alts) { sb.append("\n " + alt.toShallowString() + " "); }
