use of org.pentaho.database.model.DatabaseConnection in project pentaho-platform by pentaho.
the class DatasourceMgmtToWebServiceAdapterTest method createDatabaseConnection.
private IDatabaseConnection createDatabaseConnection(final String dbName) throws Exception {
IDatabaseConnection dbConnection = new DatabaseConnection();
dbConnection.setName(dbName);
dbConnection.setHostname(EXP_DBMETA_HOSTNAME);
dbConnection.setDatabaseType(mockDatabaseType("Hypersonic"));
dbConnection.setAccessType(DatabaseAccessType.NATIVE);
dbConnection.setDatabasePort(EXP_DBMETA_PORT);
return dbConnection;
}
use of org.pentaho.database.model.DatabaseConnection in project pentaho-platform by pentaho.
the class DefaultDatasourceMgmtWebServiceTest method createDatabaseConnection.
private DatabaseConnection createDatabaseConnection(final String dbName) throws Exception {
DatabaseConnection dbConnection = new DatabaseConnection();
dbConnection.setName(dbName);
dbConnection.setHostname(EXP_DBMETA_HOSTNAME);
dbConnection.setDatabaseType(mockDatabaseType("Hypersonic"));
dbConnection.setAccessType(DatabaseAccessType.NATIVE);
dbConnection.setDatabasePort(EXP_DBMETA_PORT);
return dbConnection;
}
use of org.pentaho.database.model.DatabaseConnection in project pentaho-platform by pentaho.
the class DatabaseHelperTest method createDatabaseConnection.
private DatabaseConnection createDatabaseConnection() {
DatabaseConnection databaseConnection = new DatabaseConnection();
databaseConnection.setDatabaseType(new DatabaseType());
databaseConnection.setName("name");
databaseConnection.setId("id");
databaseConnection.setAccessType(DatabaseAccessType.CUSTOM);
databaseConnection.setHostname("hostName");
databaseConnection.setDatabaseName("databaseName");
databaseConnection.setDatabasePort("8080");
databaseConnection.setUsername("username");
databaseConnection.setPassword("password");
databaseConnection.setInformixServername("informixServername");
databaseConnection.setDataTablespace("dataTablespace");
databaseConnection.setIndexTablespace("indexTableSpace");
databaseConnection.setConnectSql("connectSql");
databaseConnection.setInitialPoolSize(1);
databaseConnection.setMaximumPoolSize(1);
databaseConnection.setUsingConnectionPool(true);
databaseConnection.setForcingIdentifiersToLowerCase(true);
databaseConnection.setForcingIdentifiersToUpperCase(true);
databaseConnection.setQuoteAllFields(true);
databaseConnection.setUsingDoubleDecimalAsSchemaTableSeparator(true);
Map<String, String> attributeMap = new HashMap<String, String>();
attributeMap.put("key", "value");
databaseConnection.setAttributes(attributeMap);
Map<String, String> connectionPoolingMap = new HashMap<String, String>();
connectionPoolingMap.put("key", "value");
databaseConnection.setConnectionPoolingProperties(connectionPoolingMap);
Map<String, String> extraOptions = new HashMap<String, String>();
extraOptions.put("key", "value");
databaseConnection.setExtraOptions(extraOptions);
Map<String, String> extraOptionsOrder = new HashMap<String, String>();
extraOptions.put("key", "value");
databaseConnection.setExtraOptionsOrder(extraOptions);
return databaseConnection;
}
use of org.pentaho.database.model.DatabaseConnection in project pentaho-platform by pentaho.
the class ExportManifestTest method testUnMarshal.
@Test
public void testUnMarshal() {
String xml = XmlToString();
ExportManifest importManifest = null;
ByteArrayInputStream input = new ByteArrayInputStream(xml.getBytes());
try {
importManifest = ExportManifest.fromXml(input);
} catch (JAXBException e) {
fail("Could not un-marshal to object " + e);
}
ExportManifestEntity fileEntity = importManifest.getExportManifestEntity("dir2/file1");
assertNotNull(fileEntity);
assertEquals("dir2/file1", fileEntity.getPath());
assertNotNull(fileEntity.getEntityMetaData());
assertFalse(fileEntity.getEntityMetaData().isIsFolder());
fileEntity = importManifest.getExportManifestEntity("dir2");
assertNotNull(fileEntity);
assertNotNull(fileEntity.getEntityMetaData());
assertTrue(fileEntity.getEntityMetaData().isIsFolder());
RepositoryFile r = fileEntity.getRepositoryFile();
try {
RepositoryFileAcl rfa = fileEntity.getRepositoryFileAcl();
assertNotNull(rfa.getAces());
} catch (ExportManifestFormatException e) {
e.printStackTrace();
fail("Could not un-marshal to RepositoryFileAcl");
}
assertEquals(1, importManifest.getMetadataList().size());
assertEquals(1, importManifest.getMondrianList().size());
assertEquals(1, importManifest.getScheduleList().size());
assertEquals(1, importManifest.getDatasourceList().size());
ExportManifestMondrian mondrian1 = importManifest.getMondrianList().get(0);
assertEquals("cat1", mondrian1.getCatalogName());
assertTrue(mondrian1.getParameters().containsKey("testKey"));
assertEquals("testValue", mondrian1.getParameters().get("testKey"));
assertEquals("testMondrian.xml", mondrian1.getFile());
ExportManifestMetadata metadata1 = importManifest.getMetadataList().get(0);
assertEquals("testDomain", metadata1.getDomainId());
assertEquals("testMetadata.xml", metadata1.getFile());
DatabaseConnection connection = importManifest.getDatasourceList().get(0);
assertEquals("SampleData", connection.getDatabaseName());
assertEquals("9001", connection.getDatabasePort());
assertEquals("Hypersonic", connection.getDatabaseType().getName());
assertEquals("HYPERSONIC", connection.getDatabaseType().getShortName());
assertEquals("localhost", connection.getHostname());
assertEquals("pentaho_user", connection.getUsername());
assertEquals("password", connection.getPassword());
assertEquals(20, connection.getMaximumPoolSize());
}
use of org.pentaho.database.model.DatabaseConnection in project pentaho-platform by pentaho.
the class PooledDatasourceHelperTest method testCreatePoolNoClassName.
@Test
public void testCreatePoolNoClassName() throws Exception {
DatabaseDialectService dialectService = new DatabaseDialectService(false);
final DatabaseTypeHelper databaseTypeHelper = new DatabaseTypeHelper(dialectService.getDatabaseTypes());
mp = new MicroPlatform(SOLUTION_PATH);
mp.defineInstance(IDatabaseDialectService.class, dialectService);
mp.start();
final DatabaseConnection con = new DatabaseConnection();
con.setId("Postgres");
con.setName("Postgres");
con.setAccessType(DatabaseAccessType.NATIVE);
con.setDatabaseType(databaseTypeHelper.getDatabaseTypeByShortName("GENERIC"));
con.setUsername("pentaho_user");
con.setPassword("password");
final HashMap<String, String> attrs = new HashMap<>();
attrs.put(DatabaseConnection.ATTRIBUTE_CUSTOM_DRIVER_CLASS, "");
attrs.put(DatabaseConnection.ATTRIBUTE_CUSTOM_URL, "jdbc:postgresql://localhost:5432/hibernate");
con.setAttributes(attrs);
try {
PooledDatasourceHelper.setupPooledDataSource(con);
fail("Expecting the exception to be thrown");
} catch (DBDatasourceServiceException ex) {
assertNotNull(ex);
}
}
Aggregations