diff --git a/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java b/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java index 13e194c35245330af83f1dbc1ae10cd6f1a2f770..ff71d5c98fe9b8e4fab914e3896e4dd382074dc1 100755 --- a/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java +++ b/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java @@ -6,14 +6,9 @@ import javax.cache.configuration.MutableConfiguration; import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Profile; -/** - * Cache could be disabled in unit test. - */ @org.springframework.context.annotation.Configuration @EnableCaching -@Profile("production") class CacheConfig { @Bean diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c8d5a5c1ab6b69d93b507949e39450629912d12b..ffaf41f230ac47b3309cedf5bef43aff9b9c7e3c 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -20,6 +20,3 @@ management.endpoints.web.exposure.include=* logging.level.org.springframework=INFO # logging.level.org.springframework.web=DEBUG # logging.level.org.springframework.context.annotation=TRACE - -# Active Spring profiles -spring.profiles.active=production diff --git a/src/test/java/org/springframework/samples/petclinic/PetclinicIntegrationTests.java b/src/test/java/org/springframework/samples/petclinic/PetclinicIntegrationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..3f48c0d4a5333a77d8c871f19fcee5a1492b539d --- /dev/null +++ b/src/test/java/org/springframework/samples/petclinic/PetclinicIntegrationTests.java @@ -0,0 +1,39 @@ +/* + * Copyright 2012-2018 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 org.springframework.samples.petclinic; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.samples.petclinic.vet.VetRepository; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class PetclinicIntegrationTests { + + @Autowired + private VetRepository vets; + + @Test + public void testFindAll() throws Exception { + vets.findAll(); + vets.findAll(); // served from cache + } +} diff --git a/src/test/java/org/springframework/samples/petclinic/system/ProductionConfigurationTests.java b/src/test/java/org/springframework/samples/petclinic/system/ProductionConfigurationTests.java deleted file mode 100644 index 9636e36233ab8c339ecd69ead571a253670f51ca..0000000000000000000000000000000000000000 --- a/src/test/java/org/springframework/samples/petclinic/system/ProductionConfigurationTests.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.springframework.samples.petclinic.system; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.samples.petclinic.vet.VetRepository; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class ProductionConfigurationTests { - - @Autowired - private VetRepository vets; - - @Test - public void testFindAll() throws Exception { - vets.findAll(); - vets.findAll(); // served from cache - } -}