Skip to content

Commit

Permalink
Windows build fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Verdent committed Oct 21, 2019
1 parent b822e77 commit 7086ed9
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package io.helidon.grpc.client;

import java.nio.file.Paths;

import javax.net.ssl.SSLException;

import io.helidon.config.Config;
Expand Down Expand Up @@ -162,9 +164,9 @@ public void testDefaultHostPortSslDisabledConfig() {
GrpcSslDescriptor ssl = chCfg.sslDescriptor();
assertThat(ssl, notNullValue());
assertThat(ssl.isEnabled(), equalTo(false));
assertThat(ssl.tlsKey(), endsWith(CLIENT_KEY));
assertThat(ssl.tlsCert(), endsWith(CLIENT_CERT));
assertThat(ssl.tlsCaCert(), endsWith(CA_CERT));
assertThat(ssl.tlsKey(), endsWith(normalizedPath(CLIENT_KEY)));
assertThat(ssl.tlsCert(), endsWith(normalizedPath(CLIENT_CERT)));
assertThat(ssl.tlsCaCert(), endsWith(normalizedPath(CA_CERT)));
}

@Test
Expand All @@ -178,7 +180,7 @@ public void testDefaultHostSslOneWay() {
assertThat(ssl.isEnabled(), equalTo(true));
assertThat(ssl.tlsKey(), nullValue());
assertThat(ssl.tlsCert(), nullValue());
assertThat(ssl.tlsCaCert(), endsWith(CA_CERT));
assertThat(ssl.tlsCaCert(), endsWith(normalizedPath(CA_CERT)));
}

@Test
Expand All @@ -190,14 +192,18 @@ public void testDefaultPortSsl() {
GrpcSslDescriptor ssl = chCfg.sslDescriptor();
assertThat(ssl, notNullValue());
assertThat(ssl.isEnabled(), equalTo(true));
assertThat(ssl.tlsKey(), endsWith(CLIENT_KEY));
assertThat(ssl.tlsCert(), endsWith(CLIENT_CERT));
assertThat(ssl.tlsCaCert(), endsWith(CA_CERT));
assertThat(ssl.tlsKey(), endsWith(normalizedPath(CLIENT_KEY)));
assertThat(ssl.tlsCert(), endsWith(normalizedPath(CLIENT_CERT)));
assertThat(ssl.tlsCaCert(), endsWith(normalizedPath(CA_CERT)));
}

@Test
public void testBuilderCreate() throws SSLException {
assertThat(GrpcChannelsProvider.create().channels().size(), equalTo(1));
assertThat(GrpcChannelsProvider.create().channel(GrpcChannelsProvider.DEFAULT_CHANNEL_NAME), notNullValue());
}

private String normalizedPath(String path) {
return Paths.get(path).normalize().toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package io.helidon.grpc.core;

import java.nio.file.Paths;

import io.helidon.config.Config;
import io.helidon.config.ConfigSources;

Expand Down Expand Up @@ -65,9 +67,13 @@ public void testLoadFromConfig() {
assertThat(desc.isJdkSSL(), equalTo(false));
String path = "src/test/resources/ssl/";

assertThat(desc.tlsKey(), endsWith(path + "serverKey.pem"));
assertThat(desc.tlsCert(), endsWith(path + "serverCert.pem"));
assertThat(desc.tlsCaCert(), endsWith(path + "ca.pem"));
assertThat(desc.tlsKey(), endsWith(normalizedPath(path + "serverKey.pem")));
assertThat(desc.tlsCert(), endsWith(normalizedPath(path + "serverCert.pem")));
assertThat(desc.tlsCaCert(), endsWith(normalizedPath(path + "ca.pem")));
}

private String normalizedPath(String path) {
return Paths.get(path).normalize().toString();
}

}
85 changes: 65 additions & 20 deletions microprofile/tests/tck/tck-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,70 @@
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.util.logging.config.file>src/test/resources/logging.properties</java.util.logging.config.file>
</systemPropertyVariables>
<environmentVariables>
<my_int_property>45</my_int_property>
<MY_BOOLEAN_PROPERTY>true</MY_BOOLEAN_PROPERTY>
<my_string_property>haha</my_string_property>
<MY_STRING_PROPERTY>woohoo</MY_STRING_PROPERTY>
</environmentVariables>
<suiteXmlFiles>
<suiteXmlFile>src/test/tck-suite.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.util.logging.config.file>src/test/resources/logging.properties</java.util.logging.config.file>
</systemPropertyVariables>
<environmentVariables>
<my_int_property>45</my_int_property>
<MY_BOOLEAN_PROPERTY>true</MY_BOOLEAN_PROPERTY>
<my_string_property>haha</my_string_property>
<MY_STRING_PROPERTY>woohoo</MY_STRING_PROPERTY>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

<profiles>
<profile>
<id>non-windows-run</id>
<activation>
<os>
<family>!Windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/tck-suite.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>windows-run</id>
<activation>
<os>
<family>Windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/tck-suite-win.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
36 changes: 36 additions & 0 deletions microprofile/tests/tck/tck-config/src/test/tck-suite-win.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<!--
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<suite name="microprofile-config-TCK" verbose="2" configfailurepolicy="continue">

<test name="microprofile-config 1.2 TCK">
<packages>
<package name="org.eclipse.microprofile.config.tck.*"/>
</packages>
<!-- Skip this test on Windows since it has case insensitive environment variables. -->
<classes>
<class name="org.eclipse.microprofile.config.tck.ConfigProviderTest">
<methods>
<exclude name="testEnvironmentConfigSource"/>
</methods>
</class>
</classes>
</test>

</suite>
4 changes: 2 additions & 2 deletions tests/functional/bookstore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<name>Helidon Functional Test: Bookstore</name>

<properties>
<appJarPathSE>${top.parent.basedir}/tests/apps/bookstore/bookstore-se/target/bookstore-se.jar</appJarPathSE>
<appJarPathMP>${top.parent.basedir}/tests/apps/bookstore/bookstore-mp/target/bookstore-mp.jar</appJarPathMP>
<appJarPathSE>${project.basedir}/../../apps/bookstore/bookstore-se/target/bookstore-se.jar</appJarPathSE>
<appJarPathMP>${project.basedir}/../../apps/bookstore/bookstore-mp/target/bookstore-mp.jar</appJarPathMP>
</properties>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
Expand Down Expand Up @@ -61,6 +62,8 @@ class MainTest {
static void setup() throws Exception {
System.out.println("Using port number" + port);
healthUrl = new URL("http://localhost:" + port + "/health");
appJarPathSE = Paths.get(appJarPathSE).normalize().toString();
appJarPathMP = Paths.get(appJarPathMP).normalize().toString();
}

@AfterEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void handleRoot() throws Exception {
TestContentHandler handler = new TestContentHandler("/root", true);
handler.handle(Http.Method.GET, request, response);
verify(request, never()).next();
assertThat(handler.path, is(Paths.get("/root")));
assertThat(handler.path, is(Paths.get("/root").toAbsolutePath().normalize()));
}

@Test
Expand All @@ -195,7 +195,7 @@ public void handleValid() throws Exception {
TestContentHandler handler = new TestContentHandler("/root", true);
handler.handle(Http.Method.GET, request, response);
verify(request, never()).next();
assertThat(handler.path, is(Paths.get("/root/foo/some.txt")));
assertThat(handler.path, is(Paths.get("/root/foo/some.txt").toAbsolutePath().normalize()));
}

@Test
Expand Down

0 comments on commit 7086ed9

Please sign in to comment.