--- /dev/null
+package de.spring.example.persistence.repository;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+import javax.inject.Inject;
+
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.palantir.docker.compose.DockerComposeRule;
+import com.palantir.docker.compose.connection.waiting.HealthChecks;
+
+import de.spring.example.persistence.domain.AdDescription;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration( {"classpath*:spring-configuration/*.xml",
+ "classpath*:spring-configuration-docker-test/*.xml"} )
+@Transactional
+
+// IT DOES NOT WORK FOR THESE REASONS:
+// 1. Spring context is loaded before the DockerComposeRule
+// 2. DockerComposeRule can work with random ports, the problem is:
+// the Spring Context was loaded before DockerComposeRule and dataSource
+// requires some port for connection to data base.
+
+// These issues can be fixed using org.junit.Suite and running
+// DockerComposeRule in the Suite instead of in every Test.
+// But if I want to run just one test that solution does not work because
+// DockerComposeRule will be declared in the Suite instead of in the Test.
+// We will have to run our tests always from the Suite not being able to run
+// just one Test from the IDE :(
+@Ignore
+public class AdDescriptionRepositoryDockerComposeRuleIntegrationShould {
+
+ @Inject
+ AdDescriptionRepository adDescriptionRepository;
+
+ @ClassRule
+ public static final DockerComposeRule DOCKER = DockerComposeRule.builder()
+ .file("src/integTest/resources/docker/docker-compose.yml")
+ .waitingForService("mysql", HealthChecks.toHaveAllPortsOpen())
+ .saveLogsTo("build/dockerLogs")
+ .build();
+
+ @Test public void
+ find_ad_descriptions_by_ad() {
+ Iterable<AdDescription> adDescriptions = adDescriptionRepository.findAll();
+
+ for (AdDescription adDescription : adDescriptions) {
+ assertThat(adDescription, is(notNullValue()));
+ }
+ }
+
+}
+++ /dev/null
-package de.spring.example.persistence.repository;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.junit.Assert.assertThat;
-
-import javax.inject.Inject;
-
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.palantir.docker.compose.DockerComposeRule;
-import com.palantir.docker.compose.connection.waiting.HealthChecks;
-
-import de.spring.example.persistence.domain.AdDescription;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration( {"classpath*:spring-configuration/*.xml",
- "classpath*:spring-configuration-docker-test/*.xml"} )
-@Transactional
-
-// IT DOES NOT WORK FOR THESE REASONS:
-// 1. Spring context is loaded before the DockerComposeRule
-// 2. DockerComposeRule can work with random ports, the problem is:
-// the Spring Context was loaded before DockerComposeRule and dataSource
-// requires some port for connection to data base.
-
-// These issues can be fixed using org.junit.Suite and running
-// DockerComposeRule in the Suite instead of in every Test.
-// But if I want to run just one test that solution does not work because
-// DockerComposeRule will be declared in the Suite instead of in the Test.
-// We will have to run our tests always from the Suite not being able to run
-// just one Test from the IDE :(
-@Ignore
-public class AdDescriptionRepositoryDockerComposeRuleShould {
-
- @Inject
- AdDescriptionRepository adDescriptionRepository;
-
- @ClassRule
- public static final DockerComposeRule DOCKER = DockerComposeRule.builder()
- .file("src/integTest/resources/docker/docker-compose.yml")
- .waitingForService("mysql", HealthChecks.toHaveAllPortsOpen())
- .saveLogsTo("build/dockerLogs")
- .build();
-
- @Test public void
- find_ad_descriptions_by_ad() {
- Iterable<AdDescription> adDescriptions = adDescriptionRepository.findAll();
-
- for (AdDescription adDescription : adDescriptions) {
- assertThat(adDescription, is(notNullValue()));
- }
- }
-
-}
--- /dev/null
+package de.spring.example.persistence.repository;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+import javax.inject.Inject;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.annotation.Transactional;
+
+import de.spring.example.persistence.domain.AdDescription;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration( {"classpath*:spring-configuration/*.xml",
+ "classpath*:spring-configuration-docker-test/*.xml"} )
+@Transactional
+public class AdDescriptionRepositoryIntegrationShould {
+
+ @Inject
+ AdDescriptionRepository adDescriptionRepository;
+
+ @Test public void
+ find_ad_descriptions_by_ad() {
+ Iterable<AdDescription> adDescriptions = adDescriptionRepository.findAll();
+
+ for (AdDescription adDescription : adDescriptions) {
+ assertThat(adDescription, is(notNullValue()));
+ }
+ }
+
+}
+++ /dev/null
-package de.spring.example.persistence.repository;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.junit.Assert.assertThat;
-
-import javax.inject.Inject;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.transaction.annotation.Transactional;
-
-import de.spring.example.persistence.domain.AdDescription;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration( {"classpath*:spring-configuration/*.xml",
- "classpath*:spring-configuration-docker-test/*.xml"} )
-@Transactional
-public class AdDescriptionRepositoryShould {
-
- @Inject
- AdDescriptionRepository adDescriptionRepository;
-
- @Test public void
- find_ad_descriptions_by_ad() {
- Iterable<AdDescription> adDescriptions = adDescriptionRepository.findAll();
-
- for (AdDescription adDescription : adDescriptions) {
- assertThat(adDescription, is(notNullValue()));
- }
- }
-
-}
--- /dev/null
+package de.spring.example.persistence.repository;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.time.OffsetDateTime;
+
+import javax.inject.Inject;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.annotation.Transactional;
+
+import de.spring.example.persistence.domain.Ad;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration( {"classpath*:spring-configuration/*.xml",
+ "classpath*:spring-configuration-h2-test/*.xml"} )
+@Transactional
+public class AdRespositoryIntegrationShould {
+ // Ad
+ public static final Long COMPANY_ID = 2L;
+ public static final Long COMPANY_CATEG_ID = 3L;
+ public static final String AD_MOBILE_IMAGE = "slippers.jpg";
+ public static final OffsetDateTime CREATED_AT = OffsetDateTime.now().minusDays(1);
+ public static final OffsetDateTime UPDATED_AT = OffsetDateTime.now();
+
+ @Inject
+ AdRepository adRepository;
+
+ @Test public void
+ find_one_ad_by_id() {
+ Ad ad = createAd();
+ Ad createdAd = adRepository.save(ad);
+
+ Ad storedAd = adRepository.findOne(createdAd.getId());
+
+ assertThat(createdAd, is(storedAd));
+ }
+
+ @Test public void
+ find_one_ad_by_id_using_native_query() {
+ Ad ad = createAd();
+ Ad createdAd = adRepository.save(ad);
+
+ Ad storedAd = adRepository.findByIdNativeQuery(createdAd.getId());
+
+ assertThat(createdAd, is(storedAd));
+ }
+
+ @Test public void
+ find_one_ad_by_id_using_named_query() {
+ Ad ad = createAd();
+ Ad createdAd = adRepository.save(ad);
+
+ Ad storedAd = adRepository.findByIdQuery(createdAd.getId());
+
+ assertThat(createdAd, is(storedAd));
+ }
+
+ private static final Ad createAd() {
+ return new Ad(null, null, COMPANY_ID, COMPANY_CATEG_ID, AD_MOBILE_IMAGE,
+ CREATED_AT, UPDATED_AT);
+ }
+}
+++ /dev/null
-package de.spring.example.persistence.repository;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.time.OffsetDateTime;
-
-import javax.inject.Inject;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.transaction.annotation.Transactional;
-
-import de.spring.example.persistence.domain.Ad;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration( {"classpath*:spring-configuration/*.xml",
- "classpath*:spring-configuration-h2-test/*.xml"} )
-@Transactional
-public class AdRespositoryShould {
- // Ad
- public static final Long COMPANY_ID = 2L;
- public static final Long COMPANY_CATEG_ID = 3L;
- public static final String AD_MOBILE_IMAGE = "slippers.jpg";
- public static final OffsetDateTime CREATED_AT = OffsetDateTime.now().minusDays(1);
- public static final OffsetDateTime UPDATED_AT = OffsetDateTime.now();
-
- @Inject
- AdRepository adRepository;
-
- @Test public void
- find_one_ad_by_id() {
- Ad ad = createAd();
- Ad createdAd = adRepository.save(ad);
-
- Ad storedAd = adRepository.findOne(createdAd.getId());
-
- assertThat(createdAd, is(storedAd));
- }
-
- @Test public void
- find_one_ad_by_id_using_native_query() {
- Ad ad = createAd();
- Ad createdAd = adRepository.save(ad);
-
- Ad storedAd = adRepository.findByIdNativeQuery(createdAd.getId());
-
- assertThat(createdAd, is(storedAd));
- }
-
- @Test public void
- find_one_ad_by_id_using_named_query() {
- Ad ad = createAd();
- Ad createdAd = adRepository.save(ad);
-
- Ad storedAd = adRepository.findByIdQuery(createdAd.getId());
-
- assertThat(createdAd, is(storedAd));
- }
-
- private static final Ad createAd() {
- return new Ad(null, null, COMPANY_ID, COMPANY_CATEG_ID, AD_MOBILE_IMAGE,
- CREATED_AT, UPDATED_AT);
- }
-}