chore: bump javafmt to 0.10.0 (#2081)

* chore: bump javafmt to 0.10.0

* chore: format with javafmt
This commit is contained in:
He-Pin(kerr) 2025-08-25 19:32:35 +08:00 committed by GitHub
parent b81b50edf6
commit 00b0a99278
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
351 changed files with 2266 additions and 1750 deletions

View file

@ -2,3 +2,8 @@
-J-Xms1G -J-Xms1G
-Dmultinode.XX:MetaspaceSize=128M -Dmultinode.XX:MetaspaceSize=128M
-J-XX:+AlwaysActAsServerClassMachine -J-XX:+AlwaysActAsServerClassMachine
-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED

View file

@ -9,8 +9,11 @@
package jdocs.org.apache.pekko.actor.testkit.typed.javadsl; package jdocs.org.apache.pekko.actor.testkit.typed.javadsl;
import org.apache.pekko.actor.testkit.typed.annotations.JUnit5TestKit; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.apache.pekko.actor.Address; import org.apache.pekko.actor.Address;
import org.apache.pekko.actor.testkit.typed.annotations.JUnit5TestKit;
import org.apache.pekko.actor.testkit.typed.javadsl.*; import org.apache.pekko.actor.testkit.typed.javadsl.*;
import org.apache.pekko.actor.testkit.typed.javadsl.JUnit5TestKitBuilder; import org.apache.pekko.actor.testkit.typed.javadsl.JUnit5TestKitBuilder;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
@ -18,9 +21,6 @@ import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
// #junit5-integration // #junit5-integration
@DisplayName("JUnit5") @DisplayName("JUnit5")
@ExtendWith(TestKitJUnit5Extension.class) @ExtendWith(TestKitJUnit5Extension.class)

View file

@ -17,6 +17,8 @@
package jdocs.org.apache.pekko.actor.testkit.typed.javadsl; package jdocs.org.apache.pekko.actor.testkit.typed.javadsl;
import static jdocs.org.apache.pekko.actor.testkit.typed.javadsl.AsyncTestingExampleTest.Echo;
import org.apache.pekko.actor.testkit.typed.annotations.JUnit5TestKit; import org.apache.pekko.actor.testkit.typed.annotations.JUnit5TestKit;
import org.apache.pekko.actor.testkit.typed.javadsl.*; import org.apache.pekko.actor.testkit.typed.javadsl.*;
import org.apache.pekko.actor.testkit.typed.javadsl.JUnit5TestKitBuilder; import org.apache.pekko.actor.testkit.typed.javadsl.JUnit5TestKitBuilder;
@ -25,8 +27,6 @@ import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import static jdocs.org.apache.pekko.actor.testkit.typed.javadsl.AsyncTestingExampleTest.Echo;
// test code copied from LogCapturingExampleTest.java // test code copied from LogCapturingExampleTest.java
@DisplayName("JUnit5 log capturing") @DisplayName("JUnit5 log capturing")

View file

@ -15,20 +15,17 @@ package jdocs.org.apache.pekko.actor.testkit.typed.javadsl;
// #manual-scheduling-simple // #manual-scheduling-simple
import java.time.Duration;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.testkit.typed.javadsl.ManualTime; import org.apache.pekko.actor.testkit.typed.javadsl.ManualTime;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.scalatestplus.junit.JUnitSuite;
import java.time.Duration;
import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
public class ManualTimerExampleTest extends JUnitSuite { public class ManualTimerExampleTest extends JUnitSuite {

View file

@ -14,22 +14,23 @@
package jdocs.org.apache.pekko.actor.testkit.typed.javadsl; package jdocs.org.apache.pekko.actor.testkit.typed.javadsl;
// #imports // #imports
import static org.junit.Assert.assertEquals;
import com.typesafe.config.Config;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import org.apache.pekko.actor.testkit.typed.CapturedLogEvent; import org.apache.pekko.actor.testkit.typed.CapturedLogEvent;
import org.apache.pekko.actor.testkit.typed.Effect; import org.apache.pekko.actor.testkit.typed.Effect;
import org.apache.pekko.actor.testkit.typed.javadsl.BehaviorTestKit; import org.apache.pekko.actor.testkit.typed.javadsl.BehaviorTestKit;
import org.apache.pekko.actor.testkit.typed.javadsl.TestInbox; import org.apache.pekko.actor.testkit.typed.javadsl.TestInbox;
import org.apache.pekko.actor.typed.*; import org.apache.pekko.actor.typed.*;
import org.apache.pekko.actor.typed.javadsl.*; import org.apache.pekko.actor.typed.javadsl.*;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import com.typesafe.config.Config;
import org.slf4j.event.Level;
// #imports
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import org.slf4j.event.Level;
// #imports
public class SyncTestingExampleTest extends JUnitSuite { public class SyncTestingExampleTest extends JUnitSuite {
@ -39,6 +40,7 @@ public class SyncTestingExampleTest extends JUnitSuite {
return Behaviors.receive((context, message) -> Behaviors.same()); return Behaviors.receive((context, message) -> Behaviors.same());
} }
} }
// #child // #child
// #under-test // #under-test
@ -139,6 +141,7 @@ public class SyncTestingExampleTest extends JUnitSuite {
return Behaviors.same(); return Behaviors.same();
} }
} }
// #under-test // #under-test
@Test @Test

View file

