-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support configuring minThreads and maxThreads (#722)
- Loading branch information
1 parent
749ed8e
commit 86de754
Showing
6 changed files
with
142 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
http-server-jetty/src/test/groovy/io/micronaut/servlet/jetty/JettyConfigurationSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package io.micronaut.servlet.jetty | ||
|
||
import io.micronaut.context.annotation.Property | ||
import io.micronaut.http.HttpRequest | ||
import io.micronaut.http.MediaType | ||
import io.micronaut.http.annotation.Controller | ||
import io.micronaut.http.annotation.Get | ||
import io.micronaut.http.annotation.Produces | ||
import io.micronaut.http.annotation.QueryValue | ||
import io.micronaut.http.client.HttpClient | ||
import io.micronaut.http.client.annotation.Client | ||
import io.micronaut.servlet.engine.MicronautServletConfiguration | ||
import io.micronaut.test.extensions.spock.annotation.MicronautTest | ||
import jakarta.inject.Inject | ||
import org.eclipse.jetty.server.Server | ||
import org.eclipse.jetty.util.Jetty | ||
import spock.lang.Specification | ||
|
||
@MicronautTest | ||
@Property(name = "spec.name", value = SPEC_NAME) | ||
@Property(name = "micronaut.servlet.minThreads", value = "11") | ||
@Property(name = "micronaut.servlet.maxThreads", value = "11") | ||
class JettyConfigurationSpec extends Specification { | ||
|
||
static final String SPEC_NAME = "JettyConfigurationSpec" | ||
|
||
@Inject | ||
Server jetty | ||
|
||
@Inject | ||
@Client("/configTest") | ||
HttpClient client | ||
|
||
void "configuring thread pool is supported"() { | ||
when: | ||
var threadPool = jetty.threadPool | ||
|
||
then: | ||
threadPool.threads == 11 | ||
|
||
when: | ||
def request = HttpRequest.GET("/") | ||
String response = client.toBlocking().retrieve(request) | ||
|
||
then: | ||
response == "OK" | ||
} | ||
|
||
@Controller("/configTest") | ||
static class TestController { | ||
|
||
@Get | ||
@Produces(MediaType.TEXT_PLAIN) | ||
String index() { | ||
"OK" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters