Repository: calcite-avatica
Updated Branches:
  refs/heads/master 97d90a32e -> dbbf64542


Fix tests on Windows; disable SPNEGO test on Windows


Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica/commit/dbbf6454
Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica/tree/dbbf6454
Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica/diff/dbbf6454

Branch: refs/heads/master
Commit: dbbf64542e9d303a5b4197abcc066a01df1f4275
Parents: 97d90a3
Author: Julian Hyde <[email protected]>
Authored: Thu May 25 21:09:42 2017 -0700
Committer: Julian Hyde <[email protected]>
Committed: Tue May 30 02:17:46 2017 -0700

----------------------------------------------------------------------
 .../calcite/avatica/ConnectionConfigImplTest.java   | 16 ++++++++++------
 .../server/HttpServerSpnegoWithJaasTest.java        |  4 ++++
 2 files changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/dbbf6454/core/src/test/java/org/apache/calcite/avatica/ConnectionConfigImplTest.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/calcite/avatica/ConnectionConfigImplTest.java 
b/core/src/test/java/org/apache/calcite/avatica/ConnectionConfigImplTest.java
index bbe30e1..71f4b66 100644
--- 
a/core/src/test/java/org/apache/calcite/avatica/ConnectionConfigImplTest.java
+++ 
b/core/src/test/java/org/apache/calcite/avatica/ConnectionConfigImplTest.java
@@ -18,10 +18,12 @@ package org.apache.calcite.avatica;
 
 import org.junit.Test;
 
+import java.io.File;
 import java.util.Properties;
 
-import static org.junit.Assert.assertEquals;
+import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
 
 /**
  * Test class for {@link ConnectionConfigImpl}.
@@ -29,17 +31,19 @@ import static org.junit.Assert.assertNull;
 public class ConnectionConfigImplTest {
 
   @Test public void testTrustStore() {
-    final String truststore = "/my/truststore.jks";
+    final String trustStore = "/my/truststore.jks";
+    final String windowsTrustStore = "C:\\my\\truststore.jks";
     final String pw = "supremelysecret";
     Properties props = new Properties();
-    props.setProperty(BuiltInConnectionProperty.TRUSTSTORE.name(), truststore);
+    props.setProperty(BuiltInConnectionProperty.TRUSTSTORE.name(), trustStore);
     props.setProperty(BuiltInConnectionProperty.TRUSTSTORE_PASSWORD.name(), 
pw);
     ConnectionConfigImpl config = new ConnectionConfigImpl(props);
-    assertEquals(truststore, config.truststore().getAbsolutePath());
-    assertEquals(pw, config.truststorePassword());
+    assertThat(config.truststore().getAbsolutePath(),
+        File.separatorChar == '/' ? is(trustStore) : is(windowsTrustStore));
+    assertThat(config.truststorePassword(), is(pw));
   }
 
-  @Test public void testNoTruststore() {
+  @Test public void testNoTrustStore() {
     Properties props = new Properties();
     ConnectionConfigImpl config = new ConnectionConfigImpl(props);
     assertNull(config.truststore());

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/dbbf6454/server/src/test/java/org/apache/calcite/avatica/server/HttpServerSpnegoWithJaasTest.java
----------------------------------------------------------------------
diff --git 
a/server/src/test/java/org/apache/calcite/avatica/server/HttpServerSpnegoWithJaasTest.java
 
b/server/src/test/java/org/apache/calcite/avatica/server/HttpServerSpnegoWithJaasTest.java
index 8f6fede..06daa86 100644
--- 
a/server/src/test/java/org/apache/calcite/avatica/server/HttpServerSpnegoWithJaasTest.java
+++ 
b/server/src/test/java/org/apache/calcite/avatica/server/HttpServerSpnegoWithJaasTest.java
@@ -30,6 +30,7 @@ import org.ietf.jgss.GSSManager;
 import org.ietf.jgss.GSSName;
 import org.ietf.jgss.Oid;
 import org.junit.AfterClass;
+import org.junit.Assume;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -46,6 +47,7 @@ import java.util.Set;
 import javax.security.auth.Subject;
 import javax.security.auth.kerberos.KerberosTicket;
 
+import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -182,6 +184,8 @@ public class HttpServerSpnegoWithJaasTest {
   }
 
   @Test public void testAuthenticatedClientsAllowed() throws Exception {
+    Assume.assumeThat("Test disabled on Windows", File.separatorChar, is('/'));
+
     // Create the subject for the client
     final Subject clientSubject = 
JaasKrbUtil.loginUsingKeytab(SpnegoTestUtil.CLIENT_PRINCIPAL,
         clientKeytab);

Reply via email to