Skip to content

Commit

Permalink
Move tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bryce-anderson committed Dec 11, 2024
1 parent 2d1db2a commit 5ae052a
Show file tree
Hide file tree
Showing 50 changed files with 10 additions and 141 deletions.
10 changes: 4 additions & 6 deletions servicetalk-examples/docs/modules/ROOT/pages/http/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -236,20 +236,18 @@ on via a client filter on the client builder.

[#LoadBalancer]
== LoadBalancer
This example demonstrates how to use and configure the experimental link:{source-root}/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancers.java[LoadBalancers]:
This example demonstrates how to use and configure link:{source-root}/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/LoadBalancers.java[LoadBalancers]:

- by using link:{source-root}/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancerBuilder.java[LoadBalancerBuilder] to customize its setting:
* configuring a different link:{source-root}/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancingPolicy.java[LoadBalancingPolicy]
* configuring xDS failure detection using link:{source-root}/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/OutlierDetectorConfig.java[OutlierDetectorConfig]
- by using link:{source-root}/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/LoadBalancerBuilder.java[LoadBalancerBuilder] to customize its setting:
* configuring a different link:{source-root}/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/LoadBalancingPolicy.java[LoadBalancingPolicy]
* configuring xDS failure detection using link:{source-root}/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/OutlierDetectorConfig.java[OutlierDetectorConfig]
- by using link:{source-root}/servicetalk-http-api/src/main/java/io/servicetalk/http/api/DefaultHttpLoadBalancerFactory.java[DefaultHttpLoadBalancerFactory] to adapt a LoadBalancer to HTTP and configure it via client builder

Using the following classes:

- link:{source-root}/servicetalk-examples/http/loadbalancer/src/main/java/io/servicetalk/examples/http/loadbalancer/CustomLoadBalancerClient.java[CustomLoadBalancerClient] - A client that configures custom settings for its LoadBalancer.
- link:{source-root}/servicetalk-examples/http/loadbalancer/src/main/java/io/servicetalk/examples/http/loadbalancer/HelloWorldServer.java[HelloWorldServer] - A simple server implementation.

NOTE: DefaultLoadBalancer is currently considered experimental and therefore the API is subject to change.

[#OpenTracing]
== OpenTracing

Expand Down
1 change: 0 additions & 1 deletion servicetalk-http-netty/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ dependencies {
implementation project(":servicetalk-dns-discovery-netty")
implementation project(":servicetalk-http-utils")
implementation project(":servicetalk-loadbalancer")
implementation project(":servicetalk-loadbalancer-experimental")
implementation project(":servicetalk-loadbalancer-experimental-provider")
implementation project(":servicetalk-logging-slf4j-internal")
implementation project(":servicetalk-tcp-netty-internal")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ dependencies {

implementation project(":servicetalk-annotations")
implementation project(":servicetalk-loadbalancer")
implementation project(":servicetalk-loadbalancer-experimental")
implementation "org.slf4j:slf4j-api:$slf4jVersion"
}
39 changes: 0 additions & 39 deletions servicetalk-loadbalancer-experimental/build.gradle

This file was deleted.

7 changes: 0 additions & 7 deletions servicetalk-loadbalancer-experimental/gradle.lockfile

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">

<suppressions>C
<suppressions>
<suppress checks="LineLength"
files="io[\\/]servicetalk[\\/]loadbalancer[\\/]OutlierDetectorConfig.java"/>
</suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ private ConnectionPoolPolicies() {
// no instances
}

/**
* Get the recommended default {@link ConnectionPoolPolicy}.
* @param <C> the concrete type of the {@link LoadBalancedConnection}
* @return the recommended default {@link ConnectionPoolPolicy}.
*/
public static <C extends LoadBalancedConnection> ConnectionPoolPolicy<C> defaultPolicy() {
return linearSearch();
}

/**
* A connection selection policy that prioritizes a configurable "core" pool.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ final class DefaultLoadBalancerBuilder<ResolvedAddress, C extends LoadBalancedCo
private Executor backgroundExecutor;
@Nullable
private LoadBalancerObserverFactory loadBalancerObserverFactory;
private LoadBalancingPolicy<ResolvedAddress, C> loadBalancingPolicy = LoadBalancingPolicies.defaultPolicy();
private ConnectionPoolPolicy<C> connectionPoolPolicy = ConnectionPoolPolicies.defaultPolicy();;
private LoadBalancingPolicy<ResolvedAddress, C> loadBalancingPolicy = LoadBalancingPolicies.roundRobin().build();
private ConnectionPoolPolicy<C> connectionPoolPolicy = ConnectionPoolPolicies.linearSearch();
private OutlierDetectorConfig outlierDetectorConfig = OutlierDetectorConfig.DEFAULT_CONFIG;

// package private constructor so users must funnel through providers in `LoadBalancers`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package io.servicetalk.loadbalancer;

import io.servicetalk.client.api.LoadBalancedConnection;

/**
* A collections of factories for constructing a {@link LoadBalancingPolicy}.
*/
Expand All @@ -26,15 +24,6 @@ private LoadBalancingPolicies() {
// no instances.
}

/**
* Get the recommended default {@link LoadBalancingPolicy}.
* @return the recommended default {@link LoadBalancingPolicy}.
*/
public static <ResolvedAddress, C extends LoadBalancedConnection>
LoadBalancingPolicy<ResolvedAddress, C> defaultPolicy() {
return LoadBalancingPolicies.roundRobin().build();
}

/**
* Builder for the round-robin {@link LoadBalancingPolicy}.
* Round-robin load balancing is a strategy that maximizes fairness of the request distribution. This comes at the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

import static io.servicetalk.loadbalancer.RoundRobinToDefaultLBMigrationProvider.PROPERTY_NAME;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

Expand All @@ -34,11 +35,13 @@ class RoundRobinLoadBalancerBuilderProviderTest {
@BeforeEach
void reset() {
TestRoundRobinLoadBalancerBuilderProvider.reset();
System.setProperty(PROPERTY_NAME, Boolean.FALSE.toString());
}

@AfterEach
void deactivate() {
TestRoundRobinLoadBalancerBuilderProvider.activated.set(false);
System.setProperty(PROPERTY_NAME, Boolean.TRUE.toString());
}

@Test
Expand Down
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ include "servicetalk-annotations",
"servicetalk-http-security-jersey3-jakarta10",
"servicetalk-http-utils",
"servicetalk-loadbalancer",
"servicetalk-loadbalancer-experimental",
"servicetalk-loadbalancer-experimental-provider",
"servicetalk-log4j2-mdc",
"servicetalk-log4j2-mdc-utils",
Expand Down

0 comments on commit 5ae052a

Please sign in to comment.