Search in sources :

Example 6 with DatabaseType

use of org.pentaho.database.model.DatabaseType in project data-access by pentaho.

the class DSWDatasourceServiceImplTest method testSqlQueries_AreNotSupported_PentahoDataServices.

@Test(expected = SqlQueriesNotSupportedException.class)
public void testSqlQueries_AreNotSupported_PentahoDataServices() throws Exception {
    String connNameDataService = "connToDataService";
    String dbTypeIdDataService = "Pentaho Data Services";
    DatabaseType dbtype = new DatabaseType(dbTypeIdDataService, STRING_DEFAULT, null, 0, STRING_DEFAULT);
    IDatabaseConnection connDataService = new DatabaseConnection();
    connDataService.setDatabaseType(dbtype);
    ConnectionServiceImpl connService = mock(ConnectionServiceImpl.class);
    doReturn(connDataService).when(connService).getConnectionByName(eq(connNameDataService));
    DSWDatasourceServiceImpl service = new DSWDatasourceServiceImpl(connService);
    service.checkSqlQueriesSupported(connNameDataService);
}
Also used : DatabaseType(org.pentaho.database.model.DatabaseType) IDatabaseType(org.pentaho.database.model.IDatabaseType) DatabaseConnection(org.pentaho.database.model.DatabaseConnection) IDatabaseConnection(org.pentaho.database.model.IDatabaseConnection) Mockito.anyString(org.mockito.Mockito.anyString) IDatabaseConnection(org.pentaho.database.model.IDatabaseConnection) Test(org.junit.Test)

Example 7 with DatabaseType

use of org.pentaho.database.model.DatabaseType in project data-access by pentaho.

the class DSWDatasourceServiceImplTest method testSqlQueries_Supported_PostgresDb.

@Test
public void testSqlQueries_Supported_PostgresDb() throws Exception {
    String connNamePostgres = "connToPostgresDb";
    String dbTypeIdPostgres = "PostgresDb";
    IDatabaseConnection connDataService = new DatabaseConnection();
    connDataService.setDatabaseType(new DatabaseType(dbTypeIdPostgres, STRING_DEFAULT, null, 0, STRING_DEFAULT));
    ConnectionServiceImpl connService = mock(ConnectionServiceImpl.class);
    doReturn(connDataService).when(connService).getConnectionByName(eq(connNamePostgres));
    DSWDatasourceServiceImpl service = new DSWDatasourceServiceImpl(connService);
    service.checkSqlQueriesSupported(connNamePostgres);
}
Also used : DatabaseType(org.pentaho.database.model.DatabaseType) IDatabaseType(org.pentaho.database.model.IDatabaseType) DatabaseConnection(org.pentaho.database.model.DatabaseConnection) IDatabaseConnection(org.pentaho.database.model.IDatabaseConnection) Mockito.anyString(org.mockito.Mockito.anyString) IDatabaseConnection(org.pentaho.database.model.IDatabaseConnection) Test(org.junit.Test)

Example 8 with DatabaseType

use of org.pentaho.database.model.DatabaseType in project data-access by pentaho.

the class AutobeanUtilitiesTest method testDbTypeBeanToImpl.

@Test
public void testDbTypeBeanToImpl() {
    List<DatabaseAccessType> accessTypes = new LinkedList<DatabaseAccessType>();
    accessTypes.add(DatabaseAccessType.NATIVE);
    DatabaseType dbType1 = new DatabaseType("name", "short name", accessTypes, 100500, "helpUri");
    IDatabaseType dbType = AutobeanUtilities.dbTypeBeanToImpl(dbType1);
    assertEquals(dbType.getName(), "name");
    assertEquals(dbType.getShortName(), "short name");
    assertEquals(dbType.getDefaultDatabasePort(), 100500);
    assertEquals(dbType.getExtraOptionsHelpUrl(), "helpUri");
    assertEquals(dbType.getSupportedAccessTypes().size(), 1);
}
Also used : IDatabaseType(org.pentaho.database.model.IDatabaseType) DatabaseAccessType(org.pentaho.database.model.DatabaseAccessType) DatabaseType(org.pentaho.database.model.DatabaseType) IDatabaseType(org.pentaho.database.model.IDatabaseType) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Aggregations

DatabaseType (org.pentaho.database.model.DatabaseType)8 Test (org.junit.Test)6 DatabaseConnection (org.pentaho.database.model.DatabaseConnection)6 IDatabaseType (org.pentaho.database.model.IDatabaseType)6 IDatabaseConnection (org.pentaho.database.model.IDatabaseConnection)5 HashMap (java.util.HashMap)3 LinkedList (java.util.LinkedList)3 DatabaseAccessType (org.pentaho.database.model.DatabaseAccessType)3 Mockito.anyString (org.mockito.Mockito.anyString)2 PartitionDatabaseMeta (org.pentaho.database.model.PartitionDatabaseMeta)2 DatabaseTypeHelper (org.pentaho.database.util.DatabaseTypeHelper)1