Search in sources :

Example 31 with DatabaseConnection

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

the class ConnectionServiceImplIT method testAddConnection.

@Test
public void testAddConnection() throws ConnectionServiceException {
    DatabaseConnection connection = new DatabaseConnection();
    connection.setName(SECOND_CONNECTION);
    connectionServiceImpl.addConnection(connection);
    IDatabaseConnection actualCnnection = connectionServiceImpl.getConnectionByName(SECOND_CONNECTION);
    assertEquals(connection, actualCnnection);
}
Also used : DatabaseConnection(org.pentaho.database.model.DatabaseConnection) IDatabaseConnection(org.pentaho.database.model.IDatabaseConnection) IDatabaseConnection(org.pentaho.database.model.IDatabaseConnection) Test(org.junit.Test)

Example 32 with DatabaseConnection

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

the class ConnectionServiceImplIT method testTestConnection.

@Test
public void testTestConnection() throws ConnectionServiceException {
    DatabaseConnection connection = new DatabaseConnection();
    connection.setName(NON_EXIST_CONNECTION_NAME);
    connection.setAccessType(DatabaseAccessType.NATIVE);
    connection.setDatabaseType(new DatabaseType("H2", "H2", Arrays.asList(DatabaseAccessType.NATIVE), 0, null));
    assertTrue(connectionServiceImpl.testConnection(connection));
}
Also used : DatabaseType(org.pentaho.database.model.DatabaseType) DatabaseConnection(org.pentaho.database.model.DatabaseConnection) IDatabaseConnection(org.pentaho.database.model.IDatabaseConnection) Test(org.junit.Test)

Example 33 with DatabaseConnection

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

the class ConnectionServiceImplIT method testDeleteConnectionError.

@Test(expected = ConnectionServiceException.class)
public void testDeleteConnectionError() throws Exception {
    DatabaseConnection connection = new DatabaseConnection();
    connection.setName(ERROR_CONNECTION_NAME);
    connectionServiceImpl.deleteConnection(connection);
}
Also used : DatabaseConnection(org.pentaho.database.model.DatabaseConnection) IDatabaseConnection(org.pentaho.database.model.IDatabaseConnection) Test(org.junit.Test)

Example 34 with DatabaseConnection

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

the class ConnectionServiceImplIT method testAddConnectionError.

@Test(expected = ConnectionServiceException.class)
public void testAddConnectionError() throws ConnectionServiceException {
    DatabaseConnection connection = new DatabaseConnection();
    connection.setName(ERROR_CONNECTION_NAME);
    connectionServiceImpl.addConnection(connection);
}
Also used : DatabaseConnection(org.pentaho.database.model.DatabaseConnection) IDatabaseConnection(org.pentaho.database.model.IDatabaseConnection) Test(org.junit.Test)

Example 35 with DatabaseConnection

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

the class ConnectionServiceImplIT method testDeleteConnectionNONExist.

@Test(expected = ConnectionServiceException.class)
public void testDeleteConnectionNONExist() throws Exception {
    DatabaseConnection connection = new DatabaseConnection();
    connection.setName(NON_EXIST_CONNECTION_NAME);
    connectionServiceImpl.deleteConnection(connection);
}
Also used : DatabaseConnection(org.pentaho.database.model.DatabaseConnection) IDatabaseConnection(org.pentaho.database.model.IDatabaseConnection) Test(org.junit.Test)

Aggregations

DatabaseConnection (org.pentaho.database.model.DatabaseConnection)56 IDatabaseConnection (org.pentaho.database.model.IDatabaseConnection)48 Test (org.junit.Test)36 HashMap (java.util.HashMap)10 IDatabaseDialectService (org.pentaho.database.service.IDatabaseDialectService)7 DatabaseType (org.pentaho.database.model.DatabaseType)6 DatabaseDialectService (org.pentaho.database.service.DatabaseDialectService)6 DatabaseTypeHelper (org.pentaho.database.util.DatabaseTypeHelper)6 ArrayList (java.util.ArrayList)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 IDatabaseType (org.pentaho.database.model.IDatabaseType)5 DBDatasourceServiceException (org.pentaho.platform.api.data.DBDatasourceServiceException)5 ConnectionServiceException (org.pentaho.platform.dataaccess.datasource.wizard.service.ConnectionServiceException)5 Response (javax.ws.rs.core.Response)4 List (java.util.List)3 LinkedList (java.util.LinkedList)2 Mockito.anyString (org.mockito.Mockito.anyString)2 DatabaseAccessType (org.pentaho.database.model.DatabaseAccessType)2 PartitionDatabaseMeta (org.pentaho.database.model.PartitionDatabaseMeta)2 Category (org.pentaho.metadata.model.Category)2