### Question:
DSWDatasourceServiceImpl implements IDSWDatasourceService { void checkSqlQueriesSupported( String connName ) throws ConnectionServiceException, SqlQueriesNotSupportedException { IDatabaseConnection conn = connService.getConnectionByName( connName ); IDatabaseType dbType = conn.getDatabaseType(); if ( dbType.getName().equals( DB_TYPE_ID_PENTAHO_DATA_SERVICE ) ) { throw new SqlQueriesNotSupportedException( Messages .getErrorString( "DatasourceServiceImpl.ERROR_0024_SQL_QUERIES_NOT_SUPPORTED_FOR_PENTAHO_DATA_SERVICE" ) ); } } DSWDatasourceServiceImpl();  DSWDatasourceServiceImpl( ConnectionServiceImpl connService ); boolean deleteLogicalModel( String domainId, String modelName ); SerializedResultSet doPreview( String connectionName, String query, String previewLimit ); boolean testDataSourceConnection( String connectionName ); BusinessData generateLogicalModel( String modelName, String connectionName, String dbType, String query,
                                            String previewLimit ); IMetadataDomainRepository getMetadataDomainRepository(); void setMetadataDomainRepository( IMetadataDomainRepository metadataDomainRepository ); boolean saveLogicalModel( Domain domain, boolean overwrite ); boolean hasPermission(); List<LogicalModelSummary> getLogicalModels( String context ); BusinessData loadBusinessData( String domainId, String modelId ); BogoPojo gwtWorkaround( BogoPojo pojo ); String serializeModelState( DatasourceDTO dto ); DatasourceDTO deSerializeModelState( String dtoStr ); List<String> listDatasourceNames(); @Override QueryDatasourceSummary generateQueryDomain( String name, String query, DatabaseConnection connection,
                                                     DatasourceDTO datasourceDTO ); void prepareForSerializaton( Domain domain ); String getDatasourceIllegalCharacters(); @Override GeoContext getGeoContext();  }### Answer:
@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 ); }
@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 ); }