@ -13,14 +13,13 @@
package org.apache.pekko.actor.testkit.typed.javadsl; package org.apache.pekko.actor.testkit.typed.javadsl;
import java.time.Duration;
import java.util.List;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Props; import org.apache.pekko.actor.typed.Props;
import org.apache.pekko.actor.typed.Scheduler; import org.apache.pekko.actor.typed.Scheduler;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import java.time.Duration;
import java.util.List;
public class ActorTestKitApiTest { public class ActorTestKitApiTest {
public void compileOnlyTestCase() { public void compileOnlyTestCase() {

View file

@ -9,22 +9,20 @@
package org.apache.pekko.actor.testkit.typed.javadsl; package org.apache.pekko.actor.testkit.typed.javadsl;
import org.apache.pekko.actor.testkit.typed.annotations.JUnit5TestKit; import static org.apache.pekko.Done.done;
import org.apache.pekko.Done; import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.scalatestplus.junit.JUnitSuite;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.pekko.Done;
import static org.apache.pekko.Done.done; import org.apache.pekko.actor.testkit.typed.annotations.JUnit5TestKit;
import static org.junit.jupiter.api.Assertions.assertEquals; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import static org.junit.jupiter.api.Assertions.assertNotNull; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.scalatestplus.junit.JUnitSuite;
@DisplayName("ActorTestKitTestJUnit5") @DisplayName("ActorTestKitTestJUnit5")
@ExtendWith(TestKitJUnit5Extension.class) @ExtendWith(TestKitJUnit5Extension.class)

View file

@ -13,6 +13,12 @@
package org.apache.pekko.actor.testkit.typed.javadsl; package org.apache.pekko.actor.testkit.typed.javadsl;
import static org.apache.pekko.Done.done;
import static org.junit.Assert.assertEquals;
import java.util.HashMap;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.junit.ClassRule; import org.junit.ClassRule;
@ -20,13 +26,6 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.util.HashMap;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import static org.apache.pekko.Done.done;
import static org.junit.Assert.assertEquals;
public class ActorTestKitTest extends JUnitSuite { public class ActorTestKitTest extends JUnitSuite {
@ClassRule public static TestKitJunitResource testKit = new TestKitJunitResource(); @ClassRule public static TestKitJunitResource testKit = new TestKitJunitResource();

View file

@ -13,6 +13,13 @@
package org.apache.pekko.actor.testkit.typed.javadsl; package org.apache.pekko.actor.testkit.typed.javadsl;
import static org.junit.Assert.*;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.IntStream;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.testkit.typed.CapturedLogEvent; import org.apache.pekko.actor.testkit.typed.CapturedLogEvent;
import org.apache.pekko.actor.testkit.typed.Effect; import org.apache.pekko.actor.testkit.typed.Effect;
@ -25,14 +32,6 @@ import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import org.slf4j.event.Level; import org.slf4j.event.Level;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.IntStream;
import static org.junit.Assert.*;
public class BehaviorTestKitTest extends JUnitSuite { public class BehaviorTestKitTest extends JUnitSuite {
public interface Command {} public interface Command {}

View file

@ -13,6 +13,11 @@
package org.apache.pekko.actor.testkit.typed.javadsl; package org.apache.pekko.actor.testkit.typed.javadsl;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Collections;
import java.util.Optional;
import org.apache.pekko.actor.testkit.typed.LoggingEvent; import org.apache.pekko.actor.testkit.typed.LoggingEvent;
import org.apache.pekko.actor.testkit.typed.TestException; import org.apache.pekko.actor.testkit.typed.TestException;
import org.junit.ClassRule; import org.junit.ClassRule;
@ -21,12 +26,6 @@ import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import org.slf4j.event.Level; import org.slf4j.event.Level;
import java.util.Collections;
import java.util.Optional;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class LoggingTestKitTest extends JUnitSuite { public class LoggingTestKitTest extends JUnitSuite {
@ClassRule public static TestKitJunitResource testKit = new TestKitJunitResource(); @ClassRule public static TestKitJunitResource testKit = new TestKitJunitResource();

View file

@ -13,10 +13,11 @@
package org.apache.pekko.actor.testkit.typed.javadsl; package org.apache.pekko.actor.testkit.typed.javadsl;
import static org.junit.Assert.*;
import java.time.Duration; import java.time.Duration;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.apache.pekko.actor.testkit.typed.scaladsl.TestProbeSpec; import org.apache.pekko.actor.testkit.typed.scaladsl.TestProbeSpec;
import org.apache.pekko.actor.testkit.typed.scaladsl.TestProbeSpec.*; import org.apache.pekko.actor.testkit.typed.scaladsl.TestProbeSpec.*;
import org.junit.ClassRule; import org.junit.ClassRule;
@ -24,8 +25,6 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import static org.junit.Assert.*;
public class TestProbeTest extends JUnitSuite { public class TestProbeTest extends JUnitSuite {
@ClassRule public static TestKitJunitResource testKit = new TestKitJunitResource(); @ClassRule public static TestKitJunitResource testKit = new TestKitJunitResource();

View file

@ -13,17 +13,14 @@
package org.apache.pekko.actor; package org.apache.pekko.actor;
import static org.junit.Assert.*;
import static java.util.stream.Collectors.toCollection; import static java.util.stream.Collectors.toCollection;
import static org.junit.Assert.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import org.apache.pekko.japi.function.Creator;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.apache.pekko.japi.function.Creator;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
public class ActorCreationTest extends JUnitSuite { public class ActorCreationTest extends JUnitSuite {
@ -193,7 +190,8 @@ public class ActorCreationTest extends JUnitSuite {
} }
})); }));
assertEquals( assertEquals(
"cannot use non-static local Creator to create actors; make it static (e.g. local to a static method) or top-level", "cannot use non-static local Creator to create actors; make it static (e.g. local to a"
+ " static method) or top-level",
exception.getMessage()); exception.getMessage());
} }

View file

@ -13,19 +13,17 @@
package org.apache.pekko.actor; package org.apache.pekko.actor;
import static org.junit.Assert.assertEquals;
import java.time.Duration; import java.time.Duration;
import java.util.concurrent.CompletionStage; import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource; import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.testkit.PekkoSpec; import org.apache.pekko.testkit.PekkoSpec;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import static org.junit.Assert.assertEquals;
public class ActorSelectionTest extends JUnitSuite { public class ActorSelectionTest extends JUnitSuite {
@ClassRule @ClassRule

View file

@ -13,17 +13,16 @@
package org.apache.pekko.actor; package org.apache.pekko.actor;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.Assert.assertFalse;
import java.util.concurrent.CompletionStage;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource; import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.util.concurrent.CompletionStage;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.Assert.assertFalse;
public class ActorSystemTest extends JUnitSuite { public class ActorSystemTest extends JUnitSuite {
@Rule @Rule

View file

@ -13,12 +13,11 @@
package org.apache.pekko.actor; package org.apache.pekko.actor;
import org.junit.Test; import static org.junit.Assert.assertEquals;
import org.scalatestplus.junit.JUnitSuite;
import java.util.Optional; import java.util.Optional;
import org.junit.Test;
import static org.junit.Assert.assertEquals; import org.scalatestplus.junit.JUnitSuite;
public class AddressTest extends JUnitSuite { public class AddressTest extends JUnitSuite {

View file

@ -13,29 +13,27 @@
package org.apache.pekko.actor; package org.apache.pekko.actor;
import static org.junit.Assert.*;
import java.util.Optional;
import org.apache.pekko.event.Logging; import org.apache.pekko.event.Logging;
import org.apache.pekko.event.Logging.LoggerInitialized; import org.apache.pekko.event.Logging.LoggerInitialized;
import org.apache.pekko.japi.function.Creator;
import org.apache.pekko.japi.Pair; import org.apache.pekko.japi.Pair;
import org.apache.pekko.japi.Util; import org.apache.pekko.japi.Util;
import org.apache.pekko.japi.function.Creator;
import org.apache.pekko.japi.tuple.Tuple22; import org.apache.pekko.japi.tuple.Tuple22;
import org.apache.pekko.japi.tuple.Tuple4; import org.apache.pekko.japi.tuple.Tuple4;
import org.apache.pekko.routing.GetRoutees;
import org.apache.pekko.routing.FromConfig; import org.apache.pekko.routing.FromConfig;
import org.apache.pekko.routing.GetRoutees;
import org.apache.pekko.routing.NoRouter; import org.apache.pekko.routing.NoRouter;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource; import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.testkit.PekkoSpec; import org.apache.pekko.testkit.PekkoSpec;
import org.apache.pekko.testkit.TestProbe; import org.apache.pekko.testkit.TestProbe;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import scala.Option; import scala.Option;
import java.util.Optional;
import static org.junit.Assert.*;
public class JavaAPI extends JUnitSuite { public class JavaAPI extends JUnitSuite {
@ClassRule @ClassRule

View file

@ -13,14 +13,14 @@
package org.apache.pekko.actor; package org.apache.pekko.actor;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.junit.*;
import org.apache.pekko.testkit.PekkoSpec;
import com.typesafe.config.ConfigFactory;
import org.scalatestplus.junit.JUnitSuite;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import com.typesafe.config.ConfigFactory;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.testkit.PekkoSpec;
import org.junit.*;
import org.scalatestplus.junit.JUnitSuite;
public class JavaExtension extends JUnitSuite { public class JavaExtension extends JUnitSuite {
static class TestExtensionId extends AbstractExtensionId<TestExtension> static class TestExtensionId extends AbstractExtensionId<TestExtension>

View file

@ -15,7 +15,6 @@ package org.apache.pekko.actor;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource; import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.testkit.TestProbe; import org.apache.pekko.testkit.TestProbe;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;

View file

@ -13,12 +13,11 @@
package org.apache.pekko.actor.setup; package org.apache.pekko.actor.setup;
import org.junit.Test; import static org.junit.Assert.*;
import org.scalatestplus.junit.JUnitSuite;
import java.util.Optional; import java.util.Optional;
import org.junit.Test;
import static org.junit.Assert.*; import org.scalatestplus.junit.JUnitSuite;
public class ActorSystemSetupTest extends JUnitSuite { public class ActorSystemSetupTest extends JUnitSuite {

View file

@ -13,11 +13,10 @@
package org.apache.pekko.event; package org.apache.pekko.event;
import org.apache.pekko.actor.AbstractActor;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import org.apache.pekko.actor.AbstractActor;
public class ActorWithMDC extends AbstractActor { public class ActorWithMDC extends AbstractActor {

View file

@ -13,30 +13,28 @@
package org.apache.pekko.event; package org.apache.pekko.event;
import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.actor.Props;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.event.Logging.Error;
import org.apache.pekko.event.ActorWithMDC.Log;
import static org.apache.pekko.event.Logging.*; import static org.apache.pekko.event.Logging.*;
import org.apache.pekko.testkit.javadsl.TestKit;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import java.util.*;
import java.time.Duration;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame; import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import java.time.Duration;
import java.util.*;
import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.actor.Props;
import org.apache.pekko.event.ActorWithMDC.Log;
import org.apache.pekko.event.Logging.Error;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.testkit.javadsl.TestKit;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
public class LoggingAdapterTest extends JUnitSuite { public class LoggingAdapterTest extends JUnitSuite {
private static final Config config = ConfigFactory.parseString("pekko.loglevel = DEBUG\n"); private static final Config config = ConfigFactory.parseString("pekko.loglevel = DEBUG\n");

View file

@ -13,17 +13,15 @@
package org.apache.pekko.japi; package org.apache.pekko.japi;
import static org.junit.Assert.*;
import java.util.concurrent.Callable;
import org.apache.pekko.actor.ExtendedActorSystem; import org.apache.pekko.actor.ExtendedActorSystem;
import org.apache.pekko.event.LoggingAdapter; import org.apache.pekko.event.LoggingAdapter;
import org.apache.pekko.event.NoLogging; import org.apache.pekko.event.NoLogging;
import org.apache.pekko.serialization.JavaSerializer; import org.apache.pekko.serialization.JavaSerializer;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import scala.Option;
import java.util.concurrent.Callable;
import static org.junit.Assert.*;
public class JavaAPITestBase extends JUnitSuite { public class JavaAPITestBase extends JUnitSuite {

View file

@ -13,6 +13,8 @@
package org.apache.pekko.japi; package org.apache.pekko.japi;
import static org.junit.Assert.*;
import org.apache.pekko.japi.function.Function; import org.apache.pekko.japi.function.Function;
import org.apache.pekko.japi.function.Predicate; import org.apache.pekko.japi.function.Predicate;
import org.apache.pekko.japi.pf.Match; import org.apache.pekko.japi.pf.Match;
@ -21,8 +23,6 @@ import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import scala.MatchError; import scala.MatchError;
import static org.junit.Assert.*;
public class MatchBuilderTest extends JUnitSuite { public class MatchBuilderTest extends JUnitSuite {
@Test @Test

View file

@ -13,12 +13,12 @@
package org.apache.pekko.japi.pf; package org.apache.pekko.japi.pf;
import static org.junit.Assert.*;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import scala.PartialFunction; import scala.PartialFunction;
import static org.junit.Assert.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PFBuilderTest extends JUnitSuite { public class PFBuilderTest extends JUnitSuite {

View file

@ -13,15 +13,14 @@
package org.apache.pekko.japi.pf; package org.apache.pekko.japi.pf;
import static org.junit.Assert.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.junit.Test;
import org.junit.Before;
import org.scalatestplus.junit.JUnitSuite;
import org.apache.pekko.actor.AbstractActor.Receive; import org.apache.pekko.actor.AbstractActor.Receive;
import org.junit.Before;
import static org.junit.Assert.*; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ReceiveBuilderTest extends JUnitSuite { public class ReceiveBuilderTest extends JUnitSuite {

View file

@ -13,6 +13,13 @@
package org.apache.pekko.pattern; package org.apache.pekko.pattern;
import static org.junit.Assert.assertEquals;
import java.time.Duration;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.function.BiFunction;
import org.apache.pekko.actor.*; import org.apache.pekko.actor.*;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource; import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.testkit.PekkoSpec; import org.apache.pekko.testkit.PekkoSpec;
@ -23,14 +30,6 @@ import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import scala.concurrent.Await; import scala.concurrent.Await;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.function.BiFunction;
import java.time.Duration;
import static org.junit.Assert.assertEquals;
public class CircuitBreakerTest extends JUnitSuite { public class CircuitBreakerTest extends JUnitSuite {
@ClassRule @ClassRule

View file

@ -13,6 +13,16 @@
package org.apache.pekko.pattern; package org.apache.pekko.pattern;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.apache.pekko.pattern.Patterns.ask;
import static org.apache.pekko.pattern.Patterns.pipe;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.time.Duration;
import java.util.Arrays;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.pekko.actor.*; import org.apache.pekko.actor.*;
import org.apache.pekko.dispatch.CompletionStages; import org.apache.pekko.dispatch.CompletionStages;
import org.apache.pekko.dispatch.Futures; import org.apache.pekko.dispatch.Futures;
@ -20,7 +30,6 @@ import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.testkit.PekkoSpec; import org.apache.pekko.testkit.PekkoSpec;
import org.apache.pekko.testkit.TestProbe; import org.apache.pekko.testkit.TestProbe;
import org.apache.pekko.util.Timeout; import org.apache.pekko.util.Timeout;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
@ -29,17 +38,6 @@ import scala.concurrent.ExecutionContext;
import scala.concurrent.Future; import scala.concurrent.Future;
import scala.concurrent.duration.FiniteDuration; import scala.concurrent.duration.FiniteDuration;
import java.util.Arrays;
import java.util.concurrent.*;
import java.time.Duration;
import java.util.concurrent.atomic.AtomicInteger;
import static org.apache.pekko.pattern.Patterns.ask;
import static org.apache.pekko.pattern.Patterns.pipe;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/** Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com> */ /** Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com> */
public class PatternsTest extends JUnitSuite { public class PatternsTest extends JUnitSuite {

View file

@ -13,6 +13,13 @@
package org.apache.pekko.pattern; package org.apache.pekko.pattern;
import static org.apache.pekko.pattern.Patterns.askWithStatus;
import static org.junit.Assert.*;
import java.time.Duration;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import org.apache.pekko.actor.ActorRef; import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource; import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.testkit.PekkoSpec; import org.apache.pekko.testkit.PekkoSpec;
@ -23,15 +30,6 @@ import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.time.Duration;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import static org.apache.pekko.pattern.Patterns.askWithStatus;
import static org.junit.Assert.*;
public class StatusReplyTest extends JUnitSuite { public class StatusReplyTest extends JUnitSuite {
@ClassRule @ClassRule

View file

@ -13,11 +13,11 @@
package org.apache.pekko.util; package org.apache.pekko.util;
import static junit.framework.TestCase.assertEquals;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import static junit.framework.TestCase.assertEquals;
public class ByteStringTest extends JUnitSuite { public class ByteStringTest extends JUnitSuite {
@Test @Test

View file

@ -20,7 +20,6 @@ package org.apache.pekko.util;
import java.time.Duration; import java.time.Duration;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import scala.Option; import scala.Option;
import scala.concurrent.Future; import scala.concurrent.Future;

View file

@ -13,12 +13,12 @@
package org.apache.pekko.util; package org.apache.pekko.util;
import static org.junit.Assert.assertTrue;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import scala.concurrent.duration.Duration; import scala.concurrent.duration.Duration;
import static org.junit.Assert.assertTrue;
public class JavaDuration extends JUnitSuite { public class JavaDuration extends JUnitSuite {
@Test @Test

View file

@ -14,6 +14,11 @@
package jdocs.org.apache.pekko.typed; package jdocs.org.apache.pekko.typed;
// #behavior // #behavior
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.AbstractBehavior; import org.apache.pekko.actor.typed.javadsl.AbstractBehavior;
@ -21,12 +26,6 @@ import org.apache.pekko.actor.typed.javadsl.ActorContext;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.apache.pekko.actor.typed.javadsl.Receive; import org.apache.pekko.actor.typed.javadsl.Receive;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
public class Aggregator<Reply, Aggregate> extends AbstractBehavior<Aggregator.Command> { public class Aggregator<Reply, Aggregate> extends AbstractBehavior<Aggregator.Command> {
interface Command {} interface Command {}

View file

@ -13,6 +13,19 @@
package jdocs.org.apache.pekko.typed; package jdocs.org.apache.pekko.typed;
import static jdocs.org.apache.pekko.typed.AggregatorTest.IllustrateUsage.Hotel1;
import static jdocs.org.apache.pekko.typed.AggregatorTest.IllustrateUsage.Hotel2;
import static jdocs.org.apache.pekko.typed.AggregatorTest.IllustrateUsage.HotelCustomer;
import static org.junit.Assert.assertEquals;
import java.math.BigDecimal;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe; import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
@ -27,20 +40,6 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.math.BigDecimal;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import static jdocs.org.apache.pekko.typed.AggregatorTest.IllustrateUsage.HotelCustomer;
import static jdocs.org.apache.pekko.typed.AggregatorTest.IllustrateUsage.Hotel1;
import static jdocs.org.apache.pekko.typed.AggregatorTest.IllustrateUsage.Hotel2;
import static org.junit.Assert.assertEquals;
public class AggregatorTest extends JUnitSuite { public class AggregatorTest extends JUnitSuite {
@ClassRule public static final TestKitJunitResource testKit = new TestKitJunitResource(); @ClassRule public static final TestKitJunitResource testKit = new TestKitJunitResource();

View file

@ -13,6 +13,10 @@
package jdocs.org.apache.pekko.typed; package jdocs.org.apache.pekko.typed;
import static jdocs.org.apache.pekko.typed.BubblingSample.Boss;
import static jdocs.org.apache.pekko.typed.BubblingSample.Protocol;
import java.time.Duration;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe; import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
@ -22,11 +26,6 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.time.Duration;
import static jdocs.org.apache.pekko.typed.BubblingSample.Boss;
import static jdocs.org.apache.pekko.typed.BubblingSample.Protocol;
public class BubblingSampleTest extends JUnitSuite { public class BubblingSampleTest extends JUnitSuite {
@ClassRule @ClassRule

View file

@ -14,8 +14,8 @@
package jdocs.org.apache.pekko.typed; package jdocs.org.apache.pekko.typed;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.*;
import org.apache.pekko.actor.typed.DispatcherSelector; import org.apache.pekko.actor.typed.DispatcherSelector;
import org.apache.pekko.actor.typed.javadsl.*;
public class DispatchersDocTest { public class DispatchersDocTest {

View file

@ -13,15 +13,14 @@
package jdocs.org.apache.pekko.typed; package jdocs.org.apache.pekko.typed;
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.Behaviors;
import java.time.Duration; import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.Behaviors;
interface FSMDocTest { interface FSMDocTest {
@ -55,6 +54,7 @@ interface FSMDocTest {
this.obj = obj; this.obj = obj;
} }
} }
// #simple-events // #simple-events
// #storing-state // #storing-state
@ -132,6 +132,7 @@ interface FSMDocTest {
} }
// #storing-state // #storing-state
} }
// #storing-state // #storing-state
// #simple-state // #simple-state

View file

@ -13,18 +13,8 @@
package jdocs.org.apache.pekko.typed; package jdocs.org.apache.pekko.typed;
import org.apache.pekko.Done; import static jdocs.org.apache.pekko.typed.InteractionPatternsTest.Samples.*;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import static org.junit.Assert.assertEquals;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.ActorSystem;
import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.*;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import java.net.URI; import java.net.URI;
import java.time.Duration; import java.time.Duration;
@ -32,9 +22,18 @@ import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage; import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.pekko.Done;
import static jdocs.org.apache.pekko.typed.InteractionPatternsTest.Samples.*; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import static org.junit.Assert.assertEquals; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.ActorSystem;
import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.*;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
public class InteractionPatternsTest extends JUnitSuite { public class InteractionPatternsTest extends JUnitSuite {
@ -63,6 +62,7 @@ public class InteractionPatternsTest extends JUnitSuite {
.build()); .build());
} }
} }
// #fire-and-forget-definition // #fire-and-forget-definition
public class CookieFabric { public class CookieFabric {
@ -84,6 +84,7 @@ public class InteractionPatternsTest extends JUnitSuite {
this.result = result; this.result = result;
} }
} }
// #request-response-protocol // #request-response-protocol
// #request-response-respond // #request-response-respond
@ -99,6 +100,7 @@ public class InteractionPatternsTest extends JUnitSuite {
request.replyTo.tell(new Response("Here are the cookies for " + request.query)); request.replyTo.tell(new Response("Here are the cookies for " + request.query));
return Behaviors.same(); return Behaviors.same();
} }
// #request-response-respond // #request-response-respond
void demo() { void demo() {
@ -237,6 +239,7 @@ public class InteractionPatternsTest extends JUnitSuite {
} }
} }
} }
// #adapted-response // #adapted-response
// #timer // #timer
@ -254,6 +257,7 @@ public class InteractionPatternsTest extends JUnitSuite {
public List<Command> getMessages() { public List<Command> getMessages() {
return messages; return messages;
} }
// #timer // #timer
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
@ -345,6 +349,7 @@ public class InteractionPatternsTest extends JUnitSuite {
} }
} }
} }
// #timer // #timer
// #actor-ask // #actor-ask
@ -463,6 +468,7 @@ public class InteractionPatternsTest extends JUnitSuite {
return this; return this;
} }
} }
// #actor-ask // #actor-ask
// #per-session-child // #per-session-child
@ -686,6 +692,7 @@ public class InteractionPatternsTest extends JUnitSuite {
return this; return this;
} }
} }
// #standalone-ask // #standalone-ask
class NotShown { class NotShown {
@ -713,6 +720,7 @@ public class InteractionPatternsTest extends JUnitSuite {
else System.out.println("Boo! didn't get cookies in time. " + failure); else System.out.println("Boo! didn't get cookies in time. " + failure);
}); });
} }
// #standalone-ask // #standalone-ask
public void askAndMapInvalid( public void askAndMapInvalid(

View file

@ -13,6 +13,7 @@
package jdocs.org.apache.pekko.typed; package jdocs.org.apache.pekko.typed;
import com.typesafe.config.ConfigFactory;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
@ -22,7 +23,6 @@ import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.Dispatchers; import org.apache.pekko.actor.typed.Dispatchers;
import org.apache.pekko.actor.typed.MailboxSelector; import org.apache.pekko.actor.typed.MailboxSelector;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;

View file

@ -12,15 +12,18 @@
*/ */
package jdocs.org.apache.pekko.typed; package jdocs.org.apache.pekko.typed;
/* /*
* Copyright (C) 2009-2019 Lightbend Inc. <https://www.lightbend.com> * Copyright (C) 2009-2019 Lightbend Inc. <https://www.lightbend.com>
*/ */
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.ActorSystem; import org.apache.pekko.actor.typed.ActorSystem;
import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.DispatcherSelector; import org.apache.pekko.actor.typed.DispatcherSelector;
// #pool // #pool
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.SupervisorStrategy; import org.apache.pekko.actor.typed.SupervisorStrategy;
import org.apache.pekko.actor.typed.javadsl.ActorContext; import org.apache.pekko.actor.typed.javadsl.ActorContext;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
@ -29,10 +32,6 @@ import org.apache.pekko.actor.typed.javadsl.PoolRouter;
import org.apache.pekko.actor.typed.javadsl.Routers; import org.apache.pekko.actor.typed.javadsl.Routers;
import org.apache.pekko.actor.typed.receptionist.Receptionist; import org.apache.pekko.actor.typed.receptionist.Receptionist;
import org.apache.pekko.actor.typed.receptionist.ServiceKey; import org.apache.pekko.actor.typed.receptionist.ServiceKey;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;

View file

@ -14,13 +14,13 @@
package jdocs.org.apache.pekko.typed; package jdocs.org.apache.pekko.typed;
// #import // #import
import java.util.concurrent.CompletionStage;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.ActorContext; import org.apache.pekko.actor.typed.javadsl.ActorContext;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.apache.pekko.actor.typed.javadsl.StashBuffer; import org.apache.pekko.actor.typed.javadsl.StashBuffer;
import java.util.concurrent.CompletionStage;
// #import // #import
@ -32,6 +32,7 @@ interface StashDocSample {
CompletionStage<String> load(String id); CompletionStage<String> load(String id);
} }
// #db // #db
// #stashing // #stashing

View file

@ -13,6 +13,11 @@
package jdocs.org.apache.pekko.typed; package jdocs.org.apache.pekko.typed;
import static jdocs.org.apache.pekko.typed.StashDocSample.DB;
import static jdocs.org.apache.pekko.typed.StashDocSample.DataAccess;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
@ -23,12 +28,6 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import static jdocs.org.apache.pekko.typed.StashDocSample.DB;
import static jdocs.org.apache.pekko.typed.StashDocSample.DataAccess;
public class StashDocTest extends JUnitSuite { public class StashDocTest extends JUnitSuite {
@ClassRule public static final TestKitJunitResource testKit = new TestKitJunitResource(); @ClassRule public static final TestKitJunitResource testKit = new TestKitJunitResource();

View file

@ -15,19 +15,18 @@ package jdocs.org.apache.pekko.typed;
// #oo-style // #oo-style
// #fun-style // #fun-style
import java.time.Duration;
import org.apache.pekko.Done;
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.SupervisorStrategy; import org.apache.pekko.actor.typed.SupervisorStrategy;
import org.apache.pekko.actor.typed.javadsl.AbstractBehavior;
import org.apache.pekko.actor.typed.javadsl.ActorContext; import org.apache.pekko.actor.typed.javadsl.ActorContext;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
// #fun-style // #fun-style
import org.apache.pekko.actor.typed.javadsl.AbstractBehavior;
import org.apache.pekko.actor.typed.javadsl.Receive; import org.apache.pekko.actor.typed.javadsl.Receive;
// #oo-style // #oo-style
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.javadsl.TimerScheduler; import org.apache.pekko.actor.typed.javadsl.TimerScheduler;
import org.apache.pekko.Done;
import java.time.Duration;
interface StyleGuideDocExamples { interface StyleGuideDocExamples {
@ -97,6 +96,7 @@ interface StyleGuideDocExamples {
public enum Increment implements Command { public enum Increment implements Command {
INSTANCE INSTANCE
} }
// #message-enum // #message-enum
public static class GetValue implements Command { public static class GetValue implements Command {
@ -114,6 +114,7 @@ interface StyleGuideDocExamples {
this.value = value; this.value = value;
} }
} }
// #messages // #messages
public static Behavior<Command> create() { public static Behavior<Command> create() {
@ -276,6 +277,7 @@ interface StyleGuideDocExamples {
this.value = value; this.value = value;
} }
} }
// #fun-style-setup-params2 // #fun-style-setup-params2
private static class Setup { private static class Setup {
@ -370,6 +372,7 @@ interface StyleGuideDocExamples {
this.value = value; this.value = value;
} }
} }
// #fun-style-setup-params3 // #fun-style-setup-params3
public static Behavior<Command> create(String name) { public static Behavior<Command> create(String name) {
@ -462,6 +465,7 @@ interface StyleGuideDocExamples {
} }
} }
} }
// #behavior-factory-method // #behavior-factory-method
public class Usage { public class Usage {
@ -601,6 +605,7 @@ interface StyleGuideDocExamples {
getContext().getLog().debug("[{}] Incremented counter to [{}]", name, count); getContext().getLog().debug("[{}] Incremented counter to [{}]", name, count);
return this; return this;
} }
// #on-message-lambda // #on-message-lambda
private Behavior<Command> onTick() { private Behavior<Command> onTick() {
@ -616,6 +621,7 @@ interface StyleGuideDocExamples {
command.replyTo.tell(new Value(count)); command.replyTo.tell(new Value(count));
return this; return this;
} }
// #on-message-method-ref // #on-message-method-ref
// #public-private-messages-1 // #public-private-messages-1

View file

@ -14,6 +14,8 @@
package jdocs.org.apache.pekko.typed; package jdocs.org.apache.pekko.typed;
// #behavior // #behavior
import java.time.Duration;
import java.util.function.BiFunction;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.AbstractBehavior; import org.apache.pekko.actor.typed.javadsl.AbstractBehavior;
@ -22,9 +24,6 @@ import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.apache.pekko.actor.typed.javadsl.Receive; import org.apache.pekko.actor.typed.javadsl.Receive;
import org.apache.pekko.actor.typed.javadsl.TimerScheduler; import org.apache.pekko.actor.typed.javadsl.TimerScheduler;
import java.time.Duration;
import java.util.function.BiFunction;
public class TailChopping<Reply> extends AbstractBehavior<TailChopping.Command> { public class TailChopping<Reply> extends AbstractBehavior<TailChopping.Command> {
interface Command {} interface Command {}

View file

@ -13,23 +13,23 @@
package jdocs.org.apache.pekko.typed.coexistence; package jdocs.org.apache.pekko.typed.coexistence;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.same;
import org.apache.pekko.actor.AbstractActor; import org.apache.pekko.actor.AbstractActor;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.ActorSystem; import org.apache.pekko.actor.typed.ActorSystem;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.Adapter;
// #adapter-import
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
// #adapter-import // #adapter-import
// In java use the static methods on Adapter to convert from typed to classic // In java use the static methods on Adapter to convert from typed to classic
import org.apache.pekko.actor.typed.javadsl.Adapter;
// #adapter-import
import org.apache.pekko.testkit.TestProbe; import org.apache.pekko.testkit.TestProbe;
import org.apache.pekko.testkit.javadsl.TestKit; import org.apache.pekko.testkit.javadsl.TestKit;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import scala.concurrent.duration.Duration; import scala.concurrent.duration.Duration;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.same;
public class ClassicWatchingTypedTest extends JUnitSuite { public class ClassicWatchingTypedTest extends JUnitSuite {
// #classic-watch // #classic-watch
@ -63,6 +63,7 @@ public class ClassicWatchingTypedTest extends JUnitSuite {
.build(); .build();
} }
} }
// #classic-watch // #classic-watch
// #typed // #typed
@ -90,6 +91,7 @@ public class ClassicWatchingTypedTest extends JUnitSuite {
.build(); .build();
} }
} }
// #typed // #typed
@Test @Test

View file

@ -19,10 +19,10 @@ import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
// #adapter-import // #adapter-import
// in Java use the static methods on Adapter to convert from classic to typed // in Java use the static methods on Adapter to convert from classic to typed
import org.apache.pekko.actor.typed.javadsl.Adapter;
// #adapter-import
import org.apache.pekko.actor.typed.javadsl.AbstractBehavior; import org.apache.pekko.actor.typed.javadsl.AbstractBehavior;
import org.apache.pekko.actor.typed.javadsl.ActorContext; import org.apache.pekko.actor.typed.javadsl.ActorContext;
import org.apache.pekko.actor.typed.javadsl.Adapter;
// #adapter-import
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.apache.pekko.actor.typed.javadsl.Receive; import org.apache.pekko.actor.typed.javadsl.Receive;
import org.apache.pekko.testkit.javadsl.TestKit; import org.apache.pekko.testkit.javadsl.TestKit;
@ -83,6 +83,7 @@ public class TypedWatchingClassicTest extends JUnitSuite {
return this; return this;
} }
} }
// #typed // #typed
// #classic // #classic
@ -100,6 +101,7 @@ public class TypedWatchingClassicTest extends JUnitSuite {
message.replyTo.tell(Typed.Pong.INSTANCE); message.replyTo.tell(Typed.Pong.INSTANCE);
} }
} }
// #classic // #classic
@Test @Test

View file

@ -13,14 +13,13 @@
package jdocs.org.apache.pekko.typed.extensions; package jdocs.org.apache.pekko.typed.extensions;
import docs.org.apache.pekko.typed.extensions.DatabasePool;
import java.util.concurrent.CompletionStage;
import org.apache.pekko.actor.typed.ActorSystem; import org.apache.pekko.actor.typed.ActorSystem;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.Extension; import org.apache.pekko.actor.typed.Extension;
import org.apache.pekko.actor.typed.ExtensionId; import org.apache.pekko.actor.typed.ExtensionId;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import docs.org.apache.pekko.typed.extensions.DatabasePool;
import java.util.concurrent.CompletionStage;
interface ExtensionDocTest { interface ExtensionDocTest {
@ -31,6 +30,7 @@ interface ExtensionDocTest {
} }
// ... // ...
} }
// #shared-resource // #shared-resource
// #extension // #extension
@ -53,6 +53,7 @@ interface ExtensionDocTest {
return instance.apply(system); return instance.apply(system);
} }
} }
// #extension-id // #extension-id
// #extension // #extension
@ -68,6 +69,7 @@ interface ExtensionDocTest {
return _connection; return _connection;
} }
} }
// #extension // #extension
public static Behavior<Object> initialBehavior() { public static Behavior<Object> initialBehavior() {

View file

@ -14,6 +14,8 @@
package jdocs.org.apache.pekko.typed.fromclassic; package jdocs.org.apache.pekko.typed.fromclassic;
// #hello-world-actor // #hello-world-actor
import java.util.HashMap;
import java.util.Map;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.AbstractBehavior; import org.apache.pekko.actor.typed.javadsl.AbstractBehavior;
@ -21,9 +23,6 @@ import org.apache.pekko.actor.typed.javadsl.ActorContext;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.apache.pekko.actor.typed.javadsl.Receive; import org.apache.pekko.actor.typed.javadsl.Receive;
import java.util.HashMap;
import java.util.Map;
// #hello-world-actor // #hello-world-actor
interface TypedSample { interface TypedSample {
@ -70,6 +69,7 @@ interface TypedSample {
return this; return this;
} }
} }
// #hello-world-actor // #hello-world-actor
// #children // #children
@ -129,6 +129,7 @@ interface TypedSample {
return this; return this;
} }
} }
// #children // #children
public class Child { public class Child {

View file

@ -13,11 +13,10 @@
package jdocs.org.apache.pekko.typed.supervision; package jdocs.org.apache.pekko.typed.supervision;
import java.time.Duration;
import org.apache.pekko.actor.typed.*; import org.apache.pekko.actor.typed.*;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import java.time.Duration;
public class SupervisionCompileOnlyTest { public class SupervisionCompileOnlyTest {
// #wrap // #wrap
public static class Counter { public static class Counter {
@ -45,6 +44,7 @@ public class SupervisionCompileOnlyTest {
public static Behavior<Command> create() { public static Behavior<Command> create() {
return Behaviors.supervise(counter(1)).onFailure(SupervisorStrategy.restart()); return Behaviors.supervise(counter(1)).onFailure(SupervisorStrategy.restart());
} }
// #top-level // #top-level
private static Behavior<Command> counter(int currentValue) { private static Behavior<Command> counter(int currentValue) {
@ -63,6 +63,7 @@ public class SupervisionCompileOnlyTest {
return Behaviors.same(); return Behaviors.same();
} }
} }
// #wrap // #wrap
public static Behavior<String> behavior = Behaviors.empty(); public static Behavior<String> behavior = Behaviors.empty();
@ -116,6 +117,7 @@ public class SupervisionCompileOnlyTest {
})) }))
.onFailure(SupervisorStrategy.restart()); .onFailure(SupervisorStrategy.restart());
} }
// #restart-stop-children // #restart-stop-children
// #restart-keep-children // #restart-keep-children
@ -138,6 +140,7 @@ public class SupervisionCompileOnlyTest {
.onFailure(SupervisorStrategy.restart().withStopChildren(false)); .onFailure(SupervisorStrategy.restart().withStopChildren(false));
}); });
} }
// #restart-keep-children // #restart-keep-children
interface Resource { interface Resource {

View file

@ -13,16 +13,15 @@
package org.apache.pekko.actor.typed; package org.apache.pekko.actor.typed;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.Assert.assertFalse;
import java.util.concurrent.CompletionStage;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.util.concurrent.CompletionStage;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.Assert.assertFalse;
public class ActorSystemTest extends JUnitSuite { public class ActorSystemTest extends JUnitSuite {
@Test @Test

View file

@ -13,19 +13,18 @@
package org.apache.pekko.actor.typed; package org.apache.pekko.actor.typed;
import org.apache.pekko.actor.setup.ActorSystemSetup;
import org.apache.pekko.actor.typed.javadsl.Behaviors;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import java.util.function.Function;
import static junit.framework.TestCase.assertSame; import static junit.framework.TestCase.assertSame;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import java.util.function.Function;
import org.apache.pekko.actor.setup.ActorSystemSetup;
import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
public class ExtensionsTest extends JUnitSuite { public class ExtensionsTest extends JUnitSuite {
public static class MyExtImpl implements Extension {} public static class MyExtImpl implements Extension {}
@ -61,7 +60,8 @@ public class ExtensionsTest extends JUnitSuite {
public void loadJavaExtensionsFromConfig() { public void loadJavaExtensionsFromConfig() {
Config cfg = Config cfg =
ConfigFactory.parseString( ConfigFactory.parseString(
"pekko.actor.typed.extensions += \"org.apache.pekko.actor.typed.ExtensionsTest$MyExtension\"") "pekko.actor.typed.extensions +="
+ " \"org.apache.pekko.actor.typed.ExtensionsTest$MyExtension\"")
.resolve(); .resolve();
final ActorSystem<Object> system = final ActorSystem<Object> system =
ActorSystem.create(Behaviors.empty(), "loadJavaExtensionsFromConfig", cfg); ActorSystem.create(Behaviors.empty(), "loadJavaExtensionsFromConfig", cfg);

View file

@ -17,7 +17,11 @@
package org.apache.pekko.actor.typed.eventstream; package org.apache.pekko.actor.typed.eventstream;
import org.apache.pekko.actor.DeadLetter;
import org.apache.pekko.actor.testkit.typed.javadsl.ActorTestKit; import org.apache.pekko.actor.testkit.typed.javadsl.ActorTestKit;
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.ActorSystem;
// #dead-letter-imports
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.AbstractBehavior; import org.apache.pekko.actor.typed.javadsl.AbstractBehavior;
import org.apache.pekko.actor.typed.javadsl.ActorContext; import org.apache.pekko.actor.typed.javadsl.ActorContext;
@ -25,10 +29,7 @@ import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.apache.pekko.actor.typed.javadsl.Receive; import org.apache.pekko.actor.typed.javadsl.Receive;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
// #dead-letter-imports
import org.apache.pekko.actor.DeadLetter;
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.ActorSystem;
// #dead-letter-imports // #dead-letter-imports
public class EventStreamDocTest extends JUnitSuite { public class EventStreamDocTest extends JUnitSuite {

View file

@ -13,15 +13,14 @@
package org.apache.pekko.actor.typed.javadsl; package org.apache.pekko.actor.typed.javadsl;
import org.apache.pekko.actor.typed.*; import static org.apache.pekko.actor.typed.javadsl.Behaviors.*;
import org.apache.pekko.actor.typed.TypedActorContext;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.time.Duration; import java.time.Duration;
import java.util.concurrent.CompletionStage; import java.util.concurrent.CompletionStage;
import org.apache.pekko.actor.typed.*;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.*; import org.apache.pekko.actor.typed.TypedActorContext;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class ActorCompile { public class ActorCompile {

View file

@ -13,21 +13,20 @@
package org.apache.pekko.actor.typed.javadsl; package org.apache.pekko.actor.typed.javadsl;
import java.time.Duration;
import org.apache.pekko.actor.testkit.typed.TestException; import org.apache.pekko.actor.testkit.typed.TestException;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.pattern.StatusReply; import org.apache.pekko.pattern.StatusReply;
import org.apache.pekko.testkit.PekkoSpec; import org.apache.pekko.testkit.PekkoSpec;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.time.Duration;
public class ActorContextAskTest extends JUnitSuite { public class ActorContextAskTest extends JUnitSuite {
@ClassRule @ClassRule

View file

@ -13,6 +13,13 @@
package org.apache.pekko.actor.typed.javadsl; package org.apache.pekko.actor.typed.javadsl;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.junit.Assert.*;
import com.typesafe.config.ConfigFactory;
import java.time.Duration;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.LoggingTestKit; import org.apache.pekko.actor.testkit.typed.javadsl.LoggingTestKit;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
@ -20,19 +27,11 @@ import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.Props; import org.apache.pekko.actor.typed.Props;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.time.Duration;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.junit.Assert.*;
public final class ActorContextPipeToSelfTest extends JUnitSuite { public final class ActorContextPipeToSelfTest extends JUnitSuite {
@ClassRule @ClassRule

View file

@ -13,6 +13,10 @@
package org.apache.pekko.actor.typed.javadsl; package org.apache.pekko.actor.typed.javadsl;
import com.typesafe.config.ConfigFactory;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
@ -20,17 +24,12 @@ import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.event.Logging; import org.apache.pekko.event.Logging;
import org.apache.pekko.japi.pf.PFBuilder; import org.apache.pekko.japi.pf.PFBuilder;
import org.apache.pekko.testkit.CustomEventFilter; import org.apache.pekko.testkit.CustomEventFilter;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import scala.concurrent.duration.FiniteDuration; import scala.concurrent.duration.FiniteDuration;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class ActorLoggingTest extends JUnitSuite { public class ActorLoggingTest extends JUnitSuite {
@ClassRule @ClassRule

View file

@ -13,27 +13,26 @@
package org.apache.pekko.actor.typed.javadsl; package org.apache.pekko.actor.typed.javadsl;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import static org.apache.pekko.actor.typed.javadsl.Behaviors.*;
import org.apache.pekko.actor.typed.internal.adapter.SchedulerAdapter; import static org.junit.Assert.assertEquals;
import org.junit.ClassRule; import static org.junit.Assert.assertSame;
import org.junit.Rule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import java.time.Duration; import java.time.Duration;
import org.apache.pekko.actor.ActorSystem; import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource; import org.apache.pekko.actor.SupervisorStrategy;
import org.apache.pekko.testkit.PekkoSpec; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.Signal; import org.apache.pekko.actor.typed.Signal;
import org.apache.pekko.actor.typed.Terminated; import org.apache.pekko.actor.typed.Terminated;
import org.apache.pekko.actor.typed.internal.adapter.SchedulerAdapter;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.testkit.PekkoSpec;
import org.apache.pekko.testkit.javadsl.TestKit; import org.apache.pekko.testkit.javadsl.TestKit;
import org.apache.pekko.actor.SupervisorStrategy; import org.junit.ClassRule;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.*; import org.junit.Rule;
import static org.junit.Assert.assertEquals; import org.junit.Test;
import static org.junit.Assert.assertSame; import org.scalatestplus.junit.JUnitSuite;
public class AdapterTest extends JUnitSuite { public class AdapterTest extends JUnitSuite {
@ -119,7 +118,8 @@ public class AdapterTest extends JUnitSuite {
} }
} }
static interface Typed2Msg {}; static interface Typed2Msg {}
;
static final class Ping implements Typed2Msg { static final class Ping implements Typed2Msg {
public final ActorRef<String> replyTo; public final ActorRef<String> replyTo;

View file

@ -13,24 +13,22 @@
package org.apache.pekko.actor.typed.javadsl; package org.apache.pekko.actor.typed.javadsl;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.same;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.stopped;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe; import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.Terminated;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.Terminated;
import org.apache.pekko.actor.typed.ActorRef;
import java.util.ArrayList;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.same;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.stopped;
import static org.junit.Assert.assertEquals;
/** Test creating [[Behavior]]s using [[BehaviorBuilder]] */ /** Test creating [[Behavior]]s using [[BehaviorBuilder]] */
public class BehaviorBuilderTest extends JUnitSuite { public class BehaviorBuilderTest extends JUnitSuite {
@ -46,7 +44,8 @@ public class BehaviorBuilderTest extends JUnitSuite {
} }
} }
static final class MyList<T> extends ArrayList<T> implements Message {}; static final class MyList<T> extends ArrayList<T> implements Message {}
;
public void shouldCompile() { public void shouldCompile() {
Behavior<Message> b = Behavior<Message> b =
@ -153,9 +152,11 @@ public class BehaviorBuilderTest extends JUnitSuite {
probe.expectMessage("message"); probe.expectMessage("message");
} }
interface CounterMessage {}; interface CounterMessage {}
;
static final class Increase implements CounterMessage {}; static final class Increase implements CounterMessage {}
;
static final class Get implements CounterMessage { static final class Get implements CounterMessage {
final ActorRef<Got> sender; final ActorRef<Got> sender;
@ -163,7 +164,8 @@ public class BehaviorBuilderTest extends JUnitSuite {
public Get(ActorRef<Got> sender) { public Get(ActorRef<Got> sender) {
this.sender = sender; this.sender = sender;
} }
}; }
;
static final class Got { static final class Got {
final int n; final int n;

View file

@ -13,20 +13,19 @@
package org.apache.pekko.actor.typed.javadsl; package org.apache.pekko.actor.typed.javadsl;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.same;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe; import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.PostStop; import org.apache.pekko.actor.typed.PostStop;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import org.apache.pekko.actor.typed.Behavior;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.same;
/** Test creating [[MutableActor]]s using [[ReceiveBuilder]] */ /** Test creating [[MutableActor]]s using [[ReceiveBuilder]] */
public class ReceiveBuilderTest extends JUnitSuite { public class ReceiveBuilderTest extends JUnitSuite {

View file

@ -13,8 +13,10 @@
package org.apache.pekko.actor.typed.javadsl; package org.apache.pekko.actor.typed.javadsl;
import java.util.List; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.List;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe; import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
@ -27,9 +29,6 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class RoutersTest extends JUnitSuite { public class RoutersTest extends JUnitSuite {
@ClassRule @ClassRule

View file

@ -13,6 +13,10 @@
package org.apache.pekko.actor.typed.javadsl; package org.apache.pekko.actor.typed.javadsl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.function.Function;
import org.apache.pekko.actor.testkit.typed.internal.StubbedActorContext; import org.apache.pekko.actor.testkit.typed.internal.StubbedActorContext;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.typed.internal.StashBufferImpl; import org.apache.pekko.actor.typed.internal.StashBufferImpl;
@ -20,11 +24,6 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.util.function.Function;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class StashBufferTest extends JUnitSuite { public class StashBufferTest extends JUnitSuite {
@Rule public final LogCapturing logCapturing = new LogCapturing(); @Rule public final LogCapturing logCapturing = new LogCapturing();

View file

@ -13,23 +13,20 @@
package org.apache.pekko.actor.typed.javadsl; package org.apache.pekko.actor.typed.javadsl;
import static org.apache.pekko.Done.done;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.*;
import java.time.Duration;
import java.util.concurrent.CompletionStage; import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.typed.*;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.scalatestplus.junit.JUnitSuite;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import org.apache.pekko.actor.typed.*;
import java.time.Duration;
import static org.apache.pekko.Done.done;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.*;
public class WatchTest extends JUnitSuite { public class WatchTest extends JUnitSuite {

View file

@ -13,15 +13,14 @@
package org.apache.pekko.actor.typed.receptionist; package org.apache.pekko.actor.typed.receptionist;
import java.time.Duration;
import java.util.Set;
import java.util.concurrent.CompletionStage;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.ActorSystem; import org.apache.pekko.actor.typed.ActorSystem;
import org.apache.pekko.actor.typed.javadsl.AskPattern; import org.apache.pekko.actor.typed.javadsl.AskPattern;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import java.time.Duration;
import java.util.Set;
import java.util.concurrent.CompletionStage;
public class ReceptionistApiTest { public class ReceptionistApiTest {
public void compileOnlyApiTest() { public void compileOnlyApiTest() {

View file

@ -16,8 +16,6 @@ package org.apache.pekko.actor;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle; import java.lang.invoke.VarHandle;
import org.apache.pekko.actor.Cell;
final class AbstractActorRef { final class AbstractActorRef {
static final VarHandle cellHandle; static final VarHandle cellHandle;
static final VarHandle lookupHandle; static final VarHandle lookupHandle;

View file

@ -15,7 +15,6 @@ package org.apache.pekko.actor.dungeon;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle; import java.lang.invoke.VarHandle;
import org.apache.pekko.actor.ActorCell; import org.apache.pekko.actor.ActorCell;
import org.apache.pekko.dispatch.Mailbox; import org.apache.pekko.dispatch.Mailbox;

View file

@ -17,13 +17,13 @@
package org.apache.pekko.io; package org.apache.pekko.io;
import static java.lang.invoke.MethodType.methodType;
import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import static java.lang.invoke.MethodType.methodType;
/** /**
* Cleans a direct {@link ByteBuffer}. Without manual intervention, direct ByteBuffers will be * Cleans a direct {@link ByteBuffer}. Without manual intervention, direct ByteBuffers will be
* cleaned eventually upon garbage collection. However, this should not be relied upon since it may * cleaned eventually upon garbage collection. However, this should not be relied upon since it may
@ -100,9 +100,9 @@ final class ByteBufferCleaner {
} catch (final Throwable t) { } catch (final Throwable t) {
cleaner = null; cleaner = null;
System.err.println( System.err.println(
"WARNING: ByteBuffer Cleaner failed to clean a test buffer. ByteBuffer Cleaner " "WARNING: ByteBuffer Cleaner failed to clean a test buffer. ByteBuffer Cleaner has been"
+ "has been disabled. This means direct ByteBuffers will only be cleaned upon garbage collection. " + " disabled. This means direct ByteBuffers will only be cleaned upon garbage"
+ "Reason: " + " collection. Reason: "
+ t); + t);
} }
} }

View file

@ -13,11 +13,11 @@
package org.apache.pekko.japi.pf; package org.apache.pekko.japi.pf;
import static org.apache.pekko.actor.SupervisorStrategy.Directive;
import org.apache.pekko.japi.function.Function; import org.apache.pekko.japi.function.Function;
import org.apache.pekko.japi.function.Predicate; import org.apache.pekko.japi.function.Predicate;
import static org.apache.pekko.actor.SupervisorStrategy.Directive;
/** /**
* Used for building a partial function for {@link org.apache.pekko.actor.Actor#supervisorStrategy * Used for building a partial function for {@link org.apache.pekko.actor.Actor#supervisorStrategy
* Actor.supervisorStrategy()}. * Inside an actor you can use it like this with Java 8 to define * Actor.supervisorStrategy()}. * Inside an actor you can use it like this with Java 8 to define

View file

@ -13,10 +13,10 @@
package org.apache.pekko.japi.pf; package org.apache.pekko.japi.pf;
import java.util.List;
import org.apache.pekko.actor.FSM; import org.apache.pekko.actor.FSM;
import org.apache.pekko.japi.function.*; import org.apache.pekko.japi.function.*;
import scala.PartialFunction; import scala.PartialFunction;
import java.util.List;
/** /**
* Builder used to create a partial function for {@link org.apache.pekko.actor.FSM#whenUnhandled}. * Builder used to create a partial function for {@link org.apache.pekko.actor.FSM#whenUnhandled}.

View file

@ -18,8 +18,8 @@ import org.apache.pekko.japi.function.Predicate;
import org.apache.pekko.japi.function.Procedure; import org.apache.pekko.japi.function.Procedure;
import org.apache.pekko.japi.function.Procedure2; import org.apache.pekko.japi.function.Procedure2;
import scala.PartialFunction; import scala.PartialFunction;
import scala.runtime.BoxedUnit;
import scala.Tuple2; import scala.Tuple2;
import scala.runtime.BoxedUnit;
/** /**
* Builder used to create a partial function for {@link org.apache.pekko.actor.FSM#onTransition}. * Builder used to create a partial function for {@link org.apache.pekko.actor.FSM#onTransition}.

View file

@ -15,10 +15,8 @@ package org.apache.pekko.pattern;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle; import java.lang.invoke.VarHandle;
import scala.concurrent.duration.FiniteDuration;
import org.apache.pekko.pattern.CircuitBreaker.State; import org.apache.pekko.pattern.CircuitBreaker.State;
import scala.concurrent.duration.FiniteDuration;
class AbstractCircuitBreaker { class AbstractCircuitBreaker {
protected static final VarHandle stateHandle; protected static final VarHandle stateHandle;

View file

@ -13,11 +13,10 @@
package org.apache.pekko.util; package org.apache.pekko.util;
import org.apache.pekko.annotation.InternalApi;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle; import java.lang.invoke.VarHandle;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import org.apache.pekko.annotation.InternalApi;
/** INTERNAL API */ /** INTERNAL API */
@InternalApi @InternalApi

View file

@ -13,6 +13,18 @@
package jdocs.org.apache.pekko.cluster.sharding.typed; package jdocs.org.apache.pekko.cluster.sharding.typed;
import static jdocs.org.apache.pekko.cluster.sharding.typed.AccountExampleWithEventHandlersInState.AccountEntity;
import static jdocs.org.apache.pekko.cluster.sharding.typed.AccountExampleWithEventHandlersInState.AccountEntity.*;
import static org.apache.pekko.Done.done;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import java.math.BigDecimal;
import java.time.Duration;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
@ -24,24 +36,11 @@ import org.apache.pekko.cluster.typed.Cluster;
import org.apache.pekko.cluster.typed.Join; import org.apache.pekko.cluster.typed.Join;
import org.apache.pekko.pattern.StatusReply; import org.apache.pekko.pattern.StatusReply;
import org.apache.pekko.persistence.typed.PersistenceId; import org.apache.pekko.persistence.typed.PersistenceId;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.math.BigDecimal;
import java.time.Duration;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
import static org.apache.pekko.Done.done;
import static jdocs.org.apache.pekko.cluster.sharding.typed.AccountExampleWithEventHandlersInState.AccountEntity;
import static jdocs.org.apache.pekko.cluster.sharding.typed.AccountExampleWithEventHandlersInState.AccountEntity.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class AccountExampleTest extends JUnitSuite { public class AccountExampleTest extends JUnitSuite {
public static final Config config = public static final Config config =

View file

@ -13,6 +13,8 @@
package jdocs.org.apache.pekko.cluster.sharding.typed; package jdocs.org.apache.pekko.cluster.sharding.typed;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.math.BigDecimal;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.cluster.sharding.typed.javadsl.EntityTypeKey; import org.apache.pekko.cluster.sharding.typed.javadsl.EntityTypeKey;
@ -25,9 +27,6 @@ import org.apache.pekko.persistence.typed.javadsl.EventHandlerBuilder;
import org.apache.pekko.persistence.typed.javadsl.EventSourcedBehaviorWithEnforcedReplies; import org.apache.pekko.persistence.typed.javadsl.EventSourcedBehaviorWithEnforcedReplies;
import org.apache.pekko.persistence.typed.javadsl.ReplyEffect; import org.apache.pekko.persistence.typed.javadsl.ReplyEffect;
import org.apache.pekko.serialization.jackson.CborSerializable; import org.apache.pekko.serialization.jackson.CborSerializable;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.math.BigDecimal;
/** /**
* Bank account example illustrating: - different state classes representing the lifecycle of the * Bank account example illustrating: - different state classes representing the lifecycle of the
@ -50,6 +49,7 @@ public interface AccountExampleWithEventHandlersInState {
// Command // Command
// #reply-command // #reply-command
interface Command extends CborSerializable {} interface Command extends CborSerializable {}
// #reply-command // #reply-command
public static class CreateAccount implements Command { public static class CreateAccount implements Command {
@ -236,6 +236,7 @@ public interface AccountExampleWithEventHandlersInState {
.thenReply(command.replyTo, account2 -> StatusReply.ack()); .thenReply(command.replyTo, account2 -> StatusReply.ack());
} }
} }
// #reply // #reply
private ReplyEffect<Event, Account> getBalance(OpenedAccount account, GetBalance command) { private ReplyEffect<Event, Account> getBalance(OpenedAccount account, GetBalance command) {

View file

@ -13,6 +13,8 @@
package jdocs.org.apache.pekko.cluster.sharding.typed; package jdocs.org.apache.pekko.cluster.sharding.typed;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.math.BigDecimal;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.cluster.sharding.typed.javadsl.EntityTypeKey; import org.apache.pekko.cluster.sharding.typed.javadsl.EntityTypeKey;
@ -25,9 +27,6 @@ import org.apache.pekko.persistence.typed.javadsl.EventHandlerBuilder;
import org.apache.pekko.persistence.typed.javadsl.EventSourcedBehaviorWithEnforcedReplies; import org.apache.pekko.persistence.typed.javadsl.EventSourcedBehaviorWithEnforcedReplies;
import org.apache.pekko.persistence.typed.javadsl.ReplyEffect; import org.apache.pekko.persistence.typed.javadsl.ReplyEffect;
import org.apache.pekko.serialization.jackson.CborSerializable; import org.apache.pekko.serialization.jackson.CborSerializable;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.math.BigDecimal;
/** /**
* Bank account example illustrating: - different state classes representing the lifecycle of the * Bank account example illustrating: - different state classes representing the lifecycle of the

View file

@ -13,6 +13,8 @@
package jdocs.org.apache.pekko.cluster.sharding.typed; package jdocs.org.apache.pekko.cluster.sharding.typed;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.math.BigDecimal;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.cluster.sharding.typed.javadsl.EntityTypeKey; import org.apache.pekko.cluster.sharding.typed.javadsl.EntityTypeKey;
@ -23,9 +25,6 @@ import org.apache.pekko.persistence.typed.state.javadsl.CommandHandlerWithReplyB
import org.apache.pekko.persistence.typed.state.javadsl.DurableStateBehaviorWithEnforcedReplies; import org.apache.pekko.persistence.typed.state.javadsl.DurableStateBehaviorWithEnforcedReplies;
import org.apache.pekko.persistence.typed.state.javadsl.ReplyEffect; import org.apache.pekko.persistence.typed.state.javadsl.ReplyEffect;
import org.apache.pekko.serialization.jackson.CborSerializable; import org.apache.pekko.serialization.jackson.CborSerializable;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.math.BigDecimal;
/** /**
* This bank account example illustrates the following: - different state classes representing the * This bank account example illustrates the following: - different state classes representing the
@ -48,6 +47,7 @@ public interface AccountExampleWithNullDurableState {
// Command // Command
// #reply-command // #reply-command
interface Command extends CborSerializable {} interface Command extends CborSerializable {}
// #reply-command // #reply-command
public static class CreateAccount implements Command { public static class CreateAccount implements Command {
@ -205,6 +205,7 @@ public interface AccountExampleWithNullDurableState {
.thenReply(command.replyTo, account2 -> StatusReply.ack()); .thenReply(command.replyTo, account2 -> StatusReply.ack());
} }
} }
// #reply // #reply
private ReplyEffect<Account> getBalance(OpenedAccount account, GetBalance command) { private ReplyEffect<Account> getBalance(OpenedAccount account, GetBalance command) {

View file

@ -13,6 +13,8 @@
package jdocs.org.apache.pekko.cluster.sharding.typed; package jdocs.org.apache.pekko.cluster.sharding.typed;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.math.BigDecimal;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.cluster.sharding.typed.javadsl.EntityTypeKey; import org.apache.pekko.cluster.sharding.typed.javadsl.EntityTypeKey;
@ -25,9 +27,6 @@ import org.apache.pekko.persistence.typed.javadsl.EventHandlerBuilder;
import org.apache.pekko.persistence.typed.javadsl.EventSourcedBehaviorWithEnforcedReplies; import org.apache.pekko.persistence.typed.javadsl.EventSourcedBehaviorWithEnforcedReplies;
import org.apache.pekko.persistence.typed.javadsl.ReplyEffect; import org.apache.pekko.persistence.typed.javadsl.ReplyEffect;
import org.apache.pekko.serialization.jackson.CborSerializable; import org.apache.pekko.serialization.jackson.CborSerializable;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.math.BigDecimal;
/** /**
* Bank account example illustrating: - different state classes representing the lifecycle of the * Bank account example illustrating: - different state classes representing the lifecycle of the

View file

@ -13,6 +13,10 @@
package jdocs.org.apache.pekko.cluster.sharding.typed; package jdocs.org.apache.pekko.cluster.sharding.typed;
import static jdocs.org.apache.pekko.cluster.sharding.typed.ShardingCompileOnlyTest.Counter;
import java.time.Duration;
import java.util.concurrent.CompletionStage;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.Address; import org.apache.pekko.actor.Address;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
@ -25,11 +29,6 @@ import org.apache.pekko.cluster.sharding.typed.javadsl.ClusterSharding;
import org.apache.pekko.cluster.sharding.typed.javadsl.Entity; import org.apache.pekko.cluster.sharding.typed.javadsl.Entity;
import org.apache.pekko.cluster.sharding.typed.javadsl.EntityTypeKey; import org.apache.pekko.cluster.sharding.typed.javadsl.EntityTypeKey;
import java.time.Duration;
import java.util.concurrent.CompletionStage;
import static jdocs.org.apache.pekko.cluster.sharding.typed.ShardingCompileOnlyTest.Counter;
public class ExternalShardAllocationCompileOnlyTest { public class ExternalShardAllocationCompileOnlyTest {
void example() { void example() {

View file

@ -13,25 +13,25 @@
package jdocs.org.apache.pekko.cluster.sharding.typed; package jdocs.org.apache.pekko.cluster.sharding.typed;
import static jdocs.org.apache.pekko.cluster.sharding.typed.HelloWorldPersistentEntityExample.*;
import static org.junit.Assert.assertEquals;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe; import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.apache.pekko.cluster.sharding.typed.javadsl.ClusterSharding; import org.apache.pekko.cluster.sharding.typed.javadsl.ClusterSharding;
import org.apache.pekko.cluster.sharding.typed.javadsl.EntityRef;
import org.apache.pekko.cluster.sharding.typed.javadsl.Entity; import org.apache.pekko.cluster.sharding.typed.javadsl.Entity;
import org.apache.pekko.cluster.sharding.typed.javadsl.EntityRef;
import org.apache.pekko.cluster.typed.Cluster; import org.apache.pekko.cluster.typed.Cluster;
import org.apache.pekko.cluster.typed.Join; import org.apache.pekko.cluster.typed.Join;
import org.apache.pekko.persistence.typed.PersistenceId; import org.apache.pekko.persistence.typed.PersistenceId;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import static jdocs.org.apache.pekko.cluster.sharding.typed.HelloWorldPersistentEntityExample.*;
import static org.junit.Assert.assertEquals;
public class HelloWorldEventSourcedEntityExampleTest extends JUnitSuite { public class HelloWorldEventSourcedEntityExampleTest extends JUnitSuite {
public static final Config config = public static final Config config =

View file

@ -13,6 +13,7 @@
package jdocs.org.apache.pekko.cluster.sharding.typed; package jdocs.org.apache.pekko.cluster.sharding.typed;
import java.util.*;
import org.apache.pekko.actor.typed.ActorSystem; import org.apache.pekko.actor.typed.ActorSystem;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.cluster.sharding.typed.*; import org.apache.pekko.cluster.sharding.typed.*;
@ -21,8 +22,6 @@ import org.apache.pekko.cluster.sharding.typed.javadsl.EntityRef;
import org.apache.pekko.persistence.typed.ReplicaId; import org.apache.pekko.persistence.typed.ReplicaId;
import org.apache.pekko.persistence.typed.ReplicationId; import org.apache.pekko.persistence.typed.ReplicationId;
import java.util.*;
public class ReplicatedShardingCompileOnlySpec { public class ReplicatedShardingCompileOnlySpec {
private static ActorSystem<?> system = null; private static ActorSystem<?> system = null;

View file

@ -13,6 +13,13 @@
package org.apache.pekko.cluster.sharding.typed; package org.apache.pekko.cluster.sharding.typed;
import static org.apache.pekko.cluster.sharding.typed.ReplicatedShardingTest.ProxyActor.ALL_REPLICAS;
import static org.junit.Assert.assertEquals;
import com.typesafe.config.ConfigFactory;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe; import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
@ -32,19 +39,11 @@ import org.apache.pekko.persistence.testkit.query.javadsl.PersistenceTestKitRead
import org.apache.pekko.persistence.typed.ReplicaId; import org.apache.pekko.persistence.typed.ReplicaId;
import org.apache.pekko.persistence.typed.ReplicationId; import org.apache.pekko.persistence.typed.ReplicationId;
import org.apache.pekko.persistence.typed.javadsl.*; import org.apache.pekko.persistence.typed.javadsl.*;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
import static org.apache.pekko.cluster.sharding.typed.ReplicatedShardingTest.ProxyActor.ALL_REPLICAS;
import static org.junit.Assert.assertEquals;
public class ReplicatedShardingTest extends JUnitSuite { public class ReplicatedShardingTest extends JUnitSuite {
static class MyReplicatedStringSet static class MyReplicatedStringSet
@ -221,7 +220,8 @@ public class ReplicatedShardingTest extends JUnitSuite {
new TestKitJunitResource( new TestKitJunitResource(
ConfigFactory.parseString( ConfigFactory.parseString(
" pekko.loglevel = DEBUG\n" " pekko.loglevel = DEBUG\n"
+ " pekko.loggers = [\"org.apache.pekko.testkit.SilenceAllTestEventListener\"]\n" + " pekko.loggers ="
+ " [\"org.apache.pekko.testkit.SilenceAllTestEventListener\"]\n"
+ " pekko.actor.provider = \"cluster\"\n" + " pekko.actor.provider = \"cluster\"\n"
+ " # pretend we're a node in all dc:s\n" + " # pretend we're a node in all dc:s\n"
+ " pekko.cluster.roles = [\"DC-A\", \"DC-B\", \"DC-C\"]\n" + " pekko.cluster.roles = [\"DC-A\", \"DC-B\", \"DC-C\"]\n"

View file

@ -13,6 +13,9 @@
package org.apache.pekko.cluster.sharding.typed.javadsl; package org.apache.pekko.cluster.sharding.typed.javadsl;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import java.util.concurrent.CompletionStage;
import org.apache.pekko.Done; import org.apache.pekko.Done;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
@ -25,15 +28,11 @@ import org.apache.pekko.persistence.typed.javadsl.CommandHandler;
import org.apache.pekko.persistence.typed.javadsl.Effect; import org.apache.pekko.persistence.typed.javadsl.Effect;
import org.apache.pekko.persistence.typed.javadsl.EventHandler; import org.apache.pekko.persistence.typed.javadsl.EventHandler;
import org.apache.pekko.persistence.typed.javadsl.EventSourcedBehavior; import org.apache.pekko.persistence.typed.javadsl.EventSourcedBehavior;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.util.concurrent.CompletionStage;
public class ClusterShardingPersistenceTest extends JUnitSuite { public class ClusterShardingPersistenceTest extends JUnitSuite {
public static final Config config = public static final Config config =

View file

@ -13,15 +13,14 @@
package org.apache.pekko.cluster.sharding.typed.javadsl; package org.apache.pekko.cluster.sharding.typed.javadsl;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import org.apache.pekko.actor.typed.ActorSystem; import org.apache.pekko.actor.typed.ActorSystem;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.apache.pekko.cluster.sharding.typed.ShardedDaemonProcessSettings; import org.apache.pekko.cluster.sharding.typed.ShardedDaemonProcessSettings;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
public class ShardedDaemonProcessCompileOnlyTest { public class ShardedDaemonProcessCompileOnlyTest {
interface Command {} interface Command {}

View file

@ -13,15 +13,14 @@
package org.apache.pekko.cluster.client; package org.apache.pekko.cluster.client;
import org.apache.pekko.actor.*;
import com.typesafe.config.ConfigFactory; import com.typesafe.config.ConfigFactory;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.apache.pekko.actor.*;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
public class ClusterClientTest extends JUnitSuite { public class ClusterClientTest extends JUnitSuite {
@ -44,6 +43,7 @@ public class ClusterClientTest extends JUnitSuite {
ActorPaths.fromString("pekko://OtherSys@host1:7355/system/receptionist"), ActorPaths.fromString("pekko://OtherSys@host1:7355/system/receptionist"),
ActorPaths.fromString("pekko://OtherSys@host2:7355/system/receptionist"))); ActorPaths.fromString("pekko://OtherSys@host2:7355/system/receptionist")));
} }
// #initialContacts // #initialContacts
@Test @Test
@ -115,6 +115,7 @@ public class ClusterClientTest extends JUnitSuite {
.build(); .build();
} }
} }
// #clientEventsListener // #clientEventsListener
// #receptionistEventsListener // #receptionistEventsListener

View file

@ -14,18 +14,15 @@
package org.apache.pekko.cluster.pubsub; package org.apache.pekko.cluster.pubsub;
import com.typesafe.config.ConfigFactory; import com.typesafe.config.ConfigFactory;
import org.apache.pekko.actor.AbstractActor;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.junit.ClassRule;
import org.junit.Test;
import org.apache.pekko.actor.ActorRef; import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.actor.ActorSystem; import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.actor.Props; import org.apache.pekko.actor.Props;
import org.apache.pekko.actor.AbstractActor;
import org.apache.pekko.event.Logging; import org.apache.pekko.event.Logging;
import org.apache.pekko.event.LoggingAdapter; import org.apache.pekko.event.LoggingAdapter;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.junit.ClassRule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
public class DistributedPubSubMediatorTest extends JUnitSuite { public class DistributedPubSubMediatorTest extends JUnitSuite {
@ -112,6 +109,7 @@ public class DistributedPubSubMediatorTest extends JUnitSuite {
.build(); .build();
} }
} }
// #publisher // #publisher
public // #send-destination public // #send-destination

View file

@ -13,9 +13,8 @@
package org.apache.pekko.cluster.singleton; package org.apache.pekko.cluster.singleton;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.actor.ActorRef; import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.actor.Props; import org.apache.pekko.actor.Props;
public class ClusterSingletonManagerTest { public class ClusterSingletonManagerTest {

View file

@ -15,9 +15,9 @@ package org.apache.pekko.cluster.singleton;
import org.apache.pekko.actor.AbstractActor; import org.apache.pekko.actor.AbstractActor;
import org.apache.pekko.actor.ActorRef; import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.cluster.singleton.TestSingletonMessages.*;
import org.apache.pekko.event.Logging; import org.apache.pekko.event.Logging;
import org.apache.pekko.event.LoggingAdapter; import org.apache.pekko.event.LoggingAdapter;
import org.apache.pekko.cluster.singleton.TestSingletonMessages.*;
public class Consumer extends AbstractActor { public class Consumer extends AbstractActor {

View file

@ -13,6 +13,12 @@
package jdocs.org.apache.pekko.cluster.ddata.typed.javadsl; package jdocs.org.apache.pekko.cluster.ddata.typed.javadsl;
import static jdocs.org.apache.pekko.cluster.ddata.typed.javadsl.ReplicatorDocSample.Counter;
import static org.junit.Assert.assertEquals;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import java.time.Duration;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing; import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource; import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe; import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
@ -22,18 +28,11 @@ import org.apache.pekko.cluster.ddata.GCounterKey;
import org.apache.pekko.cluster.ddata.Key; import org.apache.pekko.cluster.ddata.Key;
import org.apache.pekko.cluster.ddata.typed.javadsl.DistributedData; import org.apache.pekko.cluster.ddata.typed.javadsl.DistributedData;
import org.apache.pekko.cluster.ddata.typed.javadsl.Replicator; import org.apache.pekko.cluster.ddata.typed.javadsl.Replicator;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.time.Duration;
import static jdocs.org.apache.pekko.cluster.ddata.typed.javadsl.ReplicatorDocSample.Counter;
import static org.junit.Assert.assertEquals;
public class ReplicatorDocTest extends JUnitSuite { public class ReplicatorDocTest extends JUnitSuite {
static Config config = static Config config =

View file

@ -13,14 +13,13 @@
package jdocs.org.apache.pekko.cluster.typed; package jdocs.org.apache.pekko.cluster.typed;
import java.nio.charset.StandardCharsets;
import org.apache.pekko.actor.ExtendedActorSystem; import org.apache.pekko.actor.ExtendedActorSystem;
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.ActorRefResolver; import org.apache.pekko.actor.typed.ActorRefResolver;
import org.apache.pekko.actor.typed.javadsl.Adapter; import org.apache.pekko.actor.typed.javadsl.Adapter;
import org.apache.pekko.serialization.SerializerWithStringManifest; import org.apache.pekko.serialization.SerializerWithStringManifest;
import java.nio.charset.StandardCharsets;
public class PingSerializerExampleTest { public class PingSerializerExampleTest {
public class Pong {} public class Pong {}

View file

@ -15,13 +15,14 @@ package jdocs.org.apache.pekko.cluster.typed;
// #import // #import
import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.ActorSystem;
import org.apache.pekko.actor.typed.Behavior; import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.javadsl.ActorContext; import org.apache.pekko.actor.typed.javadsl.ActorContext;
import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.apache.pekko.actor.typed.receptionist.Receptionist; import org.apache.pekko.actor.typed.receptionist.Receptionist;
import org.apache.pekko.actor.typed.receptionist.ServiceKey; import org.apache.pekko.actor.typed.receptionist.ServiceKey;
// #import // #import
import org.apache.pekko.actor.typed.ActorSystem;
public interface ReceptionistExample { public interface ReceptionistExample {
@ -69,6 +70,7 @@ public interface ReceptionistExample {
return Behaviors.same(); return Behaviors.same();
} }
} }
// #ping-service // #ping-service
// #pinger // #pinger
@ -100,6 +102,7 @@ public interface ReceptionistExample {
return Behaviors.stopped(); return Behaviors.stopped();
} }
} }
// #pinger // #pinger
// #pinger-guardian // #pinger-guardian
@ -139,6 +142,7 @@ public interface ReceptionistExample {
return Behaviors.same(); return Behaviors.same();
} }
} }
// #pinger-guardian // #pinger-guardian
// #find // #find
@ -194,6 +198,7 @@ public interface ReceptionistExample {
return Behaviors.same(); return Behaviors.same();
} }
} }
// #find // #find
default void deregisterSample() { default void deregisterSample() {

View file

@ -13,16 +13,15 @@
package org.apache.pekko.cluster.typed; package org.apache.pekko.cluster.typed;
import org.apache.pekko.cluster.ClusterEvent;
import org.apache.pekko.actor.typed.ActorSystem;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import com.typesafe.config.Config; import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory; import com.typesafe.config.ConfigFactory;
import java.util.concurrent.TimeUnit;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.apache.pekko.actor.typed.ActorSystem;
import org.apache.pekko.cluster.ClusterEvent;
import org.junit.Test; import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite; import org.scalatestplus.junit.JUnitSuite;
import java.util.concurrent.TimeUnit;
public class ClusterApiTest extends JUnitSuite { public class ClusterApiTest extends JUnitSuite {
@Test @Test

View file

@ -13,11 +13,10 @@
package org.apache.pekko.cluster; package org.apache.pekko.cluster;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.actor.Address;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.actor.Address;
// Doc code, compile only // Doc code, compile only
@SuppressWarnings("ConstantConditions") @SuppressWarnings("ConstantConditions")

View file

@ -13,6 +13,8 @@
package org.apache.pekko.coordination.lease.javadsl; package org.apache.pekko.coordination.lease.javadsl;
import static org.junit.Assert.assertEquals;
import org.apache.pekko.actor.ActorSystem; import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.coordination.lease.scaladsl.LeaseProviderSpec; import org.apache.pekko.coordination.lease.scaladsl.LeaseProviderSpec;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource; import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
@ -20,8 +22,6 @@ import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class LeaseProviderTest { public class LeaseProviderTest {
@Rule @Rule
public PekkoJUnitActorSystemResource actorSystemResource = public PekkoJUnitActorSystemResource actorSystemResource =

View file

@ -13,13 +13,12 @@
package jdoc.org.apache.pekko.discovery; package jdoc.org.apache.pekko.discovery;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.discovery.Lookup;
import org.apache.pekko.discovery.Discovery;
import org.apache.pekko.discovery.ServiceDiscovery;
import java.time.Duration; import java.time.Duration;
import java.util.concurrent.CompletionStage; import java.util.concurrent.CompletionStage;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.discovery.Discovery;
import org.apache.pekko.discovery.Lookup;
import org.apache.pekko.discovery.ServiceDiscovery;
public class CompileOnlyTest { public class CompileOnlyTest {
public static void example() { public static void example() {

View file

@ -15,29 +15,26 @@ package jdocs.actor;
// #all // #all
// #imports // #imports
import static jdocs.actor.FaultHandlingDocSample.CounterApi.*;
import static jdocs.actor.FaultHandlingDocSample.CounterServiceApi.*;
import static jdocs.actor.FaultHandlingDocSample.StorageApi.*;
import static jdocs.actor.FaultHandlingDocSample.WorkerApi.*;
import static org.apache.pekko.actor.SupervisorStrategy.escalate;
import static org.apache.pekko.actor.SupervisorStrategy.restart;
import static org.apache.pekko.actor.SupervisorStrategy.stop;
import static org.apache.pekko.pattern.Patterns.pipe;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.time.Duration;
import org.apache.pekko.actor.*; import org.apache.pekko.actor.*;
import org.apache.pekko.event.LoggingReceive; import org.apache.pekko.event.LoggingReceive;
import org.apache.pekko.japi.pf.DeciderBuilder; import org.apache.pekko.japi.pf.DeciderBuilder;
import org.apache.pekko.pattern.Patterns; import org.apache.pekko.pattern.Patterns;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import static org.apache.pekko.actor.SupervisorStrategy.restart;
import static org.apache.pekko.actor.SupervisorStrategy.stop;
import static org.apache.pekko.actor.SupervisorStrategy.escalate;
import static org.apache.pekko.pattern.Patterns.pipe;
import static jdocs.actor.FaultHandlingDocSample.WorkerApi.*;
import static jdocs.actor.FaultHandlingDocSample.CounterServiceApi.*;
import static jdocs.actor.FaultHandlingDocSample.CounterApi.*;
import static jdocs.actor.FaultHandlingDocSample.StorageApi.*;
// #imports // #imports

View file

@ -13,20 +13,19 @@
package jdocs.actor; package jdocs.actor;
import java.time.Duration;
import java.util.Optional;
import jdocs.AbstractJavaTest;
import org.apache.pekko.actor.AbstractActor; import org.apache.pekko.actor.AbstractActor;
import org.apache.pekko.actor.ActorRef; import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.actor.ActorSystem; import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.actor.Props; import org.apache.pekko.actor.Props;
import jdocs.AbstractJavaTest;
import org.apache.pekko.japi.function.Predicate; import org.apache.pekko.japi.function.Predicate;
import org.apache.pekko.testkit.javadsl.TestKit; import org.apache.pekko.testkit.javadsl.TestKit;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import java.time.Duration;
import java.util.Optional;
public class InitializationDocTest extends AbstractJavaTest { public class InitializationDocTest extends AbstractJavaTest {
static ActorSystem system = null; static ActorSystem system = null;

View file

@ -37,6 +37,7 @@ public class Messages {
return values; return values;
} }
} }
// #immutable-message // #immutable-message
public static class DoIt { public static class DoIt {

View file

@ -14,8 +14,8 @@
package jdocs.actor; package jdocs.actor;
// #my-stopping-actor // #my-stopping-actor
import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.actor.AbstractActor; import org.apache.pekko.actor.AbstractActor;
import org.apache.pekko.actor.ActorRef;
public class MyStoppingActor extends AbstractActor { public class MyStoppingActor extends AbstractActor {

View file

@ -13,17 +13,17 @@
package jdocs.actor; package jdocs.actor;
import static org.junit.Assert.*;
import jdocs.AbstractJavaTest;
import org.apache.pekko.actor.ActorRef; import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.actor.ActorSystem; import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.actor.Props; import org.apache.pekko.actor.Props;
import jdocs.AbstractJavaTest;
import org.apache.pekko.testkit.javadsl.TestKit; import org.apache.pekko.testkit.javadsl.TestKit;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.*;
public class SampleActorTest extends AbstractJavaTest { public class SampleActorTest extends AbstractJavaTest {
static ActorSystem system; static ActorSystem system;

View file

@ -13,22 +13,22 @@
package jdocs.actor.fsm; package jdocs.actor.fsm;
import static jdocs.actor.fsm.Buncher.Data;
import static jdocs.actor.fsm.Buncher.State;
import static jdocs.actor.fsm.Buncher.State.*;
import static jdocs.actor.fsm.Buncher.Uninitialized.*;
import static jdocs.actor.fsm.Events.*;
// #simple-imports // #simple-imports
import org.apache.pekko.actor.AbstractFSM; import java.time.Duration;
import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.japi.pf.UnitMatch;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.time.Duration; import org.apache.pekko.actor.AbstractFSM;
import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.japi.pf.UnitMatch;
// #simple-imports // #simple-imports
import static jdocs.actor.fsm.Buncher.Data;
import static jdocs.actor.fsm.Buncher.State.*;
import static jdocs.actor.fsm.Buncher.State;
import static jdocs.actor.fsm.Buncher.Uninitialized.*;
import static jdocs.actor.fsm.Events.*;
// #simple-fsm // #simple-fsm
public class Buncher extends AbstractFSM<State, Data> { public class Buncher extends AbstractFSM<State, Data> {
{ {
@ -97,6 +97,7 @@ public class Buncher extends AbstractFSM<State, Data> {
initialize(); initialize();
// #fsm-body // #fsm-body
} }
// #simple-fsm // #simple-fsm
static static
@ -139,6 +140,7 @@ public class Buncher extends AbstractFSM<State, Data> {
public List<Object> getQueue() { public List<Object> getQueue() {
return queue; return queue;
} }
// #boilerplate // #boilerplate
@Override @Override

View file

@ -13,20 +13,20 @@
package jdocs.actor.fsm; package jdocs.actor.fsm;
import static jdocs.actor.fsm.Events.Batch;
import static jdocs.actor.fsm.Events.Flush.Flush;
import static jdocs.actor.fsm.Events.Queue;
import static jdocs.actor.fsm.Events.SetTarget;
import java.util.LinkedList;
import jdocs.AbstractJavaTest;
import org.apache.pekko.actor.ActorRef; import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.actor.ActorSystem; import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.actor.Props; import org.apache.pekko.actor.Props;
import jdocs.AbstractJavaTest;
import org.apache.pekko.testkit.javadsl.TestKit; import org.apache.pekko.testkit.javadsl.TestKit;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import java.util.LinkedList;
import static jdocs.actor.fsm.Events.Batch;
import static jdocs.actor.fsm.Events.Queue;
import static jdocs.actor.fsm.Events.SetTarget;
import static jdocs.actor.fsm.Events.Flush.Flush;
// #test-code // #test-code
public class BuncherTest extends AbstractJavaTest { public class BuncherTest extends AbstractJavaTest {

View file

@ -13,8 +13,8 @@
package jdocs.actor.fsm; package jdocs.actor.fsm;
import org.apache.pekko.actor.ActorRef;
import java.util.List; import java.util.List;
import org.apache.pekko.actor.ActorRef;
public class Events { public class Events {
@ -30,6 +30,7 @@ public class Events {
public ActorRef getRef() { public ActorRef getRef() {
return ref; return ref;
} }
// #boilerplate // #boilerplate
@Override @Override
@ -52,6 +53,7 @@ public class Events {
public Object getObj() { public Object getObj() {
return obj; return obj;
} }
// #boilerplate // #boilerplate
@Override @Override
@ -74,6 +76,7 @@ public class Events {
public List<Object> getList() { public List<Object> getList() {
return list; return list;
} }
// #boilerplate // #boilerplate
@Override @Override

Some files were not shown because too many files have changed in this diff Show more