Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
Signed-off-by: tvallin <[email protected]>
  • Loading branch information
tvallin committed Mar 13, 2024
1 parent bbd2fd3 commit 937fc20
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ private static String normalizePath(String value) {
if (value == null) {
return null;
}
return value.replace("\\", "/");
return value.replace(File.separator, "/");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package io.helidon.inject.tools;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
Expand Down Expand Up @@ -222,7 +223,7 @@ static String normalizePath(String value) {
if (value == null) {
return null;
}
return value.replace("\\", "/");
return value.replace(File.separator, "/");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.helidon.integrations.oci.sdk.runtime;

import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Path;
Expand Down Expand Up @@ -169,7 +170,7 @@ private static String normalizePath(String value) {
if (value == null) {
return null;
}
return value.replace("\\", "/");
return value.replace(File.separator, "/");
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.sdk.trace.data.SpanData;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

@DisabledOnOs(OS.WINDOWS)
class WithSpanTest extends WithSpanTestBase {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@

import io.helidon.microprofile.testing.junit5.AddBean;

import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

@AddBean(App.class)
@AddBean(AppTracedResource.class)
@DisabledOnOs(OS.WINDOWS)
class WithSpanWithExplicitAppTest extends WithSpanTestBase {

@ParameterizedTest()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates.
* Copyright (c) 2023, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,7 +43,7 @@ public class InMemorySpanExporter implements SpanExporter {
*/
public List<SpanData> getFinishedSpanItems(int spanCount) {
assertSpanCount(spanCount);
return finishedSpanItems.stream().sorted(comparingLong(SpanData::getStartEpochNanos).reversed())
return finishedSpanItems.stream().sorted(comparingLong(SpanData::getEndEpochNanos))
.collect(Collectors.toList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,21 @@

import java.util.List;

import io.helidon.http.Status;
import io.helidon.microprofile.telemetry.InMemorySpanExporterProvider;
import io.helidon.microprofile.testing.junit5.AddBean;
import io.helidon.microprofile.testing.junit5.AddConfig;
import io.helidon.microprofile.testing.junit5.AddExtension;
import io.helidon.microprofile.testing.junit5.HelidonTest;

import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.instrumentation.annotations.WithSpan;
import io.opentelemetry.sdk.trace.data.SpanData;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.Response;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import static io.opentelemetry.api.trace.SpanKind.INTERNAL;
import static io.opentelemetry.api.trace.SpanKind.SERVER;
Expand Down Expand Up @@ -73,7 +65,6 @@ void setup() {
}

@Test
@DisabledOnOs(OS.WINDOWS)
void spanHierarchy() {

assertThat(webTarget.path("mixed").request().get().getStatus(), is(Response.Status.OK.getStatusCode()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates.
* Copyright (c) 2023, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,10 +17,8 @@
package io.helidon.microprofile.telemetry;

import java.util.List;
import java.util.stream.Collectors;

import io.helidon.http.Status;
import io.helidon.microprofile.telemetry.InMemorySpanExporter;
import io.helidon.microprofile.telemetry.InMemorySpanExporterProvider;
import io.helidon.microprofile.testing.junit5.AddBean;
import io.helidon.microprofile.testing.junit5.AddConfig;
import io.helidon.microprofile.testing.junit5.AddExtension;
Expand All @@ -29,16 +27,15 @@
import io.opentelemetry.sdk.trace.data.SpanData;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.Response;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.is;

/**
Expand Down Expand Up @@ -76,9 +73,12 @@ void spanNaming() {

assertThat(webTarget.path("named").request().get().getStatus(), is(Response.Status.OK.getStatusCode()));

List<SpanData> spanItems = spanExporter.getFinishedSpanItems(2);
assertThat(spanItems.size(), is(2));
assertThat(spanItems.get(0).getName(), is("http://localhost:" + webTarget.getUri().getPort() + "/named"));
List<String> names = spanExporter.getFinishedSpanItems(2).stream()
.map(SpanData::getName)
.collect(Collectors.toList());
assertThat(names.size(), is(2));
assertThat(names, hasItem("http://localhost:" + webTarget.getUri().getPort() + "/named"));
assertThat(names, hasItem("HTTP GET"));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import static java.lang.System.Logger.Level.DEBUG;

Expand Down Expand Up @@ -108,14 +106,12 @@ void resendAckTestPart1(SeContainer cdi) {

@Test
@Order(2)
@DisabledOnOs(OS.WINDOWS)
void resendAckTestPart2(SeContainer cdi) {
MockConnector mockConnector = cdi.select(MockConnector.class, TEST_CONNECTOR_ANNOTATION).get();

//Check if not acked messages are redelivered
mockConnector.outgoing("mock-conn-channel", String.class)
.requestMax()
.awaitCount(Duration.ofSeconds(5), 1)
.awaitPayloads(Duration.ofSeconds(5), "NO_ACK-1", "NO_ACK-2", "NO_ACK-3");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
Expand All @@ -72,7 +70,6 @@
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;

@DisabledOnOs(OS.WINDOWS)
public class KafkaSeTest extends AbstractKafkaTest {
private static final Logger LOGGER = Logger.getLogger(KafkaSeTest.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;

@Testcontainers
@Testcontainers(disabledWithoutDocker = true)
@HelidonTest(resetPerTest = true)
@AddBean(TestResource.class)
class CommonLoginBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,14 @@
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.Form;
import jakarta.ws.rs.core.Response;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import static io.helidon.tests.integration.oidc.TestResource.EXPECTED_POST_LOGOUT_TEST_MESSAGE;
import static io.helidon.tests.integration.oidc.TestResource.EXPECTED_TEST_MESSAGE;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;

@DisabledOnOs(OS.WINDOWS)
class CookieBasedLoginIT extends CommonLoginBase {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,9 @@
import jakarta.ws.rs.core.Response;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import static io.helidon.security.providers.oidc.common.OidcConfig.DEFAULT_ID_COOKIE_NAME;
import static io.helidon.tests.integration.oidc.TestResource.EXPECTED_TEST_MESSAGE;
Expand All @@ -56,7 +52,6 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;

@DisabledOnOs(OS.WINDOWS)
class IdTokenIT extends CommonLoginBase {

private static final ClientConfig CONFIG_CLIENT_2 = new ClientConfig()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.Response;
import org.glassfish.jersey.client.ClientProperties;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import static io.helidon.tests.integration.oidc.TestResource.EXPECTED_TEST_MESSAGE;
import static org.hamcrest.CoreMatchers.is;
Expand All @@ -38,7 +34,6 @@
@AddConfig(key = "security.providers.1.oidc.cookie-use", value = "false")
@AddConfig(key = "security.providers.1.oidc.query-param-use", value = "true")
@AddConfig(key = "server.protocols.http_1_1.max-prologue-length", value = "4096")
@DisabledOnOs(OS.WINDOWS)
class QueryBasedLoginIT extends CommonLoginBase {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@
import jakarta.ws.rs.core.Form;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.Response;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import static io.helidon.tests.integration.oidc.TestResource.EXPECTED_TEST_MESSAGE;
import static org.hamcrest.CoreMatchers.hasItem;
Expand All @@ -49,7 +45,6 @@
import static org.hamcrest.Matchers.empty;

@AddConfig(key = "security.providers.1.oidc.token-signature-validation", value = "false")
@DisabledOnOs(OS.WINDOWS)
class RefreshTokenIT extends CommonLoginBase {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import jakarta.ws.rs.core.Response;
import org.glassfish.jersey.client.ClientProperties;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
Expand All @@ -46,7 +44,6 @@
@HelidonTest(resetPerTest = true)
@AddBean(TestResource.class)
@AddConfig(key = "security.providers.1.oidc.oidc-metadata-well-known", value = "false")
@DisabledOnOs(OS.WINDOWS)
class TenantIdentificationIT {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.helidon.webserver.staticcontent;

import java.io.File;
import java.io.IOException;
import java.lang.System.Logger.Level;
import java.nio.file.Files;
Expand Down Expand Up @@ -79,7 +80,7 @@ boolean doHandle(Method method, String requestedPath, ServerRequest req, ServerR

String rawPath = req.prologue().uriPath().rawPath();

String relativePath = root.relativize(path).toString().replace("\\", "/");
String relativePath = root.relativize(path).toString().replace(File.separator, "/");
String requestedResource;
if (mapped) {
requestedResource = relativePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader;
import static io.helidon.common.testing.junit5.OptionalMatcher.optionalPresent;
Expand Down Expand Up @@ -183,7 +181,6 @@ void testFsInMemoryCache() {
}

@Test
@DisabledOnOs(OS.WINDOWS)
void testFsFromInMemory() throws IOException {
ServerResponseHeaders responseHeaders = ServerResponseHeaders.create();

Expand Down

0 comments on commit 937fc20

Please sign in to comment.