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
-Dmultinode.XX:MetaspaceSize=128M
-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;
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.testkit.typed.annotations.JUnit5TestKit;
import org.apache.pekko.actor.testkit.typed.javadsl.*;
import org.apache.pekko.actor.testkit.typed.javadsl.JUnit5TestKitBuilder;
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.extension.ExtendWith;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
// #junit5-integration
@DisplayName("JUnit5")
@ExtendWith(TestKitJUnit5Extension.class)

View file

@ -17,6 +17,8 @@
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.javadsl.*;
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.extension.ExtendWith;
import static jdocs.org.apache.pekko.actor.testkit.typed.javadsl.AsyncTestingExampleTest.Echo;
// test code copied from LogCapturingExampleTest.java
@DisplayName("JUnit5 log capturing")

View file

@ -15,20 +15,17 @@ package jdocs.org.apache.pekko.actor.testkit.typed.javadsl;
// #manual-scheduling-simple
import java.time.Duration;
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.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.Rule;
import org.scalatestplus.junit.JUnitSuite;
import java.time.Duration;
import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.junit.Test;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.scalatestplus.junit.JUnitSuite;
public class ManualTimerExampleTest extends JUnitSuite {

View file

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

View file

@ -13,14 +13,13 @@
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.Props;
import org.apache.pekko.actor.typed.Scheduler;
import org.apache.pekko.actor.typed.javadsl.Behaviors;
import java.time.Duration;
import java.util.List;
public class ActorTestKitApiTest {
public void compileOnlyTestCase() {

View file

@ -9,22 +9,20 @@
package org.apache.pekko.actor.testkit.typed.javadsl;
import org.apache.pekko.actor.testkit.typed.annotations.JUnit5TestKit;
import org.apache.pekko.Done;
import org.apache.pekko.actor.typed.javadsl.Behaviors;
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 static org.apache.pekko.Done.done;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
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.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.apache.pekko.Done;
import org.apache.pekko.actor.testkit.typed.annotations.JUnit5TestKit;
import org.apache.pekko.actor.typed.javadsl.Behaviors;
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")
@ExtendWith(TestKitJUnit5Extension.class)

View file

@ -13,6 +13,12 @@
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.actor.typed.javadsl.Behaviors;
import org.junit.ClassRule;
@ -20,13 +26,6 @@ import org.junit.Rule;
import org.junit.Test;
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 {
@ClassRule public static TestKitJunitResource testKit = new TestKitJunitResource();

View file

@ -13,6 +13,13 @@
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.actor.testkit.typed.CapturedLogEvent;
import org.apache.pekko.actor.testkit.typed.Effect;
@ -25,14 +32,6 @@ import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
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 interface Command {}

View file

@ -13,6 +13,11 @@
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.TestException;
import org.junit.ClassRule;
@ -21,12 +26,6 @@ import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
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 {
@ClassRule public static TestKitJunitResource testKit = new TestKitJunitResource();

View file

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

View file

@ -13,17 +13,14 @@
package org.apache.pekko.actor;
import static org.junit.Assert.*;
import static java.util.stream.Collectors.toCollection;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.stream.IntStream;
import org.apache.pekko.japi.function.Creator;
import org.junit.Assert;
import org.junit.Test;
import org.apache.pekko.japi.function.Creator;
import org.scalatestplus.junit.JUnitSuite;
public class ActorCreationTest extends JUnitSuite {
@ -193,7 +190,8 @@ public class ActorCreationTest extends JUnitSuite {
}
}));
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());
}

View file

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

View file

@ -13,17 +13,16 @@
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.junit.Before;
import org.junit.Rule;
import org.junit.Test;
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 {
@Rule

View file

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

View file

@ -13,29 +13,27 @@
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.LoggerInitialized;
import org.apache.pekko.japi.function.Creator;
import org.apache.pekko.japi.Pair;
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.Tuple4;
import org.apache.pekko.routing.GetRoutees;
import org.apache.pekko.routing.FromConfig;
import org.apache.pekko.routing.GetRoutees;
import org.apache.pekko.routing.NoRouter;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.testkit.PekkoSpec;
import org.apache.pekko.testkit.TestProbe;
import org.junit.ClassRule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import scala.Option;
import java.util.Optional;
import static org.junit.Assert.*;
public class JavaAPI extends JUnitSuite {
@ClassRule

View file

@ -13,14 +13,14 @@
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 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 {
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.TestProbe;
import org.junit.ClassRule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;

View file

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

View file

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

View file

@ -13,30 +13,28 @@
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 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.assertNotNull;
import static org.junit.Assert.assertSame;
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 {
private static final Config config = ConfigFactory.parseString("pekko.loglevel = DEBUG\n");

View file

@ -13,17 +13,15 @@
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.event.LoggingAdapter;
import org.apache.pekko.event.NoLogging;
import org.apache.pekko.serialization.JavaSerializer;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import scala.Option;
import java.util.concurrent.Callable;
import static org.junit.Assert.*;
public class JavaAPITestBase extends JUnitSuite {

View file

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

View file

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

View file

@ -13,15 +13,14 @@
package org.apache.pekko.japi.pf;
import static org.junit.Assert.*;
import java.util.Arrays;
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 static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
@SuppressWarnings("serial")
public class ReceiveBuilderTest extends JUnitSuite {

View file

@ -13,6 +13,13 @@
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.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.testkit.PekkoSpec;
@ -23,14 +30,6 @@ import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
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 {
@ClassRule

View file

@ -13,6 +13,16 @@
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.dispatch.CompletionStages;
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.TestProbe;
import org.apache.pekko.util.Timeout;
import org.junit.ClassRule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
@ -29,17 +38,6 @@ import scala.concurrent.ExecutionContext;
import scala.concurrent.Future;
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> */
public class PatternsTest extends JUnitSuite {

View file

@ -13,6 +13,13 @@
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.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.testkit.PekkoSpec;
@ -23,15 +30,6 @@ import org.junit.ClassRule;
import org.junit.Test;
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 {
@ClassRule

View file

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

View file

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

View file

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

View file

@ -14,6 +14,11 @@
package jdocs.org.apache.pekko.typed;
// #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.Behavior;
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.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> {
interface Command {}

View file

@ -13,6 +13,19 @@
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.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
@ -27,20 +40,6 @@ import org.junit.Rule;
import org.junit.Test;
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 {
@ClassRule public static final TestKitJunitResource testKit = new TestKitJunitResource();

View file

@ -13,6 +13,10 @@
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.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
@ -22,11 +26,6 @@ import org.junit.Rule;
import org.junit.Test;
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 {
@ClassRule

View file

@ -14,8 +14,8 @@
package jdocs.org.apache.pekko.typed;
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.javadsl.*;
public class DispatchersDocTest {

View file

@ -13,15 +13,14 @@
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.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
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 {
@ -55,6 +54,7 @@ interface FSMDocTest {
this.obj = obj;
}
}
// #simple-events
// #storing-state
@ -132,6 +132,7 @@ interface FSMDocTest {
}
// #storing-state
}
// #storing-state
// #simple-state

View file

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

View file

@ -13,6 +13,7 @@
package jdocs.org.apache.pekko.typed;
import com.typesafe.config.ConfigFactory;
import org.apache.pekko.Done;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
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.MailboxSelector;
import org.apache.pekko.actor.typed.javadsl.Behaviors;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;

View file

@ -12,15 +12,18 @@
*/
package jdocs.org.apache.pekko.typed;
/*
* 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.Behavior;
import org.apache.pekko.actor.typed.DispatcherSelector;
// #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.javadsl.ActorContext;
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.receptionist.Receptionist;
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.Test;
import org.scalatestplus.junit.JUnitSuite;

View file

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

View file

@ -13,6 +13,11 @@
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.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
@ -23,12 +28,6 @@ import org.junit.Rule;
import org.junit.Test;
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 {
@ClassRule public static final TestKitJunitResource testKit = new TestKitJunitResource();

View file

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

View file

@ -14,6 +14,8 @@
package jdocs.org.apache.pekko.typed;
// #behavior
import java.time.Duration;
import java.util.function.BiFunction;
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior;
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.TimerScheduler;
import java.time.Duration;
import java.util.function.BiFunction;
public class TailChopping<Reply> extends AbstractBehavior<TailChopping.Command> {
interface Command {}

View file

@ -13,23 +13,23 @@
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.typed.ActorRef;
import org.apache.pekko.actor.typed.ActorSystem;
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;
// #adapter-import
// 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.javadsl.TestKit;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import scala.concurrent.duration.Duration;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.same;
public class ClassicWatchingTypedTest extends JUnitSuite {
// #classic-watch
@ -63,6 +63,7 @@ public class ClassicWatchingTypedTest extends JUnitSuite {
.build();
}
}
// #classic-watch
// #typed
@ -90,6 +91,7 @@ public class ClassicWatchingTypedTest extends JUnitSuite {
.build();
}
}
// #typed
@Test

View file

@ -19,10 +19,10 @@ import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior;
// #adapter-import
// 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.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.Receive;
import org.apache.pekko.testkit.javadsl.TestKit;
@ -83,6 +83,7 @@ public class TypedWatchingClassicTest extends JUnitSuite {
return this;
}
}
// #typed
// #classic
@ -100,6 +101,7 @@ public class TypedWatchingClassicTest extends JUnitSuite {
message.replyTo.tell(Typed.Pong.INSTANCE);
}
}
// #classic
@Test

View file

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

View file

@ -14,6 +14,8 @@
package jdocs.org.apache.pekko.typed.fromclassic;
// #hello-world-actor
import java.util.HashMap;
import java.util.Map;
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior;
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.Receive;
import java.util.HashMap;
import java.util.Map;
// #hello-world-actor
interface TypedSample {
@ -70,6 +69,7 @@ interface TypedSample {
return this;
}
}
// #hello-world-actor
// #children
@ -129,6 +129,7 @@ interface TypedSample {
return this;
}
}
// #children
public class Child {

View file

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

View file

@ -13,16 +13,15 @@
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.actor.typed.javadsl.Behaviors;
import org.junit.Test;
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 {
@Test

View file

@ -13,19 +13,18 @@
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 org.junit.Assert.assertEquals;
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 static class MyExtImpl implements Extension {}
@ -61,7 +60,8 @@ public class ExtensionsTest extends JUnitSuite {
public void loadJavaExtensionsFromConfig() {
Config cfg =
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();
final ActorSystem<Object> system =
ActorSystem.create(Behaviors.empty(), "loadJavaExtensionsFromConfig", cfg);

View file

@ -17,7 +17,11 @@
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.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.javadsl.AbstractBehavior;
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.junit.Test;
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
public class EventStreamDocTest extends JUnitSuite {

View file

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

View file

@ -13,21 +13,20 @@
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.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.Behavior;
import org.apache.pekko.pattern.StatusReply;
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.Rule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import java.time.Duration;
public class ActorContextAskTest extends JUnitSuite {
@ClassRule

View file

@ -13,6 +13,13 @@
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.LoggingTestKit;
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.Behavior;
import org.apache.pekko.actor.typed.Props;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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 {
@ClassRule

View file

@ -13,6 +13,10 @@
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.TestKitJunitResource;
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.japi.pf.PFBuilder;
import org.apache.pekko.testkit.CustomEventFilter;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import scala.concurrent.duration.FiniteDuration;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class ActorLoggingTest extends JUnitSuite {
@ClassRule

View file

@ -13,27 +13,26 @@
package org.apache.pekko.actor.typed.javadsl;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.typed.internal.adapter.SchedulerAdapter;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import java.time.Duration;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
import org.apache.pekko.testkit.PekkoSpec;
import org.apache.pekko.actor.SupervisorStrategy;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.Signal;
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.actor.SupervisorStrategy;
import static org.apache.pekko.actor.typed.javadsl.Behaviors.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.scalatestplus.junit.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 {
public final ActorRef<String> replyTo;

View file

@ -13,24 +13,22 @@
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.TestKitJunitResource;
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.Rule;
import org.junit.Test;
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]] */
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() {
Behavior<Message> b =
@ -153,9 +152,11 @@ public class BehaviorBuilderTest extends JUnitSuite {
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 {
final ActorRef<Got> sender;
@ -163,7 +164,8 @@ public class BehaviorBuilderTest extends JUnitSuite {
public Get(ActorRef<Got> sender) {
this.sender = sender;
}
};
}
;
static final class Got {
final int n;

View file

@ -13,20 +13,19 @@
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.TestKitJunitResource;
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.PostStop;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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]] */
public class ReceiveBuilderTest extends JUnitSuite {

View file

@ -13,8 +13,10 @@
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.TestKitJunitResource;
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
@ -27,9 +29,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class RoutersTest extends JUnitSuite {
@ClassRule

View file

@ -13,6 +13,10 @@
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.javadsl.LogCapturing;
import org.apache.pekko.actor.typed.internal.StashBufferImpl;
@ -20,11 +24,6 @@ import org.junit.Rule;
import org.junit.Test;
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 {
@Rule public final LogCapturing logCapturing = new LogCapturing();

View file

@ -13,23 +13,20 @@
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.TimeUnit;
import org.apache.pekko.Done;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJunitResource;
import org.apache.pekko.actor.typed.*;
import org.junit.ClassRule;
import org.junit.Rule;
import org.scalatestplus.junit.JUnitSuite;
import org.junit.Test;
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.*;
import org.scalatestplus.junit.JUnitSuite;
public class WatchTest extends JUnitSuite {

View file

@ -13,15 +13,14 @@
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.ActorSystem;
import org.apache.pekko.actor.typed.javadsl.AskPattern;
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 void compileOnlyApiTest() {

View file

@ -16,8 +16,6 @@ package org.apache.pekko.actor;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import org.apache.pekko.actor.Cell;
final class AbstractActorRef {
static final VarHandle cellHandle;
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.VarHandle;
import org.apache.pekko.actor.ActorCell;
import org.apache.pekko.dispatch.Mailbox;

View file

@ -17,13 +17,13 @@
package org.apache.pekko.io;
import static java.lang.invoke.MethodType.methodType;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import static java.lang.invoke.MethodType.methodType;
/**
* 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
@ -100,9 +100,9 @@ final class ByteBufferCleaner {
} catch (final Throwable t) {
cleaner = null;
System.err.println(
"WARNING: ByteBuffer Cleaner failed to clean a test buffer. ByteBuffer Cleaner "
+ "has been disabled. This means direct ByteBuffers will only be cleaned upon garbage collection. "
+ "Reason: "
"WARNING: ByteBuffer Cleaner failed to clean a test buffer. ByteBuffer Cleaner has been"
+ " disabled. This means direct ByteBuffers will only be cleaned upon garbage"
+ " collection. Reason: "
+ t);
}
}

View file

@ -13,11 +13,11 @@
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.Predicate;
import static org.apache.pekko.actor.SupervisorStrategy.Directive;
/**
* 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

View file

@ -13,10 +13,10 @@
package org.apache.pekko.japi.pf;
import java.util.List;
import org.apache.pekko.actor.FSM;
import org.apache.pekko.japi.function.*;
import scala.PartialFunction;
import java.util.List;
/**
* 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.Procedure2;
import scala.PartialFunction;
import scala.runtime.BoxedUnit;
import scala.Tuple2;
import scala.runtime.BoxedUnit;
/**
* 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.VarHandle;
import scala.concurrent.duration.FiniteDuration;
import org.apache.pekko.pattern.CircuitBreaker.State;
import scala.concurrent.duration.FiniteDuration;
class AbstractCircuitBreaker {
protected static final VarHandle stateHandle;

View file

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

View file

@ -13,6 +13,18 @@
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.actor.testkit.typed.javadsl.LogCapturing;
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.pattern.StatusReply;
import org.apache.pekko.persistence.typed.PersistenceId;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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 static final Config config =

View file

@ -13,6 +13,8 @@
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.actor.typed.ActorRef;
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.ReplyEffect;
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
@ -50,6 +49,7 @@ public interface AccountExampleWithEventHandlersInState {
// Command
// #reply-command
interface Command extends CborSerializable {}
// #reply-command
public static class CreateAccount implements Command {
@ -236,6 +236,7 @@ public interface AccountExampleWithEventHandlersInState {
.thenReply(command.replyTo, account2 -> StatusReply.ack());
}
}
// #reply
private ReplyEffect<Event, Account> getBalance(OpenedAccount account, GetBalance command) {

View file

@ -13,6 +13,8 @@
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.actor.typed.ActorRef;
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.ReplyEffect;
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

View file

@ -13,6 +13,8 @@
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.actor.typed.ActorRef;
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.ReplyEffect;
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
@ -48,6 +47,7 @@ public interface AccountExampleWithNullDurableState {
// Command
// #reply-command
interface Command extends CborSerializable {}
// #reply-command
public static class CreateAccount implements Command {
@ -205,6 +205,7 @@ public interface AccountExampleWithNullDurableState {
.thenReply(command.replyTo, account2 -> StatusReply.ack());
}
}
// #reply
private ReplyEffect<Account> getBalance(OpenedAccount account, GetBalance command) {

View file

@ -13,6 +13,8 @@
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.actor.typed.ActorRef;
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.ReplyEffect;
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

View file

@ -13,6 +13,10 @@
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.actor.Address;
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.EntityTypeKey;
import java.time.Duration;
import java.util.concurrent.CompletionStage;
import static jdocs.org.apache.pekko.cluster.sharding.typed.ShardingCompileOnlyTest.Counter;
public class ExternalShardAllocationCompileOnlyTest {
void example() {

View file

@ -13,25 +13,25 @@
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.TestKitJunitResource;
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.EntityRef;
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.Join;
import org.apache.pekko.persistence.typed.PersistenceId;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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 static final Config config =

View file

@ -13,6 +13,7 @@
package jdocs.org.apache.pekko.cluster.sharding.typed;
import java.util.*;
import org.apache.pekko.actor.typed.ActorSystem;
import org.apache.pekko.actor.typed.Behavior;
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.ReplicationId;
import java.util.*;
public class ReplicatedShardingCompileOnlySpec {
private static ActorSystem<?> system = null;

View file

@ -13,6 +13,13 @@
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.TestKitJunitResource;
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.ReplicationId;
import org.apache.pekko.persistence.typed.javadsl.*;
import com.typesafe.config.ConfigFactory;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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 {
static class MyReplicatedStringSet
@ -221,7 +220,8 @@ public class ReplicatedShardingTest extends JUnitSuite {
new TestKitJunitResource(
ConfigFactory.parseString(
" 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"
+ " # pretend we're a node in all dc:s\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;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import java.util.concurrent.CompletionStage;
import org.apache.pekko.Done;
import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing;
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.EventHandler;
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.Rule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import java.util.concurrent.CompletionStage;
public class ClusterShardingPersistenceTest extends JUnitSuite {
public static final Config config =

View file

@ -13,15 +13,14 @@
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.Behavior;
import org.apache.pekko.actor.typed.javadsl.Behaviors;
import org.apache.pekko.cluster.sharding.typed.ShardedDaemonProcessSettings;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
public class ShardedDaemonProcessCompileOnlyTest {
interface Command {}

View file

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

View file

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

View file

@ -13,9 +13,8 @@
package org.apache.pekko.cluster.singleton;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.actor.Props;
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.ActorRef;
import org.apache.pekko.cluster.singleton.TestSingletonMessages.*;
import org.apache.pekko.event.Logging;
import org.apache.pekko.event.LoggingAdapter;
import org.apache.pekko.cluster.singleton.TestSingletonMessages.*;
public class Consumer extends AbstractActor {

View file

@ -13,6 +13,12 @@
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.TestKitJunitResource;
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.typed.javadsl.DistributedData;
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.Rule;
import org.junit.Test;
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 {
static Config config =

View file

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

View file

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

View file

@ -13,16 +13,15 @@
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.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.scalatestplus.junit.JUnitSuite;
import java.util.concurrent.TimeUnit;
public class ClusterApiTest extends JUnitSuite {
@Test

View file

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

View file

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

View file

@ -13,13 +13,12 @@
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.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 static void example() {

View file

@ -15,29 +15,26 @@ package jdocs.actor;
// #all
// #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.HashMap;
import java.util.List;
import java.util.Map;
import java.time.Duration;
import org.apache.pekko.actor.*;
import org.apache.pekko.event.LoggingReceive;
import org.apache.pekko.japi.pf.DeciderBuilder;
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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -13,20 +13,20 @@
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.ActorSystem;
import org.apache.pekko.actor.Props;
import jdocs.AbstractJavaTest;
import org.apache.pekko.testkit.javadsl.TestKit;
import org.junit.AfterClass;
import org.junit.BeforeClass;
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
public class BuncherTest extends AbstractJavaTest {

View file

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

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