/*
 * European Variation Archive (EVA) - Open-access database of all types of genetic
 * variation data from all species
 *
 * Copyright 2017 EMBL - European Bioinformatics Institute
 *
 * 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 uk.ac.ebi.eva.commons.mongodb.configuration;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.test.autoconfigure.data.mongo.AutoConfigureDataMongo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.config.EnableMongoAuditing;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.util.Assert;

@Configuration
@EntityScan(basePackages = {"uk.ac.ebi.eva.commons.mongodb.entities"})
@EnableMongoRepositories(basePackages = "uk.ac.ebi.eva.commons.mongodb.repositories")
@EnableMongoAuditing
@AutoConfigureDataMongo
public class MongoRepositoryTestConfiguration {

    @Value("${mongodb.read-preference}")
    private String readPreference;

    @Value("${eva.mongo.collections.annotation-metadata:#{null}}")
    private String collectionAnnotationMetadata;

    @Value("${eva.mongo.collections.annotations:#{null}}")
    private String collectionAnnotations;

    @Value("${eva.mongo.collections.features:#{null}}")
    private String collectionFeatures;

    @Value("${eva.mongo.collections.variants:#{null}}")
    private String collectionVariants;

    @Value("${eva.mongo.collections.files:#{null}}")
    private String collectionFiles;

    @Value("${eva.mongo.collections.samples:#{null}}")
    private String collectionSamples;

    @Bean
    public String mongoCollectionsAnnotationMetadata() {
        Assert.notNull(collectionAnnotationMetadata);
        return collectionAnnotationMetadata;
    }

    @Bean
    public String mongoCollectionsAnnotations() {
        Assert.notNull(collectionAnnotations);
        return collectionAnnotations;
    }

    @Bean
    public String mongoCollectionsFeatures() {
        Assert.notNull(collectionFeatures);
        return collectionFeatures;
    }

    @Bean
    public String mongoCollectionsVariants() {
        Assert.notNull(collectionVariants);
        return collectionVariants;
    }

    @Bean
    public String mongoCollectionsFiles() {
        Assert.notNull(collectionFiles);
        return collectionFiles;
    }

    @Bean
    public String mongoCollectionsSamples() {
        Assert.notNull(collectionSamples);
        return collectionSamples;
    }
}
@@ -1580,80 +1580,75 @@
    @
-Value(%22$%7Bmongodb.read-preference%7D%22)%0A    private String readPreference;%0A%0A
+Bean%0A    public String mongoCollectionsAnnotationMetadata(%0A        
     
@@ -1705,36 +1705,24 @@
 a:#%7Bnull%7D%7D%22)
-%0A    private
  String coll
@@ -1749,35 +1749,35 @@
 data
-;%0A%0A    @Value(%22$%7Beva.mongo.
+) %7B%0A        Assert.notNull(
 coll
@@ -1774,35 +1774,33 @@
 tNull(collection
-s.a
+A
 nnotations:#%7Bnul
@@ -1796,185 +1796,105 @@
 tion
-s:#%7Bnull%7D%7D%22)%0A    private String collectionAnnotations;%0A%0A    @Value(%22$%7Beva.mongo.collections.features:#%7Bnull%7D%7D%22)%0A    private String collectionFeatures;%0A%0A    @Value(%22$%7Beva.
+Metadata);%0A        return collectionAnnotationMetadata;%0A    %7D%0A%0A    @Bean%0A    public String 
 mongo
-.c
+C
 olle
@@ -1903,297 +1903,105 @@
 ions
-.variants:#%7Bnull%7D%7D%22)%0A    private String collectionVariants;%0A%0A    @Value(%22$%7Beva.mongo.collections.files:#%7Bnull%7D%7D%22)%0A    private String collectionFiles;%0A%0A    @Value(%22$%7Beva.mongo.collections.samples:#%7Bnull%7D%7D%22)%0A    private String collectionSamples;%0A%0A    @Bean%0A    public String mongoCollections
+Annotations(%0A            @Value(%22$%7Beva.mongo.collections.annotations:#%7Bnull%7D%7D%22) String collection
 Anno
@@ -2006,25 +2006,17 @@
 notation
-Metadata(
+s
 ) %7B%0A    
@@ -2050,32 +2050,25 @@
 onAnnotation
-Metadata
+s
 );%0A        r
@@ -2089,32 +2089,25 @@
 onAnnotation
-Metadata
+s
 ;%0A    %7D%0A%0A   
@@ -2151,144 +2151,89 @@
 ions
-Annotations() %7B%0A        Assert.notNull(collectionAnnotations);%0A        return collectionAnnotations;%0A    %7D%0A%0A    @Bean%0A    public
+Features(%0A            @Value(%22$%7Beva.mongo.collections.features:#%7Bnull%7D%7D%22)
  String 
 mong
@@ -2220,38 +2220,33 @@
 null%7D%7D%22) String 
-mongoC
+c
 ollectionsFeatur
@@ -2238,25 +2238,24 @@
 llection
-s
 Features
 () %7B%0A   
@@ -2246,17 +2246,16 @@
 Features
-(
 ) %7B%0A    
@@ -2389,16 +2389,106 @@
 ariants(
+%0A            @Value(%22$%7Beva.mongo.collections.variants:#%7Bnull%7D%7D%22) String collectionVariants
 ) %7B%0A    
@@ -2615,24 +2615,95 @@
 ctionsFiles(
+@Value(%22$%7Beva.mongo.collections.files:#%7Bnull%7D%7D%22) String collectionFiles
 ) %7B%0A        
@@ -2826,16 +2826,91 @@
 Samples(
+@Value(%22$%7Beva.mongo.collections.samples:#%7Bnull%7D%7D%22) String collectionSamples
 ) %7B%0A    
@@ -2989,8 +2989,9 @@
 %0A    %7D%0A%7D
+%0A

Remove unneeded class fields for autowired collection names