// Path: datasource-decorator-spring-boot-autoconfigure/src/main/java/com/github/gavlyukovskiy/boot/jdbc/decorator/DecoratedDataSource.java
// public class DecoratedDataSource extends DelegatingDataSource {
// 
//     private final String beanName;
//     private final DataSource realDataSource;
//     private final DataSource decoratedDataSource;
//     private final List<DataSourceDecorationStage> decoratingChain;
// 
//     DecoratedDataSource(String beanName, DataSource realDataSource, DataSource decoratedDataSource, List<DataSourceDecorationStage> decoratingChain) {
//         super(decoratedDataSource);
//         this.beanName = beanName;
//         this.realDataSource = realDataSource;
//         this.decoratedDataSource = decoratedDataSource;
//         this.decoratingChain = decoratingChain;
//     }
// 
//     /**
//      * Returns data source bean name.
//      *
//      * @return data source bean name
//      */
//     public String getBeanName() {
//         return beanName;
//     }
// 
//     /**
//      * Returns initial data source, before applying any decorator.
//      *
//      * @return initial data source
//      */
//     public DataSource getRealDataSource() {
//         return realDataSource;
//     }
// 
//     /**
//      * Returns wrapped data source with all decorators applied.
//      *
//      * @return decorated data source
//      */
//     public DataSource getDecoratedDataSource() {
//         return decoratedDataSource;
//     }
// 
//     /**
//      * Returns list with all decorators applied on a {@link DataSource} reverse ordered with applying order.
//      *
//      * @return decorating information chain
//      */
//     public List<DataSourceDecorationStage> getDecoratingChain() {
//         return decoratingChain;
//     }
// 
//     @Override
//     public String toString() {
//         return decoratingChain.stream()
//                 .map(entry -> entry.getBeanName() + " [" + entry.getDataSource().getClass().getName() + "]")
//                 .collect(Collectors.joining(" -> ")) + " -> " + beanName + " [" + realDataSource.getClass().getName() + "]";
//     }
// }
// 
// Path: datasource-decorator-spring-boot-autoconfigure/src/main/java/com/github/gavlyukovskiy/boot/jdbc/decorator/dsproxy/ProxyDataSourceDecorator.java
// public class ProxyDataSourceDecorator implements DataSourceDecorator, Ordered {
// 
//     private final DataSourceDecoratorProperties dataSourceDecoratorProperties;
//     private final ProxyDataSourceBuilderConfigurer proxyDataSourceBuilderConfigurer;
//     private final DataSourceNameResolver dataSourceNameResolver;
// 
//     ProxyDataSourceDecorator(
//             DataSourceDecoratorProperties dataSourceDecoratorProperties,
//             ProxyDataSourceBuilderConfigurer proxyDataSourceBuilderConfigurer,
//             DataSourceNameResolver dataSourceNameResolver
//     ) {
//         this.dataSourceDecoratorProperties = dataSourceDecoratorProperties;
//         this.proxyDataSourceBuilderConfigurer = proxyDataSourceBuilderConfigurer;
//         this.dataSourceNameResolver = dataSourceNameResolver;
//     }
// 
//     @Override
//     public DataSource decorate(String beanName, DataSource dataSource) {
//         ProxyDataSourceBuilder proxyDataSourceBuilder = ProxyDataSourceBuilder.create();
//         DataSourceProxyProperties datasourceProxy = dataSourceDecoratorProperties.getDatasourceProxy();
//         proxyDataSourceBuilderConfigurer.configure(proxyDataSourceBuilder, datasourceProxy);
//         String dataSourceName = dataSourceNameResolver.resolveDataSourceName(dataSource);
//         return proxyDataSourceBuilder.dataSource(dataSource).name(dataSourceName).build();
//     }
// 
//     @Override
//     public int getOrder() {
//         return 20;
//     }
// }


