Permalink
Browse files

Update testcase to set properties where TestUtil methods look them up.

  • Loading branch information...
whitingjr committed Dec 2, 2015
1 parent ecf4a2c commit b86e07a5b5df7e5057d8a1c33ad5ad706e20f9da
Showing with 15 additions and 2 deletions.
  1. +12 −1 org/postgresql/test/TestUtil.java
  2. +3 −1 org/postgresql/test/jdbc2/PGPropertyTest.java
@@ -58,6 +58,11 @@ public static String getURL(String server, int port)
sendBufferSize = "&sendBufferSize="+getSendBufferSize();
}
String ssl = "";
if (getSSL() != null ){
ssl = "&ssl="+getSSL();
}
return "jdbc:postgresql://"
+ server + ":"
+ port + "/"
@@ -66,7 +71,8 @@ public static String getURL(String server, int port)
+ protocolVersion
+ binaryTransfer
+ receiveBufferSize
+ sendBufferSize;
+ sendBufferSize
+ ssl;
}
/*
@@ -161,6 +167,11 @@ public static int getReceiveBufferSize()
return Integer.parseInt(System.getProperty("receiveBufferSize","-1"));
}
public static String getSSL()
{
return System.getProperty("ssl");
}
private static boolean initialized = false;
public static void initDriver() throws Exception
{
@@ -204,9 +204,11 @@ public void testIsPresentWithParseURLResult() throws Exception
givenProperties.setProperty("user", TestUtil.getUser());
givenProperties.setProperty("password", TestUtil.getPassword());
System.setProperty("ssl", null);
Properties parsedProperties = Driver.parseURL(TestUtil.getURL(), givenProperties);
Assert.assertFalse("SSL property should not be present", PGProperty.SSL.isPresent(parsedProperties));
Assert.assertTrue("SSL property should not be present", PGProperty.SSL.isPresent(parsedProperties));
System.setProperty("ssl", "true");
givenProperties.setProperty("ssl", "true");
parsedProperties = Driver.parseURL(TestUtil.getURL(), givenProperties);
Assert.assertTrue("SSL property should be present", PGProperty.SSL.isPresent(parsedProperties));

0 comments on commit b86e07a

Please sign in to comment.