Java Code Examples for java.sql.DriverManager#setLogStream()
The following examples show how to use
java.sql.DriverManager#setLogStream() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DriverManagerTests.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Create a PrintStream and use to send output via DriverManager.println * Validate that if you disable the stream, the output sent is not present */ @Test public void tests17() throws Exception { ByteArrayOutputStream os = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(os); DriverManager.setLogStream(ps); assertTrue(DriverManager.getLogStream() == ps); DriverManager.println(results[0]); DriverManager.setLogStream((PrintStream) null); assertTrue(DriverManager.getLogStream() == null); DriverManager.println(noOutput); DriverManager.setLogStream(ps); DriverManager.println(results[1]); DriverManager.println(results[2]); DriverManager.println(results[3]); DriverManager.setLogStream((PrintStream) null); DriverManager.println(noOutput); /* * Check we do not get the output when the stream is disabled */ InputStreamReader is = new InputStreamReader(new ByteArrayInputStream(os.toByteArray())); BufferedReader reader = new BufferedReader(is); for (String result : results) { assertTrue(result.equals(reader.readLine())); } }
Example 2
Source File: DriverManagerTests.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Create a PrintStream and use to send output via DriverManager.println * Validate that if you disable the stream, the output sent is not present */ @Test public void tests17() throws Exception { ByteArrayOutputStream os = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(os); DriverManager.setLogStream(ps); assertTrue(DriverManager.getLogStream() == ps); DriverManager.println(results[0]); DriverManager.setLogStream((PrintStream) null); assertTrue(DriverManager.getLogStream() == null); DriverManager.println(noOutput); DriverManager.setLogStream(ps); DriverManager.println(results[1]); DriverManager.println(results[2]); DriverManager.println(results[3]); DriverManager.setLogStream((PrintStream) null); DriverManager.println(noOutput); /* * Check we do not get the output when the stream is disabled */ InputStreamReader is = new InputStreamReader(new ByteArrayInputStream(os.toByteArray())); BufferedReader reader = new BufferedReader(is); for (String result : results) { assertTrue(result.equals(reader.readLine())); } }
Example 3
Source File: DriverManagerTests.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Create a PrintStream and use to send output via DriverManager.println * Validate that if you disable the stream, the output sent is not present */ @Test public void tests17() throws Exception { ByteArrayOutputStream os = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(os); DriverManager.setLogStream(ps); assertTrue(DriverManager.getLogStream() == ps); DriverManager.println(results[0]); DriverManager.setLogStream((PrintStream) null); assertTrue(DriverManager.getLogStream() == null); DriverManager.println(noOutput); DriverManager.setLogStream(ps); DriverManager.println(results[1]); DriverManager.println(results[2]); DriverManager.println(results[3]); DriverManager.setLogStream((PrintStream) null); DriverManager.println(noOutput); /* * Check we do not get the output when the stream is disabled */ InputStreamReader is = new InputStreamReader(new ByteArrayInputStream(os.toByteArray())); BufferedReader reader = new BufferedReader(is); for (String result : results) { assertTrue(result.equals(reader.readLine())); } }
Example 4
Source File: DriverManagerTests.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Create a PrintStream and use to send output via DriverManager.println * Validate that if you disable the stream, the output sent is not present */ @Test public void tests17() throws Exception { ByteArrayOutputStream os = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(os); DriverManager.setLogStream(ps); assertTrue(DriverManager.getLogStream() == ps); DriverManager.println(results[0]); DriverManager.setLogStream((PrintStream) null); assertTrue(DriverManager.getLogStream() == null); DriverManager.println(noOutput); DriverManager.setLogStream(ps); DriverManager.println(results[1]); DriverManager.println(results[2]); DriverManager.println(results[3]); DriverManager.setLogStream((PrintStream) null); DriverManager.println(noOutput); /* * Check we do not get the output when the stream is disabled */ InputStreamReader is = new InputStreamReader(new ByteArrayInputStream(os.toByteArray())); BufferedReader reader = new BufferedReader(is); for (String result : results) { assertTrue(result.equals(reader.readLine())); } }
Example 5
Source File: DriverManagerTests.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Create a PrintStream and use to send output via DriverManager.println * Validate that if you disable the stream, the output sent is not present */ @Test public void tests17() throws Exception { ByteArrayOutputStream os = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(os); DriverManager.setLogStream(ps); assertTrue(DriverManager.getLogStream() == ps); DriverManager.println(results[0]); DriverManager.setLogStream((PrintStream) null); assertTrue(DriverManager.getLogStream() == null); DriverManager.println(noOutput); DriverManager.setLogStream(ps); DriverManager.println(results[1]); DriverManager.println(results[2]); DriverManager.println(results[3]); DriverManager.setLogStream((PrintStream) null); DriverManager.println(noOutput); /* * Check we do not get the output when the stream is disabled */ InputStreamReader is = new InputStreamReader(new ByteArrayInputStream(os.toByteArray())); BufferedReader reader = new BufferedReader(is); for (String result : results) { assertTrue(result.equals(reader.readLine())); } }
Example 6
Source File: DriverManagerTests.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Create a PrintStream and use to send output via DriverManager.println * Validate that if you disable the stream, the output sent is not present */ @Test public void tests17() throws Exception { ByteArrayOutputStream os = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(os); DriverManager.setLogStream(ps); assertTrue(DriverManager.getLogStream() == ps); DriverManager.println(results[0]); DriverManager.setLogStream((PrintStream) null); assertTrue(DriverManager.getLogStream() == null); DriverManager.println(noOutput); DriverManager.setLogStream(ps); DriverManager.println(results[1]); DriverManager.println(results[2]); DriverManager.println(results[3]); DriverManager.setLogStream((PrintStream) null); DriverManager.println(noOutput); /* * Check we do not get the output when the stream is disabled */ InputStreamReader is = new InputStreamReader(new ByteArrayInputStream(os.toByteArray())); BufferedReader reader = new BufferedReader(is); for (String result : results) { assertTrue(result.equals(reader.readLine())); } }
Example 7
Source File: DriverManagerPermissionsTests.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Test public void test1() { Policy.setPolicy(new TestPolicy("setLog")); DriverManager.setLogStream(null); }
Example 8
Source File: DriverManagerPermissionsTests.java From hottub with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = AccessControlException.class) public void test() { setPolicy(new TestPolicy()); DriverManager.setLogStream(null); }
Example 9
Source File: DriverManagerPermissionsTests.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Test public void test2() { setPolicy(new TestPolicy("all")); DriverManager.setLogStream(null); }
Example 10
Source File: DriverManagerPermissionsTests.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Test public void test1() { Policy.setPolicy(new TestPolicy("setLog")); DriverManager.setLogStream(null); }
Example 11
Source File: DriverManagerPermissionsTests.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = AccessControlException.class) public void test() { setPolicy(new TestPolicy()); DriverManager.setLogStream(null); }
Example 12
Source File: DriverManagerPermissionsTests.java From hottub with GNU General Public License v2.0 | 4 votes |
@Test public void test1() { Policy.setPolicy(new TestPolicy("setLog")); DriverManager.setLogStream(null); }
Example 13
Source File: DriverManagerPermissionsTests.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = AccessControlException.class) public void test() { setPolicy(new TestPolicy()); DriverManager.setLogStream(null); }
Example 14
Source File: DriverManagerPermissionsTests.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test public void test2() { setPolicy(new TestPolicy("all")); DriverManager.setLogStream(null); }
Example 15
Source File: DriverManagerPermissionsTests.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Test public void test2() { setPolicy(new TestPolicy("all")); DriverManager.setLogStream(null); }
Example 16
Source File: DriverManagerPermissionsTests.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Test public void test1() { Policy.setPolicy(new TestPolicy("setLog")); DriverManager.setLogStream(null); }
Example 17
Source File: DriverManagerPermissionsTests.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test public void test1() { Policy.setPolicy(new TestPolicy("setLog")); DriverManager.setLogStream(null); }
Example 18
Source File: DriverManagerPermissionsTests.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = AccessControlException.class) public void test() { setPolicy(new TestPolicy()); DriverManager.setLogStream(null); }
Example 19
Source File: DriverManagerPermissionsTests.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Test public void test1() { Policy.setPolicy(new TestPolicy("setLog")); DriverManager.setLogStream(null); }
Example 20
Source File: DriverManagerPermissionsTests.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = AccessControlException.class) public void test() { setPolicy(new TestPolicy()); DriverManager.setLogStream(null); }