01: /*
02: * ConnectionProfileTest.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2007, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.db;
13:
14: import junit.framework.TestCase;
15: import workbench.sql.DelimiterDefinition;
16:
17: /**
18: * @author support@sql-workbench.net
19: */
20: public class ConnectionProfileTest extends TestCase {
21: public ConnectionProfileTest(String testName) {
22: super (testName);
23: }
24:
25: public void testCreateCopy() {
26: try {
27: ConnectionProfile old = new ConnectionProfile();
28: old
29: .setAlternateDelimiter(new DelimiterDefinition("/",
30: true));
31: old.setAutocommit(false);
32: old.setConfirmUpdates(true);
33: old.setDriverName("Postgres");
34: old.setEmptyStringIsNull(true);
35: old.setName("First");
36: old.setStorePassword(true);
37: old.setUrl("jdbc:some:database");
38:
39: ConnectionProfile copy = old.createCopy();
40: assertFalse(copy.getAutocommit());
41: assertTrue(copy.isConfirmUpdates());
42: assertEquals("Postgres", copy.getDriverName());
43: assertEquals("First", copy.getName());
44: assertTrue(copy.getStorePassword());
45: assertEquals("jdbc:some:database", copy.getUrl());
46: DelimiterDefinition delim = copy.getAlternateDelimiter();
47: assertNotNull(delim);
48: assertEquals("/", delim.getDelimiter());
49: assertTrue(delim.isSingleLine());
50:
51: old.setAlternateDelimiter(null);
52: copy = old.createCopy();
53: assertNull(copy.getAlternateDelimiter());
54: } catch (Exception e) {
55: e.printStackTrace();
56: fail(e.getMessage());
57: }
58: }
59: }
|