import com.github.gavlyukovskiy.boot.jdbc.decorator.DecoratedDataSource;
import com.github.gavlyukovskiy.boot.jdbc.decorator.dsproxy.ProxyDataSourceDecorator;
import com.zaxxer.hikari.HikariDataSource;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import javax.sql.DataSource;
import static org.assertj.core.api.Assertions.assertThat;
/*
 * Copyright 2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.github.gavlyukovskiy.sample;




@ExtendWith(SpringExtension.class)
@SpringBootTest
class SampleDatasourceProxyApplicationTests {

    @Autowired
    private DataSource dataSource;

    @Test
// Path: datasource-decorator-spring-boot-autoconfigure/src/main/java/com/github/gavlyukovskiy/boot/jdbc/decorator/DecoratedDataSource.java
// public class DecoratedDataSource extends DelegatingDataSource {
// 
//     private final String beanName;
//     private final DataSource realDataSource;
//     private final DataSource decoratedDataSource;
//     private final List<DataSourceDecorationStage> decoratingChain;
// 
//     DecoratedDataSource(String beanName, DataSource realDataSource, DataSource decoratedDataSource, List<DataSourceDecorationStage> decoratingChain) {
//         super(decoratedDataSource);
//         this.beanName = beanName;
//         this.realDataSource = realDataSource;
//         this.decoratedDataSource = decoratedDataSource;
//         this.decoratingChain = decoratingChain;
//     }
// 
//     /**
//      * Returns data source bean name.
//      *
//      * @return data source bean name
//      */
//     public String getBeanName() {
//         return beanName;
//     }
// 
//     /**
//      * Returns initial data source, before applying any decorator.
//      *
//      * @return initial data source
//      */
//     public DataSource getRealDataSource() {
//         return realDataSource;
//     }
// 
//     /**
//      * Returns wrapped data source with all decorators applied.
//      *
//      * @return decorated data source
//      */
//     public DataSource getDecoratedDataSource() {
//         return decoratedDataSource;
//     }
// 
//     /**
//      * Returns list with all decorators applied on a {@link DataSource} reverse ordered with applying order.
//      *
//      * @return decorating information chain
//      */
//     public List<DataSourceDecorationStage> getDecoratingChain() {
//         return decoratingChain;
//     }
// 
//     @Override
//     public String toString() {
//         return decoratingChain.stream()
//                 .map(entry -> entry.getBeanName() + " [" + entry.getDataSource().getClass().getName() + "]")
//                 .collect(Collectors.joining(" -> ")) + " -> " + beanName + " [" + realDataSource.getClass().getName() + "]";
//     }
// }
// 
// Path: datasource-decorator-spring-boot-autoconfigure/src/main/java/com/github/gavlyukovskiy/boot/jdbc/decorator/dsproxy/ProxyDataSourceDecorator.java
// public class ProxyDataSourceDecorator implements DataSourceDecorator, Ordered {
// 
//     private final DataSourceDecoratorProperties dataSourceDecoratorProperties;
//     private final ProxyDataSourceBuilderConfigurer proxyDataSourceBuilderConfigurer;
//     private final DataSourceNameResolver dataSourceNameResolver;
// 
//     ProxyDataSourceDecorator(
//             DataSourceDecoratorProperties dataSourceDecoratorProperties,
//             ProxyDataSourceBuilderConfigurer proxyDataSourceBuilderConfigurer,
//             DataSourceNameResolver dataSourceNameResolver
//     ) {
//         this.dataSourceDecoratorProperties = dataSourceDecoratorProperties;
//         this.proxyDataSourceBuilderConfigurer = proxyDataSourceBuilderConfigurer;
//         this.dataSourceNameResolver = dataSourceNameResolver;
//     }
// 
//     @Override
//     public DataSource decorate(String beanName, DataSource dataSource) {
//         ProxyDataSourceBuilder proxyDataSourceBuilder = ProxyDataSourceBuilder.create();
//         DataSourceProxyProperties datasourceProxy = dataSourceDecoratorProperties.getDatasourceProxy();
//         proxyDataSourceBuilderConfigurer.configure(proxyDataSourceBuilder, datasourceProxy);
//         String dataSourceName = dataSourceNameResolver.resolveDataSourceName(dataSource);
//         return proxyDataSourceBuilder.dataSource(dataSource).name(dataSourceName).build();
//     }
// 
//     @Override
//     public int getOrder() {
//         return 20;
//     }
// }


// Path: samples/datasource-proxy-sample/src/test/java/com/github/gavlyukovskiy/sample/SampleDatasourceProxyApplicationTests.java
import com.github.gavlyukovskiy.boot.jdbc.decorator.DecoratedDataSource;
import com.github.gavlyukovskiy.boot.jdbc.decorator.dsproxy.ProxyDataSourceDecorator;
import com.zaxxer.hikari.HikariDataSource;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import javax.sql.DataSource;
import static org.assertj.core.api.Assertions.assertThat;

/*
 * Copyright 2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.github.gavlyukovskiy.sample;




@ExtendWith(SpringExtension.class)
@SpringBootTest
class SampleDatasourceProxyApplicationTests {

    @Autowired
    private DataSource dataSource;

    @Test
    void contextLoads() {