Skip to content

Commit

Permalink
Config and name (#4802)
Browse files Browse the repository at this point in the history
* Use same config root as MP for Nima
* Use correct project name.
  • Loading branch information
tomas-langer authored Aug 26, 2022
1 parent 73db971 commit 06e089c
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ public static void main(String[] args) {
* @param router HTTP routing builder to configure routes for this service
*/
static void routing(HttpRouting.Builder router) {
router.get("/*", (req, res) -> res.send("Warp Works!"));
router.get("/*", (req, res) -> res.send("Níma Works!"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void testRootRoute() {
.request()
.as(String.class);

assertThat(response, is("Warp Works!"));
assertThat(response, is("Níma Works!"));
}

@Test
Expand All @@ -52,6 +52,6 @@ void testOtherRoute() {
.request()
.as(String.class);

assertThat(response, is("Warp Works!"));
assertThat(response, is("Níma Works!"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ public static void main(String[] args) {
*/
static void routing(HttpRouting.Builder router) {
router.update(ObserveSupport.create())
.get("/", (req, res) -> res.send("Warp Works!"));
.get("/", (req, res) -> res.send("Níma Works!"));
}
}
17 changes: 8 additions & 9 deletions examples/nima/observe/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
# limitations under the License.
#

nima:
server:
host: "127.0.0.1"
port: 8080
observe:
info:
values:
name: "Observe Example"
version: "1.0.0"
server:
host: "127.0.0.1"
port: 8080
observe:
info:
values:
name: "Observe Example"
version: "1.0.0"

app:
greeting: "Hello!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void testRootRoute() {
.request()
.as(String.class);

assertThat(response, is("Warp Works!"));
assertThat(response, is("Níma Works!"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* Example showing supported protocols.
*/
public class ProtocolsMain {
private static final byte[] RESPONSE = "Hello from WARP!".getBytes(StandardCharsets.UTF_8);
private static final byte[] RESPONSE = "Hello from Níma!".getBytes(StandardCharsets.UTF_8);

private ProtocolsMain() {
}
Expand Down
2 changes: 1 addition & 1 deletion examples/nima/quickstart-standalone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<version>4.0.0-SNAPSHOT</version>

<name>Helidon Níma Examples Quickstart Standalone</name>
<description>Example demonstrating a standalone project without a Warp parent.</description>
<description>Example demonstrating a standalone project without an application parent.</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.
#

nima:
server:
host: "127.0.0.1"
port: 8080
server:
host: "127.0.0.1"
port: 8080
7 changes: 3 additions & 4 deletions examples/nima/quickstart/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.
#

nima:
server:
host: "127.0.0.1"
port: 8080
server:
host: "127.0.0.1"
port: 8080
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static class Builder implements io.helidon.common.Builder<Builder, Observ
private Config config;

private Builder() {
config(Nima.config().get("nima.observe"));
config(Nima.config().get("observe"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,22 @@
# limitations under the License.
#

nima:
server:
sockets:
- name: "@default"
host: "127.0.0.1"
port: 8080
backlog: 8192
server:
sockets:
- name: "@default"
host: "127.0.0.1"
port: 8080
backlog: 8192
receive-buffer-size: 64000
write-queue-length: 8192
connection-options:
read-timeout-seconds: 0
connect-timeout-seconds: 0
send-buffer-size: 64000
receive-buffer-size: 64000
write-queue-length: 8192
connection-options:
read-timeout-seconds: 0
connect-timeout-seconds: 0
send-buffer-size: 64000
receive-buffer-size: 64000
connection-providers:
"http_1_1":
validate-headers: false
validate-path: false
recv-log: false
send-log: false
connection-providers:
"http_1_1":
validate-headers: false
validate-path: false
recv-log: false
send-log: false
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public WebSocketOriginTest(URI uri) {
static void updateServer(WebServer.Builder builder) {
builder.addConnectionProvider(Http1ConnectionProvider.builder()
.addUpgradeProvider(WsUpgradeProvider.builder()
.addOrigin("WarpTest")
.addOrigin("NimaTest")
.build())
.build());
}
Expand All @@ -79,7 +79,7 @@ void testSingle() throws ExecutionException, InterruptedException, TimeoutExcept
CompletableFuture<Boolean> wsCompleted = new CompletableFuture<>();

java.net.http.WebSocket webSocket = client.newWebSocketBuilder()
.header("Origin", "WarpTest")
.header("Origin", "NimaTest")
.buildAsync(URI.create("ws://localhost:" + port + "/single"),
new java.net.http.WebSocket.Listener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class Builder implements io.helidon.common.Builder<Builder, WebServer>, Router.R
HelidonServiceLoader.builder(ServiceLoader.load(ServerConnectionProvider.class));

Builder(Config rootConfig) {
Config config = rootConfig.get("nima.server");
Config config = rootConfig.get("server");
config.get("host").asString().ifPresent(this::host);
config.get("port").asInt().ifPresent(this::port);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public static class Builder implements io.helidon.common.Builder<Builder, Http1C

private Builder() {
Config config = Config.create()
.get("nima.server.connection-providers.http_1_1");
.get("server.connection-providers.http_1_1");

config.get("validate-headers").asBoolean().ifPresent(this::validateHeaders);
config.get("validate-path").asBoolean().ifPresent(this::validatePath);
Expand Down

0 comments on commit 06e089c

Please sign in to comment.