2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.database
.types
;
12 import static org
.junit
.Assert
.assertEquals
;
14 import org
.apache
.log4j
.Logger
;
15 import org
.junit
.After
;
16 import org
.junit
.Before
;
17 import org
.junit
.BeforeClass
;
18 import org
.junit
.Test
;
20 import eu
.etaxonomy
.cdm
.database
.CdmDataSource
;
21 import eu
.etaxonomy
.cdm
.database
.CdmPersistentDataSource
;
22 import eu
.etaxonomy
.cdm
.database
.DatabaseTypeEnum
;
29 public class OracleDatabaseTypeTest
{
30 @SuppressWarnings("unused")
31 private static final Logger logger
= Logger
.getLogger(OracleDatabaseTypeTest
.class);
33 static DatabaseTypeEnum enumType
;
35 CdmPersistentDataSource dataSource
;
43 * @throws java.lang.Exception
46 public static void setUpBeforeClass() throws Exception
{
47 enumType
= DatabaseTypeEnum
.Oracle
;
51 * @throws java.lang.Exception
54 public void setUp() throws Exception
{
60 dataSource
= CdmPersistentDataSource
.save(
62 CdmDataSource
.NewInstance(enumType
, server
, dbName
, port
, username
, password
));
66 * @throws java.lang.Exception
69 public void tearDown() throws Exception
{
74 public void testGetConnectionStringICdmDataSource() {
75 String expected
= "jdbc:oracle:thin:@" + server
+ ":" + port
+ ":" + dbName
;
76 assertEquals(expected
, enumType
.getConnectionString(dataSource
));
80 public void testGetConnectionStringICdmDataSourceInt() {
82 String expected
= "jdbc:oracle:thin:@" + server
+ ":" + port
+ ":" + dbName
;
83 assertEquals(expected
, ((OracleDatabaseType
)enumType
.getDatabaseType()).getConnectionString(dataSource
, port
));
87 public void testGetDatabaseNameByConnectionString() {
88 assertEquals(dbName
, dataSource
.getDatabase());
93 public void testGetServerNameByConnectionStringString() {
94 assertEquals(server
, dataSource
.getServer());
98 * Test method for {@link eu.etaxonomy.cdm.database.types.DatabaseTypeBase#getPortByConnectionString(java.lang.String)}.
101 public void testGetPortByConnectionStringString() {
102 assertEquals(port
, dataSource
.getPort());